|
@@ -8,7 +8,7 @@ Page({
|
|
|
*/
|
|
|
data: {
|
|
|
isAgree: true,
|
|
|
- phoneNumber: "",
|
|
|
+ accountno: "",
|
|
|
password: "",
|
|
|
inputType: "password", //密码输入框类型
|
|
|
memory: true, //记忆
|
|
@@ -35,12 +35,10 @@ Page({
|
|
|
this.setData({
|
|
|
loading: true
|
|
|
})
|
|
|
- /* "accountno": this.data.phoneNumber,
|
|
|
- "password": md5.hexMD5(this.data.password), */
|
|
|
_Http.login({
|
|
|
- "accountno": "test",
|
|
|
- "password": "e10adc3949ba59abbe56e057f20f883e",
|
|
|
- "systemclient": "wechatapp"
|
|
|
+ "accountno": this.data.accountno,
|
|
|
+ "password": md5.hexMD5(this.data.password),
|
|
|
+ "systemclient": "wechatsaletool"
|
|
|
}).then(res => {
|
|
|
console.log("登录", res)
|
|
|
this.setData({
|
|
@@ -52,12 +50,19 @@ Page({
|
|
|
})
|
|
|
wx.setStorageSync('account_list', res.account_list)
|
|
|
wx.setStorageSync('loginMsg', {
|
|
|
- phoneNumber: this.data.phoneNumber,
|
|
|
+ accountno: this.data.accountno,
|
|
|
password: (this.data.memory) ? this.data.password : ''
|
|
|
})
|
|
|
- wx.switchTab({
|
|
|
- url: '/pages/tabbar/home/index'
|
|
|
- })
|
|
|
+ if (res.account_list.length == 1) {
|
|
|
+ wx.setStorageSync('userMsg', res.account_list[0])
|
|
|
+ wx.switchTab({
|
|
|
+ url: '/pages/tabbar/home/index'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.redirectTo({
|
|
|
+ url: './selectSite',
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
/* 改变密码输入框类型 */
|
|
@@ -77,7 +82,7 @@ Page({
|
|
|
/* 手机号 */
|
|
|
inputPhone(e) {
|
|
|
this.setData({
|
|
|
- phoneNumber: e.detail.value.trim()
|
|
|
+ accountno: e.detail.value.trim()
|
|
|
})
|
|
|
this.allowOrNot()
|
|
|
},
|
|
@@ -91,7 +96,7 @@ Page({
|
|
|
/* 验证是否允许登录 */
|
|
|
allowOrNot() {
|
|
|
this.setData({
|
|
|
- disabled: (this.data.phoneNumber.length == 11 && this.data.password.length >= 6) ? false : true
|
|
|
+ disabled: (this.data.accountno.length > 0 && this.data.password.length > 5) ? false : true
|
|
|
})
|
|
|
},
|
|
|
/* 是否记忆密码 */
|