// pages/index/index.js import { getApi, postApi } from "../../apis/api" import cloudApi from "../../apis/cloudApi" const app = getApp() Page({ data: { indexInfo: {}, loginName: '', logoUrl: "" }, 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() this.setData({ loginName: wx.getStorageSync('loginName'), logo: wx.getStorageSync('logo') }) }, goTo(e) { if (!wx.getStorageSync('loginAccountId')) { wx.showToast({ title: '请登录!', icon: "error" }) return } let { url, maintab } = e.currentTarget.dataset if (url == "/pages/voyageManage/voyageManage") { wx.switchTab({ url }) } else { if (url == '/pages/voyageManage/createVoyage/createVoyage') { wx.redirectTo({ url }) } else { wx.navigateTo({ url }) } } }, })