fix: request before getting token
parent
fb9f4b4342
commit
8b2ed25109
|
|
@ -1,5 +1,6 @@
|
||||||
export default defineAppConfig({
|
export default defineAppConfig({
|
||||||
pages: [
|
pages: [
|
||||||
|
'pages/Loading/Loading',
|
||||||
'pages/index/index',
|
'pages/index/index',
|
||||||
'pages/repair/repair',
|
'pages/repair/repair',
|
||||||
'pages/user/user',
|
'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 {
|
export interface NavBarTitle {
|
||||||
notFound: string;
|
notFound: string;
|
||||||
|
loading: string;
|
||||||
ticketDetail: string;
|
ticketDetail: string;
|
||||||
ticketList: string;
|
ticketList: string;
|
||||||
askLeave: string;
|
askLeave: string;
|
||||||
|
|
@ -16,6 +17,7 @@ export interface NavBarTitle {
|
||||||
|
|
||||||
export const navBarTitleZhCn: NavBarTitle = {
|
export const navBarTitleZhCn: NavBarTitle = {
|
||||||
notFound: '连接失败',
|
notFound: '连接失败',
|
||||||
|
loading: '加载中',
|
||||||
ticketDetail: '工单详情',
|
ticketDetail: '工单详情',
|
||||||
ticketList: '所有工单',
|
ticketList: '所有工单',
|
||||||
askLeave: '请假单填写',
|
askLeave: '请假单填写',
|
||||||
|
|
@ -32,6 +34,7 @@ export const navBarTitleZhCn: NavBarTitle = {
|
||||||
|
|
||||||
export const navBarTitleEnUs: NavBarTitle = {
|
export const navBarTitleEnUs: NavBarTitle = {
|
||||||
notFound: 'Failed',
|
notFound: 'Failed',
|
||||||
|
loading: 'Loading',
|
||||||
ticketDetail: 'Ticket Detail',
|
ticketDetail: 'Ticket Detail',
|
||||||
ticketList: 'All Tickets',
|
ticketList: 'All Tickets',
|
||||||
askLeave: 'Ask for leave',
|
askLeave: 'Ask for leave',
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,9 @@ export function loginAte() {
|
||||||
data: data.token,
|
data: data.token,
|
||||||
});
|
});
|
||||||
wechatUser.setToken(data.token);
|
wechatUser.setToken(data.token);
|
||||||
|
Taro.reLaunch({
|
||||||
|
url: '/pages/index/index',
|
||||||
|
});
|
||||||
getLocaleData();
|
getLocaleData();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,15 @@ export function pingAte() {
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data);
|
console.log(res.data);
|
||||||
checkLogin((success) => {
|
// checkLogin((success) => {
|
||||||
if (success) {
|
// if (success) {
|
||||||
wechatUser.setToken(checkToken());
|
// wechatUser.setToken(checkToken());
|
||||||
getInfo();
|
// getInfo();
|
||||||
} else {
|
// } else {
|
||||||
|
// loginAte();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
loginAte();
|
loginAte();
|
||||||
}
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err.errMsg);
|
console.log(err.errMsg);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue