|
@@ -14,7 +14,13 @@
|
|
|
</span>
|
|
|
</div>
|
|
|
<div class="train-top-info">
|
|
|
- <div class="img-box" :style="{backgroundColor: '#f0f0f0',backgroundImage: `url(${trainInfo.img || defImg})`}"></div>
|
|
|
+ <div class="img-box" :style="{backgroundColor: '#f0f0f0',backgroundImage: `url(${trainInfo.img || defImg})`}">
|
|
|
+ <Upload ref="upd-poster" :show-upload-list="false" :headers="updHeader" :on-error="handleUpdErr" type="drag" action="/blob/public-upload" :format="['jpg','png','jpeg']" :on-format-error="handleFormatError" :on-success="success">
|
|
|
+ <span @click="setUpload('poster')">
|
|
|
+ {{$t('train.detail.upd1')}}
|
|
|
+ </span>
|
|
|
+ </Upload>
|
|
|
+ </div>
|
|
|
<div class="infos">
|
|
|
<p class="title">
|
|
|
<span>{{trainInfo.topic}}</span>
|
|
@@ -92,7 +98,7 @@
|
|
|
<span v-if="trainFiles.length">
|
|
|
<span class="train-file-item" v-for="(item,index) in trainFiles" :key="index" @click="handlePreviewFile('file',index)">
|
|
|
{{item.name}}
|
|
|
- <Icon class="delete-train-file" type="md-close" @click="deleteFile('file',index)" />
|
|
|
+ <Icon class="delete-train-file" type="md-close" @click.stop="deleteFile('file',index)" />
|
|
|
</span>
|
|
|
<Upload action="" multiple :show-upload-list="false" :before-upload="handleUpload" style="display:inline-block">
|
|
|
<span class="upload-text" @click="setUpload('file')">{{$t('td.td126')}}</span>
|
|
@@ -520,6 +526,7 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ updHeader: {},
|
|
|
hwPreviewFile: {},
|
|
|
modalLoading: false,
|
|
|
selections: [],
|
|
@@ -874,6 +881,27 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ success(response, file, fileList) {
|
|
|
+ this.$api.train.updTrain({
|
|
|
+ id: this.trainInfo.id,
|
|
|
+ code: this.trainInfo.code.replace('Study-', ''),
|
|
|
+ img: response.url
|
|
|
+ }).then(
|
|
|
+ res => {
|
|
|
+ this.trainInfo.img = response.url
|
|
|
+ this.$Message.success(this.$t('train.detail.upd2'))
|
|
|
+ },
|
|
|
+ err => {
|
|
|
+ this.$Message.error(this.$t('train.detail.upd3'))
|
|
|
+ }
|
|
|
+ )
|
|
|
+ },
|
|
|
+ handleFormatError(file) {
|
|
|
+ this.$Message.warning(this.$t('train.create.uploadErr'));
|
|
|
+ },
|
|
|
+ handleUpdErr() {
|
|
|
+ this.$Message.error(this.$t('updModal.updErr'))
|
|
|
+ },
|
|
|
publishAreaActivity() {
|
|
|
let params = {
|
|
|
study: this.trainInfo,
|
|
@@ -1097,11 +1125,14 @@ export default {
|
|
|
}
|
|
|
}).then(
|
|
|
res => {
|
|
|
+ let url = res.url
|
|
|
res.url = res.url + schoolSas.sas
|
|
|
if (this.uploadType === 'video') {
|
|
|
this.trainVideo = res
|
|
|
- } else {
|
|
|
+ } else if (this.uploadType === 'file') {
|
|
|
this.trainFiles.push(res)
|
|
|
+ } else if (this.uploadType === 'poster') {
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
err => {
|
|
@@ -1793,6 +1824,10 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
+ if (localStorage.getItem('auth_token')) {
|
|
|
+ this.updHeader['x-auth-authtoken'] = localStorage.getItem('auth_token')
|
|
|
+ this.updHeader['authorization'] = 'Bearer ' + localStorage.getItem('access_token')
|
|
|
+ }
|
|
|
this.defImg = require("@/assets/image/def-train-poster.jpg")
|
|
|
let routerData = this.$route
|
|
|
console.log(routerData)
|