| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- // 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 {
- wx.navigateTo({
- url
- })
- }
- },
- })
|