refactor: migrate to Tencent Cloud backend
这个提交包含在:
+15
-14
@@ -12,14 +12,6 @@ App({
|
||||
onLaunch: function () {
|
||||
var sysInfo = wx.getSystemInfoSync()
|
||||
this.globalData.statusBarHeight = sysInfo.statusBarHeight || 44
|
||||
|
||||
if (!wx.cloud) {
|
||||
console.error('请使用 2.2.3 或以上的基础库以使用云能力')
|
||||
return
|
||||
}
|
||||
wx.cloud.init({
|
||||
traceUser: true
|
||||
})
|
||||
this.checkLogin()
|
||||
},
|
||||
|
||||
@@ -43,12 +35,21 @@ App({
|
||||
},
|
||||
|
||||
doLogin: function () {
|
||||
return http.post('/api/v1/auth/login', {}).then(function (data) {
|
||||
wx.setStorageSync('token', data.token)
|
||||
var app = getApp()
|
||||
app.globalData.userInfo = data.user_info
|
||||
app.globalData.userId = data.user_id
|
||||
return data
|
||||
return new Promise(function (resolve, reject) {
|
||||
wx.login({
|
||||
success: function (res) {
|
||||
http.post('/api/v1/auth/login', { code: res.code }).then(function (data) {
|
||||
wx.setStorageSync('token', data.token)
|
||||
var app = getApp()
|
||||
app.globalData.userInfo = data.user_info
|
||||
app.globalData.userId = data.user_id
|
||||
resolve(data)
|
||||
}).catch(reject)
|
||||
},
|
||||
fail: function (err) {
|
||||
reject({ code: 2002, message: err.errMsg || '微信登录失败' })
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
在新工单中引用
屏蔽一个用户