From 37b626a2e9073132a504e595b0416c7e704a8cd8 Mon Sep 17 00:00:00 2001 From: tanghaolin <1723298894@qq.com> Date: 星期六, 08 十月 2022 10:59:59 +0800 Subject: [PATCH] 修改报错提示和登陆后保存密码和账号的功能 --- login/login/index.js | 25 ++++++++++++++++++++----- test/reportTable/index.js | 2 +- utils/api.js | 1 + reportForm/index/index.js | 4 ++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/login/login/index.js b/login/login/index.js index f89da8e..bde23dc 100644 --- a/login/login/index.js +++ b/login/login/index.js @@ -22,7 +22,16 @@ isShowPwd:false,//鏄惁鏄剧ず瀵嗙爜 }, - + //鑾峰彇缂撳瓨涓殑鐢ㄦ埛淇℃伅 + getStorageUserInfo(){ + if(!wx.getStorageSync('AccountInfo'))return + let userInfo = JSON.parse(wx.getStorageSync('AccountInfo')) || {} + if(!userInfo)return + this.setData({ + phone:userInfo.access_info.account, + password:userInfo.access_info.password + }) + }, // 鎵撶數璇� call: function () { wx.makePhoneCall({ @@ -171,15 +180,22 @@ if(Token){ isNeedToken = true } - let ExpreTime = new Date().getTime() //鑾峰彇褰撳墠鏃堕棿鎴� + let access_info = { + account:that.data.phone, + password:that.data.password + } + // 璐︽埛淇℃伅 + let userAccountInfo = { + access_info:access_info + } wx.setStorageSync('AccessToken', { Token:Token, ExpreTime:ExpreTime, isNeedToken:isNeedToken }) - + wx.setStorageSync( "AccountInfo",JSON.stringify(userAccountInfo)) var return_user = return_data.User; //console.log(return_user); @@ -198,7 +214,6 @@ //鐧诲綍鎴愬姛 loginSuccessCb: function (userInfo) { var that = this; - console.log(userInfo,184) that.setData({ userInfo: userInfo }); @@ -356,7 +371,7 @@ inputWidth: screenWidth, inputHeight: screenHightScale * 177 }); - + this.getStorageUserInfo() }, onShareAppMessage: function () { diff --git a/reportForm/index/index.js b/reportForm/index/index.js index b91a9fa..2504496 100644 --- a/reportForm/index/index.js +++ b/reportForm/index/index.js @@ -90,7 +90,7 @@ var result = res.data.Data if (res.data.Code != 0) { wx.showToast({ - title: '鏁版嵁鍔犺浇澶辫触', + title: '褰撳墠鏈堜唤鏆傛棤鎶ヨ〃鏁版嵁', icon: 'none', duration: 2000 }) @@ -159,7 +159,7 @@ icon: 'none', duration: 2000 }) - // console.log(err) + console.log(err) } }) }, diff --git a/test/reportTable/index.js b/test/reportTable/index.js index ca104f2..3781c5b 100644 --- a/test/reportTable/index.js +++ b/test/reportTable/index.js @@ -172,7 +172,7 @@ //return if (res.data.Code != 0) { wx.showToast({ - title: '鏁版嵁鍔犺浇澶辫触', + title: '褰撳墠鏈堜唤鏆傛棤鎶ヨ〃鏁版嵁', icon: 'none', duration: 2000 }) diff --git a/utils/api.js b/utils/api.js index dfe6efb..bbba7b1 100644 --- a/utils/api.js +++ b/utils/api.js @@ -1,4 +1,5 @@ const Request = function(params){ + console.log(params,2) let tokenInfo = wx.getStorageSync('AccessToken') // console.log(tokenInfo,3) let currentDateTime = new Date().getTime() -- Gitblit v1.9.3