From 2c41dc4162446120feae6a09ecf1d07118850f88 Mon Sep 17 00:00:00 2001 From: yangyin <1850366751@qq.com> Date: 星期四, 29 八月 2024 12:00:12 +0800 Subject: [PATCH] fix: 修改登录的token过期问题 --- login/login/index.js | 80 +--------------------------------------- 1 files changed, 2 insertions(+), 78 deletions(-) diff --git a/login/login/index.js b/login/login/index.js index c32d257..2539aa2 100644 --- a/login/login/index.js +++ b/login/login/index.js @@ -12,15 +12,11 @@ inputViewHeight: 100, inputWidth: 100, inputHeight: 100, - userInfo: {}, - jsCode: null, canIUse: wx.canIUse('button.open-type.getUserInfo'), - LogoUrl: Constant.Assets.Login.LogoUrl, BackgroupImageUrl: Constant.Assets.Login.BackgroupImageUrl, - isShowPwd: false, //鏄惁鏄剧ず瀵嗙爜 m_SoftWareVersion: Constant.SoftWareVersion }, @@ -39,8 +35,9 @@ }, // 璁颁綇瀵嗙爜妗� rememberPwd(e) { + this.data.checked = !this.data.checked this.setData({ - checked: e.detail.value.includes('1') + checked: this.data.checked }) }, // 鑾峰彇杈撳叆鐢佃瘽鍙风爜 @@ -91,7 +88,6 @@ //婕旂ず璐︽埛 loginByDemo: function (jsCode) { let that = this; - var userInfo = this.data.userInfo; userInfo.EmployeeID = Constant.Assets.Login.DemoEmployeeID; //婕旂ず璐︽埛 userInfo.CorpID = Constant.CorpID; @@ -107,37 +103,16 @@ loginByReal: function (jsCode) { let that = this; var userInfo = this.data.userInfo; - var sysInfo = app.globalData.sysInfo; - // console.log('鎵撳嵃userInfo', userInfo) wx.showToast({ title: '鐧诲綍涓�', icon: "loading", duration: 3000 }); - // let data={ - // SoftType:Constant.SoftType, - // SoftTag:Constant.SoftTag, - // LoginName: this.data.phone, - // LoginPwd: this.data.password, - // CorpID: Constant.CorpID, - // WxCode: jsCode, - // UJsCode: jsCode, //鏄惁灏辨槸jsCode鏈夊緟纭 - // UAvatarUrl: userInfo == null ? "" : userInfo.avatarUrl, - // UCity: userInfo == null ? "" : userInfo.city, - // UProvince: userInfo == null ? "" : userInfo.province, - // UNickName: userInfo == null ? "" : userInfo.nickName, - // UGender: userInfo == null ? "" : userInfo.gender + "", - // SBrand: sysInfo.brand, - // SModel: sysInfo.model, - // SPlatform: sysInfo.platform, - // SVersion: sysInfo.version - // } let data = { LoginName: that.data.phone, LoginPwd: that.data.password, Software: Constant.Software } - // console.log(JSON.stringify(data),110) var post_url = Constant.BASE_AUTH_URL + "Auth/User/Login/LoginSoftwareStandardBySystemAccount@V1.0"; wx.request({ url: post_url, @@ -155,12 +130,8 @@ }); }, success: function (res) { - // console.log(res,123) - wx.hideToast(); - var result = res.data; - // console.log(result); if (result.Code != 0) { wx.showModal({ content: "璐﹀彿瀵嗙爜涓嶆纭�", @@ -169,7 +140,6 @@ }); return; } - var return_data = result.Data; if (return_data.Status != 0) { wx.showModal({ @@ -185,7 +155,6 @@ if (Token) { isNeedToken = true } - let Checked = {} if (that.data.checked) { Checked = { @@ -202,18 +171,11 @@ ExpreTime: ExpreTime, isNeedToken: isNeedToken, }) - var return_user = return_data.User; - //console.log(return_user); - userInfo.ID = return_user.ID - // userInfo.WxUserCode = return_user.LastLoginWxUserCode; userInfo.EmployeeID = return_user.EmployeeID; //浣跨敤鍛樺伐ID userInfo.CorpID = return_user.LoginAccount.ID; userInfo.RealName = return_user.Name; - // userInfo.Telphone = return_user.Telphone; - //console.log(userInfo); - that.loginSuccessCb(userInfo); } }); @@ -221,14 +183,9 @@ //鐧诲綍鎴愬姛 loginSuccessCb: function (userInfo) { var that = this; - //console.log(userInfo,184) that.setData({ userInfo: userInfo }); - // - //if (wx.getStorageSync("LoginUserInfo")) { - // app.globalData.userInfo = userInfo; - //} wx.setStorageSync("LoginUserInfo", userInfo); app.globalData.userInfo = userInfo; wx.showToast({ @@ -236,37 +193,14 @@ icon: 'loading', duration: 1000 }) - wx.switchTab({ url: '../../workDesktop/index/index', }) app.onStartAlarm() - - // var pages = getCurrentPages(); - // if (pages.length >= 2) { - // //var currPage = pages[pages.length - 1]; //褰撳墠椤甸潰 - // var prevPage = pages[pages.length - 2]; //杩斿洖涓婁竴涓〉闈� - // //console.log(prevPage.route) - // if (prevPage) { - // var fn = prevPage.refreshUserInfo; - // if (typeof fn == "function") - // fn(); - // wx.navigateBack(); - // } else { - // wx.navigateTo({ - // url: "/workDestop/index/index" - // }); - // } - // } else { - // wx.navigateBack(); - // } }, //鐐瑰嚮鐪熷疄鐢ㄦ埛鐧诲綍鎸夐挳 tapBindUserReal: function (e) { - // console.log(e) - let that = this; - if (this.data.phone.length < 0 || this.data.password.length < 0) { wx.showToast({ title: '鐢ㄦ埛鍚嶆垨瀵嗙爜涓嶈兘涓虹┖澶�!', @@ -275,7 +209,6 @@ }); return; } - if (this.data.phone.length < 2 || this.data.password.length < 5) { wx.showToast({ title: '鐢ㄦ埛鍚嶅瘑鐮侀暱搴︿笉澶�!', @@ -284,7 +217,6 @@ }); return; } - wx.getUserProfile({ desc: '鐢ㄤ簬鐧诲綍楠岃瘉', // 澹版槑鑾峰彇鐢ㄦ埛涓汉淇℃伅鍚庣殑鐢ㄩ�旓紝鍚庣画浼氬睍绀哄湪寮圭獥涓紝璇疯皑鎱庡~鍐� success: (res) => { @@ -306,7 +238,6 @@ that.setData({ userInfo: res.userInfo, }) - that.getWxUserLoginCodeCb().then((loginParas) => { // console.log(loginParas.code) var jsCode = loginParas.code; @@ -354,18 +285,11 @@ } } }) - }, - - - - - // 鍔犺浇 onLoad: function () { var that = this; var screenSize = app.globalData.screenSize; - var screenWidth = screenSize.width; var screenHight = screenSize.height; var screenWidthScale = screenSize.width / 750; -- Gitblit v1.9.3