123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- // pages/report/report.js
- import { myReportList } from '../../api/my'
- import { documentList } from "../../api/document";
- const app = getApp()
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- reportList: [],
- showPage: true
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- app.globalData.selectedInex = 1
- this.getMyReportList()
- },
- // 我的报告
- getMyReportList () {
- var that = this
- wx.showLoading({
- title: '加载中...',
- mask: true
- })
- myReportList({}).then(res => {
- wx.hideLoading()
- var response = res.data || []
- that.setData({
- reportList: response
- })
- }).catch(e => {
- wx.hideLoading()
- wx.showModal({
- content: e,
- confirmColor: '#333',
- showCancel: false
- })
- })
- },
- /**
- * 立即预约
- */
- handleAppoint() {
- this.getDocumentList()
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 点击报告进入详情
- */
- handleDetail(e) {
- var reportId = e.currentTarget.dataset.reportid
- wx.navigateTo({
- url: '/pages/reportDetail/reportDetail?reportid=' + reportId
- })
- },
- // 获取用户档案信息
- getDocumentList () {
- var that = this
- wx.showLoading({
- title: '加载中...',
- mask: true
- })
- documentList({
- currentPage: 1
- }).then(res => {
- wx.hideLoading()
- const response = res.data.vos || []
- if (response.length == 0) {
- wx.showModal({
- content: '预约用户前需要先添加检测人员信息',
- cancelColor: '#666',
- confirmColor: '#333',
- success (res) {
- if (res.confirm) {
- wx.navigateTo({
- url: '/pages/createFile/createFile?from=index'
- })
- }
- }
- })
- } else {
- wx.navigateTo({
- url: '/pages/appointment/appointment',
- })
- }
- }).catch(e => {
- wx.hideLoading()
- wx.showModal({
- content: e,
- confirmColor: '#333',
- showCancel: false
- })
- })
- }
- })
|