修改
This commit is contained in:
parent
a32345373c
commit
b7d2367b6e
@ -12,7 +12,7 @@ let downloadLoadingInstance;
|
|||||||
export let isRelogin = { show: false };
|
export let isRelogin = { show: false };
|
||||||
|
|
||||||
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
||||||
// 创建axios实例
|
// 创建axios实例
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||||
baseURL: process.env.VUE_APP_BASE_API,
|
baseURL: process.env.VUE_APP_BASE_API,
|
||||||
@ -24,7 +24,7 @@ const service = axios.create({
|
|||||||
service.interceptors.request.use(config => {
|
service.interceptors.request.use(config => {
|
||||||
// 是否需要设置 token
|
// 是否需要设置 token
|
||||||
const isToken = (config.headers || {}).isToken === false
|
const isToken = (config.headers || {}).isToken === false
|
||||||
// 是否需要防止数据重复提交
|
// 是否需要防止数据重复提交
|
||||||
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
|
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
|
||||||
if (getToken() && !isToken) {
|
if (getToken() && !isToken) {
|
||||||
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||||
@ -67,48 +67,48 @@ service.interceptors.request.use(config => {
|
|||||||
|
|
||||||
// 响应拦截器
|
// 响应拦截器
|
||||||
service.interceptors.response.use(res => {
|
service.interceptors.response.use(res => {
|
||||||
// 未设置状态码则默认成功状态
|
// 未设置状态码则默认成功状态
|
||||||
const code = res.data.code || 200;
|
const code = res.data.code || 200;
|
||||||
// 获取错误信息
|
// 获取错误信息
|
||||||
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
||||||
// 二进制数据则直接返回
|
// 二进制数据则直接返回
|
||||||
if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') {
|
if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') {
|
||||||
return res.data
|
return res.data
|
||||||
|
}
|
||||||
|
if (code === 401) {
|
||||||
|
if (!isRelogin.show) {
|
||||||
|
isRelogin.show = true;
|
||||||
|
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
|
||||||
|
confirmButtonText: '重新登录',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
isRelogin.show = false;
|
||||||
|
store.dispatch('LogOut').then(() => {
|
||||||
|
location.href = '/index';
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
isRelogin.show = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (code === 401) {
|
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
||||||
if (!isRelogin.show) {
|
} else if (code === 500) {
|
||||||
isRelogin.show = true;
|
Message({
|
||||||
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
|
message: msg,
|
||||||
confirmButtonText: '重新登录',
|
type: 'error'
|
||||||
cancelButtonText: '取消',
|
})
|
||||||
type: 'warning'
|
return res.data & Promise.reject(new Error(msg))
|
||||||
}).then(() => {
|
} else if (code === 600) {
|
||||||
isRelogin.show = false;
|
return Promise.reject(new Error(msg))
|
||||||
store.dispatch('LogOut').then(() => {
|
} else if (code !== 200) {
|
||||||
location.href = '/index';
|
Notification.error({
|
||||||
})
|
title: msg
|
||||||
}).catch(() => {
|
})
|
||||||
isRelogin.show = false;
|
return Promise.reject('error')
|
||||||
});
|
} else {
|
||||||
}
|
return res.data
|
||||||
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
}
|
||||||
} else if (code === 500) {
|
},
|
||||||
Message({
|
|
||||||
message: msg,
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
return Promise.reject(new Error(msg))
|
|
||||||
} else if (code === 600) {
|
|
||||||
return Promise.reject(new Error(msg))
|
|
||||||
} else if (code !== 200) {
|
|
||||||
Notification.error({
|
|
||||||
title: msg
|
|
||||||
})
|
|
||||||
return Promise.reject('error')
|
|
||||||
} else {
|
|
||||||
return res.data
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error => {
|
error => {
|
||||||
console.log('err' + error)
|
console.log('err' + error)
|
||||||
let { message } = error;
|
let { message } = error;
|
||||||
@ -135,7 +135,7 @@ export function download(url, params, filename) {
|
|||||||
transformRequest: [(params) => { return tansParams(params) }],
|
transformRequest: [(params) => { return tansParams(params) }],
|
||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
responseType: 'blob'
|
responseType: 'blob'
|
||||||
}).then(async(data) => {
|
}).then(async (data) => {
|
||||||
const isLogin = await blobValidate(data);
|
const isLogin = await blobValidate(data);
|
||||||
if (isLogin) {
|
if (isLogin) {
|
||||||
const blob = new Blob([data])
|
const blob = new Blob([data])
|
||||||
|
|||||||
@ -1,13 +1,19 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="user-info-head" :class="video.VideoPath ? 'wihi' : ''" @click="editCropper()">
|
<div
|
||||||
|
class="user-info-head"
|
||||||
|
:class="video.VideoPath ? 'wihi' : ''"
|
||||||
|
@click="editCropper()"
|
||||||
|
>
|
||||||
<video
|
<video
|
||||||
style="width: 208px; height: 208px"
|
style="width: 208px; height: 208px"
|
||||||
v-if="video.VideoPath"
|
v-if="video.VideoPath"
|
||||||
v-bind:src="video.VideoPath"
|
v-bind:src="video.VideoPath"
|
||||||
class="avatar video-avatar"
|
class="avatar video-avatar"
|
||||||
controls="controls"
|
controls="controls"
|
||||||
>您的浏览器不支持视频播放</video>
|
>
|
||||||
|
您的浏览器不支持视频播放
|
||||||
|
</video>
|
||||||
<img
|
<img
|
||||||
v-if="options.img"
|
v-if="options.img"
|
||||||
v-bind:src="options.img"
|
v-bind:src="options.img"
|
||||||
@ -56,8 +62,14 @@
|
|||||||
v-bind:src="videoForm.showVideoPath"
|
v-bind:src="videoForm.showVideoPath"
|
||||||
class="avatar video-avatar"
|
class="avatar video-avatar"
|
||||||
controls="controls"
|
controls="controls"
|
||||||
>您的浏览器不支持视频播放</video>
|
>
|
||||||
<img style="width: 100%; height: 100%" v-if="previews.url" :src="previews.url" />
|
您的浏览器不支持视频播放
|
||||||
|
</video>
|
||||||
|
<img
|
||||||
|
style="width: 100%; height: 100%"
|
||||||
|
v-if="previews.url"
|
||||||
|
:src="previews.url"
|
||||||
|
/>
|
||||||
<div v-else></div>
|
<div v-else></div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@ -67,7 +79,9 @@
|
|||||||
types != 'posterPictureUrl' &&
|
types != 'posterPictureUrl' &&
|
||||||
types != 'itemDirectoryUrl'
|
types != 'itemDirectoryUrl'
|
||||||
"
|
"
|
||||||
>请上传图片为800x800px的正方形</div>
|
>
|
||||||
|
请上传图片为800x800px的正方形
|
||||||
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<br />
|
<br />
|
||||||
@ -113,9 +127,17 @@
|
|||||||
@click="rotateRight()"
|
@click="rotateRight()"
|
||||||
></el-button>
|
></el-button>
|
||||||
</el-col>-->
|
</el-col>-->
|
||||||
<el-col :lg="{ span: 2, offset: 19}" :md="2">
|
<el-col :lg="{ span: 2, offset: 19 }" :md="2">
|
||||||
<el-button v-if="uploadbtn" type="primary" size="small" @click="uploadImg()">提 交</el-button>
|
<el-button
|
||||||
<el-button v-else :loading="!uploadbtn" type="primary" size="small">提 交 中...</el-button>
|
v-if="uploadbtn"
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="uploadImg()"
|
||||||
|
>提 交</el-button
|
||||||
|
>
|
||||||
|
<el-button v-else :loading="!uploadbtn" type="primary" size="small"
|
||||||
|
>提 交 中...</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -131,7 +153,7 @@ import {
|
|||||||
uploadVideoUrl,
|
uploadVideoUrl,
|
||||||
uploadTrainingCategoryPicture,
|
uploadTrainingCategoryPicture,
|
||||||
updatePoserHeads,
|
updatePoserHeads,
|
||||||
uploadUrl
|
uploadUrl,
|
||||||
} from "@/api/system/stationAvatar.js";
|
} from "@/api/system/stationAvatar.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -153,17 +175,17 @@ export default {
|
|||||||
autoCrop: true, // 是否默认生成截图框
|
autoCrop: true, // 是否默认生成截图框
|
||||||
autoCropWidth: 300, // 默认生成截图框宽度
|
autoCropWidth: 300, // 默认生成截图框宽度
|
||||||
autoCropHeight: 300, // 默认生成截图框高度
|
autoCropHeight: 300, // 默认生成截图框高度
|
||||||
fixedBox: true // 固定截图框大小 不允许改变
|
fixedBox: true, // 固定截图框大小 不允许改变
|
||||||
},
|
},
|
||||||
previews: {},
|
previews: {},
|
||||||
items: {},
|
items: {},
|
||||||
//显示上传按钮
|
//显示上传按钮
|
||||||
videoForm: {
|
videoForm: {
|
||||||
showVideoPath: null //回显的变量
|
showVideoPath: null, //回显的变量
|
||||||
},
|
},
|
||||||
video: {
|
video: {
|
||||||
VideoPath: null //回显的变量
|
VideoPath: null, //回显的变量
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -191,12 +213,12 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
tovideo: {
|
tovideo: {
|
||||||
handler(newimg, oldimg) {}
|
handler(newimg, oldimg) {},
|
||||||
},
|
},
|
||||||
item: {
|
item: {
|
||||||
handler(newimg, oldimg) {
|
handler(newimg, oldimg) {
|
||||||
this.items = this.item;
|
this.items = this.item;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
img: {
|
img: {
|
||||||
handler(newimg, oldimg) {
|
handler(newimg, oldimg) {
|
||||||
@ -207,13 +229,13 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.options.img = baseurl + this.img;
|
this.options.img = baseurl + this.img;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
handler(newimg, oldimg) {
|
handler(newimg, oldimg) {
|
||||||
this.types = this.type;
|
this.types = this.type;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 编辑头像
|
// 编辑头像
|
||||||
@ -276,38 +298,45 @@ export default {
|
|||||||
if (this.types == "itemDirectoryUrl") {
|
if (this.types == "itemDirectoryUrl") {
|
||||||
this.$modal.msgSuccess("上传视频中,请耐心等待");
|
this.$modal.msgSuccess("上传视频中,请耐心等待");
|
||||||
this.uploadbtn = false;
|
this.uploadbtn = false;
|
||||||
uploadVideoUrl(formData).then(response => {
|
uploadVideoUrl(formData).then((response) => {
|
||||||
this.video.VideoPath = baseurl + response.imgUrl;
|
if (response.code == 200) {
|
||||||
this.$emit("imgUrl", response.imgUrl);
|
this.video.VideoPath = baseurl + response.imgUrl;
|
||||||
this.items.itemDirectoryUrl = response.imgUrl;
|
this.$emit("imgUrl", response.imgUrl);
|
||||||
this.$emit("item", JSON.stringify(this.items));
|
this.items.itemDirectoryUrl = response.imgUrl;
|
||||||
|
this.$emit("item", JSON.stringify(this.items));
|
||||||
|
this.openimg = false;
|
||||||
|
} else {
|
||||||
|
this.$emit("item", "false");
|
||||||
|
setTimeout((e) => {
|
||||||
|
this.openimg = false;
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
this.uploadbtn = true;
|
this.uploadbtn = true;
|
||||||
this.openimg = false;
|
|
||||||
});
|
});
|
||||||
} else if (
|
} else if (
|
||||||
this.types == "trainingItemCoverUrl" ||
|
this.types == "trainingItemCoverUrl" ||
|
||||||
this.types == "trainingItemContentUrl" ||
|
this.types == "trainingItemContentUrl" ||
|
||||||
this.types == "trainingItemPosterUrl"
|
this.types == "trainingItemPosterUrl"
|
||||||
) {
|
) {
|
||||||
uploadUrl(formData).then(response => {
|
uploadUrl(formData).then((response) => {
|
||||||
this.options.img = baseurl + response.imgUrl;
|
this.options.img = baseurl + response.imgUrl;
|
||||||
this.$emit("imgUrl", response.imgUrl);
|
this.$emit("imgUrl", response.imgUrl);
|
||||||
this.openimg = false;
|
this.openimg = false;
|
||||||
});
|
});
|
||||||
} else if (this.types == "trainingCategoryPictureUrl") {
|
} else if (this.types == "trainingCategoryPictureUrl") {
|
||||||
uploadTrainingCategoryPicture(formData).then(response => {
|
uploadTrainingCategoryPicture(formData).then((response) => {
|
||||||
this.options.img = baseurl + response.imgUrl;
|
this.options.img = baseurl + response.imgUrl;
|
||||||
this.$emit("imgUrl", response.imgUrl);
|
this.$emit("imgUrl", response.imgUrl);
|
||||||
this.openimg = false;
|
this.openimg = false;
|
||||||
});
|
});
|
||||||
} else if (this.types == "posterVideoUrl") {
|
} else if (this.types == "posterVideoUrl") {
|
||||||
updatePoserHeads(formData).then(response => {
|
updatePoserHeads(formData).then((response) => {
|
||||||
this.video.VideoPath = baseurl + response.imgUrl;
|
this.video.VideoPath = baseurl + response.imgUrl;
|
||||||
this.$emit("imgUrl", response.imgUrl);
|
this.$emit("imgUrl", response.imgUrl);
|
||||||
this.openimg = false;
|
this.openimg = false;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
updateNurseStationHeads(formData).then(response => {
|
updateNurseStationHeads(formData).then((response) => {
|
||||||
this.options.img = baseurl + response.imgUrl;
|
this.options.img = baseurl + response.imgUrl;
|
||||||
this.$emit("imgUrl", response.imgUrl);
|
this.$emit("imgUrl", response.imgUrl);
|
||||||
if (this.types == "attributePitureUrl") {
|
if (this.types == "attributePitureUrl") {
|
||||||
@ -349,8 +378,8 @@ export default {
|
|||||||
closeDialog() {
|
closeDialog() {
|
||||||
this.imgs = "";
|
this.imgs = "";
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@ -1093,7 +1093,6 @@ export default {
|
|||||||
// 章节视频
|
// 章节视频
|
||||||
itemDirectoryUrl(item) {
|
itemDirectoryUrl(item) {
|
||||||
let items = JSON.parse(item);
|
let items = JSON.parse(item);
|
||||||
console.log(items);
|
|
||||||
if (items.idd && !items.trainingItemDirectoryId) {
|
if (items.idd && !items.trainingItemDirectoryId) {
|
||||||
this.form.trainingItemDirectoryList.forEach((e) => {
|
this.form.trainingItemDirectoryList.forEach((e) => {
|
||||||
if (e.idd == items.idd) {
|
if (e.idd == items.idd) {
|
||||||
@ -1298,7 +1297,7 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.queryParams.trainingItemType='';
|
this.queryParams.trainingItemType = "";
|
||||||
this.resetForm("queryForm");
|
this.resetForm("queryForm");
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
},
|
},
|
||||||
@ -1403,11 +1402,14 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
console.log(row)
|
console.log(row);
|
||||||
const ids = row.id || this.ids;
|
const ids = row.id || this.ids;
|
||||||
const trainingItemTitles = row.trainingItemTitle || this.trainingItemTitles;
|
const trainingItemTitles =
|
||||||
|
row.trainingItemTitle || this.trainingItemTitles;
|
||||||
this.$modal
|
this.$modal
|
||||||
.confirm('是否确认删除培训课程名称为"' + trainingItemTitles + '"的数据项?')
|
.confirm(
|
||||||
|
'是否确认删除培训课程名称为"' + trainingItemTitles + '"的数据项?'
|
||||||
|
)
|
||||||
.then(function () {
|
.then(function () {
|
||||||
return delTrainingItem(ids);
|
return delTrainingItem(ids);
|
||||||
})
|
})
|
||||||
|
|||||||
@ -673,6 +673,7 @@ export default {
|
|||||||
this.reset();
|
this.reset();
|
||||||
const id = row.id || this.ids;
|
const id = row.id || this.ids;
|
||||||
getTrainingOrder(id).then((response) => {
|
getTrainingOrder(id).then((response) => {
|
||||||
|
console.log(response)
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
this.form.trainingOrderDetailsList =
|
this.form.trainingOrderDetailsList =
|
||||||
response.data.trainingOrderDetailsList;
|
response.data.trainingOrderDetailsList;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user