后台管理功能进行一些优化

This commit is contained in:
xiaowang
2026-02-28 14:32:28 +08:00
parent 36e2950a99
commit 725cb07fcf
23 changed files with 2297 additions and 92 deletions
+22 -2
View File
@@ -31,7 +31,7 @@
</a-statistic>
</a-card>
</a-col>
<a-col :span="6">
<a-col :span="6" v-if="isAdmin">
<a-card>
<a-statistic
title="店铺数量"
@@ -110,7 +110,7 @@
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import { ref, reactive, onMounted, computed } from 'vue'
import { message } from 'ant-design-vue'
import {
UserOutlined,
@@ -131,6 +131,26 @@ const stats = reactive<DashboardStats>({
recentActivities: []
})
// 获取当前用户信息
const getCurrentUserInfo = () => {
try {
const userInfoStr = localStorage.getItem('adminUserInfo')
if (userInfoStr) {
const userInfo = JSON.parse(userInfoStr)
return userInfo
}
} catch (error) {
console.error('获取当前用户信息失败', error)
}
return null
}
// 判断是否为管理员
const isAdmin = computed(() => {
const userInfo = getCurrentUserInfo()
return userInfo?.type === 4
})
const formatTime = (timeStr: string) => {
if (!timeStr) return ''
const time = new Date(timeStr)