123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- import { routers, viewImage, sharePage, isFn, getGlobalVal } from '../../../utils/util.js'
- import {ApplyBookHis } from '../../../utils/api.js'
- const { navigateTo, redirectTo, navigateBack } = routers()
- const { globalData } = getApp()
- const { baseImgUrl, thumbnail } = globalData
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- baseImgUrl,
- thumbnail,
- isLoaded: 0,
- title: '',
- pageNo: 1,
- pageSize: 10,
- isAll: false,
- navIndex: 0,
- list: [],
- isAllCheck: 0,
- isManage: 0,
- totalNum: 0,
- isDelete: false,
- nodataArray: {
- text: "暂无数据"
- }
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- options.vipId = getGlobalVal('vipId', `vipId_${getGlobalVal('userId')}`) || ''
- options.libId = getGlobalVal('library').id || ''
- this.setData({ options })
- this.getData(res => {
- this.setData({ isLoaded: 1 })
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- const obj = { navigateTo, redirectTo, navigateBack, viewImage }
- for (const i in obj) {
- this[i] = obj[i]
- }
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- if (isFn(sharePage)) return sharePage()
- },
- getData: function (cb) {
- const continuousFn = { fn: this.getData, param: { ...arguments } }
- const { libId, vipId } = this.data.options
- ApplyBookHis({ data: { libId, vipId }, continuousFn }).then(res => {
- const { list}=res.data
- this.setData({ list })
- cb && cb(res)
- }).catch(res => {
- cb && cb(res)
- })
- },
- })
|