fix: dutyinfo display; relaunch to Loading page
parent
86398ff9a9
commit
0dc87d06d6
|
|
@ -3,6 +3,7 @@ import { Component, ReactNode } from 'react';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import pt from '@/plain-text';
|
import pt from '@/plain-text';
|
||||||
import { View } from '@tarojs/components';
|
import { View } from '@tarojs/components';
|
||||||
|
import wechatUser from '@/wechat';
|
||||||
import './Loading.scss';
|
import './Loading.scss';
|
||||||
|
|
||||||
export default class LoadingPage extends Component {
|
export default class LoadingPage extends Component {
|
||||||
|
|
@ -10,6 +11,11 @@ export default class LoadingPage extends Component {
|
||||||
Taro.setNavigationBarTitle({
|
Taro.setNavigationBarTitle({
|
||||||
title: pt.get().navBar.loading,
|
title: pt.get().navBar.loading,
|
||||||
});
|
});
|
||||||
|
if (wechatUser.getToken()) {
|
||||||
|
Taro.reLaunch({
|
||||||
|
url: '/pages/index/index',
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
render(): ReactNode {
|
render(): ReactNode {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,22 @@ import { Moment } from 'moment';
|
||||||
|
|
||||||
export interface CommonText {
|
export interface CommonText {
|
||||||
createdAtText(time: Moment): string;
|
createdAtText(time: Moment): string;
|
||||||
|
offDutyReason: string;
|
||||||
|
place: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const commonTextZhCn: CommonText = {
|
export const commonTextZhCn: CommonText = {
|
||||||
createdAtText(time: Moment): string {
|
createdAtText(time: Moment): string {
|
||||||
return '创建于 ' + time.format('YYYY-MM-DD HH:mm');
|
return '创建于 ' + time.format('YYYY-MM-DD HH:mm');
|
||||||
},
|
},
|
||||||
|
offDutyReason: '正常值班下班',
|
||||||
|
place: '东三-204',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const commonTextEnUs: CommonText = {
|
export const commonTextEnUs: CommonText = {
|
||||||
createdAtText(time: Moment): string {
|
createdAtText(time: Moment): string {
|
||||||
return 'Created at ' + time.format('YYYY-MM-DD HH:mm');
|
return 'Created at ' + time.format('YYYY-MM-DD HH:mm');
|
||||||
},
|
},
|
||||||
|
offDutyReason: 'Normal Shift',
|
||||||
|
place: 'E3-204',
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import MainPage from '@/pages/index';
|
import MainPage from '@/pages/index';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import wechatUser from '@/wechat';
|
import wechatUser from '@/wechat';
|
||||||
|
import pt from '@/plain-text';
|
||||||
import { getUrl } from '.';
|
import { getUrl } from '.';
|
||||||
|
|
||||||
export function getDutyInfo(that: MainPage) {
|
export function getDutyInfo(that: MainPage) {
|
||||||
|
|
@ -24,6 +25,15 @@ export function getDutyInfo(that: MainPage) {
|
||||||
rs: former.trans(true),
|
rs: former.trans(true),
|
||||||
dutyData: data,
|
dutyData: data,
|
||||||
});
|
});
|
||||||
|
if (data.currentDuty === '0') {
|
||||||
|
that.setState({
|
||||||
|
dutyData: {
|
||||||
|
...that.state.dutyData,
|
||||||
|
place: pt.get().common.place,
|
||||||
|
offDutyReason: pt.get().common.offDutyReason,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err.errMsg);
|
console.log(err.errMsg);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue