wangfei 6 vuotta sitten
vanhempi
commit
eb531767bf

+ 45
- 23
src/pages/system/courseManager/courseList/index.vue Näytä tiedosto

173
                 :action='$api.file.image.url'
173
                 :action='$api.file.image.url'
174
                 :show-file-list="false"
174
                 :show-file-list="false"
175
                 :on-success="handleAvatarSuccess">
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
                 <i v-else class="el-icon-plus avatar-uploader-icon"></i>
177
                 <i v-else class="el-icon-plus avatar-uploader-icon"></i>
178
               </el-upload>
178
               </el-upload>
179
             </div>
179
             </div>
181
           <el-button
181
           <el-button
182
             size="mini"
182
             size="mini"
183
             type="success"
183
             type="success"
184
-            v-if="editCourseDetail.newImg"
184
+            v-if="newImg"
185
             @click="addThisImg">确定添加图片</el-button>
185
             @click="addThisImg">确定添加图片</el-button>
186
         </li>
186
         </li>
187
       </ul>
187
       </ul>
188
       <el-table
188
       <el-table
189
-        :data="currentCourseDetail"
189
+        :data="courseImgs"
190
         stripe
190
         stripe
191
         style="width: 100%">
191
         style="width: 100%">
192
         <el-table-column
192
         <el-table-column
193
           prop="img"
193
           prop="img"
194
           label="图片">
194
           label="图片">
195
           <template slot-scope="scope">
195
           <template slot-scope="scope">
196
-            <img :src="scope.row.img" alt="">
196
+            <img :src="scope.row.ImgUrl" style="width:100%" alt="">
197
           </template>
197
           </template>
198
         </el-table-column>
198
         </el-table-column>
199
         <el-table-column
199
         <el-table-column
202
           <template slot-scope="scope">
202
           <template slot-scope="scope">
203
             <el-input
203
             <el-input
204
               placeholder="请输入内容"
204
               placeholder="请输入内容"
205
-              v-model="scope.row.sort"
206
-              :disabled="scope.row.edit ? false : true">
205
+              v-model="scope.row.Sort">
207
             </el-input>
206
             </el-input>
208
           </template>
207
           </template>
209
         </el-table-column>
208
         </el-table-column>
213
             <el-button
212
             <el-button
214
               size="mini"
213
               size="mini"
215
               type="success"
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
               @click="sureSort(scope.$index, scope.row)">确认</el-button>
215
               @click="sureSort(scope.$index, scope.row)">确认</el-button>
223
             <el-button
216
             <el-button
224
               size="mini"
217
               size="mini"
241
   name: '',
234
   name: '',
242
   data () {
235
   data () {
243
     return {
236
     return {
237
+      selCourseId: '',
244
       currentCourseDetail: [{
238
       currentCourseDetail: [{
245
         img: '',
239
         img: '',
246
         sort: 1,
240
         sort: 1,
247
         edit: false,
241
         edit: false,
248
       }],
242
       }],
249
-      editCourseDetail: {
250
-        newImg: '',
251
-        list: [],
252
-      },
243
+      newImg: '',
253
       centerDialogVisible: false, // 课程详情弹窗显隐
244
       centerDialogVisible: false, // 课程详情弹窗显隐
254
       total: 0,
245
       total: 0,
255
       postData: { // 表格搜索条件
246
       postData: { // 表格搜索条件
275
     }),
266
     }),
276
     ...mapCourseState({
267
     ...mapCourseState({
277
       courses: x => x.courseList,
268
       courses: x => x.courseList,
269
+      courseImgs: x => x.courseImgs
278
     }),
270
     }),
279
     ...mapLocationState({
271
     ...mapLocationState({
280
       location: x => x.location
272
       location: x => x.location
290
   },
282
   },
291
   methods: {
283
   methods: {
292
     deleteItem (index, item) { // 删除图片
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
     sureSort (index, item) { // 确认图片排序
294
     sureSort (index, item) { // 确认图片排序
296
-      this.currentCourseDetail[index].edit = false
295
+      this.UpdateCourseImg({...item, callback: this.afterImgAction})
297
     },
296
     },
298
     editItem (index, item) { // 编辑图片排序
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
     addThisImg () { // 添加图片到课程详情
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
     handleAvatarSuccess (res, file) {
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
       this.centerDialogVisible = true
325
       this.centerDialogVisible = true
309
     },
326
     },
310
     ...mapCourseActions([
327
     ...mapCourseActions([
313
       'UnPublic',
330
       'UnPublic',
314
       'DelCourse',
331
       'DelCourse',
315
       'SetNull',
332
       'SetNull',
316
-      'GetCourseByID'
333
+      'GetCourseByID',
334
+      'GetCourseImgs',
335
+      'AddCourseImg',
336
+      'UpdateCourseImg',
337
+      'DelCourseImg',
338
+      'UpdateImgList'
317
     ]),
339
     ]),
318
     ...mapLocationActions([
340
     ...mapLocationActions([
319
       'updateLocationInfo',
341
       'updateLocationInfo',

+ 2
- 2
src/pages/system/courseManager/scheduleManager/index.vue Näytä tiedosto

79
                 </el-date-picker>
79
                 </el-date-picker>
80
               </div>
80
               </div>
81
             </div>
81
             </div>
82
-            <span v-else>{{currentCourseItem.BeginDate}}</span>
82
+            <span v-else>{{this.toolClass.dateFormat(currentCourseItem.BeginDate, 'yyyy-MM-dd hh:mm')}}</span>
83
           </li>
83
           </li>
84
           <li class="flex-h">
84
           <li class="flex-h">
85
             <span>结束时间:</span>
85
             <span>结束时间:</span>
92
                 </el-date-picker>
92
                 </el-date-picker>
93
               </div>
93
               </div>
94
             </div>
94
             </div>
95
-            <span v-else>{{currentCourseItem.EndDate}}</span>
95
+            <span v-else>{{this.toolClass.dateFormat(currentCourseItem.EndDate, 'yyyy-MM-dd hh:mm')}}</span>
96
           </li>
96
           </li>
97
         </ul>
97
         </ul>
98
       </div>
98
       </div>

+ 4
- 2
src/pages/system/systemSet/roleManager/add.vue Näytä tiedosto

75
       if ((this.detail.RoleId || '') === '') {
75
       if ((this.detail.RoleId || '') === '') {
76
         this.detail.CaseId = this.caseid
76
         this.detail.CaseId = this.caseid
77
         this.detail.OrgId = this.orgid
77
         this.detail.OrgId = this.orgid
78
-        this.AddRole(this.detail)
78
+        this.AddRole({...this.detail, callback: this.afterSave})
79
       } else {
79
       } else {
80
-        this.UpdateRole(this.detail)
80
+        this.UpdateRole({...this.detail, callback: this.afterSave})
81
       }
81
       }
82
+    },
83
+    afterSave () {
82
       this.$message({
84
       this.$message({
83
         type: 'success',
85
         type: 'success',
84
         message: '操作成功'
86
         message: '操作成功'

+ 66
- 1
src/store/course/course.js Näytä tiedosto

6
   state: {
6
   state: {
7
     courseList: [],
7
     courseList: [],
8
     courseInfo: {},
8
     courseInfo: {},
9
+    courseImgs: [],
9
   },
10
   },
10
   mutations: {
11
   mutations: {
11
     updateList (state, payload) {
12
     updateList (state, payload) {
14
     updateInfo (state, payload) {
15
     updateInfo (state, payload) {
15
       state.courseInfo = payload || {}
16
       state.courseInfo = payload || {}
16
     },
17
     },
18
+    updateImgList (state, payload) {
19
+      state.courseImgs = payload
20
+    }
17
   },
21
   },
18
   actions: {
22
   actions: {
19
     GetCourseList ({ commit }, payload) {
23
     GetCourseList ({ commit }, payload) {
44
         }
48
         }
45
       }).then(res => {
49
       }).then(res => {
46
         commit('updateInfo', res)
50
         commit('updateInfo', res)
51
+        if (payload.callback) {
52
+          payload.callback()
53
+        }
47
       })
54
       })
48
     },
55
     },
49
     UpdateCourse ({ commit }, payload) {
56
     UpdateCourse ({ commit }, payload) {
56
           id: payload.GoodsId,
63
           id: payload.GoodsId,
57
         }
64
         }
58
       }).then(res => {
65
       }).then(res => {
66
+        if (payload.callback) {
67
+          payload.callback()
68
+        }
59
       })
69
       })
60
     },
70
     },
61
     DelCourse ({ commit }, { id, callback }) {
71
     DelCourse ({ commit }, { id, callback }) {
99
     },
109
     },
100
     UpdateInfo ({ commit }, payload) {
110
     UpdateInfo ({ commit }, payload) {
101
       commit('updateInfo', payload)
111
       commit('updateInfo', payload)
102
-    }
112
+    },
113
+    UpdateImgList ({ commit }, payload) {
114
+      commit('updateImgList', payload)
115
+    },
116
+    GetCourseImgs ({ commit }, {id, callback}) {
117
+      ajax(api.course.getimgs.url, {
118
+        method: api.course.getimgs.method,
119
+        urlData: {
120
+          id: id,
121
+        }
122
+      }).then(res => {
123
+        commit('updateImgList', res)
124
+        if (callback) {
125
+          callback()
126
+        }
127
+      })
128
+    },
129
+    AddCourseImg ({ commit }, payload) {
130
+      ajax(api.course.addimgs.url, {
131
+        method: api.course.addimgs.method,
132
+        data: {
133
+          ...payload
134
+        }
135
+      }).then(res => {
136
+        if (payload.callback) {
137
+          payload.callback()
138
+        }
139
+      })
140
+    },
141
+    UpdateCourseImg ({ commit }, payload) {
142
+      ajax(api.course.updateimgs.url, {
143
+        method: api.course.updateimgs.method,
144
+        data: {
145
+          ...payload
146
+        },
147
+        urlData: {
148
+          id: payload.id
149
+        }
150
+      }).then(res => {
151
+        if (payload.callback) {
152
+          payload.callback()
153
+        }
154
+      })
155
+    },
156
+    DelCourseImg ({ commit }, { id, callback }) {
157
+      ajax(api.course.deleteimgs.url, {
158
+        method: api.course.deleteimgs.method,
159
+        urlData: {
160
+          id: id,
161
+        }
162
+      }).then(res => {
163
+        if (callback) {
164
+          callback()
165
+        }
166
+      })
167
+    },
103
   }
168
   }
104
 }
169
 }

+ 6
- 0
src/store/system/role.js Näytä tiedosto

48
         }
48
         }
49
       }).then(res => {
49
       }).then(res => {
50
         commit('updateInfo', res)
50
         commit('updateInfo', res)
51
+        if (payload.callback) {
52
+          payload.callback()
53
+        }
51
       })
54
       })
52
     },
55
     },
53
     UpdateRole ({ commit }, payload) {
56
     UpdateRole ({ commit }, payload) {
57
           ...payload
60
           ...payload
58
         }
61
         }
59
       }).then(res => {
62
       }).then(res => {
63
+        if (payload.callback) {
64
+          payload.callback()
65
+        }
60
       })
66
       })
61
     },
67
     },
62
     DelRole ({ commit }, { id, callback }) {
68
     DelRole ({ commit }, { id, callback }) {