// pages/index/index.js import { getApi, postApi } from "../../apis/api" import cloudApi from "../../apis/cloudApi" Page({ data: { indexInfo: {}, }, async getIndexInfo() { let res = await postApi('/voyage/index', { cargoOwnerId: wx.getStorageSync('cargoOwnerId') }) this.setData({ indexInfo: res.data.result }) }, forbidTouchMove() { }, onLoad() { wx.removeStorageSync('voyageDetailId') }, onShow() { if (wx.getStorageSync('voyageDetailId')) return wx.removeStorageSync('voyageDetailId') let cargoOwnerId = wx.getStorageSync('cargoOwnerId') if (cargoOwnerId) { this.getIndexInfo() this.setData({ cargoOwnerId }) } let rolePermission = wx.getStorageSync('rolePermission') if (rolePermission.indexOf('VOYAGELIST') == -1) { wx.showToast({ icon: "none", title: '暂无权限,请联系管理员', }) return } const child = this.selectComponent('.voyages'); child.getVoyageList() } })