Răsfoiți Sursa

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

panxiandiao_i 5 ani în urmă
părinte
comite
44927d821f
1 a modificat fișierele cu 23 adăugiri și 5 ștergeri
  1. 23 5
      src/views/Platform/bugManage/bugCreate.vue

+ 23 - 5
src/views/Platform/bugManage/bugCreate.vue

@@ -126,18 +126,21 @@
         <el-input v-model="form.remark" type="textarea" autocomplete="off" rows="5" style="margin: 20px 0;" />
         <div>
           <el-upload
+            ref="upload"
             class="upload-demo"
             multiple
-            capture
             accept="image/jpeg, image/png, image/gif, audio/mp4, video/mp4, audio/mpeg, application/vnd.ms-excel"
-            :on-change="handleChange"
             :file-list="fileList"
             action="http://star.xiaojukeji.com/upload/img.node"
+            :on-success="handleChange"
+            :auto-upload="false"
           >
             <!-- action="http://page-daily.kuaidadi.com/upload/img.node" 线下 -->
             <!-- action="http://star.xiaojukeji.com/upload/img.node" 线上 -->
             <!-- action="https://jsonplaceholder.typicode.com/posts/" 原始地址-->
-            <el-button size="small">点击上传</el-button>
+            <!-- <el-button size="small">点击上传</el-button> -->
+            <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
+            <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
           </el-upload>
         </div>
         <el-form-item class="submit">
@@ -241,9 +244,24 @@ export default {
     this.forkDown()
   },
   methods: {
-    handleChange(file, fileList) {
+    submitUpload() {
+      this.$refs.upload.submit()
+    },
+    test() {
+      console.log('测试')
+    },
+    handleChange(response, file, fileList) {
+      // setTimeout(function() {
+      console.log(response)
+      console.log(fileList)
+      console.log(fileList[0].response.url)
+      this.fileDbList = []
       this.fileList = fileList.slice(-3)
-      console.log(this.fileList)
+      for (var a of this.fileList) {
+        this.fileDbList.push({ 'name': a.name, 'url': 'http:' + a.response.url })
+      }
+      console.log(this.fileDbList)
+      // }, 500)
     },
     async bugListSelect() {
       await bugGetEnum().then(res => {