diff --git a/app.js b/app.js
index 7562555..5e6cdf5 100644
--- a/app.js
+++ b/app.js
@@ -13,10 +13,10 @@ App({
wx.login({
success: function (res) {
if (res.code) {
+ that.globalData.code = res.code
wx.getUserInfo({
success: function (res) {
that.globalData.userInfo = res.userInfo
- that.globalData.code = res.code
typeof cb == "function" && cb(that.globalData.userInfo)
}
})
diff --git a/pages/mine/mine.js b/pages/mine/mine.js
index b7ddcc3..3bfc9c2 100644
--- a/pages/mine/mine.js
+++ b/pages/mine/mine.js
@@ -5,7 +5,7 @@ const profile = require('../../utils/profile.js')
Page({
data: {
needBindMobile: true,
-
+ mobile: '',
userInfo: null,
zichan_slides: [],
xunZhang: 'https://bayewechat.oss-cn-shanghai.aliyuncs.com/rassets/revision/' +
@@ -23,14 +23,15 @@ Page({
})
},
- bindGetPassCode: function() {
-
+ bindGetPassCode: function(e) {
+ this.setData({mobile: e.detail.value.mobile})
},
bindSubmitMobile: function(e) {
- var mobile = this.detail
+ var mobile = this.data.mobile
+ var data = {mobile_code: this.data.mobile, code: e.detail.value.code}
- profile.getCustomerInfo(this.data.currentMobile, function(currentCustomer){
+ profile.getCustomerInfo(data, function(currentCustomer){
var baye_rank = currentCustomer.baye_rank
that.setData({baye_rank: baye_rank})
diff --git a/pages/mine/mine.wxml b/pages/mine/mine.wxml
index fc9ad7c..d7ce40b 100644
--- a/pages/mine/mine.wxml
+++ b/pages/mine/mine.wxml
@@ -14,17 +14,20 @@
-
- 绑定手机号:
-
-
-
-
- 输入验证码:
-
-
-
-
+
+
diff --git a/utils/profile.js b/utils/profile.js
index 1abe833..43c545c 100644
--- a/utils/profile.js
+++ b/utils/profile.js
@@ -10,15 +10,13 @@ function getZichanSlides (resolve) {
})
}
-function getCustomerInfo (customerMobile, cb) {
+function getCustomerInfo (data, cb) {
+ data['code'] = app.globalData.code
+ data['name'] = app.globalData.userInfo.nickName
wx.request({
url: `${app.globalData.API_URL}/sessions/new`,
header: { 'Content-Type': 'application/json'},
- data: {
- code: app.globalData.code,
- mobile: customerMobile,
- name: app.globalData.userInfo.nickName
- },
+ data: data,
success: function(res) {
app.globalData.currentCustomer = res.data.customer
app.globalData.token = res.data.token