健康报告生成

This commit is contained in:
limqhz
2021-03-08 22:51:14 +08:00
parent f09c3ecb4e
commit c3b5b50464
13 changed files with 274 additions and 17 deletions

133
pages/healthDocs/index.js Normal file
View File

@@ -0,0 +1,133 @@
// pages/healthDocs/index.js
const app = getApp();
let page = 1;
Page({
/**
* 页面的初始数据
*/
data: {
docs: [],
isShowAuth: false,
isShowNewplot: false,
isGoHome: false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
this.getData();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
this.getData();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
this.getData(++page);
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
return {
title: '智慧云馆'
}
},
getData(e){
wx.showLoading({
title: '加载中...',
mask: true,
})
app.$api.memberHealthDocs({
page: e ? e : 1,
pageSize: 10
}).then(res => {
page = res.page.data.length > 0 ? res.page.page : page--;
let list = [];
if (e) {
list = this.data.docs
}
for (let i = 0; i < res.page.data.length; i++) {
list.push(res.page.data[i]);
}
this.setData({
docs: list,
isShowNewplot: true
})
wx.stopPullDownRefresh();
}, err => {
wx.stopPullDownRefresh();
this.setData({
isShowNewplot: true
})
})
},
// 点击cell
clickCell(e) {
wx.showLoading({
title: '请稍候...',
mask: true,
})
wx.downloadFile({
// 示例 url并非真实存在
url: e.currentTarget.dataset.id,
success: function (res) {
const filePath = res.tempFilePath
wx.openDocument({
filePath: filePath,
success: function (res) {
console.log('打开文档成功')
}
})
}
})
},
// 获取授权
setAuthSuccess(e) {
if (e.detail.authSetting['scope.userLocation']) {
this.getLocation();
this.setData({
isShowAuth: false
})
}
},
})