|
|
@@ -3,6 +3,10 @@ Component({
|
|
|
language: {
|
|
|
type: Object,
|
|
|
value: {}
|
|
|
+ },
|
|
|
+ isphonenumber: {
|
|
|
+ type: Boolean,
|
|
|
+ value: false
|
|
|
}
|
|
|
},
|
|
|
options: {
|
|
|
@@ -19,8 +23,8 @@ Component({
|
|
|
attached: function () {
|
|
|
/* 恢复缓存中保存的账号密码 */
|
|
|
this.setData({
|
|
|
- ...wx.getStorageSync('loginMsg')
|
|
|
- });
|
|
|
+ ...wx.getStorageSync('loginMsg')
|
|
|
+ });
|
|
|
setTimeout(() => {
|
|
|
this.allowOrNot();
|
|
|
}, 100)
|
|
|
@@ -56,36 +60,37 @@ Component({
|
|
|
},
|
|
|
/* 处理登录 */
|
|
|
handleLogin() {
|
|
|
- getApp().globalData.http.login({
|
|
|
- "accountno": this.data.accountno,
|
|
|
- "password": require("../../../utils/md5").hexMD5(this.data.password),
|
|
|
- "systemclient": "bgj-wechat"
|
|
|
- }).then(res => {
|
|
|
- getCurrentPages()[0].setData({
|
|
|
- loading: false
|
|
|
- })
|
|
|
- if (res.code != '1') return wx.showToast({
|
|
|
- title: res.msg,
|
|
|
- icon: "none"
|
|
|
- })
|
|
|
- let loginMsg = {
|
|
|
- accountno: this.data.accountno,
|
|
|
- baseUrl: getApp().globalData.http.baseUrl,
|
|
|
- password: (this.data.memory) ? this.data.password : ''
|
|
|
- }
|
|
|
- let list = wx.getStorageSync('logins') || [],
|
|
|
- index = list.findIndex(v => v.accountno == loginMsg.accountno && v.baseUrl == loginMsg.baseUrl);
|
|
|
+ getApp().globalData.http.login({
|
|
|
+ "accountno": this.data.accountno,
|
|
|
+ "password": require("../../../utils/md5").hexMD5(this.data.password),
|
|
|
+ "isphonenumber":this.properties.isphonenumber,
|
|
|
+ "systemclient": "bgj-wechat"
|
|
|
+ }).then(res => {
|
|
|
+ getCurrentPages()[0].setData({
|
|
|
+ loading: false
|
|
|
+ })
|
|
|
+ if (res.code != '1') return wx.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ let loginMsg = {
|
|
|
+ accountno: this.data.accountno,
|
|
|
+ baseUrl: getApp().globalData.http.baseUrl,
|
|
|
+ password: (this.data.memory) ? this.data.password : ''
|
|
|
+ }
|
|
|
+ let list = wx.getStorageSync('logins') || [],
|
|
|
+ index = list.findIndex(v => v.accountno == loginMsg.accountno && v.baseUrl == loginMsg.baseUrl);
|
|
|
|
|
|
- if (index != -1) {
|
|
|
- list[index] = loginMsg
|
|
|
- } else {
|
|
|
- list.push(loginMsg)
|
|
|
- }
|
|
|
- wx.setStorageSync('logins', list)
|
|
|
- wx.setStorageSync('loginMsg', loginMsg)
|
|
|
- require("./login").loginMsg(res);
|
|
|
- getApp().globalData.remindchangepassword = res.remindchangepassword == 1;
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
+ if (index != -1) {
|
|
|
+ list[index] = loginMsg
|
|
|
+ } else {
|
|
|
+ list.push(loginMsg)
|
|
|
+ }
|
|
|
+ wx.setStorageSync('logins', list)
|
|
|
+ wx.setStorageSync('loginMsg', loginMsg)
|
|
|
+ require("./login").loginMsg(res);
|
|
|
+ getApp().globalData.remindchangepassword = res.remindchangepassword == 1;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|