diff --git a/app.js b/app.js
index d29666d..5e8207e 100644
--- a/app.js
+++ b/app.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
diff --git a/pages/mine/mine.js b/pages/mine/mine.js
index 4f4895a..c253ac7 100644
--- a/pages/mine/mine.js
+++ b/pages/mine/mine.js
@@ -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
+ })
+ })
})
})
},
diff --git a/pages/mine/mine.wxml b/pages/mine/mine.wxml
index e2ddd58..a01a174 100644
--- a/pages/mine/mine.wxml
+++ b/pages/mine/mine.wxml
@@ -3,9 +3,11 @@
{{userInfo.nickName}}
-
-
- {{baye_rank}}
+
+
+
+ {{baye_rank || ''}}
+
diff --git a/utils/profile.js b/utils/profile.js
index 3497e06..e22597c 100644
--- a/utils/profile.js
+++ b/utils/profile.js
@@ -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)
}
}
\ No newline at end of file