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