|
@@ -266,7 +266,7 @@ export default {
|
266
|
266
|
},
|
267
|
267
|
checkFn (arr) {
|
268
|
268
|
for (var n = 0; n < arr.length; n++) {
|
269
|
|
- if (arr[n].type === 'isNull' && arr[n].target === '') {
|
|
269
|
+ if (arr[n].type === 'isNull' && !arr[n].target) {
|
270
|
270
|
this.$message({
|
271
|
271
|
message: arr[n].errorMsg,
|
272
|
272
|
type: 'error'
|
|
@@ -278,31 +278,31 @@ export default {
|
278
|
278
|
},
|
279
|
279
|
submit () {
|
280
|
280
|
var checkOff = this.checkFn([{
|
281
|
|
- target: this.CaseId || '',
|
|
281
|
+ target: Boolean(this.CaseId || ''),
|
282
|
282
|
errorMsg: '对应案场不能为空',
|
283
|
283
|
type: 'isNull'
|
284
|
284
|
}, {
|
285
|
|
- target: this.detail.Name || '',
|
|
285
|
+ target: Boolean(this.detail.Name || ''),
|
286
|
286
|
errorMsg: '名称不能为空',
|
287
|
287
|
type: 'isNull'
|
288
|
288
|
}, {
|
289
|
|
- target: this.imgShow || '',
|
|
289
|
+ target: Boolean(this.imgShow || ''),
|
290
|
290
|
errorMsg: '图片不能为空',
|
291
|
291
|
type: 'isNull'
|
292
|
292
|
}, {
|
293
|
|
- target: (this.detailImgShow || ''),
|
|
293
|
+ target: Boolean(this.detailImgShow || ''),
|
294
|
294
|
errorMsg: '详细图片不能为空',
|
295
|
295
|
type: 'isNull'
|
296
|
296
|
}, {
|
297
|
|
- target: this.detail.DetailContent || '',
|
|
297
|
+ target: Boolean(this.detail.DetailContent || ''),
|
298
|
298
|
errorMsg: '专题简介不能为空',
|
299
|
299
|
type: 'isNull'
|
300
|
300
|
}, {
|
301
|
|
- target: this.detail.IsAllCourse || '',
|
|
301
|
+ target: Boolean(this.detail.IsAllCourse || ''),
|
302
|
302
|
errorMsg: '展示课程不能为空',
|
303
|
303
|
type: 'isNull'
|
304
|
304
|
}, {
|
305
|
|
- target: this.detail.Status === 0 || this.detail.Status || '',
|
|
305
|
+ target: Boolean(String(this.detail.Status) || ''),
|
306
|
306
|
errorMsg: '是否前台展示不能为空',
|
307
|
307
|
type: 'isNull'
|
308
|
308
|
}])
|
|
@@ -319,11 +319,13 @@ export default {
|
319
|
319
|
const courseids = (this.detail.Courses || []).map(x => x.CourseId).join(',')
|
320
|
320
|
if (this.id === '') {
|
321
|
321
|
this.detail.OrgId = this.OrgId
|
322
|
|
- this.AddCaseInfo({ ...this.detail, OrgId: this.OrgId, imgs: this.imgShow, detailimgs: this.detailImgShow, courseids }).then(res => {
|
|
322
|
+ console.log(JSON.stringify({ ...this.detail, OrgId: this.OrgId, imgs: this.imgShow, detailimgs: this.detailImgShow, courseids }))
|
|
323
|
+ this.AddCaseInfo({ ...this.detail, OrgId: this.OrgId, imgs: this.imgShow, detailimgs: this.detailImgShow, courseids }).then((res) => {
|
323
|
324
|
this.afterSave()
|
324
|
325
|
})
|
325
|
326
|
} else {
|
326
|
|
- this.AddCaseInfo({ ...this.detail, imgs: this.imgShow, detailimgs: this.detailImgShow, courseids }).then(res => {
|
|
327
|
+ console.log(JSON.stringify({ ...this.detail, OrgId: this.OrgId, imgs: this.imgShow, detailimgs: this.detailImgShow, courseids }))
|
|
328
|
+ this.AddCaseInfo({ ...this.detail, imgs: this.imgShow, detailimgs: this.detailImgShow, courseids }).then((res) => {
|
327
|
329
|
this.afterSave()
|
328
|
330
|
})
|
329
|
331
|
}
|
|
@@ -334,9 +336,7 @@ export default {
|
334
|
336
|
type: 'success',
|
335
|
337
|
duration: 1000
|
336
|
338
|
})
|
337
|
|
- setTimeout(() => {
|
338
|
|
- this.$router.push({ name: 'indexCase' })
|
339
|
|
- }, 1000)
|
|
339
|
+ this.$router.push({ name: 'indexCase' })
|
340
|
340
|
},
|
341
|
341
|
cancel () {
|
342
|
342
|
this.$router.go(-1)
|