Files
decode-mini-app-v5/wx214944c362629fc7/pages/user/she.js
2024-08-22 12:47:21 +08:00

1 line
1.6 KiB
JavaScript

require("../../@babel/runtime/helpers/Arrayincludes");var e=getApp();Page({data:{isLogin:!1,userInfo:{}},onLoad:function(o){if(console.log(o),o.scene){var t=decodeURIComponent(o.scene),n=this.urlParamToJson(t);wx.setStorageSync("she",n),console.log(n),console.log(t)}if(e._get("wxapp/base",{},(function(e){wx.setStorageSync("wxapp",e.data.wxapp),console.log("sss",e),wx.setStorageSync("storedata",e.data.shdata),wx.setStorageSync("values",e.data.values)}),!1,!1),console.log(123),this.setData({isLogin:e.checkIsLogin()}),this.data.isLogin){console.log(222);var a=wx.getStorageSync("phone"),s=wx.getStorageSync("storedata");if(!a&&s.sh)return void wx.navigateTo({url:"../phone/phone"});this.getUserDetail(),console.log("xxxxxxx"),wx.switchTab({url:"../index/index"})}},urlParamToJson:function(e){var o={};return e.trim().split("&").forEach((function(e){return o[e.split("=")[0]]=e.split("=")[1]})),o},onShow:function(){console.log("show");if(this.setData({isLogin:e.checkIsLogin()}),this.data.isLogin){var o=wx.getStorageSync("phone"),t=wx.getStorageSync("storedata");if(!o&&t.sh)return void wx.navigateTo({url:"../phone/phone"});console.log("show获取当前用户信息"),this.getUserDetail(),console.log("show准备跳转主页了"),wx.switchTab({url:"../index/index"})}},getUserDetail:function(){var o=this,t=wx.getStorageSync("values");e._get("user.index/detail",{},(function(e){o.setData(e.data),""!=e.data.userInfo.phone&&t.includes(e.data.userInfo.phone)&&o.setData({isadmin:!0})}))},onLogin:function(){wx.navigateTo({url:"../login/login"})},onCheckLogin:function(){return!!this.data.isLogin||(e.showError("很抱歉,您还没有登录"),!1)}});