yujialong 2 months ago
parent 06ec798ae8
commit 2146dfbfa5
  1. 8
      apis/request.js
  2. 50
      pages/index/index.vue
  3. 2
      team/setting/setting.vue

@ -15,22 +15,22 @@ const request = options => {
method: options.method || 'GET', // 请求类型,默认为GET
data: options.data || {}, // 请求参数,默认空对象
success: ({ data }) => {
const { status, message } = data
const { status, code, message } = data
// 状态判断,根据后台定义并提示
if (status === 200) {
resolve(data)
} else if (status == 401) {
} else if (status == 401 || code == 401) {
if (!logouted) {
// 登录过期
uni.clearStorageSync()
uni.showToast({
title: message,
title: message || '登录过期,请重新登录',
icon: 'none'
})
setTimeout(() => {
logouted = 0
uni.reLaunch({
url: '/pages/index/index'
url: '/pages/login/login'
})
}, 1500)
reject(data)

@ -112,30 +112,32 @@
methods: {
//
getAuth() {
uni.showLoading({
title: '加载中'
})
uni.getStorageSync('token') && getUserRolesPermissionMenu({
platformId: 3
}).then(res => {
uni.hideLoading()
const auth = []
//
const generateAuth = (list, parent) => {
list.map(e => {
const name = `${parent ? parent + ':' : ''}${e.name}`
auth.push(name)
generateAuth(e.children, name)
})
}
generateAuth(res.permissionMenu[0].children, '')
uni.setStorageSync('dataPermission', res.dataPermissionList)
uni.setStorageSync('auth', auth)
this.$forceUpdate()
}).catch(e => {
uni.hideLoading()
uni.setStorageSync('auth', [])
})
if (uni.getStorageSync('token')) {
uni.showLoading({
title: '加载中'
})
getUserRolesPermissionMenu({
platformId: 3
}).then(res => {
uni.hideLoading()
const auth = []
//
const generateAuth = (list, parent) => {
list.map(e => {
const name = `${parent ? parent + ':' : ''}${e.name}`
auth.push(name)
generateAuth(e.children, name)
})
}
generateAuth(res.permissionMenu[0].children, '')
uni.setStorageSync('dataPermission', res.dataPermissionList)
uni.setStorageSync('auth', auth)
this.$forceUpdate()
}).catch(e => {
uni.hideLoading()
uni.setStorageSync('auth', [])
})
}
},
//
toPanel(i) {

@ -3,7 +3,7 @@
<uni-list>
<uni-list-item :show-extra-icon="true" showArrow :extra-icon="phoneIcon" title="手机号" :rightText="info.phone" clickable @click="toPage('../phone/phone')" />
<uni-list-item :show-extra-icon="true" showArrow :extra-icon="mailIcon" title="邮箱" :rightText="info.email" clickable @click="toPage('../email/email')" />
<uni-list-item :show-extra-icon="true" showArrow :extra-icon="accountIcon" title="账号" :rightText="info.account" clickable @click="toPage('../account/account')" />
<uni-list-item :show-extra-icon="true" :extra-icon="accountIcon" title="账号" :rightText="info.account" />
<uni-list-item :show-extra-icon="true" showArrow :extra-icon="pwdIcon" title="密码" rightText="******" clickable @click="toPage('../password/password')" />
</uni-list>

Loading…
Cancel
Save