Browse Source

上传素材内容校验

zhaoxiaohai 3 years ago
parent
commit
82170ccb6c
1 changed files with 15 additions and 8 deletions
  1. 15 8
      src/SManagement/archives_upload/index.vue

+ 15 - 8
src/SManagement/archives_upload/index.vue

@@ -134,7 +134,14 @@ export default {
     save() {
       this.$refs.set.$refs.form.validate((val) => {
         if (val) {
-          if (this.uploadType == '3') this.cacheInfo.content.content = this.$refs.editor.editor.getHtml()
+          //判断有无内容
+          if (this.uploadType == '3') {
+            const content = this.$refs.editor.editor.getHtml();
+            if (content == "<p><br></p>") return this.$message.error('您还未编辑图文内容');
+            this.cacheInfo.content.content = content;
+          } else {
+            if (this.uploadCacheData.attinfos.length == 0) return this.$message.error('您还未上传附件');
+          }
           this.cacheInfo.content.type = this.uploadType;
           //判断所属ID是否为初始ID
           if (this.cacheInfo.content.sat_sharematerial_classid == '9999' + JSON.parse(window.sessionStorage.getItem("active_account")).userid) return this.$message.error('请选择素材分类');
@@ -212,13 +219,13 @@ export default {
         }
       }
       let res = await this.$api.requested(param)
-        if (res.msg != '成功') return this.$notify({
-          title: '提示',
-          message: '上传失败',
-          type: 'error'
-        })
-        this.uploadCacheData.attinfos = this.uploadCacheData.attinfos.concat(res.data);
-        this.randerData();
+      if (res.msg != '成功') return this.$notify({
+        title: '提示',
+        message: '上传失败',
+        type: 'error'
+      })
+      this.uploadCacheData.attinfos = this.uploadCacheData.attinfos.concat(res.data);
+      this.randerData();
     },
     //退出后对数据进行销毁
     async removeAllData() {