|
@@ -1,16 +1,19 @@
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import naviInterceptor from '@/interceptors/naviInterceptor.js';
|
|
import naviInterceptor from '@/interceptors/naviInterceptor.js';
|
|
|
import { useSafeAreaStore } from '@/stores/safeArea.js';
|
|
import { useSafeAreaStore } from '@/stores/safeArea.js';
|
|
|
|
|
+import { useUserInfoStore } from '@/stores/userInfo';
|
|
|
import { onLaunch, onShow } from '@dcloudio/uni-app';
|
|
import { onLaunch, onShow } from '@dcloudio/uni-app';
|
|
|
import { getSafeArea } from '@/utils/system.js';
|
|
import { getSafeArea } from '@/utils/system.js';
|
|
|
-import { useDictStore } from '@/stores/dict';
|
|
|
|
|
|
|
+import { tokenApi } from '@/service/apis';
|
|
|
|
|
|
|
|
onLaunch(() => {
|
|
onLaunch(() => {
|
|
|
// 导航拦截器初始化
|
|
// 导航拦截器初始化
|
|
|
naviInterceptor();
|
|
naviInterceptor();
|
|
|
- // 数据字典初始化
|
|
|
|
|
- const dictStore = useDictStore();
|
|
|
|
|
- dictStore.refresh();
|
|
|
|
|
|
|
+ // 程序启动前检测登录状态
|
|
|
|
|
+ tokenApi.refreshToken().then(token => {
|
|
|
|
|
+ const userInfoStore = useUserInfoStore();
|
|
|
|
|
+ userInfoStore.token = token;
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
onShow(() => {
|
|
onShow(() => {
|