Browse Source

研报插入图表等域名取后端接口返回数据

jwyu 1 year ago
parent
commit
d3110918e4

+ 8 - 1
src/router/index.js

@@ -11,6 +11,7 @@
 import { createRouter, createWebHistory } from "vue-router";
 import {useCachedViewsStore} from '@/store/modules/cachedViews'
 import {useAuthBtnStore} from '@/store/modules/authBtn'
+import {usePublicSettingStore} from '@/store/modules/publicSetting'
 
 import { pptRoutes } from "./ppt";
 import {pptENRoutes} from './pptEn'
@@ -118,7 +119,13 @@ function setKeeplive(to){
 router.beforeEach(async(to, from, next) => {
 	setKeeplive(to)
     const authBtnStore = useAuthBtnStore()
-    to.path!='/login'&&await authBtnStore.getAuthList()
+	const publicSettingStore = usePublicSettingStore()
+	if(to.path!='/login'){
+		authBtnStore.getAuthList()
+		if(Object.keys(publicSettingStore.publicSetting).length===0){
+			publicSettingStore.getPublicSetting()
+		}
+	}
 	document.title = to.meta.title;
   	next();
 });

+ 7 - 3
src/views/report/AddReport.vue

@@ -11,7 +11,9 @@ import { showToast,showDialog  } from 'vant'
 import { useRouter } from 'vue-router'
 import {useCachedViewsStore} from '@/store/modules/cachedViews'
 import {reportManageBtn} from '@/hooks/useAuthBtn'
+import {usePublicSettingStore} from '@/store/modules/publicSetting'
 const cachedViewsStore=useCachedViewsStore()
+const publicSettingStore = usePublicSettingStore()
 
 const router=useRouter()
 
@@ -79,16 +81,18 @@ function handleInsert({list,type,chartType}){
         reportContentEditorIns.selection.get().addRange(lastFocusPosition.value)
     }
     if(type==='iframe'){
-        let link;
+        let link=publicSettingStore.publicSetting.ChartViewUrl;
         if(chartType==='chart'){
-            link=import.meta.env.MODE==='production'?'https://chartlib.hzinsights.com/chartshow':'https://charttest.hzinsights.com/chartshow'
+            // link=import.meta.env.MODE==='production'?'https://chartlib.hzinsights.com/chartshow':'https://charttest.hzinsights.com/chartshow'
+            link=link+'/chartshow'
             list.forEach(item => {
                 reportContentEditorIns.html.insert(`<p style='text-align:left; margin-top:10px;'>
 						<iframe src='${link}?code=${item}&fromPage=' width='100%' height='350' style='border-width:0px; min-height:350px;'></iframe>
 					</p>`)
             });
         }else if(chartType==='sheet'){
-            link=import.meta.env.MODE==='production'?'https://chartlib.hzinsights.com/sheetshow':'https://charttest.hzinsights.com/sheetshow'
+            // link=import.meta.env.MODE==='production'?'https://chartlib.hzinsights.com/sheetshow':'https://charttest.hzinsights.com/sheetshow'
+            link=link+'/sheetshow'
             list.forEach(item => {
                 reportContentEditorIns.html.insert(`<p style='text-align:left; margin-top:10px;'>
 						<iframe src='${link}?code=${item}' class='iframe${item}'  width='100%' style='border-width:0px;'></iframe>

+ 5 - 3
src/views/report/EditReport.vue

@@ -159,16 +159,18 @@ function handleInsert({list,type,chartType}){
         reportContentEditorIns.selection.get().addRange(lastFocusPosition.value)
     }
     if(type==='iframe'){
-        let link;
+        let link=publicSettingStore.publicSetting.ChartViewUrl;
         if(chartType==='chart'){
-            link=import.meta.env.MODE==='production'?'https://chartlib.hzinsights.com/chartshow':'https://charttest.hzinsights.com/chartshow'
+            // link=import.meta.env.MODE==='production'?'https://chartlib.hzinsights.com/chartshow':'https://charttest.hzinsights.com/chartshow'
+            link=link+'/chartshow'
             list.forEach(item => {
                 reportContentEditorIns.html.insert(`<p style='text-align:left; margin-top:10px;'>
 						<iframe src='${link}?code=${item}&fromPage=' width='100%' height='350' style='border-width:0px; min-height:350px;'></iframe>
 					</p>`,false)
             });
         }else if(chartType==='sheet'){
-            link=import.meta.env.MODE==='production'?'https://chartlib.hzinsights.com/sheetshow':'https://charttest.hzinsights.com/sheetshow'
+            // link=import.meta.env.MODE==='production'?'https://chartlib.hzinsights.com/sheetshow':'https://charttest.hzinsights.com/sheetshow'
+            link=link+'/sheetshow'
             list.forEach(item => {
                 reportContentEditorIns.html.insert(`<p style='text-align:left; margin-top:10px;'>
 						<iframe src='${link}?code=${item}' class='iframe${item}'  width='100%' style='border-width:0px;'></iframe>

+ 7 - 3
src/views/report/chapter/Detail.vue

@@ -13,11 +13,13 @@ import { showToast,showDialog } from 'vant'
 import {useUploadFileToOSS} from '@/hooks/useUploadFileToOSS'
 import MD5 from 'js-md5'
 import {reportManageBtn} from '@/hooks/useAuthBtn'
+import {usePublicSettingStore} from '@/store/modules/publicSetting'
 
 const route=useRoute()
 const router=useRouter()
 
 const userInfo=useUserInfo()
+const publicSettingStore = usePublicSettingStore()
 
 const {lastFocusPosition,initFroalaEditor,imgUploadFlag,frolaEditorContentChange}=useInitFroalaEditor()
 let reportContentEditorIns=null//报告内容编辑器实例
@@ -262,16 +264,18 @@ function handleInsert({list,type,chartType}){
         reportContentEditorIns.selection.get().addRange(lastFocusPosition.value)
     }
     if(type==='iframe'){
-        let link;
+        let link=publicSettingStore.publicSetting.ChartViewUrl;
         if(chartType==='chart'){
-            link=import.meta.env.MODE==='production'?'https://chartlib.hzinsights.com/chartshow':'https://charttest.hzinsights.com/chartshow'
+            // link=import.meta.env.MODE==='production'?'https://chartlib.hzinsights.com/chartshow':'https://charttest.hzinsights.com/chartshow'
+            link=link+'/chartshow'
             list.forEach(item => {
                 reportContentEditorIns.html.insert(`<p style='text-align:left; margin-top:10px;'>
 						<iframe src='${link}?code=${item}&fromPage=' width='100%' height='350' style='border-width:0px; min-height:350px;'></iframe>
 					</p>`)
             });
         }else if(chartType==='sheet'){
-            link=import.meta.env.MODE==='production'?'https://chartlib.hzinsights.com/sheetshow':'https://charttest.hzinsights.com/sheetshow'
+            // link=import.meta.env.MODE==='production'?'https://chartlib.hzinsights.com/sheetshow':'https://charttest.hzinsights.com/sheetshow'
+            link=link+'/sheetshow'
             list.forEach(item => {
                 reportContentEditorIns.html.insert(`<p style='text-align:left; margin-top:10px;'>
 						<iframe src='${link}?code=${item}' class='iframe${item}'  width='100%' style='border-width:0px;'></iframe>

+ 7 - 3
src/views/reportEn/AddReport.vue

@@ -11,10 +11,12 @@ import { useRoute, useRouter } from 'vue-router'
 import {useInitFroalaEditor} from '@/hooks/useFroalaEditor'
 import {useCachedViewsStore} from '@/store/modules/cachedViews'
 import {enReportManageBtn} from '@/hooks/useAuthBtn'
+import {usePublicSettingStore} from '@/store/modules/publicSetting'
 
 const cachedViewsStore=useCachedViewsStore()
 const router=useRouter()
 const route=useRoute()
+const publicSettingStore = usePublicSettingStore()
 
 const {lastFocusPosition,frolaEditorContentChange,imgUploadFlag,initFroalaEditor}=useInitFroalaEditor()
 
@@ -159,16 +161,18 @@ function handleInsert({list,type,chartType}){
         reportContentIns.selection.get().addRange(lastFocusPosition.value)
     }
     if(type==='iframe'){
-        let link;
+        let link=publicSettingStore.publicSetting.ChartViewUrl;
         if(chartType==='chart'){
-            link=import.meta.env.MODE==='production'?'https://chartlib.hzinsights.com/chartshow':'https://charttest.hzinsights.com/chartshow'
+            // link=import.meta.env.MODE==='production'?'https://chartlib.hzinsights.com/chartshow':'https://charttest.hzinsights.com/chartshow'
+            link=link+'/chartshow'
             list.forEach(item => {
                 reportContentIns.html.insert(`<p style='text-align:left; margin-top:10px;'>
 						<iframe src='${link}?code=${item}&fromPage=en' width='100%' height='350' style='border-width:0px; min-height:350px;'></iframe>
 					</p>`)
             });
         }else if(chartType==='sheet'){
-            link=import.meta.env.MODE==='production'?'https://chartlib.hzinsights.com/sheetshow':'https://charttest.hzinsights.com/sheetshow'
+            // link=import.meta.env.MODE==='production'?'https://chartlib.hzinsights.com/sheetshow':'https://charttest.hzinsights.com/sheetshow'
+            link=link+'/sheetshow'
             list.forEach(item => {
                 reportContentIns.html.insert(`<p style='text-align:left; margin-top:10px;'>
 						<iframe src='${link}?code=${item}' class='iframe${item}'  width='100%' style='border-width:0px;'></iframe>