|
@@ -1,6 +1,10 @@
|
|
|
<script setup>
|
|
|
+import {ref} from 'vue'
|
|
|
import { useRouter } from "vue-router";
|
|
|
+import {apiMenuList} from '@/api/user'
|
|
|
+import {getStaticImg} from '@/hooks/common'
|
|
|
import {useCachedViewsStore} from '@/store/modules/cachedViews'
|
|
|
+
|
|
|
const cachedViewsStore=useCachedViewsStore()
|
|
|
cachedViewsStore.removeCaches(-1)
|
|
|
|
|
@@ -15,31 +19,106 @@ if(!localStorage.getItem('token')){
|
|
|
router.replace('/login')
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * name 显示的名称
|
|
|
+ * key 对应接口中的 name
|
|
|
+ * level 说明该菜单在数据中的第几级查找
|
|
|
+ */
|
|
|
+const menuConfig=[
|
|
|
+ {
|
|
|
+ name:'中文研报',
|
|
|
+ key:'研报列表',
|
|
|
+ level:2,
|
|
|
+ path:'/report/list',
|
|
|
+ icon:getStaticImg('report/report_icon.png'),
|
|
|
+ show:false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'英文研报',
|
|
|
+ key:'英文研报',
|
|
|
+ level:2,
|
|
|
+ path:'/reportEn/list',
|
|
|
+ icon:getStaticImg('report/report_icon_en.png'),
|
|
|
+ show:false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'智能PPT',
|
|
|
+ key:'智能ppt ',
|
|
|
+ level:1,
|
|
|
+ path:'/ppt/index',
|
|
|
+ icon:getStaticImg('ppt/ppt_icon_zh.png'),
|
|
|
+ show:false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'英文PPT',
|
|
|
+ key:'英文ppt ',
|
|
|
+ level:1,
|
|
|
+ path:'/ppten/index',
|
|
|
+ icon:getStaticImg('ppt/ppt_icon_en.png'),
|
|
|
+ show:false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'My ETA',
|
|
|
+ key:'My ETA',
|
|
|
+ level:1,
|
|
|
+ path:'/myETA/index',
|
|
|
+ icon:getStaticImg('myETA/icon_myETA_logo.png'),
|
|
|
+ show:false
|
|
|
+ }
|
|
|
+]
|
|
|
+const menuOpts=ref([])
|
|
|
+
|
|
|
+// 获取菜单权限数据
|
|
|
+async function getMenuList(){
|
|
|
+ menuConfig.forEach(item=>{
|
|
|
+ item.show=false
|
|
|
+ })
|
|
|
+ const res=await apiMenuList()
|
|
|
+ if(res.Ret===200){
|
|
|
+ if(res.Data.List){
|
|
|
+ const arr=res.Data.List
|
|
|
+ menuConfig.forEach(item=>{
|
|
|
+ if(item.level===1){
|
|
|
+ arr.forEach(f=>{
|
|
|
+ if(f.name===item.key){
|
|
|
+ item.show=true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if(item.level===2){
|
|
|
+ arr.forEach(f=>{
|
|
|
+ f.children.forEach(s=>{
|
|
|
+ if(s.name===item.key){
|
|
|
+ item.show=true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ menuOpts.value=menuConfig.filter(item=>item.show)
|
|
|
+ }else{
|
|
|
+ menuOpts.value=[]
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+getMenuList()
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div class="home-page">
|
|
|
<div class="list">
|
|
|
- <div class="item-box" @click="goNext('/report/list')">
|
|
|
- <img src="@/assets/imgs/report/report_icon.png" alt="">
|
|
|
- <div>中文研报</div>
|
|
|
- </div>
|
|
|
- <div class="item-box" @click="goNext('/reportEn/list')">
|
|
|
- <img src="@/assets/imgs/report/report_icon_en.png" alt="">
|
|
|
- <div>英文研报</div>
|
|
|
- </div>
|
|
|
- <div class="item-box" @click="goNext('/ppt/index')">
|
|
|
- <img src="@/assets/imgs/ppt/ppt_icon_zh.png" alt="">
|
|
|
- <div>智能PPT</div>
|
|
|
- </div>
|
|
|
- <div class="item-box" @click="goNext('/ppten/index')">
|
|
|
- <img src="@/assets/imgs/ppt/ppt_icon_en.png" alt="">
|
|
|
- <div>英文PPT</div>
|
|
|
- </div>
|
|
|
- <div class="item-box" @click="goNext('/myETA/index')">
|
|
|
- <img src="@/assets/imgs/myETA/icon_myETA_logo.png" alt="">
|
|
|
- <div>My ETA</div>
|
|
|
+ <div
|
|
|
+ v-for="item in menuOpts"
|
|
|
+ :key="item.name"
|
|
|
+ class="item-box"
|
|
|
+ @click="goNext(item.path)"
|
|
|
+ >
|
|
|
+ <img :src="item.icon" alt="">
|
|
|
+ <div>{{item.name}}</div>
|
|
|
</div>
|
|
|
+
|
|
|
+ <div class="item-box" style="border:none"></div>
|
|
|
<div class="item-box" style="border:none"></div>
|
|
|
</div>
|
|
|
|