Prechádzať zdrojové kódy

优化组态图和大屏的token设置,避免跳转时候带token参数,减少渲染时间

yanglzh 2 rokov pred
rodič
commit
e57a008724

+ 3 - 1
src/views/iot/configuration/list/index.vue

@@ -58,7 +58,9 @@ const { params, tableData, getList, loading } = useSearch<any[]>(api.getList, 'd
 getList();
 
 function getTokenUrl(url: string) {
-  const tokenUrl = import.meta.env.VITE_TOPO_URL + '?token=' + encodeURIComponent(Session.get('token'))
+  localStorage.setItem('token', Session.get('token'));
+  const tokenUrl = import.meta.env.VITE_TOPO_URL
+  // const tokenUrl = import.meta.env.VITE_TOPO_URL + '?token=' + encodeURIComponent(Session.get('token'))
   return getOrigin(tokenUrl + url)
 };
 

+ 6 - 2
src/views/iot/configuration/screen/index.vue

@@ -91,12 +91,16 @@ const add = async () => {
 };
 
 const edit = async (row: any) => {
-  const url = import.meta.env.VITE_SCREEN_URL + '?token=' + encodeURIComponent(Session.get('token')) + '#/chart/home/' + row.id;
+  localStorage.setItem('token', Session.get('token'));
+  const url = import.meta.env.VITE_SCREEN_URL + '#/chart/home/' + row.id;
+  // const url = import.meta.env.VITE_SCREEN_URL + '?token=' + encodeURIComponent(Session.get('token')) + '#/chart/home/' + row.id;
   window.open(url);
 };
 
 const preview = async (row: any) => {
-  const url = import.meta.env.VITE_SCREEN_URL + '?token=' + encodeURIComponent(Session.get('token')) + '#/chart/preview/' + row.id;
+  localStorage.setItem('token', Session.get('token'));
+  const url = import.meta.env.VITE_SCREEN_URL + '#/chart/preview/' + row.id;
+  // const url = import.meta.env.VITE_SCREEN_URL + '?token=' + encodeURIComponent(Session.get('token')) + '#/chart/preview/' + row.id;
   window.open(url);
 };