Commit bda6380a by hanjixin

修改压缩后视频替换

parent 9cf21866
...@@ -149,7 +149,7 @@ export function getUserInfo() { ...@@ -149,7 +149,7 @@ export function getUserInfo() {
return get(`/user/get/info`) return get(`/user/get/info`)
} }
export function checkVideoCompress(videoSrc = []) { export function checkVideoCompress(videoSrc = []) {
return get(`/user/get/info`, videoSrc) return post(`/common/get/mts/state`, {url: videoSrc})
} }
export function upload(file) { export function upload(file) {
// 上传文件 // 上传文件
......
...@@ -31,7 +31,9 @@ const app = { ...@@ -31,7 +31,9 @@ const app = {
state.errorData = errorData state.errorData = errorData
}, },
SET_VIDEO_SRC : (state, videoSrc) => { SET_VIDEO_SRC : (state, videoSrc) => {
state.videoSrc = state.videoSrc.push(videoSrc) console.log(JSON.parse(JSON.stringify(state)),videoSrc)
state.videoSrc.push(videoSrc)
}, },
CLEAR_VIDEO_SRC : (state) => { CLEAR_VIDEO_SRC : (state) => {
state.videoSrc = [] state.videoSrc = []
......
...@@ -302,7 +302,9 @@ export default { ...@@ -302,7 +302,9 @@ export default {
this.VueCropperOption.fixedNumber = [9, 16]; this.VueCropperOption.fixedNumber = [9, 16];
} }
}, },
created() {}, created() {
// this.$store.commit('SET_VIDEO_SRC', 'https://visual-clouds.bdideal.com/html/156394962402878b178ab4088494e9df36c49ec944add.ttf')
},
computed: { computed: {
errorData() { errorData() {
return this.$store.state.app.errorData; return this.$store.state.app.errorData;
...@@ -369,9 +371,9 @@ export default { ...@@ -369,9 +371,9 @@ export default {
} }
// this.schemaData[this.dataKey].value = res.data.data; // this.schemaData[this.dataKey].value = res.data.data;
if (this.itemKey) { if (this.itemKey) {
this.setSchemaListData(res.data.data); this.setSchemaListData(res.data.data.replace('-mts', ''));
} else { } else {
this.setSchemaData(res.data.data); this.setSchemaData(res.data.data.replace('-mts', ''));
} }
this.$toast.clear(); this.$toast.clear();
}) })
...@@ -509,7 +511,7 @@ export default { ...@@ -509,7 +511,7 @@ export default {
document.querySelector(".edit-container").style.height = "100vh"; document.querySelector(".edit-container").style.height = "100vh";
this.VueCropperOption.img = file.content; this.VueCropperOption.img = file.content;
} else { } else {
this.uploadFile(file.file), String(file.file.type).indexOf("image") === -1; this.uploadFile(file.file, String(file.file.type).indexOf("image") === -1);
} }
}, },
checkboxChange(value) { checkboxChange(value) {
......
...@@ -302,7 +302,8 @@ import { ...@@ -302,7 +302,8 @@ import {
updateFilmInfo, updateFilmInfo,
upload, upload,
getTempalteDetail, getTempalteDetail,
createFilm createFilm,
checkVideoCompress
} from "@/api/api"; } from "@/api/api";
import axios from "axios"; import axios from "axios";
import draggable from "vuedraggable"; import draggable from "vuedraggable";
...@@ -758,15 +759,22 @@ export default { ...@@ -758,15 +759,22 @@ export default {
alert("数据为空"); alert("数据为空");
return; return;
} }
let filmData = JSON.stringify({
templateInfo: this.templateData.templateInfo,
pageList: this.templateData.listData
})
// 过滤替换
let videoSrc = this.$store.state.app.videoSrc
videoSrc.map(item => {
// 全部替换
filmData = filmData.replace(new RegExp(item.replace('-mts', ''),"gm") , item)
})
if (this.mode === "film" || window.sessionStorage.getItem("filmId")) { if (this.mode === "film" || window.sessionStorage.getItem("filmId")) {
const filmId = const filmId =
this.$route.query.filmId || window.sessionStorage.getItem("filmId"); this.$route.query.filmId || window.sessionStorage.getItem("filmId");
updateFilmInfo( updateFilmInfo(
filmId, filmId,
JSON.stringify({ filmData,
templateInfo: this.templateData.templateInfo,
pageList: this.templateData.listData
}),
this.templateData.filmName, this.templateData.filmName,
this.templateData.filmDescribe this.templateData.filmDescribe
) )
...@@ -783,10 +791,7 @@ export default { ...@@ -783,10 +791,7 @@ export default {
} else { } else {
createFilm({ createFilm({
templateId: this.$route.query.templateId, templateId: this.$route.query.templateId,
filmData: JSON.stringify({ filmData: filmData,
templateInfo: this.templateData.templateInfo,
pageList: this.templateData.listData
}),
filmName: this.templateData.filmName, filmName: this.templateData.filmName,
filmDescribe: this.templateData.filmDescribe filmDescribe: this.templateData.filmDescribe
}) })
...@@ -823,16 +828,28 @@ export default { ...@@ -823,16 +828,28 @@ export default {
} }
this.$toast.loading({ this.$toast.loading({
overlay: true, overlay: true,
message: "加载中...", message: "保存中, 请等待!",
forbidClick: true, forbidClick: true,
duration: 0 duration: 0
}); });
checkVideoCompress(this.$store.state.app.videoSrc).then(() => {
this.publish();
}).catch(() => {
this.$toast.clear()
// this.$toast("请重新发布")
})
// this.$toast.loading({
// overlay: true,
// message: "加载中...",
// forbidClick: true,
// duration: 0
// });
// this.message({ // this.message({
// type: "getList" // type: "getList"
// }); // });
setTimeout(() => { // setTimeout(() => {
this.publish(); // this.publish();
}, 500); // }, 500);
}, },
uploadAfter(file) { uploadAfter(file) {
// console.log(file, upload); // console.log(file, upload);
......
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 sign in to comment