refactor: merge index & member page
parent
a7c96b2e8c
commit
f3f5be793b
|
|
@ -103,6 +103,7 @@ export default {
|
||||||
isInDuty: true,
|
isInDuty: true,
|
||||||
inDutyCnt: 6,
|
inDutyCnt: 6,
|
||||||
currentDuty: '3',
|
currentDuty: '3',
|
||||||
|
place: '204',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'POST /login': {
|
'POST /login': {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ export default defineAppConfig({
|
||||||
pages: [
|
pages: [
|
||||||
'pages/index/index',
|
'pages/index/index',
|
||||||
'pages/repair/repair',
|
'pages/repair/repair',
|
||||||
'pages/member/member',
|
|
||||||
'pages/user/user',
|
'pages/user/user',
|
||||||
'pages/user/myTicket/myTicket',
|
'pages/user/myTicket/myTicket',
|
||||||
'pages/user/inform/inform',
|
'pages/user/inform/inform',
|
||||||
|
|
@ -28,10 +27,6 @@ export default defineAppConfig({
|
||||||
pagePath: 'pages/repair/repair',
|
pagePath: 'pages/repair/repair',
|
||||||
text: '维修',
|
text: '维修',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
pagePath: 'pages/member/member',
|
|
||||||
text: '管理',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
pagePath: 'pages/user/user',
|
pagePath: 'pages/user/user',
|
||||||
text: '我的',
|
text: '我的',
|
||||||
|
|
|
||||||
|
|
@ -7,35 +7,20 @@ import 'taro-ui/dist/style/index.scss';
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
|
|
||||||
const navList: () => Array<Taro.TabBarItem> = () => {
|
const navList: () => Array<Taro.TabBarItem> = () => {
|
||||||
return wechatUser.getAccess()
|
return [
|
||||||
? [
|
{
|
||||||
{
|
pagePath: '/pages/index/index',
|
||||||
pagePath: '/pages/member/member',
|
text: pt.get().tabBar.indexText,
|
||||||
text: pt.get().tabBar.memberText,
|
},
|
||||||
},
|
{
|
||||||
{
|
pagePath: '/pages/repair/repair',
|
||||||
pagePath: '/pages/repair/repair',
|
text: pt.get().tabBar.repairText,
|
||||||
text: pt.get().tabBar.repairText,
|
},
|
||||||
},
|
{
|
||||||
{
|
pagePath: '/pages/user/user',
|
||||||
pagePath: '/pages/user/user',
|
text: pt.get().tabBar.userText,
|
||||||
text: pt.get().tabBar.userText,
|
},
|
||||||
},
|
];
|
||||||
]
|
|
||||||
: [
|
|
||||||
{
|
|
||||||
pagePath: '/pages/index/index',
|
|
||||||
text: pt.get().tabBar.indexText,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
pagePath: '/pages/repair/repair',
|
|
||||||
text: pt.get().tabBar.repairText,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
pagePath: '/pages/user/user',
|
|
||||||
text: pt.get().tabBar.userText,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const tabList = () => {
|
const tabList = () => {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import { AtTimeline } from 'taro-ui';
|
||||||
import pt from '@/plain-text';
|
import pt from '@/plain-text';
|
||||||
import tick from '@/assets/icons/MainPage/tick.svg';
|
import tick from '@/assets/icons/MainPage/tick.svg';
|
||||||
import cross from '@/assets/icons/MainPage/cross.svg';
|
import cross from '@/assets/icons/MainPage/cross.svg';
|
||||||
|
import clock from '@/assets/icons/MemberPage/clock.svg';
|
||||||
|
import wechatUser from '@/wechat';
|
||||||
|
|
||||||
export class DutyData {
|
export class DutyData {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
@ -17,7 +19,7 @@ export class DutyData {
|
||||||
|
|
||||||
isInDuty: boolean;
|
isInDuty: boolean;
|
||||||
inDutyCnt?: number;
|
inDutyCnt?: number;
|
||||||
currentDuty?: 'off' | '1' | '2' | '3';
|
currentDuty?: 'off' | '1' | '2' | '3' | 'others';
|
||||||
offDutyReason?: string;
|
offDutyReason?: string;
|
||||||
dutyRecoverTime?: string;
|
dutyRecoverTime?: string;
|
||||||
place: string;
|
place: string;
|
||||||
|
|
@ -33,7 +35,7 @@ class Card extends Component {
|
||||||
const place = this.props.place;
|
const place = this.props.place;
|
||||||
const dc = pt.get().mainPage.dutyCard;
|
const dc = pt.get().mainPage.dutyCard;
|
||||||
const title = inDuty ? dc.inDuty.title : dc.offDuty.title;
|
const title = inDuty ? dc.inDuty.title : dc.offDuty.title;
|
||||||
const iconsrc = inDuty ? tick : cross;
|
const iconsrc = inDuty ? tick : wechatUser.getAccess() ? clock : cross;
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<View
|
<View
|
||||||
|
|
@ -66,6 +68,11 @@ class Card extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DutyInfo extends Component {
|
export class DutyInfo extends Component {
|
||||||
|
state: {
|
||||||
|
isLoading: false;
|
||||||
|
isDisable: false;
|
||||||
|
};
|
||||||
|
|
||||||
props = {
|
props = {
|
||||||
data: new DutyData(),
|
data: new DutyData(),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,19 @@ import { Component, ReactNode } from 'react';
|
||||||
import { View } from '@tarojs/components';
|
import { View } from '@tarojs/components';
|
||||||
import { AtTimeline } from 'taro-ui';
|
import { AtTimeline } from 'taro-ui';
|
||||||
import pt from '@/plain-text';
|
import pt from '@/plain-text';
|
||||||
|
import wechatUser from '@/wechat';
|
||||||
|
|
||||||
export class StepInfo extends Component {
|
export class StepInfo extends Component {
|
||||||
render(): ReactNode {
|
render(): ReactNode {
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<AtTimeline items={pt.get().mainPage.stepList}></AtTimeline>
|
<AtTimeline
|
||||||
|
items={
|
||||||
|
wechatUser.getAccess()
|
||||||
|
? pt.get().memberPage.stepList
|
||||||
|
: pt.get().mainPage.stepList
|
||||||
|
}
|
||||||
|
></AtTimeline>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -17,7 +24,13 @@ export class TipsInfo extends Component {
|
||||||
render(): ReactNode {
|
render(): ReactNode {
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<AtTimeline items={pt.get().mainPage.tipsList}></AtTimeline>
|
<AtTimeline
|
||||||
|
items={
|
||||||
|
wechatUser.getAccess()
|
||||||
|
? pt.get().memberPage.tipsList
|
||||||
|
: pt.get().mainPage.tipsList
|
||||||
|
}
|
||||||
|
></AtTimeline>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,24 +2,32 @@ import React from 'react';
|
||||||
import { View, Image } from '@tarojs/components';
|
import { View, Image } from '@tarojs/components';
|
||||||
import pt from '@/plain-text';
|
import pt from '@/plain-text';
|
||||||
import logo from '@/assets/images/UserPage/logo.png';
|
import logo from '@/assets/images/UserPage/logo.png';
|
||||||
|
import wechatUser from '@/wechat';
|
||||||
|
|
||||||
export default class TitleCard extends React.Component {
|
export default class TitleCard extends React.Component {
|
||||||
render(): React.ReactNode {
|
render(): React.ReactNode {
|
||||||
const mainPage = pt.get().mainPage;
|
const mainPage = pt.get().mainPage;
|
||||||
|
const memberPage = pt.get().memberPage;
|
||||||
return (
|
return (
|
||||||
<View className='at-row at-row__align--center'>
|
<View className='at-row at-row__align--center'>
|
||||||
<View className='at-col at-col-1 at-col--auto'>
|
<View className='at-col at-col-1 at-col--auto'>
|
||||||
<Image
|
<Image
|
||||||
style='width: 100rpx; height: 100rpx; margin-left: 30rpx;'
|
style='width: 100rpx; height: 100rpx; margin-left: 30rpx;'
|
||||||
src={logo}
|
src={wechatUser.getAccess() ? wechatUser.getInfo().avatar : logo}
|
||||||
mode='aspectFit'
|
mode='aspectFit'
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View className='page-title'>
|
<View className='page-title'>
|
||||||
<View className='at-article__h1' style={{ fontWeight: 'bold' }}>
|
<View className='at-article__h1' style={{ fontWeight: 'bold' }}>
|
||||||
{mainPage.mainTitleLine}
|
{wechatUser.getAccess()
|
||||||
|
? memberPage.mainTitleLine + wechatUser.getInfo().name
|
||||||
|
: mainPage.mainTitleLine}
|
||||||
|
</View>
|
||||||
|
<View className='at-article__h2'>
|
||||||
|
{wechatUser.getAccess()
|
||||||
|
? memberPage.subTitleLine
|
||||||
|
: mainPage.subTitleLine}
|
||||||
</View>
|
</View>
|
||||||
<View className='at-article__h2'>{mainPage.subTitleLine}</View>
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,25 @@
|
||||||
import { View } from '@tarojs/components';
|
import { View } from '@tarojs/components';
|
||||||
import { Component, ReactNode } from 'react';
|
import { Component, ReactNode } from 'react';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import { AtCard, AtAccordion } from 'taro-ui';
|
import { AtCard, AtAccordion, AtInputNumber, AtButton, AtList } from 'taro-ui';
|
||||||
import type CustomTabBar from '@/custom-tab-bar';
|
import type CustomTabBar from '@/custom-tab-bar';
|
||||||
import PageFooter from '@/components/PageFooter/PageFooter';
|
import PageFooter from '@/components/PageFooter/PageFooter';
|
||||||
import pt from '@/plain-text';
|
import pt from '@/plain-text';
|
||||||
import { getDutyInfo } from '@/service/dutyInfo';
|
import { getDutyInfo } from '@/service/dutyInfo';
|
||||||
|
import { RequestState } from '@/service';
|
||||||
|
import moment from 'moment';
|
||||||
|
import wechatUser from '@/wechat';
|
||||||
|
import { getMemberDutyInfo } from '@/service/memberDutyInfo';
|
||||||
|
import { getUncompletedTicketList } from '@/service/uncompletedTicket';
|
||||||
|
import { changeDutyCnt } from '@/service/changeDutyCount';
|
||||||
|
import { TicketListItem } from '@/components/TicketListItem/TicketListItem';
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
import TitleCard from './TitleCard';
|
import TitleCard from './TitleCard';
|
||||||
import { DutyInfo, DutyData } from './DutyInfo';
|
import { DutyInfo, DutyData } from './DutyInfo';
|
||||||
import { StepInfo, TipsInfo } from './StepTipsInfo';
|
import { StepInfo, TipsInfo } from './StepTipsInfo';
|
||||||
|
|
||||||
|
const submitInterval = 5000;
|
||||||
|
|
||||||
class CardContent {
|
class CardContent {
|
||||||
title: string;
|
title: string;
|
||||||
note: string;
|
note: string;
|
||||||
|
|
@ -57,39 +66,77 @@ class ExpandItem extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MainPageState {
|
interface MainPageState {
|
||||||
|
fixList: Array<TicketListItem>;
|
||||||
|
rs: RequestState;
|
||||||
dutyData: DutyData;
|
dutyData: DutyData;
|
||||||
|
inDutyCnt: number;
|
||||||
dutyInfoCard: CardContent;
|
dutyInfoCard: CardContent;
|
||||||
stepInfoCard: CardContent;
|
stepInfoCard: CardContent;
|
||||||
tipsInfoCard: CardContent;
|
tipsInfoCard: CardContent;
|
||||||
//rs: RequestState;
|
isLoading: boolean;
|
||||||
|
isDisable: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class MainPage extends Component<{}, MainPageState> {
|
export default class MainPage extends Component<{}, MainPageState> {
|
||||||
state = {
|
state = {
|
||||||
dutyData: new DutyData(),
|
dutyData: new DutyData(),
|
||||||
|
inDutyCnt: 0,
|
||||||
dutyInfoCard: {
|
dutyInfoCard: {
|
||||||
title: pt.get().mainPage.cardTitle.dutyInfo,
|
title: '',
|
||||||
note: pt.get().mainPage.cardTips.dutyInfo,
|
note: '',
|
||||||
extra: pt.get().mainPage.extraInfo.dutyInfo,
|
extra: '',
|
||||||
content: () => <DutyInfo data={this.state.dutyData} />,
|
content: () => <></>,
|
||||||
},
|
},
|
||||||
stepInfoCard: {
|
stepInfoCard: {
|
||||||
title: pt.get().mainPage.cardTitle.stepInfo,
|
title: '',
|
||||||
note: pt.get().mainPage.cardTips.stepInfo,
|
note: '',
|
||||||
extra: pt.get().mainPage.extraInfo.dutyInfo,
|
extra: '',
|
||||||
content: () => <StepInfo />,
|
content: () => <></>,
|
||||||
},
|
},
|
||||||
tipsInfoCard: {
|
tipsInfoCard: {
|
||||||
title: pt.get().mainPage.cardTitle.tipsInfo,
|
title: '',
|
||||||
note: pt.get().mainPage.cardTips.tipsInfo,
|
note: '',
|
||||||
extra: pt.get().mainPage.extraInfo.dutyInfo,
|
extra: '',
|
||||||
content: () => <TipsInfo />,
|
content: () => <></>,
|
||||||
},
|
},
|
||||||
// rs: new RequestState(),
|
fixList: [new TicketListItem(0, '', '', 1, moment())],
|
||||||
|
rs: new RequestState(),
|
||||||
|
isLoading: false,
|
||||||
|
isDisable: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount(): void {
|
componentDidMount(): void {
|
||||||
getDutyInfo(this);
|
const ptPage = wechatUser.getAccess() ? 'mainPage' : 'memberPage';
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
dutyData: new DutyData(),
|
||||||
|
inDutyCnt: 0,
|
||||||
|
dutyInfoCard: {
|
||||||
|
title: pt.get()[ptPage].cardTitle.dutyInfo,
|
||||||
|
note: pt.get()[ptPage].cardTips.dutyInfo,
|
||||||
|
extra: pt.get()[ptPage].extraInfo.dutyInfo,
|
||||||
|
content: () => <DutyInfo data={this.state.dutyData} />,
|
||||||
|
},
|
||||||
|
stepInfoCard: {
|
||||||
|
title: pt.get()[ptPage].cardTitle.stepInfo,
|
||||||
|
note: pt.get()[ptPage].cardTips.stepInfo,
|
||||||
|
extra: pt.get()[ptPage].extraInfo.dutyInfo,
|
||||||
|
content: () => <StepInfo />,
|
||||||
|
},
|
||||||
|
tipsInfoCard: {
|
||||||
|
title: pt.get()[ptPage].cardTitle.tipsInfo,
|
||||||
|
note: pt.get()[ptPage].cardTips.tipsInfo,
|
||||||
|
extra: pt.get()[ptPage].extraInfo.dutyInfo,
|
||||||
|
content: () => <TipsInfo />,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (wechatUser.getAccess()) {
|
||||||
|
getMemberDutyInfo(this);
|
||||||
|
getUncompletedTicketList(this);
|
||||||
|
} else {
|
||||||
|
getDutyInfo(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 以下是TabBar相关
|
// 以下是TabBar相关
|
||||||
|
|
@ -100,8 +147,35 @@ export default class MainPage extends Component<{}, MainPageState> {
|
||||||
}
|
}
|
||||||
// 以上是TabBar相关
|
// 以上是TabBar相关
|
||||||
|
|
||||||
|
handleCnt(inDutyCnt: number) {
|
||||||
|
this.setState({
|
||||||
|
inDutyCnt: inDutyCnt,
|
||||||
|
});
|
||||||
|
return inDutyCnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
onChangeCnt() {
|
||||||
|
this.setState({
|
||||||
|
isDisable: true,
|
||||||
|
});
|
||||||
|
changeDutyCnt(this);
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({
|
||||||
|
isDisable: false,
|
||||||
|
});
|
||||||
|
}, submitInterval);
|
||||||
|
}
|
||||||
|
|
||||||
render(): ReactNode {
|
render(): ReactNode {
|
||||||
const mainPage = pt.get().mainPage;
|
const mainPage = pt.get().mainPage;
|
||||||
|
const memberPage = pt.get().memberPage;
|
||||||
|
if (this.state.rs.loading) {
|
||||||
|
return <View>loading</View>;
|
||||||
|
}
|
||||||
|
if (!this.state.rs.success) {
|
||||||
|
return <View>Failed</View>;
|
||||||
|
}
|
||||||
|
const fixListRenderer = this.state.fixList.map((item) => item.render());
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<TitleCard />
|
<TitleCard />
|
||||||
|
|
@ -109,11 +183,66 @@ export default class MainPage extends Component<{}, MainPageState> {
|
||||||
<View style={{ marginTop: '60rpx' }}>
|
<View style={{ marginTop: '60rpx' }}>
|
||||||
{mainPageCard(this.state.dutyInfoCard)}
|
{mainPageCard(this.state.dutyInfoCard)}
|
||||||
{mainPageCard(this.state.tipsInfoCard)}
|
{mainPageCard(this.state.tipsInfoCard)}
|
||||||
|
{wechatUser.getAccess() && this.state.dutyData.isInDuty ? (
|
||||||
|
<ExpandItem
|
||||||
|
title={memberPage.expandTitle.admin}
|
||||||
|
content={
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
marginBottom: '40rpx',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View
|
||||||
|
className='.at-article__h3'
|
||||||
|
style={{
|
||||||
|
marginTop: '40rpx',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{pt.get().memberPage.dutyCount.text}
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
marginTop: '40rpx',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<AtInputNumber
|
||||||
|
type='number'
|
||||||
|
min={0}
|
||||||
|
max={10}
|
||||||
|
step={1}
|
||||||
|
value={this.state.inDutyCnt}
|
||||||
|
onChange={this.handleCnt.bind(this)}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
<View style={{ marginLeft: 'auto', marginTop: '40rpx' }}>
|
||||||
|
<AtButton
|
||||||
|
type='secondary'
|
||||||
|
size='small'
|
||||||
|
loading={this.state.isLoading}
|
||||||
|
disabled={this.state.isDisable}
|
||||||
|
onClick={this.onChangeCnt.bind(this)}
|
||||||
|
>
|
||||||
|
{pt.get().memberPage.dutyCount.button}
|
||||||
|
</AtButton>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<View></View>
|
||||||
|
)}
|
||||||
<ExpandItem
|
<ExpandItem
|
||||||
title={mainPage.expandTitle.stepInfo}
|
title={mainPage.expandTitle.stepInfo}
|
||||||
content={mainPageCard(this.state.stepInfoCard)}
|
content={mainPageCard(this.state.stepInfoCard)}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
{wechatUser.getAccess() ? (
|
||||||
|
<AtList>{fixListRenderer}</AtList>
|
||||||
|
) : (
|
||||||
|
<View></View>
|
||||||
|
)}
|
||||||
<PageFooter />
|
<PageFooter />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
||||||
|
|
@ -1,120 +0,0 @@
|
||||||
import { Component, ReactNode } from 'react';
|
|
||||||
import { View, Image } from '@tarojs/components';
|
|
||||||
import { AtTimeline } from 'taro-ui';
|
|
||||||
import pt from '@/plain-text';
|
|
||||||
import tick from '@/assets/icons/MainPage/tick.svg';
|
|
||||||
import clock from '@/assets/icons/MemberPage/clock.svg';
|
|
||||||
|
|
||||||
export class MemberDutyData {
|
|
||||||
constructor() {
|
|
||||||
this.isInDuty = false;
|
|
||||||
this.currentDuty = '2';
|
|
||||||
this.inDutyCnt = 3;
|
|
||||||
this.offDutyReason = '学园维修';
|
|
||||||
this.dutyRecoverTime = '下周一';
|
|
||||||
}
|
|
||||||
|
|
||||||
isInDuty: boolean;
|
|
||||||
currentDuty?: 'off' | '1' | '2' | '3' | 'others';
|
|
||||||
offDutyReason?: string;
|
|
||||||
dutyRecoverTime?: string;
|
|
||||||
inDutyCnt?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Card extends Component {
|
|
||||||
props = {
|
|
||||||
isInDuty: false,
|
|
||||||
};
|
|
||||||
render(): ReactNode {
|
|
||||||
const inDuty = this.props.isInDuty;
|
|
||||||
const dc = pt.get().memberPage.dutyCard;
|
|
||||||
const title = inDuty ? dc.inDuty.title : dc.offDuty.title;
|
|
||||||
const iconsrc = inDuty ? tick : clock;
|
|
||||||
return (
|
|
||||||
<View>
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
marginBottom: '40rpx',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Image
|
|
||||||
src={iconsrc}
|
|
||||||
style={{
|
|
||||||
width: '48rpx',
|
|
||||||
height: '48rpx',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
marginLeft: '20rpx',
|
|
||||||
fontSize: '60rpx',
|
|
||||||
fontWeight: 'bold',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{title}
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class MemberDutyInfo extends Component {
|
|
||||||
state: {
|
|
||||||
isLoading: false;
|
|
||||||
isDisable: false;
|
|
||||||
};
|
|
||||||
|
|
||||||
props = {
|
|
||||||
data: new MemberDutyData(),
|
|
||||||
};
|
|
||||||
|
|
||||||
offDutyContent(): ReactNode {
|
|
||||||
const data = this.props.data;
|
|
||||||
const od = pt.get().memberPage.dutyCard.offDuty;
|
|
||||||
return (
|
|
||||||
<View>
|
|
||||||
<Card isInDuty={data.isInDuty} />
|
|
||||||
<AtTimeline
|
|
||||||
items={[
|
|
||||||
{ title: od.reason(data.offDutyReason as string) },
|
|
||||||
{ title: od.recoverTime(data.dutyRecoverTime as string) },
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
inDutyContent(): ReactNode {
|
|
||||||
const data = this.props.data;
|
|
||||||
const id = pt.get().memberPage.dutyCard.inDuty;
|
|
||||||
return (
|
|
||||||
<View>
|
|
||||||
<Card isInDuty={data.isInDuty} />
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<AtTimeline
|
|
||||||
items={[
|
|
||||||
{ title: id.currentDutyText(data.currentDuty || 'off') },
|
|
||||||
{ title: id.inDutyCnt(data.inDutyCnt as number) },
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
render(): ReactNode {
|
|
||||||
if (this.props.data.isInDuty) {
|
|
||||||
return this.inDutyContent();
|
|
||||||
} else {
|
|
||||||
return this.offDutyContent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
import { Component, ReactNode } from 'react';
|
|
||||||
import { View } from '@tarojs/components';
|
|
||||||
import { AtTimeline } from 'taro-ui';
|
|
||||||
import pt from '@/plain-text';
|
|
||||||
|
|
||||||
export class MemberStepInfo extends Component {
|
|
||||||
render(): ReactNode {
|
|
||||||
return (
|
|
||||||
<View>
|
|
||||||
<AtTimeline items={pt.get().memberPage.stepList}></AtTimeline>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class MemberTipsInfo extends Component {
|
|
||||||
render(): ReactNode {
|
|
||||||
return (
|
|
||||||
<View>
|
|
||||||
<AtTimeline items={pt.get().memberPage.tipsList}></AtTimeline>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
import React from 'react';
|
|
||||||
import { View, Image } from '@tarojs/components';
|
|
||||||
import pt from '@/plain-text';
|
|
||||||
import wechatUser from '@/wechat';
|
|
||||||
|
|
||||||
export default class MemberTitleCard extends React.Component {
|
|
||||||
render(): React.ReactNode {
|
|
||||||
const memberPage = pt.get().memberPage;
|
|
||||||
return (
|
|
||||||
<View className='at-row at-row__align--end'>
|
|
||||||
<View className='at-col at-col-1 at-col--auto'>
|
|
||||||
<Image
|
|
||||||
style='width: 150rpx; height: 150rpx; margin-left: 60rpx;'
|
|
||||||
src={wechatUser.getInfo().avatar}
|
|
||||||
mode='aspectFit'
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
<View className='page-title' style={{ marginLeft: '30rpx' }}>
|
|
||||||
<View className='at-article__h1' style={{ fontWeight: 'bold' }}>
|
|
||||||
{memberPage.mainTitleLine + wechatUser.getInfo().name}
|
|
||||||
</View>
|
|
||||||
<View className='at-article__h2'>{memberPage.subTitleLine}</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
export default definePageConfig({
|
|
||||||
usingComponents: {},
|
|
||||||
});
|
|
||||||
|
|
@ -1,226 +0,0 @@
|
||||||
import { View } from '@tarojs/components';
|
|
||||||
import { Component, ReactNode } from 'react';
|
|
||||||
import {
|
|
||||||
AtAccordion,
|
|
||||||
AtButton,
|
|
||||||
AtCard,
|
|
||||||
AtInputNumber,
|
|
||||||
AtList,
|
|
||||||
AtMessage,
|
|
||||||
} from 'taro-ui';
|
|
||||||
import Taro from '@tarojs/taro';
|
|
||||||
import pt from '@/plain-text';
|
|
||||||
import { getUncompletedTicketList } from '@/service/uncompletedTicket';
|
|
||||||
import type CustomTabBar from '@/custom-tab-bar';
|
|
||||||
import { TicketListItem } from '@/components/TicketListItem/TicketListItem';
|
|
||||||
import { RequestState } from '@/service';
|
|
||||||
import moment from 'moment';
|
|
||||||
import { getMemberDutyInfo } from '@/service/memberDutyInfo';
|
|
||||||
import PageFooter from '@/components/PageFooter/PageFooter';
|
|
||||||
import { changeDutyCnt } from '@/service/changeDutyCount';
|
|
||||||
import './member.scss';
|
|
||||||
import { MemberDutyData, MemberDutyInfo } from './MemberDutyInfo';
|
|
||||||
import { MemberStepInfo, MemberTipsInfo } from './MemberStepTipsInfo';
|
|
||||||
import MemberTitleCard from './MemberTitleCard';
|
|
||||||
|
|
||||||
const submitInterval = 5000;
|
|
||||||
|
|
||||||
class CardContent {
|
|
||||||
title: string;
|
|
||||||
note: string;
|
|
||||||
extra: JSX.Element | string;
|
|
||||||
content: () => JSX.Element;
|
|
||||||
}
|
|
||||||
|
|
||||||
function memberPageCard(c: CardContent): JSX.Element {
|
|
||||||
return (
|
|
||||||
<View style={{ marginTop: '20rpx', marginBottom: '40rpx' }}>
|
|
||||||
<AtCard note={c.note} extra={c.extra} title={c.title}>
|
|
||||||
{c.content()}
|
|
||||||
</AtCard>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class ExpandItem extends Component {
|
|
||||||
state = {
|
|
||||||
open: false,
|
|
||||||
};
|
|
||||||
props = {
|
|
||||||
title: '',
|
|
||||||
content: <View></View>,
|
|
||||||
};
|
|
||||||
|
|
||||||
handleClick(value: boolean) {
|
|
||||||
this.setState({ open: value });
|
|
||||||
}
|
|
||||||
|
|
||||||
render(): ReactNode {
|
|
||||||
return (
|
|
||||||
<View>
|
|
||||||
<AtAccordion
|
|
||||||
open={this.state.open}
|
|
||||||
onClick={this.handleClick.bind(this)}
|
|
||||||
title={this.props.title}
|
|
||||||
>
|
|
||||||
{this.props.content}
|
|
||||||
</AtAccordion>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MemberPageState {
|
|
||||||
fixList: Array<TicketListItem>;
|
|
||||||
rs: RequestState;
|
|
||||||
dutyData: MemberDutyData;
|
|
||||||
inDutyCnt: number;
|
|
||||||
dutyInfoCard: CardContent;
|
|
||||||
stepInfoCard: CardContent;
|
|
||||||
tipsInfoCard: CardContent;
|
|
||||||
isLoading: boolean;
|
|
||||||
isDisable: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class MemberPage extends Component<{}, MemberPageState> {
|
|
||||||
state = {
|
|
||||||
dutyData: new MemberDutyData(),
|
|
||||||
inDutyCnt: 0,
|
|
||||||
dutyInfoCard: {
|
|
||||||
title: pt.get().mainPage.cardTitle.dutyInfo,
|
|
||||||
note: pt.get().mainPage.cardTips.dutyInfo,
|
|
||||||
extra: pt.get().mainPage.extraInfo.dutyInfo,
|
|
||||||
content: () => <MemberDutyInfo data={this.state.dutyData} />,
|
|
||||||
},
|
|
||||||
stepInfoCard: {
|
|
||||||
title: pt.get().mainPage.cardTitle.stepInfo,
|
|
||||||
note: pt.get().mainPage.cardTips.stepInfo,
|
|
||||||
extra: pt.get().mainPage.extraInfo.dutyInfo,
|
|
||||||
content: () => <MemberStepInfo />,
|
|
||||||
},
|
|
||||||
tipsInfoCard: {
|
|
||||||
title: pt.get().mainPage.cardTitle.tipsInfo,
|
|
||||||
note: pt.get().mainPage.cardTips.tipsInfo,
|
|
||||||
extra: pt.get().mainPage.extraInfo.dutyInfo,
|
|
||||||
content: () => <MemberTipsInfo />,
|
|
||||||
},
|
|
||||||
fixList: [new TicketListItem(0, '', '', 1, moment())],
|
|
||||||
rs: new RequestState(),
|
|
||||||
isLoading: false,
|
|
||||||
isDisable: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
componentDidMount(): void {
|
|
||||||
getMemberDutyInfo(this);
|
|
||||||
Taro.setNavigationBarTitle({
|
|
||||||
title: pt.get().navBar.user.member,
|
|
||||||
});
|
|
||||||
getUncompletedTicketList(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 以下是TabBar相关
|
|
||||||
pageCtx = Taro.getCurrentInstance().page;
|
|
||||||
componentDidShow() {
|
|
||||||
const tabbar = Taro.getTabBar<CustomTabBar>(this.pageCtx);
|
|
||||||
tabbar?.setSelected(0);
|
|
||||||
}
|
|
||||||
// 以上是TabBar相关
|
|
||||||
|
|
||||||
handleCnt(inDutyCnt: number) {
|
|
||||||
this.setState({
|
|
||||||
inDutyCnt: inDutyCnt,
|
|
||||||
});
|
|
||||||
return inDutyCnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
onChangeCnt() {
|
|
||||||
this.setState({
|
|
||||||
isDisable: true,
|
|
||||||
});
|
|
||||||
changeDutyCnt(this);
|
|
||||||
setTimeout(() => {
|
|
||||||
this.setState({
|
|
||||||
isDisable: false,
|
|
||||||
});
|
|
||||||
}, submitInterval);
|
|
||||||
}
|
|
||||||
|
|
||||||
render(): ReactNode {
|
|
||||||
const memberPage = pt.get().memberPage;
|
|
||||||
if (this.state.rs.loading) {
|
|
||||||
return <View>loading</View>;
|
|
||||||
}
|
|
||||||
if (!this.state.rs.success) {
|
|
||||||
return <View>Failed</View>;
|
|
||||||
}
|
|
||||||
const fixListRenderer = this.state.fixList.map((item) => item.render());
|
|
||||||
return (
|
|
||||||
<View>
|
|
||||||
<AtMessage />
|
|
||||||
<MemberTitleCard />
|
|
||||||
<View style={{ width: '94%', marginLeft: '3%' }}>
|
|
||||||
<View style={{ marginTop: '60rpx' }}>
|
|
||||||
{memberPageCard(this.state.dutyInfoCard)}
|
|
||||||
{memberPageCard(this.state.tipsInfoCard)}
|
|
||||||
{this.state.dutyData.isInDuty ? (
|
|
||||||
<ExpandItem
|
|
||||||
title={memberPage.expandTitle.admin}
|
|
||||||
content={
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
marginBottom: '40rpx',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<View
|
|
||||||
className='.at-article__h3'
|
|
||||||
style={{
|
|
||||||
marginTop: '40rpx',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{pt.get().memberPage.dutyCount.text}
|
|
||||||
</View>
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
marginTop: '40rpx',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<AtInputNumber
|
|
||||||
type='number'
|
|
||||||
min={0}
|
|
||||||
max={10}
|
|
||||||
step={1}
|
|
||||||
value={this.state.inDutyCnt}
|
|
||||||
onChange={this.handleCnt.bind(this)}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
<View style={{ marginLeft: 'auto', marginTop: '40rpx' }}>
|
|
||||||
<AtButton
|
|
||||||
type='secondary'
|
|
||||||
size='small'
|
|
||||||
loading={this.state.isLoading}
|
|
||||||
disabled={this.state.isDisable}
|
|
||||||
onClick={this.onChangeCnt.bind(this)}
|
|
||||||
>
|
|
||||||
{pt.get().memberPage.dutyCount.button}
|
|
||||||
</AtButton>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<View></View>
|
|
||||||
)}
|
|
||||||
<ExpandItem
|
|
||||||
title={memberPage.expandTitle.stepInfo}
|
|
||||||
content={memberPageCard(this.state.stepInfoCard)}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
<AtList>{fixListRenderer}</AtList>
|
|
||||||
<PageFooter />
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -31,7 +31,7 @@ export interface MainPageText {
|
||||||
};
|
};
|
||||||
inDuty: {
|
inDuty: {
|
||||||
title: string;
|
title: string;
|
||||||
currentDutyText: (c: 'off' | '1' | '2' | '3') => string;
|
currentDutyText: (c: 'off' | '1' | '2' | '3' | 'others') => string;
|
||||||
inDutyCnt: (n: number) => string;
|
inDutyCnt: (n: number) => string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -89,6 +89,8 @@ export const mainPageZhCn: MainPageText = {
|
||||||
return '第二班 16:00-18:00';
|
return '第二班 16:00-18:00';
|
||||||
case '3':
|
case '3':
|
||||||
return '第三班 18:00-20:30';
|
return '第三班 18:00-20:30';
|
||||||
|
case 'others':
|
||||||
|
return '其他值班时间,见通知';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
inDutyCnt: (n) => '当前值班人数:' + n,
|
inDutyCnt: (n) => '当前值班人数:' + n,
|
||||||
|
|
@ -148,6 +150,8 @@ export const mainPageEnUs: MainPageText = {
|
||||||
return '2nd Shift 16:00-18:00';
|
return '2nd Shift 16:00-18:00';
|
||||||
case '3':
|
case '3':
|
||||||
return '3rd Shift 18:00-20:30';
|
return '3rd Shift 18:00-20:30';
|
||||||
|
case 'others':
|
||||||
|
return 'Other duty time, see notice';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
inDutyCnt: (n) => 'EVA members on duty: ' + n,
|
inDutyCnt: (n) => 'EVA members on duty: ' + n,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
export interface MemberPageText {
|
export interface MemberPageText {
|
||||||
mainTitleLine: string;
|
mainTitleLine: string;
|
||||||
subTitleLine: string;
|
subTitleLine: string;
|
||||||
|
cardTitle: {
|
||||||
|
dutyInfo: string;
|
||||||
|
stepInfo: string;
|
||||||
|
tipsInfo: string;
|
||||||
|
};
|
||||||
dutyCount: {
|
dutyCount: {
|
||||||
button: string;
|
button: string;
|
||||||
text: string;
|
text: string;
|
||||||
|
|
@ -33,6 +38,16 @@ export interface MemberPageText {
|
||||||
tipsInfo: string;
|
tipsInfo: string;
|
||||||
admin: string;
|
admin: string;
|
||||||
};
|
};
|
||||||
|
cardTips: {
|
||||||
|
dutyInfo: string;
|
||||||
|
stepInfo: string;
|
||||||
|
tipsInfo: string;
|
||||||
|
};
|
||||||
|
extraInfo: {
|
||||||
|
dutyInfo: string;
|
||||||
|
stepInfo: string;
|
||||||
|
tipsInfo: string;
|
||||||
|
};
|
||||||
stepList: Array<{ title: string }>;
|
stepList: Array<{ title: string }>;
|
||||||
tipsList: Array<{ title: string }>;
|
tipsList: Array<{ title: string }>;
|
||||||
}
|
}
|
||||||
|
|
@ -40,6 +55,11 @@ export interface MemberPageText {
|
||||||
export const memberPageZhCn: MemberPageText = {
|
export const memberPageZhCn: MemberPageText = {
|
||||||
mainTitleLine: '您好,',
|
mainTitleLine: '您好,',
|
||||||
subTitleLine: '祝你满绩每一天',
|
subTitleLine: '祝你满绩每一天',
|
||||||
|
cardTitle: {
|
||||||
|
dutyInfo: '值班情况',
|
||||||
|
stepInfo: '维修步骤',
|
||||||
|
tipsInfo: '注意事项',
|
||||||
|
},
|
||||||
dutyCount: {
|
dutyCount: {
|
||||||
button: '更新值班人数',
|
button: '更新值班人数',
|
||||||
text: '当前值班人数:',
|
text: '当前值班人数:',
|
||||||
|
|
@ -85,6 +105,16 @@ export const memberPageZhCn: MemberPageText = {
|
||||||
tipsInfo: '查看注意事项',
|
tipsInfo: '查看注意事项',
|
||||||
admin: '组长管理入口',
|
admin: '组长管理入口',
|
||||||
},
|
},
|
||||||
|
cardTips: {
|
||||||
|
dutyInfo: '提示:可以先前往【维修】页面在线上预填写工单!',
|
||||||
|
stepInfo: '提示:请在 20:30 之前取走自己的物品哦!',
|
||||||
|
tipsInfo: '',
|
||||||
|
},
|
||||||
|
extraInfo: {
|
||||||
|
dutyInfo: '',
|
||||||
|
stepInfo: '',
|
||||||
|
tipsInfo: '',
|
||||||
|
},
|
||||||
stepList: [
|
stepList: [
|
||||||
{ title: '机主线上填写工单,审核接取维修后加入 Oreo' },
|
{ title: '机主线上填写工单,审核接取维修后加入 Oreo' },
|
||||||
{ title: '进行维修工作,认领工单,通过小程序与机主交流' },
|
{ title: '进行维修工作,认领工单,通过小程序与机主交流' },
|
||||||
|
|
@ -102,6 +132,11 @@ export const memberPageZhCn: MemberPageText = {
|
||||||
export const memberPageEnUs: MemberPageText = {
|
export const memberPageEnUs: MemberPageText = {
|
||||||
mainTitleLine: 'Hi! ',
|
mainTitleLine: 'Hi! ',
|
||||||
subTitleLine: 'Have a great day!',
|
subTitleLine: 'Have a great day!',
|
||||||
|
cardTitle: {
|
||||||
|
dutyInfo: 'Duty Situation',
|
||||||
|
stepInfo: 'Maintenance Steps',
|
||||||
|
tipsInfo: 'Tips',
|
||||||
|
},
|
||||||
dutyCount: {
|
dutyCount: {
|
||||||
button: 'Update Duty Count',
|
button: 'Update Duty Count',
|
||||||
text: 'The duty count: ',
|
text: 'The duty count: ',
|
||||||
|
|
@ -147,6 +182,16 @@ export const memberPageEnUs: MemberPageText = {
|
||||||
tipsInfo: 'Check for tips',
|
tipsInfo: 'Check for tips',
|
||||||
admin: 'Entry for admin',
|
admin: 'Entry for admin',
|
||||||
},
|
},
|
||||||
|
cardTips: {
|
||||||
|
dutyInfo: '提示:可以先前往【维修】页面在线上预填写工单!',
|
||||||
|
stepInfo: '提示:请在 20:30 之前取走自己的物品哦!',
|
||||||
|
tipsInfo: '',
|
||||||
|
},
|
||||||
|
extraInfo: {
|
||||||
|
dutyInfo: '',
|
||||||
|
stepInfo: '',
|
||||||
|
tipsInfo: '',
|
||||||
|
},
|
||||||
stepList: [
|
stepList: [
|
||||||
{ title: 'The owner fills out ticket online. Add it to Oreo after audit.' },
|
{ title: 'The owner fills out ticket online. Add it to Oreo after audit.' },
|
||||||
{ title: 'Repair, pick the ticket, and communicate with the owner online' },
|
{ title: 'Repair, pick the ticket, and communicate with the owner online' },
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import MemberPage from '@/pages/member/member';
|
import MainPage from '@/pages/index';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import pt from '@/plain-text';
|
import pt from '@/plain-text';
|
||||||
import wechatUser from '@/wechat';
|
import wechatUser from '@/wechat';
|
||||||
|
|
@ -6,7 +6,7 @@ import { getUrl } from '.';
|
||||||
|
|
||||||
const reLaunchInterval = 1000;
|
const reLaunchInterval = 1000;
|
||||||
|
|
||||||
export function changeDutyCnt(that: MemberPage) {
|
export function changeDutyCnt(that: MainPage) {
|
||||||
that.setState({
|
that.setState({
|
||||||
isLoading: true,
|
isLoading: true,
|
||||||
});
|
});
|
||||||
|
|
@ -29,7 +29,7 @@ export function changeDutyCnt(that: MemberPage) {
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
Taro.reLaunch({
|
Taro.reLaunch({
|
||||||
url: '/pages/member/member',
|
url: '/pages/index/index',
|
||||||
});
|
});
|
||||||
}, reLaunchInterval);
|
}, reLaunchInterval);
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,17 @@ export function getDutyInfo(that: MainPage) {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
let former = that.state.rs;
|
||||||
|
if (!res.data.success) {
|
||||||
|
that.setState({
|
||||||
|
rs: former.trans(false),
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
const data = res.data.data;
|
const data = res.data.data;
|
||||||
if (data.isInDuty) {
|
if (data.isInDuty) {
|
||||||
that.setState({
|
that.setState({
|
||||||
|
rs: former.trans(true),
|
||||||
dutyData: {
|
dutyData: {
|
||||||
isInDuty: data.isInDuty,
|
isInDuty: data.isInDuty,
|
||||||
inDutyCnt: data.inDutyCnt,
|
inDutyCnt: data.inDutyCnt,
|
||||||
|
|
@ -24,6 +32,7 @@ export function getDutyInfo(that: MainPage) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
that.setState({
|
that.setState({
|
||||||
|
rs: former.trans(true),
|
||||||
dutyData: {
|
dutyData: {
|
||||||
isInDuty: data.isInDuty,
|
isInDuty: data.isInDuty,
|
||||||
offDutyReason: data.offDutyReason,
|
offDutyReason: data.offDutyReason,
|
||||||
|
|
@ -35,7 +44,9 @@ export function getDutyInfo(that: MainPage) {
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
let former = that.state.rs;
|
||||||
that.setState({
|
that.setState({
|
||||||
|
rs: former.trans(false),
|
||||||
dutyData: {
|
dutyData: {
|
||||||
isInDuty: false,
|
isInDuty: false,
|
||||||
offDutyReason: '获取失败!Network Error!',
|
offDutyReason: '获取失败!Network Error!',
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,7 @@ export function getLocaleData() {
|
||||||
console.log(res.data);
|
console.log(res.data);
|
||||||
pt.setLang(res.data.data.lang);
|
pt.setLang(res.data.data.lang);
|
||||||
Taro.reLaunch({
|
Taro.reLaunch({
|
||||||
url: wechatUser.getAccess()
|
url: '/pages/index/index',
|
||||||
? '/pages/member/member'
|
|
||||||
: '/pages/index/index',
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ export function loginAte() {
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
});
|
});
|
||||||
|
getLocaleData();
|
||||||
} else {
|
} else {
|
||||||
console.log('Login Failed: ' + res.errMsg);
|
console.log('Login Failed: ' + res.errMsg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import MemberPage from '@/pages/member/member';
|
import MainPage from '@/pages/index';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import wechatUser from '@/wechat';
|
import wechatUser from '@/wechat';
|
||||||
import { getUrl } from '.';
|
import { getUrl } from '.';
|
||||||
|
|
||||||
export function getMemberDutyInfo(that: MemberPage) {
|
export function getMemberDutyInfo(that: MainPage) {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: getUrl('/member/duty/info'),
|
url: getUrl('/member/duty/info'),
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
|
@ -19,6 +19,7 @@ export function getMemberDutyInfo(that: MemberPage) {
|
||||||
isInDuty: data.isInDuty,
|
isInDuty: data.isInDuty,
|
||||||
inDutyCnt: data.inDutyCnt,
|
inDutyCnt: data.inDutyCnt,
|
||||||
currentDuty: data.currentDuty,
|
currentDuty: data.currentDuty,
|
||||||
|
place: data.place,
|
||||||
},
|
},
|
||||||
inDutyCnt: data.inDutyCnt,
|
inDutyCnt: data.inDutyCnt,
|
||||||
});
|
});
|
||||||
|
|
@ -28,6 +29,7 @@ export function getMemberDutyInfo(that: MemberPage) {
|
||||||
isInDuty: data.isInDuty,
|
isInDuty: data.isInDuty,
|
||||||
offDutyReason: data.offDutyReason,
|
offDutyReason: data.offDutyReason,
|
||||||
dutyRecoverTime: data.dutyRecoverTime,
|
dutyRecoverTime: data.dutyRecoverTime,
|
||||||
|
place: data.place,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -39,6 +41,7 @@ export function getMemberDutyInfo(that: MemberPage) {
|
||||||
isInDuty: false,
|
isInDuty: false,
|
||||||
offDutyReason: '获取失败!Network Error!',
|
offDutyReason: '获取失败!Network Error!',
|
||||||
dutyRecoverTime: '获取失败!Network Error!',
|
dutyRecoverTime: '获取失败!Network Error!',
|
||||||
|
place: '204',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import MemberPage from '@/pages/member/member';
|
import MainPage from '@/pages/index';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import { TicketListItem } from '@/components/TicketListItem/TicketListItem';
|
import { TicketListItem } from '@/components/TicketListItem/TicketListItem';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import wechatUser from '@/wechat';
|
import wechatUser from '@/wechat';
|
||||||
import { getUrl } from '.';
|
import { getUrl } from '.';
|
||||||
|
|
||||||
export function getUncompletedTicketList(that: MemberPage) {
|
export function getUncompletedTicketList(that: MainPage) {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: getUrl('/tickets/uncompleted'),
|
url: getUrl('/tickets/uncompleted'),
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue