sessions new staging test version

wechat_user_type
Ge Hao 8 years ago
parent 942a4cda8d
commit ed38637a58
  1. 2
      app.js
  2. 39
      pages/mine/mine.js
  3. 3
      utils/profile.js

@ -3,6 +3,7 @@ App({
const jsonApi = require('utils/jsonapi-datastore/dist/jsonapi-datastore.js')
this.store = new(jsonApi.JsonApiDataStore)
this.jsonModel = jsonApi.JsonApiDataStoreModel
this.globalData.code = wx.getStorageSync('code')
},
getUserInfo: function (cb) {
@ -14,6 +15,7 @@ App({
success: function (res) {
if (res.code) {
that.globalData.code = res.code
wx.setStorageSync('code', res.code)
wx.getUserInfo({
success: function (res) {
that.globalData.userInfo = res.userInfo

@ -18,6 +18,12 @@ Page({
onLoad: function() {
var that = this
var token = wx.getStorageSync('userToken')
if (token) {
that.setData({needBindMobile: false})
var data = {token: token}
profile.getCustomerInfo(data, that.infoCallback)
}
app.getUserInfo(function(userInfo){
that.setData({userInfo:userInfo})
})
@ -25,25 +31,28 @@ Page({
bindGetPassCode: function(e) {
this.setData({mobile: e.detail.value.mobile})
profile.getPassCode(this.data.mobile)
},
bindSubmitMobile: function(e) {
var mobile = this.data.mobile
var data = {mobile: this.data.mobile, mobile_code: e.detail.value.code}
profile.getCustomerInfo(data, function(currentCustomer){
var baye_rank = currentCustomer.baye_rank
that.setData({baye_rank: baye_rank})
profile.getZichanSlides(function(result) {
var data = getApp().store.sync(result.data)
that.setData({'zichan_slides': data})
wx.setStorage({
key:"zichan_slides",
data:data
})
var data = {mobile: this.data.mobile, mobile_code: e.detail.value.code, name: app.globalData.userInfo.nickName}
profile.getCustomerInfo(data, this.infoCallback)
},
infoCallback: function(currentCustomer) {
var that = this
var baye_rank = currentCustomer.baye_rank
that.setData({baye_rank: baye_rank})
profile.getZichanSlides(function(result) {
debugger
var data = getApp().store.sync(result.data)
that.setData({'zichan_slides': data})
wx.setStorage({
key:"zichan_slides",
data:data
})
})
},
}
})

@ -12,7 +12,6 @@ function getZichanSlides (resolve) {
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'},
@ -33,7 +32,7 @@ function getCustomerInfo (data, cb) {
function getPassCode (mobile) {
wx.request({
url: `${app.globalData.API_URL}/profile/send_pass_code`,
url: `${app.globalData.API_URL}/profiles/get_mobile_passcode`,
header: { 'Content-Type': 'application/json'},
data: {
mobile: mobile

Loading…
Cancel
Save