ソースを参照

知识库只能上传一张图片

bihuisong 1 年間 前
コミット
866b5b8178
1 ファイル変更24 行追加19 行削除
  1. 24 19
      src/views/highServer/knowledge/index.vue

+ 24 - 19
src/views/highServer/knowledge/index.vue

@@ -82,7 +82,7 @@
       <el-table-column type="selection" width="55" align="center"/>
       <el-table-column label="序号" align="center" type="index"/>
       <el-table-column label="标题" align="center" prop="titleName"/>
-<!--      <el-table-column label="正文" align="center" prop="textDetails"/>-->
+      <!--      <el-table-column label="正文" align="center" prop="textDetails"/>-->
       <el-table-column label="是否热门" align="center" prop="popular">
         <template slot-scope="scope">
           <el-switch
@@ -268,7 +268,7 @@ export default {
     handleUpdate(row) {
       this.reset();
       const id = row.id || this.ids
-      getBase(id,row.type).then(response => {
+      getBase(id, row.type).then(response => {
         this.form = response.data;
         this.open = true;
         this.title = "修改知识库";
@@ -276,29 +276,34 @@ export default {
     },
     /** 提交按钮 */
     submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.id != null) {
-            updateBase(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addBase(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
+      if ((this.form.imgUrlList != null || this.form.imgUrlList != "") && this.form.imgUrlList.split(',').length > 1) {
+        this.$modal.msgWarning("图片只能上传一张");
+      } else {
+        this.$refs["form"].validate(valid => {
+          if (valid) {
+            if (this.form.id != null) {
+              updateBase(this.form).then(response => {
+                this.$modal.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              });
+            } else {
+              addBase(this.form).then(response => {
+                this.$modal.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              });
+            }
           }
-        }
-      });
+        });
+      }
+
     },
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;
       this.$modal.confirm('是否确认删除知识库编号为"' + ids + '"的数据项?').then(function () {
-        return delBase(ids,row.type);
+        return delBase(ids, row.type);
       }).then(() => {
         this.getList();
         this.$modal.msgSuccess("删除成功");