// pages/index/index.js import { getApi, postApi } from "../../apis/api" import cloudApi from "../../apis/cloudApi" const app = getApp() Page({ data: { indexInfo: {}, }, async getIndexInfo() { let res = await postApi('/index', { loginAccountId: wx.getStorageSync('loginAccountId'), }) if (res.data.status == 0) { this.setData({ indexInfo: res.data.result }) } else if (res.data.status == 1) { wx.showToast({ title: '暂无数据', icon: "error" }) } else if (res.data.status == 2) { wx.showToast({ title: '尚未登录', icon: "error" }) } }, forbidTouchMove() { }, onLoad() {}, onShow() { this.getIndexInfo() }, goTo(e) { if (!wx.getStorageSync('loginAccountId')) { wx.showToast({ title: '请登录!', icon: "error" }) return } let { url, maintab } = e.currentTarget.dataset app.globalData.maintab = maintab if (maintab) { wx.switchTab({ url }) } else { if (url == '/pages/voyageManage/createVoyage/createVoyage') { wx.redirectTo({ url }) } else { wx.navigateTo({ url }) } } }, })