浏览代码

Merge branch 'eta2.4.5'

shanbinzhang 6 天之前
父节点
当前提交
1ef91a21d9
共有 5 个文件被更改,包括 129 次插入71 次删除
  1. 二进制
      src/assets/img/no_auth.png
  2. 37 0
      src/components/noAuth.vue
  3. 1 0
      src/request/api.ts
  4. 57 46
      src/views/chartShow/index.vue
  5. 34 25
      src/views/sheetShow/index.vue

二进制
src/assets/img/no_auth.png


+ 37 - 0
src/components/noAuth.vue

@@ -0,0 +1,37 @@
+
+<script setup lang="ts">
+import { ref } from 'vue'
+
+const props = defineProps({
+  text: {
+    type: String,
+    default: '暂无权限'
+  }
+})
+
+</script>
+<template>
+  <div class="no-auth-wapper">
+    <div>
+      <img
+        src="@/assets/img/no_auth.png"
+        alt=""
+      />
+      <span>{{text}}</span>
+    </div>
+  </div>
+</template>
+<style scoped lang="less">
+.no-auth-wapper {
+  width: 100%;
+  height: 100%;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  text-align: center;
+  color: #666;
+  img {
+    display: block;
+  }
+}
+</style>

+ 1 - 0
src/request/api.ts

@@ -96,6 +96,7 @@ interface IExcelParams {
 	FromScene: number;
 	ReferencedId:number;
 	Uuid: string;
+	AuthToken: string
 }
 interface IFreshParams {
 	UniqueCode: string | any

+ 57 - 46
src/views/chartShow/index.vue

@@ -20,6 +20,7 @@
     </header>
     <template v-if="haveData">
       <div
+        v-if="haveAuth"
         class="chart-wrapper"
         id="chart-wrapper"
         v-loading="loading"
@@ -32,53 +33,57 @@
 
         <div class="mark"></div>
       </div>
+
+      <NoAuth v-else/>
     </template>
     <div class="chart-wrapper notfound" v-else>
       <i class="el-icon-warning"></i>哎吆,你的图飞了,赶快去找管理员救命吧~
     </div>
 
-    <!-- 图表来源说明 -->
-    <div 
-      class="chart-bottom-info bootom-source"
-      v-if="chartInfo.Instructions&&JSON.parse(chartInfo.Instructions).isShow
-    ">
-
-      <!-- 图表说明 -->
+    <template v-if="haveAuth">
+      <!-- 图表来源说明 -->
       <div 
-        class="chart-instruction text_oneLine" 
-        v-text="JSON.parse(chartInfo.Instructions).text"
-        :style="`
-          color: ${JSON.parse(chartInfo.Instructions).color};
-          font-size: ${ JSON.parse(chartInfo.Instructions).fontSize }px
-        `"
-      ></div>
-    </div>
-
-    <div class="bootom-source">
-
-      <!-- 自定义来源 -->
-      <div class="source-box">
-        <div class="chart-source text_oneLine" 
-          v-if="chartInfo.SourcesFrom&&JSON.parse(chartInfo.SourcesFrom).isShow"
+        class="chart-bottom-info bootom-source"
+        v-if="chartInfo.Instructions&&JSON.parse(chartInfo.Instructions).isShow
+      ">
+        <!-- 图表说明 -->
+        <div 
+          class="chart-instruction text_oneLine" 
+          v-text="JSON.parse(chartInfo.Instructions).text"
           :style="`
-              color: ${ JSON.parse(chartInfo.SourcesFrom).color };
-              font-size: ${ JSON.parse(chartInfo.SourcesFrom).fontSize }px;
+            color: ${JSON.parse(chartInfo.Instructions).color};
+            font-size: ${ JSON.parse(chartInfo.Instructions).fontSize }px
           `"
-        >
-            source:<em>{{ JSON.parse(chartInfo.SourcesFrom).text}}</em>
-        </div>
+        ></div>
       </div>
+      
 
+      <div class="bootom-source">
 
-      <ul class="right-action" @click.stop>
-        <li v-if="$route.query.source==='ybxcx'&&$route.query.isETAForumChart!='true'"><collectBtn/></li>
-        <!-- eta小程序报告详情中的有收藏 -->
-        <li v-if="$route.query.source==='etamini'&&$route.query.isETAForumChart!='true'" @click="handleChangeChartCollect">{{IsCollect?'取消收藏':'收藏'}}</li>
-        <li v-if="$route.query.source==='ht_chart'&&$route.query.isETAForumChart!='true'"><collectBtnHT/></li>
-        <li @click="copyUrl" class="copy" v-if="isShare"><i class="el-icon-share"/>分享</li>
-        <li @click="refreshChart" v-if="chartInfo.UniqueCode&&$route.query.source!=='smartReportGetImg'&&$route.query.isETAForumChart!='true'"><i class="el-icon-refresh"/>刷新</li>
-      </ul>
-    </div>
+        <!-- 自定义来源 -->
+        <div class="source-box">
+          <div class="chart-source text_oneLine" 
+            v-if="chartInfo.SourcesFrom&&JSON.parse(chartInfo.SourcesFrom).isShow"
+            :style="`
+                color: ${ JSON.parse(chartInfo.SourcesFrom).color };
+                font-size: ${ JSON.parse(chartInfo.SourcesFrom).fontSize }px;
+            `"
+          >
+              source:<em>{{ JSON.parse(chartInfo.SourcesFrom).text}}</em>
+          </div>
+        </div>
+
+
+        <ul class="right-action" @click.stop>
+          <li v-if="$route.query.source==='ybxcx'&&$route.query.isETAForumChart!='true'"><collectBtn/></li>
+          <!-- eta小程序报告详情中的有收藏 -->
+          <li v-if="$route.query.source==='etamini'&&$route.query.isETAForumChart!='true'" @click="handleChangeChartCollect">{{IsCollect?'取消收藏':'收藏'}}</li>
+          <li v-if="$route.query.source==='ht_chart'&&$route.query.isETAForumChart!='true'"><collectBtnHT/></li>
+          <li @click="copyUrl" class="copy" v-if="isShare"><i class="el-icon-share"/>分享</li>
+          <li @click="refreshChart" v-if="chartInfo.UniqueCode&&$route.query.source!=='smartReportGetImg'&&$route.query.isETAForumChart!='true'"><i class="el-icon-refresh"/>刷新</li>
+        </ul>
+      </div>
+    </template>
   </div>
 </template>
 
@@ -93,13 +98,15 @@ import { ChartApi } from '@/request/api';
 import collectBtn from './components/collectBtn.vue'
 import collectBtnHT from './components/collectBtnHT.vue'
 import { useChartRender } from '@/hooks/chart/useChartRender';
+import NoAuth from '@/components/noAuth.vue';
 
 
 export default defineComponent({
   components: {
     chart,
     collectBtn,
-    collectBtnHT
+    collectBtnHT,
+    NoAuth
   },
   setup() {
     const route = useRoute();
@@ -127,6 +134,7 @@ export default defineComponent({
     // 语言 中英文 ch en  默认中文
     const language = ref(route.query.fromPage || route.query.lang || 'zh');
     const IsCollect=ref(false)//图表是否收藏
+    const haveAuth = ref(true)
     const getChartInfo = async (type='') => {
       localStorage.setItem('token', `Bearer ${route.query.token}`)
       if(!code.value) {
@@ -138,6 +146,7 @@ export default defineComponent({
       try {
         let params={
           UniqueCode: code.value || '',
+          AuthToken: route.query?.authToken || ''
         }
         // 如果是来自etamini 也就是eta小程序的报告详情
         if(route.query.source==='etamini'){
@@ -151,16 +160,17 @@ export default defineComponent({
         const { Data } =route.query.isETAForumChart=='true'?await ChartApi.getForumChart(params) : await ChartApi.getChart(params);
         loading.value = false;
         state.chartInfo = Data.ChartInfo;
-        IsCollect.value=Data.IsCollect
-        state.dataList = Data.ChartInfo.Source === 1 ? Data.EdbInfoList : [Data.EdbInfoList[0]];
+        IsCollect.value=Data.IsCollect;
+        haveData.value = true;
+        haveAuth.value = Data.IsAuth;
 
-        //处理英文研报英文设置不全就展示中文
-        // setLangFromEnReport();
-        document.title = language.value==='zh'?Data.ChartInfo.ChartName:Data.ChartInfo.ChartNameEn||Data.ChartInfo.ChartName;
+        document.title = language.value==='zh'?Data.ChartInfo.ChartName:(Data.ChartInfo.ChartNameEn||Data.ChartInfo.ChartName);
 
+        if(!Data.IsAuth) return
+
+        state.dataList = Data.ChartInfo.Source === 1 ? Data.EdbInfoList : [Data.EdbInfoList[0]];
         state.options = useChartRender(Data,language.value as string)
         
-        haveData.value = true;
         type === 'refresh' && ElMessage.success('刷新成功');
 
         //水印配置
@@ -168,12 +178,12 @@ export default defineComponent({
         nextTick(()=>{
           // 社区图表不加水印
           if(route.query.isETAForumChart=='true') return
-          const markDom = document.querySelector('.mark')
+          const markDom = document.querySelector('.mark') as HTMLElement
           Data.WaterMark&&(markDom.style.backgroundImage = `url(${Data.WaterMark})`)
         })
       }catch (e) {
         loading.value = false;
-        haveData.value = false; 
+        haveData.value = false;
       }
 
     };
@@ -243,7 +253,8 @@ export default defineComponent({
       refreshChart,
       copyText,
       handleChangeChartCollect,
-      IsCollect
+      IsCollect,
+      haveAuth
     };
   },
 });

+ 34 - 25
src/views/sheetShow/index.vue

@@ -5,10 +5,11 @@ import { SheetApi } from '@/request/api';
 import sheet from '@/components/sheet.vue'
 import { isMobile } from '@/utils/utils';
 import { IUnknowObject } from '@/types';
-import { ElMessage } from 'element-plus';
 import { useResizeTable } from '@/hooks/sheet/useResizeTable';
 
 const { postSheetHeightMsg } = useResizeTable();
+import { ElMessage, valueEquals } from 'element-plus';
+import NoAuth from '@/components/noAuth.vue';
 
 const route = useRoute();
 const code = ref(route.query.code || '')
@@ -36,23 +37,28 @@ const setDefaultSource=(sourceText:string)=>{
   })
 }
 
+const haveAuth = ref(true)
 const getInfo = async(type='') => {
   loading.value = true;
   const { Data,Ret } = await SheetApi.getInfo({  
     UniqueCode: code.value,
     FromScene: Number(route.query.fromScene||''),
     ReferencedId: Number(route.query.sourceId||''),
-    Uuid: (route.query.uid as string)||""
+    Uuid: (route.query.uid as string)||"",
+    AuthToken: route.query?.authToken as string || ''
   });
   
   loading.value = false;
   if(Ret !== 200) return
 
   info.value = Data;
+  haveAuth.value = Data.IsAuth;
+  showData.value = true; 
+
+  if(!Data.IsAuth) return
   if(!info.value.SourcesFrom){
     info.value.SourcesFrom = Data.ExcelSource?setDefaultSource(Data.ExcelSource):''
   }
-  showData.value = true; 
   type==='refresh'&&ElMessage.success('刷新成功')
 
 }
@@ -78,29 +84,32 @@ const refreshSheet = async()=>{
     element-loading-text="加载中..."
   >
     <!-- <h3 class="title">{{info.ExcelName}}</h3> -->
-    
-    <sheet 
-      :data="info.TableInfo.TableDataList" 
-      :config="info.Config"
-      :sceneConfig="info.ReferencedExcelConfig"
-    />
-    <div class="tool sheet-bottom">
-      <div class="sheet-source" 
-        v-if="info.SourcesFrom&&JSON.parse(info.SourcesFrom).isShow"
-        :style="`
-            color: ${ JSON.parse(info.SourcesFrom).color };
-            font-size: ${ JSON.parse(info.SourcesFrom).fontSize }px;
-        `"
-      >
-          source:<em>{{ JSON.parse(info.SourcesFrom).text}}</em>
+    <template v-if="haveAuth">
+      <sheet 
+        :data="info.TableInfo.TableDataList" 
+        :config="info.Config" 
+        :sceneConfig="info.ReferencedExcelConfig"
+      />
+      <div class="tool sheet-bottom">
+        <div class="sheet-source" 
+          v-if="info.SourcesFrom&&JSON.parse(info.SourcesFrom).isShow"
+          :style="`
+              color: ${ JSON.parse(info.SourcesFrom).color };
+              font-size: ${ JSON.parse(info.SourcesFrom).fontSize }px;
+          `"
+        >
+            source:<em>{{ JSON.parse(info.SourcesFrom).text}}</em>
+        </div>
+        <!-- 占位 -->
+        <div v-else></div>
+        <div class="right-btns">
+          <span @click="postSheetHeightMsg('update')" v-if="route.query.sourceId&&!isMobile()">更新样式</span>
+          <span @click="refreshSheet">刷新</span>
+        </div>
       </div>
-      <!-- 占位 -->
-      <div v-else></div>
-      <div class="right-btns">
-        <span @click="postSheetHeightMsg('update')" v-if="route.query.sourceId&&!isMobile()">更新样式</span>
-        <span @click="refreshSheet">刷新</span>
-      </div>
-    </div>
+    </template>
+
+    <NoAuth v-else/>
   </div>
 </template>