123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- import {
- createStoreBindings
- } from 'mobx-miniprogram-bindings'
- import {
- store
- } from "../../store/index";
- Page({
- data: {},
- onLoad() {
- this.storeBindings = createStoreBindings(this, {
- store,
- fields: ["token", "phone"],
- actions: ["setStore"],
- });
- },
- onUnload() {
- this.storeBindings.destroyStoreBindings();
- },
- onShow() {
- if (typeof this.getTabBar === 'function' &&
- this.getTabBar()) {
- this.getTabBar().setData({
- selected: 3
- })
- }
- },
- goto() {
- const token = this.data.token ?? ""
- if (token === '') {
- wx.navigateTo({
- url: "../../userLogin/pages/login/index"
- })
- }
- },
- goOrder() {
- const token = this.data.token ?? ""
- if (token === '') {
- wx.showModal({
- title: '提示',
- content: '是否去登录?',
- success(res) {
- if (res.confirm) {
- wx.navigateTo({
- url: "../../userLogin/pages/login/index"
- })
- }
- }
- })
- } else {
- wx.switchTab({
- url: '/pages/order/index'
- })
- }
- },
- pagelogout() {
- wx.showModal({
- title: '提示',
- content: '是否确认退出登录',
- success: async (res) => {
- if (res.confirm) {
- await this.setStore()
- }
- }
- })
- },
- })
|