wangfei 6 лет назад
Родитель
Сommit
eb531767bf

+ 45
- 23
src/pages/system/courseManager/courseList/index.vue Просмотреть файл

@@ -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',

+ 2
- 2
src/pages/system/courseManager/scheduleManager/index.vue Просмотреть файл

@@ -79,7 +79,7 @@
79 79
                 </el-date-picker>
80 80
               </div>
81 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 83
           </li>
84 84
           <li class="flex-h">
85 85
             <span>结束时间:</span>
@@ -92,7 +92,7 @@
92 92
                 </el-date-picker>
93 93
               </div>
94 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 96
           </li>
97 97
         </ul>
98 98
       </div>

+ 4
- 2
src/pages/system/systemSet/roleManager/add.vue Просмотреть файл

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

+ 66
- 1
src/store/course/course.js Просмотреть файл

@@ -6,6 +6,7 @@ export default {
6 6
   state: {
7 7
     courseList: [],
8 8
     courseInfo: {},
9
+    courseImgs: [],
9 10
   },
10 11
   mutations: {
11 12
     updateList (state, payload) {
@@ -14,6 +15,9 @@ export default {
14 15
     updateInfo (state, payload) {
15 16
       state.courseInfo = payload || {}
16 17
     },
18
+    updateImgList (state, payload) {
19
+      state.courseImgs = payload
20
+    }
17 21
   },
18 22
   actions: {
19 23
     GetCourseList ({ commit }, payload) {
@@ -44,6 +48,9 @@ export default {
44 48
         }
45 49
       }).then(res => {
46 50
         commit('updateInfo', res)
51
+        if (payload.callback) {
52
+          payload.callback()
53
+        }
47 54
       })
48 55
     },
49 56
     UpdateCourse ({ commit }, payload) {
@@ -56,6 +63,9 @@ export default {
56 63
           id: payload.GoodsId,
57 64
         }
58 65
       }).then(res => {
66
+        if (payload.callback) {
67
+          payload.callback()
68
+        }
59 69
       })
60 70
     },
61 71
     DelCourse ({ commit }, { id, callback }) {
@@ -99,6 +109,61 @@ export default {
99 109
     },
100 110
     UpdateInfo ({ commit }, payload) {
101 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 Просмотреть файл

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