Commit 9cf21866 by hanjixin

修改了视频上传之后的存储

parent e9489f9a
...@@ -148,6 +148,9 @@ export function getUserInfo() { ...@@ -148,6 +148,9 @@ export function getUserInfo() {
// 获取用户信息 // 获取用户信息
return get(`/user/get/info`) return get(`/user/get/info`)
} }
export function checkVideoCompress(videoSrc = []) {
return get(`/user/get/info`, videoSrc)
}
export function upload(file) { export function upload(file) {
// 上传文件 // 上传文件
let formData = new FormData() let formData = new FormData()
......
...@@ -6,7 +6,8 @@ const app = { ...@@ -6,7 +6,8 @@ const app = {
withoutAnimation: false withoutAnimation: false
}, },
device: 'desktop', device: 'desktop',
errorData: {} errorData: {},
videoSrc: []
}, },
mutations: { mutations: {
TOGGLE_SIDEBAR: state => { TOGGLE_SIDEBAR: state => {
...@@ -28,6 +29,12 @@ const app = { ...@@ -28,6 +29,12 @@ const app = {
}, },
SET_ERROR_DATA: (state, errorData) => { SET_ERROR_DATA: (state, errorData) => {
state.errorData = errorData state.errorData = errorData
},
SET_VIDEO_SRC : (state, videoSrc) => {
state.videoSrc = state.videoSrc.push(videoSrc)
},
CLEAR_VIDEO_SRC : (state) => {
state.videoSrc = []
} }
}, },
actions: { actions: {
......
...@@ -356,7 +356,7 @@ export default { ...@@ -356,7 +356,7 @@ export default {
}, 300); }, 300);
} }
}, },
uploadFile(data) { uploadFile(data, isVideo) {
this.$toast.loading({ this.$toast.loading({
mask: true, mask: true,
duration: 0, duration: 0,
...@@ -364,6 +364,9 @@ export default { ...@@ -364,6 +364,9 @@ export default {
}); });
upload(data) upload(data)
.then(res => { .then(res => {
if(isVideo) {
this.$store.commit('SET_VIDEO_SRC', res.data.data)
}
// 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);
...@@ -506,7 +509,7 @@ export default { ...@@ -506,7 +509,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); this.uploadFile(file.file), String(file.file.type).indexOf("image") === -1;
} }
}, },
checkboxChange(value) { checkboxChange(value) {
......
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