|
@@ -17,10 +17,6 @@ Page({
|
|
*/
|
|
*/
|
|
onLoad: function (options) {
|
|
onLoad: function (options) {
|
|
// this.userLogin()
|
|
// this.userLogin()
|
|
- wx.hideLoading()
|
|
|
|
- this.setData({
|
|
|
|
- userid: getApp().userinfo.userid
|
|
|
|
- })
|
|
|
|
this.getInfo()
|
|
this.getInfo()
|
|
},
|
|
},
|
|
|
|
|
|
@@ -75,6 +71,7 @@ Page({
|
|
showTopTips: function () {
|
|
showTopTips: function () {
|
|
var that = this;
|
|
var that = this;
|
|
if (!that.data.isAgree) {
|
|
if (!that.data.isAgree) {
|
|
|
|
+ wx.hideLoading()
|
|
this.setData({
|
|
this.setData({
|
|
showTopTips: true
|
|
showTopTips: true
|
|
});
|
|
});
|
|
@@ -109,9 +106,6 @@ Page({
|
|
});
|
|
});
|
|
},
|
|
},
|
|
getInfo:function(){
|
|
getInfo:function(){
|
|
- wx.showLoading({
|
|
|
|
- title: '加载中',
|
|
|
|
- })
|
|
|
|
var that = this
|
|
var that = this
|
|
var WxParse = require('../wxParse/wxParse.js');
|
|
var WxParse = require('../wxParse/wxParse.js');
|
|
wx.request({
|
|
wx.request({
|
|
@@ -131,5 +125,52 @@ Page({
|
|
//callback(tet)
|
|
//callback(tet)
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ userLogin: function () {
|
|
|
|
+ wx.showLoading({
|
|
|
|
+ title: '登录中',
|
|
|
|
+ })
|
|
|
|
+ var that = this
|
|
|
|
+ try {
|
|
|
|
+ wx.login({
|
|
|
|
+ success: function (res) {
|
|
|
|
+ let code = res.code
|
|
|
|
+ console.log(code)
|
|
|
|
+ var c = getApp()
|
|
|
|
+ c.userinfo.usercode = res.code
|
|
|
|
+ wx.getUserInfo({
|
|
|
|
+ success: function (res) {
|
|
|
|
+ //let encrypted_data = res.encryptedData
|
|
|
|
+ let tx = res.userInfo.avatarUrl
|
|
|
|
+ let nn = res.userInfo.nickName
|
|
|
|
+ wx.request({
|
|
|
|
+ url: 'https://t10.9026.com/api/home/login',
|
|
|
|
+ method: 'POST',
|
|
|
|
+ data: {
|
|
|
|
+ code: code,
|
|
|
|
+ avatar: tx,
|
|
|
|
+ nickName: nn,
|
|
|
|
+ },
|
|
|
|
+ success: function (res) {
|
|
|
|
+ that.setData({
|
|
|
|
+ userid: res.data.data.userinfo.id
|
|
|
|
+ })
|
|
|
|
+ var app = getApp()
|
|
|
|
+ app.userinfo.userid = that.data.userid
|
|
|
|
+ console.log(getApp().userinfo.userid)
|
|
|
|
+ if (res.data.data.userinfo.has_agreed == 1) {
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: 'info/info'
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ that.showTopTips()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } catch (e) { }
|
|
|
|
+ },
|
|
})
|
|
})
|