Browse Source

合并master

jwyu 1 year ago
parent
commit
33818922c8

+ 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;
+}
+
 // 列表无数据占位图
 .list-empty-img{
     width: 400px;

+ 4 - 3
src/directives/LongPress.js

@@ -1,12 +1,12 @@
 // 长按指令
 //eg: v-longpress="{ handler: onLongPressItem, args: item, duration: 1000 }"
-
+let start,cancel;
 const LongPressDirective = {
   beforeMount(el, binding) {
     let pressTimer = null;
 
     // 长按开始
-    const start = (event) => {
+    start = (event) => {
       if (event.type === 'click' && event.button !== 0) {
         return;
       }
@@ -19,7 +19,7 @@ const LongPressDirective = {
     };
 
     // 长按结束
-    const cancel = () => {
+    cancel = () => {
       if (pressTimer !== null) {
         clearTimeout(pressTimer);
         pressTimer = null;
@@ -36,6 +36,7 @@ const LongPressDirective = {
   },
 
   beforeUnmount(el) {
+    if(!start) return
     el.removeEventListener('mousedown', start);
     el.removeEventListener('touchstart', start);
 

+ 5 - 1
src/layouts/Index.vue

@@ -24,7 +24,11 @@ function handleLoginOut(){
 }
 
 function goBack(){
-    router.back()
+    if(window.history.state.back){
+        router.back()
+    }else{
+        router.replace('/tabbar/home')
+    }
 }
 
 

+ 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(){

+ 1 - 0
src/views/ppt/components/PadPPTIndexWrap.vue

@@ -441,6 +441,7 @@ const showPopover=ref(false)
                 padding: 0 10px;
                 position: sticky;
                 top: 60px;
+                z-index: 99;
             }
             .list-wrap{
                 padding: var(--van-search-padding);

+ 34 - 4
src/views/report/List.vue

@@ -142,12 +142,20 @@ function handleReportPublishCancle(item){
 // 日期筛选
 const calendarMinDate=new Date(2010,0,1)
 const showCalendar=ref(false)
+const calendarIns=ref(null)
 function handleCalendarChange(e){
     listState.StartDate=moment(e[0]).format('YYYY-MM-DD')
     listState.EndDate=moment(e[1]).format('YYYY-MM-DD')
     refreshList()
     showCalendar.value=false
 }
+function handleResetCalendar(){
+    listState.StartDate=''
+    listState.EndDate=''
+    calendarIns.value.reset()
+    refreshList()
+    showCalendar.value=false
+}
 
 // 分类筛选
 function handleConfirmClassify({firstClassify,secondClassify}){
@@ -232,6 +240,13 @@ const reportStatusOpt=[
         value:1
     }
 ]
+function handleSelectReportStatus(item){
+    if(listState.MsgIsSend==item.value){
+        listState.MsgIsSend=''
+    }else{
+        listState.MsgIsSend=item.value
+    }
+}
 function handleSelectFrequency(item){
     if(listState.Frequency==item.value){
         listState.Frequency=''
@@ -335,7 +350,7 @@ function handleSelectAddReportType(e){
                                 :class="['status-item',listState.MsgIsSend===item.value?'active':'']" 
                                 v-for="item in reportStatusOpt" 
                                 :key="item.value"
-                                @click="listState.MsgIsSend=item.value"
+                                @click="handleSelectReportStatus(item)"
                             >{{item.label}}</li>
                         </ul>
                         
@@ -359,7 +374,7 @@ function handleSelectAddReportType(e){
                 <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 }"
                 >
@@ -410,10 +425,10 @@ function handleSelectAddReportType(e){
     <!-- 报告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>
@@ -451,13 +466,21 @@ function handleSelectAddReportType(e){
         round
     >
         <van-calendar 
+            ref="calendarIns"
             :poppable="false"
             type="range"
             allow-same-day
             :min-date="calendarMinDate"
             @confirm="handleCalendarChange" 
             :style="{ height: '500px' }"
-        />
+        >
+            <template #title>
+                <div style="position: relative;">
+                    <span style="color:#666;position: absolute;left:16px" @click="handleResetCalendar">重置</span>
+                    <span>日期选择</span>
+                </div>
+            </template>
+        </van-calendar>
     </van-popup>
     
 </template>
@@ -639,6 +662,10 @@ function handleSelectAddReportType(e){
 }
 
 .report-item-action-box{
+    .title{
+        padding: 20px 32px;
+        text-align: center;
+    }
     .item{
         text-align: center;
         line-height: 48PX;
@@ -723,6 +750,9 @@ function handleSelectAddReportType(e){
     }
 
     .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"
         >

+ 7 - 1
src/views/report/components/ListClassify.vue

@@ -45,6 +45,12 @@ function handleCancle(){
     emits('close')
 }
 
+function handleReset(){
+    activeIndex.value=0
+    activeId.value=null
+    emits('confirm',{firstClassify:'',secondClassify:''})
+}
+
 function handleConfirm(){
     const firstClassify={
         text:list.value[activeIndex.value].text,
@@ -67,7 +73,7 @@ function handleConfirm(){
 <template>
     <div class="report-list-classify-wrap">
         <div class="top-box">
-            <span style="color:#666666" @click="handleCancle">取消</span>
+            <span style="color:#666666" @click="handleReset">重置</span>
             <span style="font-size:18px;font-weight:bold">选择分类</span>
             <span style="color:#0052D9" @click="handleConfirm">确定</span>
         </div>

+ 33 - 4
src/views/reportEn/List.vue

@@ -117,12 +117,20 @@ function handleReportPublishCancle(item){
 // 日期筛选
 const calendarMinDate=new Date(2010,0,1)
 const showCalendar=ref(false)
+const calendarIns=ref(null)
 function handleCalendarChange(e){
     listState.StartDate=moment(e[0]).format('YYYY-MM-DD')
     listState.EndDate=moment(e[1]).format('YYYY-MM-DD')
     refreshList()
     showCalendar.value=false
 }
+function handleResetCalendar(){
+    listState.StartDate=''
+    listState.EndDate=''
+    calendarIns.value.reset()
+    refreshList()
+    showCalendar.value=false
+}
 
 // 分类筛选
 function handleConfirmClassify({firstClassify,secondClassify}){
@@ -198,6 +206,13 @@ const reportStatusOpt=[
         value:1
     }
 ]
+function handleSelectReportStatus(item){
+    if(listState.MsgIsSend==item.value){
+        listState.MsgIsSend=''
+    }else{
+        listState.MsgIsSend=item.value
+    }
+}
 function handleSelectFrequency(item){
     if(listState.Frequency==item.value){
         listState.Frequency=''
@@ -291,7 +306,7 @@ function goSearch(){
                                 :class="['status-item',listState.MsgIsSend===item.value?'active':'']" 
                                 v-for="item in reportStatusOpt" 
                                 :key="item.value"
-                                @click="listState.MsgIsSend=item.value"
+                                @click="handleSelectReportStatus(item)"
                             >{{item.label}}</li>
                         </ul>
                         
@@ -315,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 }"
                 >
@@ -339,10 +354,10 @@ 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>
@@ -371,13 +386,21 @@ function goSearch(){
         round
     >
         <van-calendar 
+            ref="calendarIns"
             :poppable="false"
             type="range"
             allow-same-day
             :min-date="calendarMinDate"
             @confirm="handleCalendarChange" 
             :style="{ height: '500px' }"
-        />
+        >
+            <template #title>
+                <div style="position: relative;">
+                    <span style="color:#666;position: absolute;left:16px" @click="handleResetCalendar">重置</span>
+                    <span>日期选择</span>
+                </div>
+            </template>
+        </van-calendar>
     </van-popup>
 </template>
 
@@ -521,6 +544,9 @@ function goSearch(){
 }
 
 .report-item-action-box{
+    .title{
+        padding: 20px 32px;
+    }
     .item{
         text-align: center;
         line-height: 48PX;
@@ -634,6 +660,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"
         >

+ 7 - 1
src/views/reportEn/components/ListClassify.vue

@@ -37,6 +37,12 @@ function handleCancle(){
     emits('close')
 }
 
+function handleReset(){
+    activeIndex.value=0
+    activeId.value=null
+    emits('confirm',{firstClassify:'',secondClassify:''})
+}
+
 function handleConfirm(){
     const firstClassify=list.value[activeIndex.value].text
     const secondClassify=activeId.value||''
@@ -47,7 +53,7 @@ function handleConfirm(){
 <template>
     <div class="report-list-classify-wrap">
         <div class="top-box">
-            <span style="color:#666666" @click="handleCancle">取消</span>
+            <span style="color:#666666" @click="handleReset">重置</span>
             <span style="font-size:18px;font-weight:bold">选择分类</span>
             <span style="color:#0052D9" @click="handleConfirm">确定</span>
         </div>

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