添加录入设备入口

This commit is contained in:
WindowBird 2025-09-02 14:01:53 +08:00
parent d712f62917
commit 8cbc733c2b
3 changed files with 44 additions and 2 deletions

View File

@ -12,4 +12,11 @@ export function getDeviceList(params = {}) {
method: 'GET',
params,
})
}
}
export function isSysAdmin() {
return request({
url: '/app/device/isSysAdmin',
method: 'GET',
})
}

View File

@ -2,7 +2,7 @@
export const DEV_CONFIG = {
// 临时token用于开发测试
TEMP_TOKEN:
'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjA2NzFkNWMzLTViZTEtNGFjZi1hYmFjLTMxZWZjYjY0NTg2MyJ9.dPnZkiM7f3v-uP1MMRwwIwNjPciZdQcHsz79n8WehiDPtFMGm_VsfJE4P_gN2N8nVcJJ5lf7YcKZW3HRUautXQ',
'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjUwYjY5ZjZjLTU0NDMtNDgxYS1hZDU4LWJhNGFhZjlhMmEwZCJ9.InhUuGW7C4AFmTT-1ADbSkhHCtRi5HeWkM1Sfr0hIXa60j7AT4hahKMcV4bps-Qw3ba3hiu3qlAakT_g2ScKpQ',
// 是否使用临时token
USE_TEMP_TOKEN: true,

View File

@ -114,6 +114,12 @@
</view>
<text class="function-text">在线客服</text>
</view>
<view class="function-item" @click="goToDeviceEntry">
<view class="function-icon">
<image :src="commonEnum.AGENCY_INTERESTS" class="function-img" mode="aspectFit"></image>
</view>
<text class="function-text">设备录入</text>
</view>
</view>
</view>
<!-- 客服弹窗组件 -->
@ -126,6 +132,7 @@ import { commonEnum } from '@/enum/commonEnum.js'
import { getUserInfo, getUserFinancialData, getAgentCount } from '@/api/user/user.js'
import { isAgent } from '@/api/agents.js'
import { checkLoginStatus } from '../../utils/checkLogin'
import { isSysAdmin } from '../../api'
export default {
name: 'ProfilePage',
@ -153,6 +160,7 @@ export default {
CustomerList: [],
loading: false,
isAgent: false,
isSysAdmin: true,
}
},
@ -187,6 +195,7 @@ export default {
this.fetchFinancialData(),
this.fetchUserStats(),
this.getIsAgent(),
this.getIsSysAdmin(),
])
//
@ -254,6 +263,20 @@ export default {
}
},
async getIsSysAdmin() {
try {
const token = uni.getStorageSync('token')
if (!token) {
console.log('暂无登录,不请求是否是管理员')
return
}
const response = await isSysAdmin()
this.isSysAdmin = response.data
} catch (error) {
console.error('获取是否是系统管理员失败:', error)
}
},
//
async fetchFinancialData() {
try {
@ -371,6 +394,18 @@ export default {
})
}
},
goToDeviceEntry() {
if (this.isSysAdmin) {
uni.navigateTo({
url: '/page_user/luru/index',
})
} else {
uni.showToast({
title: '需要管理员权限',
icon: 'none',
})
}
},
//
handleUserInfoUpdate(updatedUserInfo) {