hookehuyr

🐞 fix: 处理首页不需要权限跳转问题

1 /* 1 /*
2 * @Date: 2022-09-19 14:11:05 2 * @Date: 2022-09-19 14:11:05
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-10-13 21:50:48 4 + * @LastEditTime: 2022-11-01 11:49:42
5 * @FilePath: /swx/src/app.js 5 * @FilePath: /swx/src/app.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
8 import { createApp } from 'vue' 8 import { createApp } from 'vue'
9 import { createPinia } from 'pinia' 9 import { createPinia } from 'pinia'
10 -
11 import './app.less' 10 import './app.less'
12 import '@/components/vant-weapp/common/index.wxss' 11 import '@/components/vant-weapp/common/index.wxss'
13 import request from './utils/request'; 12 import request from './utils/request';
14 import Taro from '@tarojs/taro' 13 import Taro from '@tarojs/taro'
14 +import { getCurrentPageUrl } from "@/utils/weapp";
15 15
16 const App = createApp({ 16 const App = createApp({
17 // 可以使用所有的 Vue 生命周期方法 17 // 可以使用所有的 Vue 生命周期方法
...@@ -19,9 +19,10 @@ const App = createApp({ ...@@ -19,9 +19,10 @@ const App = createApp({
19 }, 19 },
20 20
21 // 对应 onLaunch 21 // 对应 onLaunch
22 - onLaunch() { 22 + onLaunch(options) {
23 - // 未授权状态跳转授权页面 23 + // 未授权状态跳转授权页面,首页不需要权限
24 - if (!wx.getStorageSync("sessionid")) { 24 + const path = options.path;
25 + if (path !== 'pages/index/index' && !wx.getStorageSync("sessionid")) {
25 wx.navigateTo({ 26 wx.navigateTo({
26 url: './pages/auth/index' 27 url: './pages/auth/index'
27 }) 28 })
......