管理端权限

dev
zhangjinzhe 2024-09-27 11:05:24 +08:00
parent f9994c680d
commit 465e9f6914
1 changed files with 46 additions and 2 deletions

View File

@ -12,7 +12,7 @@
</view> </view>
<view class="grid"> <view class="grid">
<!-- 通过未通过显示 --> <!-- 通过未通过显示 -->
<view class="grid1"> <view class="grid1" v-show="quanx">
<up-grid :border="false" col="3" @click="grid1Click1"> <up-grid :border="false" col="3" @click="grid1Click1">
<up-grid-item v-for="(listItem, listIndex) in list1" :key="listIndex" <up-grid-item v-for="(listItem, listIndex) in list1" :key="listIndex"
customStyle="padding-top: 24rpx; "> customStyle="padding-top: 24rpx; ">
@ -86,6 +86,7 @@ const auditreject = iconConfig.auditreject;
const auditrejectacount = ref(111) const auditrejectacount = ref(111)
const adauditacount = ref(111) const adauditacount = ref(111)
const adpassacount = ref(111) const adpassacount = ref(111)
const quanx = ref(true)
const list1 = ref([ const list1 = ref([
{ icon: auditreject, title: `未通过(${auditrejectacount.value})` }, { icon: auditreject, title: `未通过(${auditrejectacount.value})` },
{ icon: adaudit, title: `待审核(${adauditacount.value})` }, { icon: adaudit, title: `待审核(${adauditacount.value})` },
@ -103,6 +104,9 @@ const list2 = ref([
const grid1Click1 = (e) => { const grid1Click1 = (e) => {
console.log(e); console.log(e);
} }
onMounted(() => {
getUserRoles()
})
onLoad(() => { onLoad(() => {
proxy.$store.dispatch('webSockerInfo') proxy.$store.dispatch('webSockerInfo')
getCountInfo(); getCountInfo();
@ -110,11 +114,11 @@ onLoad(() => {
onShow(() => { onShow(() => {
proxy.$store.dispatch('webSockerInfo') proxy.$store.dispatch('webSockerInfo')
getCountInfo(); getCountInfo();
getUserRoles()
}) })
const getCountInfo = () =>{ const getCountInfo = () =>{
let from = {} let from = {}
getCount(from).then(e => { getCount(from).then(e => {
let data = e.data let data = e.data
// //
auditrejectacount.value = parseInt(data.talkTopicNoPass || 0) + parseInt(data.actiTopicNoPass || 0); auditrejectacount.value = parseInt(data.talkTopicNoPass || 0) + parseInt(data.actiTopicNoPass || 0);
@ -128,6 +132,46 @@ const getCountInfo = () =>{
}) })
} }
//
const getUserRoles = () => {
const userInfo = uni.getStorageSync('loginUserPost');
if (userInfo && Array.isArray(userInfo.roles)) {
userInfo.roles.forEach(role => {
//
if (role.roleKey === 'kfuser') {
uni.setTabBarItem({
index: 0,
visible: false
});
//
} else if (role.roleKey === 'audituser') {
uni.setTabBarItem({
index: 1,
visible: false
});
list2.value = [
{ icon: talkautid, title: '话题审核' },
{ icon: adacaudit, title: '活动审核' },
{ icon: stuaudit, title: '认证审核' },
]
}
//
else if (role.roleKey === 'taskLevel') {
uni.setTabBarItem({
index: 1,
visible: false
});
list2.value = [
{ icon: adcoin, title: '校园币管理' },
{ icon: adgrade, title: '等级管理' }
]
quanx.value = false
}
});
} else {
console.error('loginUserPost 不存在或 roles 不是一个数组');
}
};
// aaa // aaa
const grid1Click2 = (e) => { const grid1Click2 = (e) => {