浏览代码

菜单控制

jwyu 1 年之前
父节点
当前提交
b1bbdbe72f

+ 1 - 1
.env.development

@@ -1,5 +1,5 @@
 # 接口地址http://8.136.199.33:8610/v1   https://rddptest.hzinsights.com/adminapi
-VITE_APP_API_URL="http://8.136.199.33:8610/v1"
+VITE_APP_API_URL="https://rddptest.hzinsights.com/adminapi"
 # 路由根地址
 VITE_APP_BASE_URL="/"
 # 打包输入文件名

+ 7 - 0
src/api/user.js

@@ -9,3 +9,10 @@ import {get,post} from './index'
 export function apiLogin(params){
     return post('/sysuser/login',params)
 }
+
+/**
+ * 菜单
+ */
+export function apiMenuList(params){
+    return get('/system/menu/list',params)
+}

+ 11 - 0
src/assets/styles/common.scss

@@ -51,6 +51,17 @@ img {
     border-radius: 5PX;
 }
 
+//禁止复制文本
+.select-text-disabled{
+    user-select: none;
+    -moz-user-select:-moz-none;
+    moz-user-select: none;
+    -o-user-select:none;
+    -webkit-user-select: none;
+    -ms-user-select: none;
+    -khtml-user-select:none;
+  }
+
 // vant搜索框样式
 .van-search__content{
     border: 1px solid $border-color;

+ 1 - 2
src/views/myETA/components/PadClasssifyWrap.vue

@@ -119,7 +119,7 @@ function handleRemoveChart(item,index){
 
 // 跳转详情
 function goDetail(item){
-    const routerEl=router.resolve({
+    router.push({
         path:"/myETA/chartdetail",
         query:{
             code:item.UniqueCode,
@@ -127,7 +127,6 @@ function goDetail(item){
             iscommon:classifyState.classifyTypeAct==1?false:true
         }
     })
-    window.open(routerEl.href,'_blank')
 }
 
 function goChooseChart(){

+ 9 - 2
src/views/report/List.vue

@@ -365,7 +365,7 @@ async function goSearch(){
                 <li
                     v-for="item in listState.list" 
                     :key="item.Id"
-                    class="item"
+                    class="select-text-disabled item"
                     @click="goDetail(item)"
                     v-longpress="{ handler: onLongPressItem, args: item, duration: 1000 }"
                 >
@@ -389,10 +389,10 @@ async function goSearch(){
     <!-- 报告item操作 -->
     <van-action-sheet 
         v-model:show="showReportItemOpt"
-        :title="activeItem?.Title"
         cancel-text="取消"
     >
         <div class="report-item-action-box" v-if="activeItem">
+            <div class="title">{{activeItem.Title}}</div>
             <template v-if="activeItem.State==1">
                 <div class="item" style="color:#C54322" @click="handleReportDel(activeItem)">删除</div>
                 <div class="item" style="color:#0052D9" @click="handleReportPublish(activeItem)">发布</div>
@@ -589,6 +589,10 @@ async function goSearch(){
 }
 
 .report-item-action-box{
+    .title{
+        padding: 20px 32px;
+        text-align: center;
+    }
     .item{
         text-align: center;
         line-height: 48PX;
@@ -673,6 +677,9 @@ async function goSearch(){
     }
 
     .report-item-action-box{
+        .title{
+            padding: 10px 16px;
+        }
         .item{
             font-size: 16px;
         }

+ 1 - 1
src/views/report/Search.vue

@@ -86,7 +86,7 @@ function goDetail(item){
         <van-list
             v-model:loading="listState.loading"
             :finished="listState.finished"
-            :finished-text="listState.list.length>0?'没有更多了':'暂无图表'"
+            :finished-text="listState.list.length>0?'没有更多了':'暂无报告'"
             :immediate-check="false"
             @load="onLoad"
         >

+ 8 - 1
src/views/reportEn/List.vue

@@ -330,7 +330,7 @@ function goSearch(){
                 <li 
                     v-for="item in listState.list" 
                     :key="item.Id"
-                    class="item" 
+                    class="select-text-disabled item" 
                     @click="goDetail(item)"
                     v-longpress="{ handler: onLongPressItem, args: item, duration: 1000 }"
                 >
@@ -358,6 +358,7 @@ function goSearch(){
         cancel-text="取消"
     >
         <div class="report-item-action-box" v-if="activeItem">
+            <div class="title">{{activeItem.Title}}</div>
             <template v-if="activeItem.State==1">
                 <div class="item" style="color:#C54322" @click="handleReportDel(activeItem)">删除</div>
                 <div class="item" style="color:#0052D9" @click="handleReportPublish(activeItem)">发布</div>
@@ -544,6 +545,9 @@ function goSearch(){
 }
 
 .report-item-action-box{
+    .title{
+        padding: 20px 32px;
+    }
     .item{
         text-align: center;
         line-height: 48PX;
@@ -657,6 +661,9 @@ function goSearch(){
     }
 
     .report-item-action-box{
+        .title{
+            padding: 10px 16px;
+        }
         .item{
             font-size: 16px;
         }

+ 1 - 1
src/views/reportEn/Search.vue

@@ -74,7 +74,7 @@ function goDetail(item){
         <van-list
             v-model:loading="listState.loading"
             :finished="listState.finished"
-            :finished-text="listState.list.length>0?'没有更多了':'暂无图表'"
+            :finished-text="listState.list.length>0?'没有更多了':'暂无报告'"
             :immediate-check="false"
             @load="onLoad"
         >

+ 98 - 19
src/views/tabbar/Home.vue

@@ -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>