瀏覽代碼

推荐管理 不可添加空内容

DESKTOP-SVI9JE1\muzen 2 年之前
父節點
當前提交
c579017168
共有 2 個文件被更改,包括 26 次插入23 次删除
  1. 25 22
      src/views/operation/recommend/detail.vue
  2. 1 1
      src/views/operation/recommend/index.vue

+ 25 - 22
src/views/operation/recommend/detail.vue

@@ -529,31 +529,34 @@ export default {
     // 提交
     getSubmit() {
       let isValid = true
-      
-      this.$refs.list.map(i => i.validate((valid) => {
-        if (!valid) {
-          isValid = false
-          return false
-        }
-      }))
+      if (this.$refs.list) {
+        this.$refs.list.map(i => i.validate((valid) => {
+          if (!valid) {
+            isValid = false
+            return false
+          }
+        }))
 
-      if (isValid) {
-        // 区分2级新增 还是 3级编辑
-        this.$route.query.secondId ? this.form.secondId = this.$route.query.secondId : this.form.threeId = this.$route.query.threeId
-        // 删除仅作展示的缓存数据
-        for (const index in this.form.list) {
-          delete this.form.list[index].contentId
-          if ('description' in this.form.list[index]) {
-            this.form.list[index].module.description = this.form.list[index].description
-            delete this.form.list[index].description
+        if (isValid) {
+          // 区分2级新增 还是 3级编辑
+          this.$route.query.secondId ? this.form.secondId = this.$route.query.secondId : this.form.threeId = this.$route.query.threeId
+          // 删除仅作展示的缓存数据
+          for (const index in this.form.list) {
+            delete this.form.list[index].contentId
+            if ('description' in this.form.list[index]) {
+              this.form.list[index].module.description = this.form.list[index].description
+              delete this.form.list[index].description
+            }
           }
+          submitThree(this.form).then(res => {
+            if (res.code === 0) {
+              this.$message.success('提交成功!')
+              this.cancel()
+            }
+          })
         }
-        submitThree(this.form).then(res => {
-          if (res.code === 0) {
-            this.$message.success('提交成功!')
-            this.cancel()
-          }
-        })
+      }else{
+        this.$message.error('请添加新增内容')
       }
     },
 

+ 1 - 1
src/views/operation/recommend/index.vue

@@ -254,7 +254,7 @@ export default {
     // 详情页
     getDetail(row, boolean) {
       this.$router.push({
-        path: `/operation/recommend/detail`,
+        path: `/operation/homePage/recommend/detail`,
         query: row.lv === 2 ? {
           secondId: row.id,
           moduleTypeId: row.moduleTypeId