|
@@ -173,7 +173,7 @@
|
173
|
173
|
:action='$api.file.image.url'
|
174
|
174
|
:show-file-list="false"
|
175
|
175
|
:on-success="handleAvatarSuccess">
|
176
|
|
- <img v-if="editCourseDetail.newImg" :src="editCourseDetail.newImg" class="avatar">
|
|
176
|
+ <img v-if="newImg" :src="newImg" class="avatar">
|
177
|
177
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
178
|
178
|
</el-upload>
|
179
|
179
|
</div>
|
|
@@ -181,19 +181,19 @@
|
181
|
181
|
<el-button
|
182
|
182
|
size="mini"
|
183
|
183
|
type="success"
|
184
|
|
- v-if="editCourseDetail.newImg"
|
|
184
|
+ v-if="newImg"
|
185
|
185
|
@click="addThisImg">确定添加图片</el-button>
|
186
|
186
|
</li>
|
187
|
187
|
</ul>
|
188
|
188
|
<el-table
|
189
|
|
- :data="currentCourseDetail"
|
|
189
|
+ :data="courseImgs"
|
190
|
190
|
stripe
|
191
|
191
|
style="width: 100%">
|
192
|
192
|
<el-table-column
|
193
|
193
|
prop="img"
|
194
|
194
|
label="图片">
|
195
|
195
|
<template slot-scope="scope">
|
196
|
|
- <img :src="scope.row.img" alt="">
|
|
196
|
+ <img :src="scope.row.ImgUrl" style="width:100%" alt="">
|
197
|
197
|
</template>
|
198
|
198
|
</el-table-column>
|
199
|
199
|
<el-table-column
|
|
@@ -202,8 +202,7 @@
|
202
|
202
|
<template slot-scope="scope">
|
203
|
203
|
<el-input
|
204
|
204
|
placeholder="请输入内容"
|
205
|
|
- v-model="scope.row.sort"
|
206
|
|
- :disabled="scope.row.edit ? false : true">
|
|
205
|
+ v-model="scope.row.Sort">
|
207
|
206
|
</el-input>
|
208
|
207
|
</template>
|
209
|
208
|
</el-table-column>
|
|
@@ -213,12 +212,6 @@
|
213
|
212
|
<el-button
|
214
|
213
|
size="mini"
|
215
|
214
|
type="success"
|
216
|
|
- v-if="!scope.row.edit"
|
217
|
|
- @click="editItem(scope.$index, scope.row)">编辑</el-button>
|
218
|
|
- <el-button
|
219
|
|
- size="mini"
|
220
|
|
- type="success"
|
221
|
|
- v-if="scope.row.edit"
|
222
|
215
|
@click="sureSort(scope.$index, scope.row)">确认</el-button>
|
223
|
216
|
<el-button
|
224
|
217
|
size="mini"
|
|
@@ -241,15 +234,13 @@ export default {
|
241
|
234
|
name: '',
|
242
|
235
|
data () {
|
243
|
236
|
return {
|
|
237
|
+ selCourseId: '',
|
244
|
238
|
currentCourseDetail: [{
|
245
|
239
|
img: '',
|
246
|
240
|
sort: 1,
|
247
|
241
|
edit: false,
|
248
|
242
|
}],
|
249
|
|
- editCourseDetail: {
|
250
|
|
- newImg: '',
|
251
|
|
- list: [],
|
252
|
|
- },
|
|
243
|
+ newImg: '',
|
253
|
244
|
centerDialogVisible: false, // 课程详情弹窗显隐
|
254
|
245
|
total: 0,
|
255
|
246
|
postData: { // 表格搜索条件
|
|
@@ -275,6 +266,7 @@ export default {
|
275
|
266
|
}),
|
276
|
267
|
...mapCourseState({
|
277
|
268
|
courses: x => x.courseList,
|
|
269
|
+ courseImgs: x => x.courseImgs
|
278
|
270
|
}),
|
279
|
271
|
...mapLocationState({
|
280
|
272
|
location: x => x.location
|
|
@@ -290,21 +282,46 @@ export default {
|
290
|
282
|
},
|
291
|
283
|
methods: {
|
292
|
284
|
deleteItem (index, item) { // 删除图片
|
293
|
|
-
|
|
285
|
+ this.$confirm('确认删除此课程?', '提示', {
|
|
286
|
+ confirmButtonText: '确定',
|
|
287
|
+ cancelButtonText: '取消',
|
|
288
|
+ type: 'warning'
|
|
289
|
+ })
|
|
290
|
+ .then(() => {
|
|
291
|
+ this.DelCourseImg({id: item.ImgId, callback: this.afterImgAction})
|
|
292
|
+ })
|
294
|
293
|
},
|
295
|
294
|
sureSort (index, item) { // 确认图片排序
|
296
|
|
- this.currentCourseDetail[index].edit = false
|
|
295
|
+ this.UpdateCourseImg({...item, callback: this.afterImgAction})
|
297
|
296
|
},
|
298
|
297
|
editItem (index, item) { // 编辑图片排序
|
299
|
|
- this.currentCourseDetail[index].edit = true
|
|
298
|
+ let imglist = {...this.courseImgs}
|
|
299
|
+ imglist[index].edit = true
|
|
300
|
+ this.UpdateImgList(imglist)
|
300
|
301
|
},
|
301
|
302
|
addThisImg () { // 添加图片到课程详情
|
302
|
|
-
|
|
303
|
+ const data = {
|
|
304
|
+ CourseId: this.selCourseId,
|
|
305
|
+ ImgUrl: this.newImg,
|
|
306
|
+ Sort: 0,
|
|
307
|
+ callback: this.afterImgAction
|
|
308
|
+ }
|
|
309
|
+ this.newImg = ''
|
|
310
|
+ this.AddCourseImg(data)
|
|
311
|
+ },
|
|
312
|
+ afterImgAction () {
|
|
313
|
+ this.$message({
|
|
314
|
+ type: 'success',
|
|
315
|
+ message: '操作成功!'
|
|
316
|
+ })
|
|
317
|
+ this.GetCourseImgs({id: this.selCourseId})
|
303
|
318
|
},
|
304
|
319
|
handleAvatarSuccess (res, file) {
|
305
|
|
- this.editCourseDetail.newImg = res.result.url
|
|
320
|
+ this.newImg = res.result.url
|
306
|
321
|
},
|
307
|
|
- addDetail (val) { // 添加课程详情
|
|
322
|
+ addDetail (row) { // 添加课程详情
|
|
323
|
+ this.selCourseId = row.CourseId
|
|
324
|
+ this.GetCourseImgs({id: this.selCourseId})
|
308
|
325
|
this.centerDialogVisible = true
|
309
|
326
|
},
|
310
|
327
|
...mapCourseActions([
|
|
@@ -313,7 +330,12 @@ export default {
|
313
|
330
|
'UnPublic',
|
314
|
331
|
'DelCourse',
|
315
|
332
|
'SetNull',
|
316
|
|
- 'GetCourseByID'
|
|
333
|
+ 'GetCourseByID',
|
|
334
|
+ 'GetCourseImgs',
|
|
335
|
+ 'AddCourseImg',
|
|
336
|
+ 'UpdateCourseImg',
|
|
337
|
+ 'DelCourseImg',
|
|
338
|
+ 'UpdateImgList'
|
317
|
339
|
]),
|
318
|
340
|
...mapLocationActions([
|
319
|
341
|
'updateLocationInfo',
|