后台管理功能进行一些优化
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user