|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
const app = getApp();
|
|
|
|
|
import Toast from '@vant/weapp/toast/toast';
|
|
|
|
|
let iPageIndex = 1;
|
|
|
|
|
let iPageSize = 20;
|
|
|
|
|
// pages/mine/pages/myReport/index.js
|
|
|
|
@ -34,7 +35,7 @@ Page({
|
|
|
|
|
},
|
|
|
|
|
onShow() {
|
|
|
|
|
iPageIndex = 1;
|
|
|
|
|
if(!wx.getStorageSync('token')) {
|
|
|
|
|
if (!wx.getStorageSync('token')) {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: '/pages/mine/pages/bindUser/index?isHome=3',
|
|
|
|
|
})
|
|
|
|
@ -79,11 +80,16 @@ Page({
|
|
|
|
|
loadMore: false //把"上拉加载"的变量设为false,隐藏
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
openFile(e) {
|
|
|
|
|
const row = e.currentTarget.dataset.row
|
|
|
|
|
wx.showToast({
|
|
|
|
|
title: '加载中...',
|
|
|
|
|
icon: 'loading',
|
|
|
|
|
duration: 300000
|
|
|
|
|
})
|
|
|
|
|
if (row.Status !== 2) {
|
|
|
|
|
wx.showModal({
|
|
|
|
|
title: '提示',
|
|
|
|
@ -91,33 +97,43 @@ Page({
|
|
|
|
|
})
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
let file = decodeURIComponent(row.FilePath);
|
|
|
|
|
file = this.getFilePathName(file);
|
|
|
|
|
wx.downloadFile({
|
|
|
|
|
url: row.FilePath,
|
|
|
|
|
filePath: wx.env.USER_DATA_PATH + '/' + file,
|
|
|
|
|
success: function (res) {
|
|
|
|
|
// console.log(res)
|
|
|
|
|
let filePath = res.tempFilePath //返回的文件临时地址,用于后面打开本地预览所用
|
|
|
|
|
let filename = row.FilePath;
|
|
|
|
|
let index1 = filename.lastIndexOf(".");
|
|
|
|
|
let index2 = filename.length;
|
|
|
|
|
let postf = filename.substring(index1, index2); //后缀名
|
|
|
|
|
let postf1 = postf.replace(/\./g, '')
|
|
|
|
|
// console.log(postf1)
|
|
|
|
|
let filePath = res.filePath //返回的文件临时地址,用于后面打开本地预览所用
|
|
|
|
|
if (filePath != null) {
|
|
|
|
|
wx.openDocument({
|
|
|
|
|
filePath: filePath,
|
|
|
|
|
fileType: postf1,
|
|
|
|
|
showMenu: true,
|
|
|
|
|
success: function (res) {
|
|
|
|
|
wx.hideToast();
|
|
|
|
|
console.log(res)
|
|
|
|
|
},
|
|
|
|
|
fail: function (res) {
|
|
|
|
|
wx.hideToast();
|
|
|
|
|
console.log(res)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
fail: function (res) {
|
|
|
|
|
wx.hideToast();
|
|
|
|
|
console.log(res)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 文件路径过滤【文件名+.后缀名】
|
|
|
|
|
// 例如:哈哈.pdf
|
|
|
|
|
getFilePathName(path) {
|
|
|
|
|
let pos1 = path.lastIndexOf('/');
|
|
|
|
|
let pos2 = path.lastIndexOf('\\');
|
|
|
|
|
let position = Math.max(pos1, pos2);
|
|
|
|
|
if (position < 0)
|
|
|
|
|
return path;
|
|
|
|
|
else
|
|
|
|
|
return path.substring(position + 1);
|
|
|
|
|
}
|
|
|
|
|
})
|