浏览代码

Merge branch 'http_mock' of git.xiaojukeji.com:jacklijiajia/thoth-frontend into http_mock

qinzhipeng_v 5 年之前
父节点
当前提交
f17ce0d67e

+ 39 - 3
src/views/projectManage/bugList/details/index.vue

@@ -594,7 +594,10 @@
         <div class="file-dialog">
           <el-form ref="form" label-width="80px">
             <el-form-item label="图片名称">
-              <el-input v-model="imageName" />
+              <el-col :span="20">
+                <el-input v-model="imageName" />
+              </el-col>
+              <el-col :span="4">.png</el-col>
             </el-form-item>
           </el-form>
           <img :src="imageUrl" class="image-url">
@@ -1197,6 +1200,15 @@ export default {
         return res
       })
     },
+    generateMixed(len) {
+      const chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
+      let res = ''
+      for (let i = 0; i < len; i++) {
+        const id = Math.ceil(Math.random() * 35)
+        res += chars[id]
+      }
+      return res
+    },
     pasteUpload() {
       if (!this.uploadButton) {
         return false
@@ -1209,11 +1221,31 @@ export default {
           this.imageUrl = reader.result
           if (this.imageUrl.match(reg)) { // 判断是否是图片
             this.showCopyFile = true
+            this.imageName = this.generateMixed(10)
           }
         }
       }
     },
     async confirmUpload() {
+      if (this.imageName === null || this.imageName.replace(/\s+/g, '') === '') {
+        this.$message({
+          showClose: true,
+          message: '请输入图片名称',
+          type: 'error'
+        })
+        return false
+      }
+      const isExist = this.fileList.some(item => {
+        return this.imageName === item.name
+      })
+      if (isExist) {
+        this.$message({
+          showClose: true,
+          message: '图片名称重复',
+          type: 'error'
+        })
+        return false
+      }
       this.showCopyFile = false
       const res = await this.updateFile(window.uploadFiles[0])
       const data = res.data
@@ -1413,7 +1445,7 @@ export default {
 }
 </style>
 
-<style scoped>
+<style scoped lang="scss">
 .module_title{
   display:flex;
   align-items: center;
@@ -1448,9 +1480,13 @@ export default {
   display: flex;
   flex-direction: column;
   align-items: center;
+  .el-form {
+    width: 80%;
+  }
 }
 .image-url {
-  width: 80%;
+  width: 90%;
   max-height: 60vh;
+  border:1px solid #EBEEF5;
 }
 </style>

+ 38 - 2
src/views/projectManage/bugList/file/createdBug.vue

@@ -182,7 +182,10 @@
       <div class="file-dialog">
         <el-form ref="form" label-width="80px">
           <el-form-item label="图片名称">
-            <el-input v-model="imageName" />
+            <el-col :span="20">
+              <el-input v-model="imageName" />
+            </el-col>
+            <el-col :span="4">.png</el-col>
           </el-form-item>
         </el-form>
         <img :src="imageUrl" class="image-url">
@@ -462,6 +465,15 @@ export default {
         return item.name !== file.name
       })
     },
+    generateMixed(len) {
+      const chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
+      let res = ''
+      for (let i = 0; i < len; i++) {
+        const id = Math.ceil(Math.random() * 35)
+        res += chars[id]
+      }
+      return res
+    },
     pasteUpload() {
       if (!this.modalShow) {
         return false
@@ -474,12 +486,32 @@ export default {
           this.imageUrl = reader.result
           if (this.imageUrl.match(reg)) { // 判断是否是图片
             this.showCopyFile = true
+            this.imageName = this.generateMixed(10)
           }
         }
         this.showCopyFile = true
       }
     },
     async confirmUpload() {
+      if (this.imageName === null || this.imageName.replace(/\s+/g, '') === '') {
+        this.$message({
+          showClose: true,
+          message: '请输入图片名称',
+          type: 'error'
+        })
+        return false
+      }
+      const isExist = this.fileList.some(item => {
+        return this.imageName === item.name
+      })
+      if (isExist) {
+        this.$message({
+          showClose: true,
+          message: '图片名称重复',
+          type: 'error'
+        })
+        return false
+      }
       this.showCopyFile = false
       const res = await this.updateFile(window.uploadFiles[0])
       const data = res.data
@@ -526,9 +558,13 @@ export default {
   display: flex;
   flex-direction: column;
   align-items: center;
+  .el-form {
+    width: 80%;
+  }
 }
 .image-url {
-  width: 80%;
+  width: 90%;
   max-height: 60vh;
+  border:1px solid #EBEEF5;
 }
 </style>

+ 0 - 2
src/views/projectManage/taskList/taskViewDetails.vue

@@ -658,8 +658,6 @@ export default {
           this.task_form.stageString === '正常' ? this.bgStyle = '#69B3FF' : ''
           this.task_form.stageString === '延期' ? this.bgStyle = '#FF8952' : ''
           this.task_form.stageString === '已延期' ? this.bgStyle = '#F56C6C' : ''
-        } else {
-          this.$message({ message: res.msg, type: 'error', offset: 150 })
         }
       })
       commentList({ type: 3, joinId: this.taskId[1] }).then(res => {