From 8d68b6a1dcdf5008fba6bdac5858d1085a0e63e7 Mon Sep 17 00:00:00 2001
From: liuwh <hugeinfo123>
Date: Mon, 30 Mar 2020 23:14:04 +0800
Subject: [PATCH] 提交

---
 SunshineLnsMinApp/pages/zhgk/zhgk.js |   87 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 82 insertions(+), 5 deletions(-)

diff --git a/SunshineLnsMinApp/pages/zhgk/zhgk.js b/SunshineLnsMinApp/pages/zhgk/zhgk.js
index cf9dc44..886c494 100644
--- a/SunshineLnsMinApp/pages/zhgk/zhgk.js
+++ b/SunshineLnsMinApp/pages/zhgk/zhgk.js
@@ -1,31 +1,89 @@
 // pages/zhgk/zhgk.js
 var app = getApp()
+var WxParse = require('../wxParse/wxParse.js');
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
+    user: app.globalData.imgUrl + '/image/user.svg',
+    yes: app.globalData.imgUrl + '/image/yes.svg',
+    add: app.globalData.imgUrl + '/image/add.svg',
+    del: app.globalData.imgUrl + '/image/del.svg',
     wjgk: './../../images/wjgk.jpg',
-    data:{},
+    data: {},
+    attList: {},
+    excelSrc: app.globalData.imgUrl + '/image/fileIcon/excel.svg',
+    fileSrc: app.globalData.imgUrl + '/image/fileIcon/file.svg',
+    mp3Src: app.globalData.imgUrl + '/image/fileIcon/mp3.svg',
+    mp4Src: app.globalData.imgUrl + '/image/fileIcon/mp4.svg',
+    pdfSrc: app.globalData.imgUrl + '/image/fileIcon/pdf.svg',
+    pictureSrc: app.globalData.imgUrl + '/image/fileIcon/picture.svg',
+    pptSrc: app.globalData.imgUrl + '/image/fileIcon/ppt.svg',
+    wordSrc: app.globalData.imgUrl + '/image/fileIcon/word.svg',
+    zipSrc: app.globalData.imgUrl + '/image/fileIcon/zip.svg',
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function (options) {
+  onLoad: function(options) {
     var that = this;
     wx.request({
       url: app.globalData.url + '/api/article/findByName',
       data: {
-        typeName:'未检概况',
+        typeName: '未检概况',
       },
-      success: function (res) {
+      success: function(res) {
         wx.hideLoading();
         console.log(res)
         if (res.data.code == 0) {
+          // var article = res.data.data;
+          // WxParse.wxParse('article', 'html', article, that, 5);
+          var attList = res.data.data.maps;
+          var attList21 = app.where(attList, { type: 21 }) || [];
+          attList21.forEach(e => {
+            e.iconSrc = that.data.mp4Src
+          })
+          var attList22 = app.where(attList, { type: 22 }) || [];
+          attList22.forEach(e => {
+            e.iconSrc = that.data.pictureSrc
+          })
+          var attList23 = app.where(attList, { type: 23 }) || [];
+          attList23.forEach(e => {
+            e.iconSrc = that.data.wordSrc
+          })
+          var attList24 = app.where(attList, { type: 24 }) || [];
+          attList24.forEach(e => {
+            e.iconSrc = that.data.excelSrc
+          })
+          var attList25 = app.where(attList, { type: 25 }) || [];
+          attList25.forEach(e => {
+            e.iconSrc = that.data.pptSrc
+          })
+          var attList26 = app.where(attList, { type: 26 }) || [];
+          attList26.forEach(e => {
+            e.iconSrc = that.data.pdfSrc
+          })
+          var attList27 = app.where(attList, { type: 27 }) || [];
+          attList27.forEach(e => {
+            e.iconSrc = that.data.zipSrc
+          })
+          var attList28 = app.where(attList, { type: 28 }) || [];
+          attList28.forEach(e => {
+            e.iconSrc = that.data.fileSrc
+          })
+          var attList99 = app.where(attList, { type: 99 }) || [];
+          attList99.forEach(e => {
+            e.iconSrc = that.data.fileSrc
+          })
+          var attList = { attList21, attList22, attList23, attList24, attList25, attList26, attList27, attList28, attList99 };
+          
+          console.log(attList)
           that.setData({
-            data: res.data.data
+            data: res.data.data,
+            attList,
           })
         } else {
           wx.showModal({
@@ -37,5 +95,24 @@
     })
   },
 
+  // 预览附件
+  open: function (e) {
+    var path = e.currentTarget.dataset.path;
+    console.log(path)
+    wx.downloadFile({
+      url: path,
+      success: function (res) {
+        const filePath = res.tempFilePath
+        wx.openDocument({
+          filePath: filePath,
+          success: function (res) {
+            console.log('打开文档成功')
+          }
+        })
+      }
+    })
+
+  }
+
 
 })
\ No newline at end of file

--
Gitblit v1.8.0