fix: bug修改
This commit is contained in:
@@ -88,11 +88,11 @@
|
||||
import { ref } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
// import { saveUserInfo } from './api';
|
||||
import {saveUserInfo} from '@/sheep/api/user'
|
||||
import { saveUserInfo } from '@/sheep/api/user';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import ReportApi from '@/sheep/api/report';
|
||||
import ReportApi from '@/sheep/api/report';
|
||||
|
||||
const { getToken } = ReportApi;
|
||||
const { getToken } = ReportApi;
|
||||
|
||||
const form = ref({
|
||||
// token: null,
|
||||
@@ -106,17 +106,33 @@
|
||||
|
||||
const token = ref('');
|
||||
|
||||
onLoad(async (e) => {
|
||||
onLoad(async (options) => {
|
||||
const queryObj = Object.assign({}, options);
|
||||
|
||||
if (!e.token) {
|
||||
if (options.token) {
|
||||
// queryObj.open = queryObj.open || 0;
|
||||
|
||||
if (!queryObj.open) {
|
||||
queryObj.open = 0;
|
||||
const queryStr = Object.entries(queryObj)
|
||||
.map(([k, v]) => `${k}=${v}`)
|
||||
.join('&');
|
||||
window.location.href = `${window.location.href.replace(/\?.*$/g, '')}?${queryStr}`;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
const res = await getToken();
|
||||
window.location.href =
|
||||
window.location.href.replace(/\?.*$/g, '') + '?token=' + res.data.accessToken;
|
||||
queryObj.open = queryObj.open || 1;
|
||||
queryObj.token = res.data.accessToken;
|
||||
const queryStr = Object.entries(queryObj)
|
||||
.map(([k, v]) => `${k}=${v}`)
|
||||
.join('&');
|
||||
window.location.href = `${window.location.href.replace(/\?.*$/g, '')}?${queryStr}`;
|
||||
return;
|
||||
}
|
||||
|
||||
token.value = e.token;
|
||||
uni.setStorageSync('token', e.token);
|
||||
token.value = options.token;
|
||||
uni.setStorageSync('token', options.token);
|
||||
});
|
||||
|
||||
const onTap = (key, value) => {
|
||||
|
||||
Reference in New Issue
Block a user