// lawPublicityDetail.js
|
const app = getApp();
|
var WxParse = require('../wxParse/wxParse.js');
|
Page({
|
|
/**
|
* 页面的初始数据
|
*/
|
data: {
|
content: '',
|
data: {},
|
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) {
|
console.log(options.id)
|
var that = this;
|
wx.request({
|
url: app.globalData.url + '/api/article/publicMsgDetails?msgId=' + options.id,
|
success: function (res) {
|
wx.hideLoading();
|
console.log(res)
|
if (res.data.code == 0) {
|
that.setData({
|
data: {
|
...res.data.data,
|
createTime: app.formatDate(res.data.data.createTime),
|
}
|
})
|
} else {
|
wx.showModal({
|
title: '提示',
|
content: "请求失败!"
|
})
|
}
|
}
|
})
|
},
|
|
// 预览附件
|
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('打开文档成功')
|
}
|
})
|
}
|
})
|
|
}
|
|
})
|
7
|