guhongwei 3 years ago
parent
commit
44c9ce4e28

+ 44 - 6
src/views/patent/admin/examine/hairmess/list-1.vue

@@ -15,11 +15,21 @@
             </van-col>
           </van-col>
           <van-col span="24" class="btn">
-            <van-button size="small" type="info" @click="download(item)">下载文件</van-button>
+            <van-button size="small" type="info" @click="toView(item.file_url)">查看文件</van-button>
           </van-col>
         </van-col>
       </van-col>
     </van-row>
+    <van-dialog class="dialog" v-model="show" title="文件下载" :show-confirm-button="false" :show-cancel-button="true">
+      <van-col span="24" class="list" v-for="(item, index) in fileList" :key="index">
+        <van-col span="24" class="name"
+          >文件路径:<span>{{ item }}</span></van-col
+        >
+        <van-col span="24" class="btn">
+          <van-button type="info" size="small" @click="download(item)">下载文件</van-button>
+        </van-col>
+      </van-col>
+    </van-dialog>
   </div>
 </template>
 
@@ -32,15 +42,22 @@ export default {
   },
   components: {},
   data: function () {
-    return {};
+    return {
+      // 文件下载
+      show: false,
+      fileList: [],
+    };
   },
   created() {},
   methods: {
-    // 查看详情
+    // 查看文件
+    toView(data) {
+      this.$set(this, `fileList`, data);
+      this.show = true;
+    },
     download(data) {
-      if (data.file_url.length > 0) {
-        let url = data.file_url.map((i) => i.url);
-        window.location.href = `${process.env.VUE_APP_HOST}/${url[0]}`;
+      if (data) {
+        window.location.href = `${process.env.VUE_APP_HOST}/${data}`;
       } else {
         this.$toast({ type: `fail`, message: `未上传文件` });
       }
@@ -94,4 +111,25 @@ export default {
     }
   }
 }
+.dialog {
+  padding: 0 8px;
+  /deep/.van-dialog__content {
+    height: 350px;
+    overflow-y: auto;
+  }
+  .list {
+    .name {
+      font-size: 14px;
+      word-break: break-all;
+      color: #666;
+      margin: 0 0 5px 0;
+      span {
+        color: #000;
+      }
+    }
+    .btn {
+      text-align: center;
+    }
+  }
+}
 </style>

+ 1 - 5
src/views/patent/admin/message/service.vue

@@ -22,11 +22,7 @@ export default {
   },
   data: function () {
     return {
-      list: [
-        {
-          name: '发送人',
-        },
-      ],
+      list: [],
       limit: 5,
       total: 0,
     };

+ 5 - 1
src/views/patent/user/apply/apply/parts/list-2.vue

@@ -60,7 +60,11 @@ export default {
       this.show = true;
     },
     download(data) {
-      console.log(data);
+      if (data) {
+        window.location.href = `${process.env.VUE_APP_HOST}/${data}`;
+      } else {
+        this.$toast({ type: `fail`, message: `未上传文件` });
+      }
     },
     getDate(val) {
       let newDate = moment(val.createdAt).format('YYYY-MM-DD hh:mm:ss');