完善小程序登录排班与个人资料流程
This commit is contained in:
@@ -3,6 +3,7 @@ const auth = require('../../utils/auth')
|
||||
const planningApi = require('../../api/planning')
|
||||
const { buildProfileCard } = require('../../utils/profile-card')
|
||||
const profileCache = require('../../utils/profile-cache')
|
||||
const authApi = require('../../api/auth')
|
||||
|
||||
function resolveRoleText(type) {
|
||||
const role = Number(type)
|
||||
@@ -90,6 +91,19 @@ Page({
|
||||
wx.navigateTo({ url: event.currentTarget.dataset.url })
|
||||
},
|
||||
|
||||
async logout() {
|
||||
const confirmed = await new Promise(resolve => wx.showModal({
|
||||
title: '退出登录',
|
||||
content: '退出后将关闭自动登录,并清除本机提醒设置。',
|
||||
success: result => resolve(result.confirm),
|
||||
fail: () => resolve(false)
|
||||
}))
|
||||
if (!confirmed) return
|
||||
try { await authApi.logout() } catch (error) {}
|
||||
getApp().logoutDevice()
|
||||
wx.reLaunch({ url: '/pages/login/index' })
|
||||
},
|
||||
|
||||
onProfileAvatarError() {
|
||||
this.setData({ 'profileCard.avatar': '' })
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user