|
@@ -1,13 +1,26 @@
|
|
import http from '../../base/httputil'
|
|
import http from '../../base/httputil'
|
|
const app = getApp()
|
|
const app = getApp()
|
|
|
|
+
|
|
Page({
|
|
Page({
|
|
|
|
|
|
/**
|
|
/**
|
|
* 页面的初始数据
|
|
* 页面的初始数据
|
|
*/
|
|
*/
|
|
data: {
|
|
data: {
|
|
- isShowAccoutDialog : false
|
|
|
|
|
|
+ isShowAccoutDialog : false,
|
|
|
|
+ isBindSuccess : false,
|
|
|
|
+ userInfo:null,
|
|
|
|
+ userName :null,
|
|
|
|
+ password: null,
|
|
|
|
+ openid: null
|
|
|
|
+ },
|
|
|
|
+ inputUserName(e){
|
|
|
|
+ this.userName = e.detail.value
|
|
|
|
+ },
|
|
|
|
+ inputPassword(e){
|
|
|
|
+ this.password = e.detail.value
|
|
},
|
|
},
|
|
|
|
+
|
|
init_userInfo() {
|
|
init_userInfo() {
|
|
let that = this
|
|
let that = this
|
|
if (app.globalToken == null) {
|
|
if (app.globalToken == null) {
|
|
@@ -16,6 +29,9 @@ Page({
|
|
desc: 'desc',
|
|
desc: 'desc',
|
|
success: (res) => {
|
|
success: (res) => {
|
|
this.getSysUserInfo(res.userInfo)
|
|
this.getSysUserInfo(res.userInfo)
|
|
|
|
+ that.setData({
|
|
|
|
+ userInfo : res.userInfo
|
|
|
|
+ })
|
|
},
|
|
},
|
|
fail: res => {
|
|
fail: res => {
|
|
console.log(res)
|
|
console.log(res)
|
|
@@ -33,6 +49,7 @@ Page({
|
|
wxNickName: info.nickName,
|
|
wxNickName: info.nickName,
|
|
wxAvatarUrl: info.avatarUrl
|
|
wxAvatarUrl: info.avatarUrl
|
|
}
|
|
}
|
|
|
|
+
|
|
http.send_post("/auth/applogin", data, that.loginSuccess)
|
|
http.send_post("/auth/applogin", data, that.loginSuccess)
|
|
},
|
|
},
|
|
fail(res) {
|
|
fail(res) {
|
|
@@ -41,24 +58,55 @@ Page({
|
|
})
|
|
})
|
|
},
|
|
},
|
|
loginSuccess(res) {
|
|
loginSuccess(res) {
|
|
- console.log("rrrr",res)
|
|
|
|
|
|
+
|
|
|
|
+ let that = this
|
|
if (res.data.code != 200) {
|
|
if (res.data.code != 200) {
|
|
|
|
+ that.openid = res.data.data
|
|
wx.showToast({
|
|
wx.showToast({
|
|
title: res.data.msg,
|
|
title: res.data.msg,
|
|
icon: "none"
|
|
icon: "none"
|
|
})
|
|
})
|
|
- this.setData({
|
|
|
|
|
|
+ http.hideLoading()
|
|
|
|
+ that.setData({
|
|
isShowAccoutDialog : true
|
|
isShowAccoutDialog : true
|
|
})
|
|
})
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
app.globalToken = res.data.data.access_token
|
|
app.globalToken = res.data.data.access_token
|
|
console.log("我的令牌:",app.globalToken )
|
|
console.log("我的令牌:",app.globalToken )
|
|
//登录成功,获取首页数据
|
|
//登录成功,获取首页数据
|
|
http.hideLoading()
|
|
http.hideLoading()
|
|
-
|
|
|
|
|
|
+ this.setData({
|
|
|
|
+ isBindSuccess : true
|
|
|
|
+ })
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ modalCancel(){
|
|
|
|
+ this.setData({
|
|
|
|
+ isShowAccoutDialog : false
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ modalSubmit(){
|
|
|
|
+ let obj = new Object()
|
|
|
|
+ obj.openid = this.openid
|
|
|
|
+ obj.userName = this.userName
|
|
|
|
+ obj.password = this.password
|
|
|
|
+ http.send_post("/system/minapp/AppLoginController/bindWxUser",obj,this.modalSubmitSuccess)
|
|
|
|
+ },
|
|
|
|
+ modalSubmitSuccess(res){
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: res.data.msg,
|
|
|
|
+ icon: "none"
|
|
|
|
+ })
|
|
|
|
+ if (res.data.code == 200) {
|
|
|
|
+ this.setData({
|
|
|
|
+ isShowAccoutDialog : false,
|
|
|
|
+ isBindSuccess : true
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ },
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
*/
|