3
0
Fork 0

feat(app): set token if url has token query

This commit is contained in:
woody 2025-04-19 11:52:43 +08:00
parent e89e3ac5e8
commit 6280f3b418
1 changed files with 9 additions and 8 deletions

17
App.vue
View File

@ -6,11 +6,14 @@
* @Date: 2022-11-21 15:11:22 * @Date: 2022-11-21 15:11:22
--> -->
<script> <script>
import { setToken } from '@/config/auth.js'
export default { export default {
onLaunch: function () { onLaunch: function (options) {
let url = window.location.href.split('/#/')[1].split('?')[0]
// //
if (options.query?.token) {
setToken(options.query?.token)
}
const whiteList = [ const whiteList = [
// 'pages/shareRegist/index', // 'pages/shareRegist/index',
// 'pages/shareRegist/success', // 'pages/shareRegist/success',
@ -21,11 +24,9 @@ export default {
// 'pages/shareArea/hiOrder', // 'pages/shareArea/hiOrder',
// 'pages/pay/hiPay' // 'pages/pay/hiPay'
] ]
if (whiteList.indexOf(url) !== -1) { if (whiteList.indexOf(options.path) !== -1) return
} else { this.$store.dispatch('GetInfo')
this.$store.dispatch('GetInfo') this.$store.dispatch('getCarLength')
this.$store.dispatch('getCarLength')
}
uni.hideTabBar({}) uni.hideTabBar({})
}, },
onShow: function () { onShow: function () {