app.js
1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* @Date: 2025-06-28 10:33:00
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-07-08 17:49:20
* @FilePath: /jgdl/src/app.js
* @Description: 文件描述
*/
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import './app.less'
import { routerStore } from '@/stores/router'
import Taro from '@tarojs/taro'
const App = createApp({
// 对应 onLaunch
onLaunch(options) {
// 未授权状态跳转授权页面,首页不需要权限
const path = options.path;
const query = options.query;
// 缓存没有权限的地址
const router = routerStore();
router.add(path);
// if (path !== 'pages/index/index' && !wx.getStorageSync("sessionid")) {
if (!wx.getStorageSync("sessionid")) {
console.warn("没有权限");
if (path === 'pages/detail/index') {
Taro.navigateTo({
url: `./pages/auth/index?url=${path}&id=${query.id}`,
})
} else {
Taro.navigateTo({
url: './pages/auth/index?url=' + path,
})
}
}
},
onShow(options) {
},
// 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖
});
App.use(createPinia())
export default App