|
@@ -21,6 +21,7 @@
|
|
|
>
|
|
|
<template slot="title">
|
|
|
<i :class="'icon icon-' + MENU_ICONS[index]"></i>
|
|
|
+
|
|
|
<span>{{ menu1.name }}</span>
|
|
|
</template>
|
|
|
<el-menu-item
|
|
@@ -77,7 +78,10 @@
|
|
|
text-color="#383b4a"
|
|
|
router
|
|
|
>
|
|
|
- <el-menu-item @click="safeSetOpen">
|
|
|
+ <el-menu-item
|
|
|
+ @click="safeSetOpen"
|
|
|
+ v-if="authButtons.includes('import_test_paper-safe')"
|
|
|
+ >
|
|
|
<i class="icon icon-safe"></i>
|
|
|
<span> 安全设置 </span>
|
|
|
</el-menu-item>
|
|
@@ -101,7 +105,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { mapState } from "vuex";
|
|
|
+import { mapState, mapGetters } from "vuex";
|
|
|
import { QUESTION_API } from "@/constants/constants";
|
|
|
import QuestionSafetySetDialog from "@/modules/question/components/QuestionSafetySetDialog.vue";
|
|
|
|
|
@@ -187,6 +191,7 @@ export default {
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState({ user: (state) => state.user }),
|
|
|
+ ...mapGetters(["authButtons"]),
|
|
|
},
|
|
|
watch: {
|
|
|
$route() {
|
|
@@ -198,24 +203,44 @@ export default {
|
|
|
},
|
|
|
async created() {
|
|
|
this.group = routesToMenu.find((v) => this.$route.path.startsWith(v.path));
|
|
|
- this.menuList = await this.getUserPrivileges();
|
|
|
+ let list = await this.getUserPrivileges();
|
|
|
+ let authButtons = [];
|
|
|
+
|
|
|
+ list.forEach((level1) => {
|
|
|
+ if (level1.subRolePrivilege?.length) {
|
|
|
+ level1.subRolePrivilege.forEach((level2) => {
|
|
|
+ if (level2.subRolePrivilege?.length) {
|
|
|
+ level2.subRolePrivilege.forEach((level3) => {
|
|
|
+ if (level3.privilegeType === "BUTTON" && level3.enable) {
|
|
|
+ authButtons.push(level3.code);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.setAuthButtons(authButtons);
|
|
|
+ console.log(this.$store.state.authButtons);
|
|
|
+ this.menuList = list;
|
|
|
this.UPDATE_MENU_LIST(this.menuList);
|
|
|
this.updatePath();
|
|
|
this.getBadge();
|
|
|
},
|
|
|
methods: {
|
|
|
- ...mapMutations([UPDATE_CURRENT_PATHS, UPDATE_MENU_LIST]),
|
|
|
+ ...mapMutations([UPDATE_CURRENT_PATHS, UPDATE_MENU_LIST, "setAuthButtons"]),
|
|
|
getBadge() {
|
|
|
- this.$httpWithMsg.post(QUESTION_API + "/pending/count").then((res) => {
|
|
|
- if (res.data) {
|
|
|
- this.badgeMenuNums["check_duplicate_list"] =
|
|
|
- res.data?.duplicateCount || 0;
|
|
|
- this.badgeMenuNums["paper_pending_trial"] =
|
|
|
- res.data?.questionAuditCount || 0;
|
|
|
- this.badgeMenuNums["exam_paper_pending_trial"] =
|
|
|
- res.data?.paperAuditCount || 0;
|
|
|
- }
|
|
|
- });
|
|
|
+ this.$httpWithMsg
|
|
|
+ .post(QUESTION_API + "/rolePrivilege/pending/count")
|
|
|
+ .then((res) => {
|
|
|
+ if (res.data) {
|
|
|
+ this.badgeMenuNums["check_duplicate_list"] =
|
|
|
+ res.data?.duplicateCount || 0;
|
|
|
+ this.badgeMenuNums["paper_pending_trial"] =
|
|
|
+ res.data?.questionAuditCount || 0;
|
|
|
+ this.badgeMenuNums["exam_paper_pending_trial"] =
|
|
|
+ res.data?.paperAuditCount || 0;
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
safeSetOpen() {
|
|
|
this.$refs.QuestionSafetySetDialog.open();
|