From 8cbc733c2bd3ecf919a98d69e166363aacfca8fc Mon Sep 17 00:00:00 2001
From: WindowBird <13870814+windows-bird@user.noreply.gitee.com>
Date: Tue, 2 Sep 2025 14:01:53 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BD=95=E5=85=A5=E8=AE=BE?=
=?UTF-8?q?=E5=A4=87=E5=85=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
api/device/device.js | 9 ++++++++-
config/dev.js | 2 +-
pages/profile/profile.vue | 35 +++++++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/api/device/device.js b/api/device/device.js
index e1842c4..4633cc1 100644
--- a/api/device/device.js
+++ b/api/device/device.js
@@ -12,4 +12,11 @@ export function getDeviceList(params = {}) {
method: 'GET',
params,
})
-}
\ No newline at end of file
+}
+
+export function isSysAdmin() {
+ return request({
+ url: '/app/device/isSysAdmin',
+ method: 'GET',
+ })
+}
diff --git a/config/dev.js b/config/dev.js
index 53256f2..1837cbe 100644
--- a/config/dev.js
+++ b/config/dev.js
@@ -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,
diff --git a/pages/profile/profile.vue b/pages/profile/profile.vue
index a84cde8..85dd606 100644
--- a/pages/profile/profile.vue
+++ b/pages/profile/profile.vue
@@ -114,6 +114,12 @@
在线客服
+
+
+
+
+ 设备录入
+
@@ -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) {