fix: request before getting token
parent
fb9f4b4342
commit
8b2ed25109
|
|
@ -1,5 +1,6 @@
|
|||
export default defineAppConfig({
|
||||
pages: [
|
||||
'pages/Loading/Loading',
|
||||
'pages/index/index',
|
||||
'pages/repair/repair',
|
||||
'pages/user/user',
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
export default definePageConfig({
|
||||
usingComponents: {},
|
||||
});
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
import { AtActivityIndicator } from 'taro-ui';
|
||||
import { Component, ReactNode } from 'react';
|
||||
import Taro from '@tarojs/taro';
|
||||
import pt from '@/plain-text';
|
||||
import { View } from '@tarojs/components';
|
||||
import './Loading.scss';
|
||||
|
||||
export default class LoadingPage extends Component {
|
||||
componentDidMount(): void {
|
||||
Taro.setNavigationBarTitle({
|
||||
title: pt.get().navBar.loading,
|
||||
});
|
||||
}
|
||||
render(): ReactNode {
|
||||
return (
|
||||
<View>
|
||||
<AtActivityIndicator
|
||||
mode='center'
|
||||
content={pt.get().actIndicator.loading}
|
||||
></AtActivityIndicator>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
export interface NavBarTitle {
|
||||
notFound: string;
|
||||
loading: string;
|
||||
ticketDetail: string;
|
||||
ticketList: string;
|
||||
askLeave: string;
|
||||
|
|
@ -16,6 +17,7 @@ export interface NavBarTitle {
|
|||
|
||||
export const navBarTitleZhCn: NavBarTitle = {
|
||||
notFound: '连接失败',
|
||||
loading: '加载中',
|
||||
ticketDetail: '工单详情',
|
||||
ticketList: '所有工单',
|
||||
askLeave: '请假单填写',
|
||||
|
|
@ -32,6 +34,7 @@ export const navBarTitleZhCn: NavBarTitle = {
|
|||
|
||||
export const navBarTitleEnUs: NavBarTitle = {
|
||||
notFound: 'Failed',
|
||||
loading: 'Loading',
|
||||
ticketDetail: 'Ticket Detail',
|
||||
ticketList: 'All Tickets',
|
||||
askLeave: 'Ask for leave',
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ export function loginAte() {
|
|||
data: data.token,
|
||||
});
|
||||
wechatUser.setToken(data.token);
|
||||
Taro.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
});
|
||||
getLocaleData();
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
|
|||
|
|
@ -13,14 +13,15 @@ export function pingAte() {
|
|||
})
|
||||
.then((res) => {
|
||||
console.log(res.data);
|
||||
checkLogin((success) => {
|
||||
if (success) {
|
||||
wechatUser.setToken(checkToken());
|
||||
getInfo();
|
||||
} else {
|
||||
// checkLogin((success) => {
|
||||
// if (success) {
|
||||
// wechatUser.setToken(checkToken());
|
||||
// getInfo();
|
||||
// } else {
|
||||
// loginAte();
|
||||
// }
|
||||
// });
|
||||
loginAte();
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err.errMsg);
|
||||
|
|
|
|||
Loading…
Reference in New Issue