wenhongquan il y a 2 ans
Parent
commit
0d9697eac2
2 fichiers modifiés avec 13 ajouts et 9 suppressions
  1. 3 2
      src/components/MapView/index.tsx
  2. 10 7
      src/store/useMainStore.ts

+ 3 - 2
src/components/MapView/index.tsx

@@ -37,8 +37,9 @@ export default defineComponent({
     let tipcontentRef = ref<Element>();
 
     const mainstore = useMainStore();
+    mainstore.getUserTicket();
     
-    const ticket = mainstore.getUserTicket();
+  
 
     const linksysdata = reactive([
       {
@@ -136,7 +137,7 @@ export default defineComponent({
                   : '')
               }
               datatype={`${index + 1 == linksysdata.length ? '1' : '0'}`}>
-              <a href={i.url+"?ticket="+ticket}>
+              <a href={i.url + "?ticket=" + mainstore.userticket}>
                 <div class="sys-item-img">
                   <img src={i.image} />
                 </div>

+ 10 - 7
src/store/useMainStore.ts

@@ -17,6 +17,7 @@ export interface MainStateType {
   videohandle: any;
   videoisshow: Boolean;
   videotitle: string;
+  userticket: string;
 }
 
 export interface MainActionsType {
@@ -36,7 +37,8 @@ export default defineStore<'main', MainStateType, {}, MainActionsType>('main', {
     isshoweventlist: false,
     videohandle: {},
     videoisshow: false,
-    videotitle:"-",
+    videotitle: '-',
+    userticket:"",
   }),
   actions: {
     async getMessage(params) {
@@ -48,7 +50,7 @@ export default defineStore<'main', MainStateType, {}, MainActionsType>('main', {
       }
     },
     setEventListshow(isshow) {
-       this.isshoweventlist = isshow;
+      this.isshoweventlist = isshow;
     },
     async getUserInfo(ticket) {
       try {
@@ -65,20 +67,21 @@ export default defineStore<'main', MainStateType, {}, MainActionsType>('main', {
         console.log(err);
       }
     },
-    async getUserTicket() { 
+    async getUserTicket() {
       const data = await getTicket();
+      this.userticket = data.data;
       return data.data;
     },
     pushReqToken(cancelToken) {
       this.cancelReqToken.push(cancelToken);
     },
     removeToken() {
-       window.localStorage.removeItem('Authorization');
+      window.localStorage.removeItem('Authorization');
     },
     clearReqToken() {
-        this.cancelReqToken.forEach((cancel) => {
-         cancel('axios cancel by router change');
-       });
+      this.cancelReqToken.forEach((cancel) => {
+        cancel('axios cancel by router change');
+      });
       this.cancelReqToken = [];
     },
   },