登录和个人页面显示的问题,还需要分离一个登录页面,输入手机号,发验证码进行登录

wechat_user_type
Ge Hao 8 years ago
parent 9bffad1a60
commit a592850d8b
  1. 21
      app.js
  2. 18
      pages/mine/mine.js
  3. 8
      pages/mine/mine.wxml
  4. 31
      utils/profile.js

@ -28,27 +28,6 @@ App({
}
},
getCustomerInfo: function (cb) {
var that = this
wx.request({
url: 'http://localhost:3000/sessions/new',
header: { 'Content-Type': 'application/json'},
data: {
code: 'sadjfskdf',
mobile: '13054277777',
name: 'test'
},
success: function(res) {
that.globalData.currentCustomer = res.data.customer
that.globalData.token = res.data.token
typeof cb == "function" && cb(that.globalData.currentCustomer)
},
fail: function(res) {
}
})
},
globalData:{
userInfo: null,
currentCustomer: null

@ -18,18 +18,18 @@ Page({
var that = this
app.getUserInfo(function(userInfo){
that.setData({userInfo:userInfo})
app.getCustomerInfo(function(currentCustomer){
profile.getCustomerInfo(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
profile.getZichanSlides(function(result) {
var data = getApp().store.sync(result.data)
that.setData({'zichan_slides': data})
wx.setStorage({
key:"zichan_slides",
data:data
})
})
})
})
},

@ -3,9 +3,11 @@
<image class="userinfo-avatar" src="{{userInfo.avatarUrl}}" background-size="cover"></image>
<text class="userinfo-nickname">{{userInfo.nickName}}</text>
</view>
<view class='xunzhang'>
<image src="{{xunZhang}}" mode="aspectFit"></image>
<view class="rank"><text>{{baye_rank}}</text></view>
<view wx:if="{{baye_rank}}">
<view class='xunzhang'>
<image src="{{xunZhang}}" mode="aspectFit"></image>
<view class="rank"><text>{{baye_rank || ''}}</text></view>
</view>
</view>
</view>

@ -1,17 +1,40 @@
const API_URL = 'http://localhost:3000'
const app = getApp()
function getZichanSlides (data, resolve) {
function getZichanSlides (resolve) {
wx.request({
url: `${API_URL}/profiles/zichan_sildes`,
data: data,
data: {token: app.globalData.token},
header: { 'Content-Type': 'application/json'},
success: resolve,
fail: function(){}
})
}
function getCustomerInfo (cb) {
wx.request({
url: `${API_URL}/sessions/new`,
header: { 'Content-Type': 'application/json'},
data: {
code: 'sadjfskdf',
mobile: '13054277977',
name: 'test'
},
success: function(res) {
app.globalData.currentCustomer = res.data.customer
app.globalData.token = res.data.token
typeof cb == "function" && cb(app.globalData.currentCustomer)
},
fail: function(res) {
}
})
}
module.exports = {
getZichanSlides (data, resolve) {
return getZichanSlides(data, resolve)
getZichanSlides (resolve) {
return getZichanSlides(resolve)
},
getCustomerInfo (resolve) {
return getCustomerInfo(resolve)
}
}
Loading…
Cancel
Save