吉安感知网项目-前端
罗广辉
3 days ago 1d552a3bad95caae4af15322df28e6240b797693
applications/task-work-order/src/App.vue
@@ -1,27 +1,43 @@
<template>
  <router-view />
   <router-view />
</template>
<script setup>
import { loginWithMiniProgramApi } from '@/api/zkxt'
import { loginApi, loginWithMiniProgramApi } from '@/api/zkxt'
import { useStore } from 'vuex'
const store = useStore()
const authToken = window.localStorage?.authToken
function getToken() {
   loginWithMiniProgramApi({username: 'admin'}).then(res => {
      console.log(res)
   })
store.commit('setXtToken', authToken)
const { VITE_APP_ENV } = import.meta.env
if (VITE_APP_ENV === 'development') {
   function getXTToken() {
      loginApi({
         "belongSystem": "basic",
         "username": "admin",
         "password": "geovis@123"
      })
         .then(res => {
            store.commit('setXtToken', res.data.data.access_token)
         })
         .catch(err => {
            const devXtToken =
               'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6IjEzNjIyODkxLWY3ZjQtNGE1NS1iNjhiLTRhZDk2OTJmMmFjOSIsInVzZXJuYW1lIjoiYWRtaW4ifQ.nVvvF69LcBnnzntZm3rzN7cEOfIhJyC7dOGNPPv_XRmV0iokED8Ew8N7EPTuE5nWPL2JULe8UoJD8dy0GLE0DQ'
            store.commit('setXtToken', devXtToken)
         })
   }
   getXTToken()
   setInterval(getXTToken, 600000)
}
getToken()
setInterval(() => {
   getToken()
}, 600000)
</script>
<style>
html,
body,
#app {
  width: 100%;
  height: 100%;
   width: 100%;
   height: 100%;
}
</style>