guhongwei 3 years ago
parent
commit
f2cf4fe814
1 changed files with 15 additions and 3 deletions
  1. 15 3
      src/views/patent/mech/message/parts/list-2.vue

+ 15 - 3
src/views/patent/mech/message/parts/list-2.vue

@@ -3,15 +3,18 @@
     <van-col span="24" class="main">
       <van-col span="24" class="list" v-for="(item, index) in list" :key="index">
         <van-col span="24" class="other">
-          <van-col span="24" class="otherInfo">
-            <span>{{ item.content || '暂无' }}</span>
-          </van-col>
           <van-col span="24" class="otherInfo">
             发送人:<span>{{ item.send_name || '暂无' }}</span>
           </van-col>
           <van-col span="24" class="otherInfo">
             发送时间:<span>{{ getDate(item.meta) }}</span>
           </van-col>
+          <van-col span="24" class="otherInfo">
+            <span>{{ item.content || '暂无' }}</span>
+          </van-col>
+        </van-col>
+        <van-col span="24" class="btn">
+          <van-button type="info" size="small" @click="download(item.notice_file)">文件下载</van-button>
         </van-col>
       </van-col>
     </van-col>
@@ -39,6 +42,15 @@ export default {
       let newDate = moment(val.createdAt).format('YYYY-MM-DD HH:mm:ss');
       if (newDate) return newDate;
     },
+    // 文件下载
+    download(data) {
+      if (data.length > 0) {
+        let url = data.map((i) => i.url);
+        window.location.href = `${process.env.VUE_APP_HOST}${url[0]}`;
+      } else {
+        this.$toast({ type: `fail`, message: `非正常文件,无法下载` });
+      }
+    },
   },
   computed: {
     ...mapState(['user']),