Commit d5e7972d authored by Mac's avatar Mac
parents 99eda6b8 0dd33c4e
......@@ -117,10 +117,7 @@
:content="item.Name" placement="top-start">
<div @click="PageSelect(item,index)" :class="item.Selected ? 'selected' :''"
class="el-tooltip item material-item ">
<img :src="getIconLink(item.Path)+'?x-oss-process=video/snapshot,t_9,f_jpg,w_299,h_0,m_fast'"
class="material-img" style="width: 140px; height: 140px;">
<img :src="getIconLink(item.Image)" class="material-img" style="width: 140px; height: 140px;">
<div class="material-video-info"><i class="el-icon-video-play"></i>
<span>{{Time(item.VideoTime)}}</span></div>
<div flex="dir:left" style="margin-top: 5px;">
......@@ -180,10 +177,7 @@
<el-button size="small" type="primary" @click="pagesubmitForm('addpageMsg')">确 定</el-button>
</span>
</el-dialog>
<video width="320" height="240" controls id="upvideo" style="display:none">
</video>
<img :src="testImg" style="width:120px;height:60px;border:1px solid red;" />
<canvas id='mycanvas' ></canvas>
</div>
</template>
<script>
......@@ -249,7 +243,7 @@
checkList: [],
checkAllList: [],
checkAll: false,
testImg: ""
imgSrc: ""
}
},
created() {
......@@ -257,33 +251,10 @@
this.GetPageList();
},
mounted() {
this.findvideocover("http://192.168.2.214:8130/Upload/Video/20200901114120428.mp4")
},
methods: {
//获取视频封面
findvideocover(videoUrl) {
let _this = this;
this.$nextTick(() => {
let video = document.getElementById("upvideo");
let source = document.createElement("source");
source.src = videoUrl;
source.type = "video/mp4";
video.appendChild(source);
video.addEventListener("loadeddata", function() {
var canvas = document.createElement("canvas");
canvas.width = "320";
canvas.height = "320";
canvas
.getContext("2d")
.drawImage(video, 0, 0, canvas.width, canvas.width);
console.log("video",video);
var img = document.createElement("img");
let imgsrc = canvas.toDataURL("image/png");
_this.testImg=imgsrc
});
});
},
Time(value) {
var theTime = parseInt(value); // 秒
var middle = 0; // 分
......@@ -458,7 +429,6 @@
this.GetPageList();
this.Success(res.data.message)
this.pageMsgDig = false;
} else {
this.Error(res.data.message);
}
......@@ -500,12 +470,11 @@
var that = this;
this.UploadSelfFile(this.FileType().Video, file.file, res => {
if (res.resultCode == 1) {
if (that.addpageMsg.Type == 2) {
that.addpageMsg.Image = res.FileUrl;
}
that.addpageMsg.Image = res.VideoCoverImg;
that.addpageMsg.Path = res.FileUrl;
that.addpageMsg.Name = res.FileName;
that.addPageList();
that.$forceUpdate();
}
})
},
......@@ -514,6 +483,7 @@
this.apipost("/api/product/SetMaterialInfo", this.addpageMsg, res => {
if (res.data.resultCode == 1) {
this.GetPageList();
this.$forceUpdate();
}
})
},
......@@ -546,16 +516,13 @@
if (res.data.resultCode === 1) {
this.GetMemberGradeList();
this.Success(res.data.message)
} else {
this.Error(res.data.message);
}
},
null
);
}).catch(() => {
});
}).catch(() => {});
},
HsGroup(item) {
let that = this;
......@@ -578,9 +545,7 @@
},
null
);
}).catch(() => {
});
}).catch(() => {});
},
DeleteGroup(item) {
let that = this;
......@@ -603,9 +568,7 @@
},
null
);
}).catch(() => {
});
}).catch(() => {});
},
addGroup() {
this.addGroupMsgDig = true;
......@@ -615,7 +578,6 @@
Type: this.commonType,
Sort: '',
}
},
GroupsubmitForm(formName) {
this.$refs[formName].validate((valid) => {
......@@ -647,6 +609,7 @@
},
GetPageList() {
this.loading = true;
this.PageList = [];
this.apipost("/api/product/GetMaterialInfoPageList", this.PageMsg, res => {
this.loading = false;
this.total = res.data.data.count;
......@@ -657,8 +620,7 @@
item.Selected = false;
})
this.PageList = data;
this.$forceUpdate();
})
},
handleClick(val) {
......@@ -668,13 +630,11 @@
this.addpageMsg.Type = val;
this.GetMemberGradeList();
this.GetPageList();
},
handleCurrentChange(val) {
this.PageMsg.pageIndex = val;
this.GetPageList();
},
},
}
......
......@@ -42,7 +42,7 @@
<div class="basefix app-attachment-list">
<div class="material-item material-upload">
<el-upload class="avatar-uploader" action="" accept="video/mp4,video/ogg,video/webm" :show-file-list="false"
:http-request="UploadImage">
:http-request="UploadVideo">
<div class="app-upload" flex="main:center cross:center" style="width: 100px; height: 100px;">
<i class="el-icon-upload"></i>
</div>
......@@ -52,21 +52,13 @@
placement="top-start">
<div @click="PageSelect(item,index)" :class="selectId==item.Id ? 'selected' :''"
class="el-tooltip item material-item ">
<img :src="getIconLink(item.Path)+'?x-oss-process=video/snapshot,t_9,f_jpg,w_299,h_0,m_fast'"
class="material-img" style="width: 100px; height: 100px;">
<img :src="getIconLink(item.Image)" class="material-img" style="width: 100px; height: 100px;">
<div class="material-video-info"><i class="el-icon-video-play"></i> <span>{{item.VideoTime}}</span></div>
<div flex="dir:left" style="margin-top: 5px;">
<div class="material-name">{{item.Name}}</div>
<!-- <div style="margin: 0px 5px;">|</div>
<div>
<button type="button" class="el-button el-button--text" style="padding: 0px;">
<span @click="EditPage(item)">编辑</span>
</button>
</div> -->
</div>
</div>
</el-tooltip>
</div>
<div style="padding-right:10px">
<el-pagination style="text-align:right" background :current-page="currentPage4"
......@@ -87,9 +79,6 @@
show-word-limit>
</el-input>
</el-form-item>
<!-- <el-form-item label="排序" prop="Sort">
<el-input @keyup.native="checkInteger(addGroupMsg,'Sort')" size="small" v-model="addGroupMsg.Sort"></el-input>
</el-form-item> -->
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="addGroupMsgDig = false">取 消</el-button>
......@@ -165,9 +154,6 @@
selectId: -1,
emitmsg: {},
}
},
created() {
},
computed: {
NewItems() {
......@@ -186,10 +172,22 @@
this.GetPageList();
},
methods: {
//上传视频
UploadVideo(file) {
var that = this;
this.UploadSelfFile(this.FileType().Video, file.file, res => {
if (res.resultCode == 1) {
that.addpageMsg.Image = res.VideoCoverImg;
that.addpageMsg.Path = res.FileUrl;
that.addpageMsg.Name = res.FileName;
that.addPageList();
that.$forceUpdate();
}
})
},
InitData(Type) {
this.czType = Type;
this.selectId = -1;
},
SelectImgId() {
this.$emit('Selectvideo', this.emitmsg)
......@@ -209,18 +207,16 @@
this.apipost("/api/product/SetMaterialInfo", this.addpageMsg, res => {
if (res.data.resultCode == 1) {
this.GetPageList();
}
})
},
PageSelect(item) {
this.emitmsg = {
Path: this.domainManager().ImageUrl + item.Path,
Path:item.Path,
Id: item.Id
}
this.selectId = item.Id;
},
addGroup() {
this.addGroupMsgDig = true;
this.addGroupMsg = {
......@@ -229,7 +225,6 @@
Type: 2,
Sort: '',
}
},
HsGroup(item) {
let that = this;
......@@ -245,7 +240,6 @@
if (res.data.resultCode === 1) {
this.GetMemberGradeList();
this.Success(res.data.message)
} else {
this.Error(res.data.message);
}
......@@ -274,7 +268,6 @@
this.GetMemberGradeList();
this.Success(res.data.message)
this.addGroupMsgDig = false;
} else {
this.Error(res.data.message);
}
......@@ -308,11 +301,8 @@
this.total = res.data.data.count;
let data = res.data.data.pageData;
this.PageList = data;
})
},
},
}
......
......@@ -58,7 +58,7 @@ export default {
let javaUrl = 'http://192.168.2.65:8018';
domainUrl = "http://192.168.0.116:8200";
domainUrl = "https://localhost:5001";
//domainUrl = "https://localhost:5001";
let vtUploadUrl = "http://192.168.2.214:8120";
let vtViewUrl = "http://192.168.2.214:8130";
......@@ -87,7 +87,7 @@ export default {
//文件上传自己服务器
VTUploadUrl: vtUploadUrl,
//文件预览自己服务器
VTViewUrl: vtUploadUrl
VTViewUrl: vtViewUrl
};
return obj;
},
......@@ -148,9 +148,11 @@ export default {
//上传文件到本地服务器
Vue.prototype.UploadSelfFile = function (path, file, callback) {
var that = this;
that.Info('上传中...')
var newPath = '/Upload/' + path + "/";
var formData = new FormData();
var uploadUrl = that.domainManager().VTUploadUrl + "/Upload?filePath=" + newPath;
var uploadUrl = that.domainManager().VTUploadUrl + "/Upload?filePath=" + newPath+"&isCreateCover=1";
formData.append("myfile", file);
that.$http.post(uploadUrl, formData, {})
.then(res => {
......@@ -158,7 +160,8 @@ export default {
var uploadResult = {
resultCode: 1,
FileName: file.name,
FileUrl: that.domainManager().VTViewUrl + res.data.FilePath
FileUrl: that.domainManager().VTViewUrl + res.data.FilePath,
VideoCoverImg:that.domainManager().VTViewUrl + res.data.VideoCoverImg
}
if (callback) {
callback(uploadResult);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment