Compare commits
No commits in common. "9bd6c8f1b4f43b846b158cf86a637a4b9103bac4" and "2fd629d479be84655f9b995dd4193cd9a3841794" have entirely different histories.
9bd6c8f1b4
...
2fd629d479
19
src/app.ts
19
src/app.ts
|
|
@ -1,13 +1,26 @@
|
||||||
import { PropsWithChildren } from 'react';
|
import { PropsWithChildren } from 'react';
|
||||||
import { useLaunch } from '@tarojs/taro';
|
import Taro, { useLaunch } from '@tarojs/taro';
|
||||||
|
import { getUrl } from '@/service';
|
||||||
|
import pt from '@/plain-text';
|
||||||
import 'taro-ui/dist/style/index.scss';
|
import 'taro-ui/dist/style/index.scss';
|
||||||
import './app.scss';
|
import './app.scss';
|
||||||
import { getLocaleData } from './service/localeData';
|
|
||||||
|
|
||||||
function App({ children }: PropsWithChildren<any>) {
|
function App({ children }: PropsWithChildren<any>) {
|
||||||
useLaunch(() => {
|
useLaunch(() => {
|
||||||
console.log('App launched.');
|
console.log('App launched.');
|
||||||
getLocaleData();
|
Taro.request({
|
||||||
|
url: getUrl('/user/locale/get'),
|
||||||
|
method: 'GET',
|
||||||
|
data: {
|
||||||
|
token: 'token_test',
|
||||||
|
},
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res.data);
|
||||||
|
pt.setLang(res.data.data.lang);
|
||||||
|
Taro.reLaunch({
|
||||||
|
url: '/pages/index/index',
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// children 是将要会渲染的页面
|
// children 是将要会渲染的页面
|
||||||
|
|
|
||||||
|
|
@ -3,23 +3,10 @@ import { View } from '@tarojs/components';
|
||||||
import { getCurrentInstance } from '@tarojs/runtime';
|
import { getCurrentInstance } from '@tarojs/runtime';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import pt from '@/plain-text';
|
import pt from '@/plain-text';
|
||||||
import { AtSteps } from 'taro-ui';
|
|
||||||
|
|
||||||
interface StepItemData {
|
export default class TicketDetail extends Component {
|
||||||
title: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface TicketDetailState {
|
|
||||||
id: number;
|
|
||||||
current: number;
|
|
||||||
items: Array<StepItemData>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|
||||||
state = {
|
state = {
|
||||||
id: 0,
|
id: 0,
|
||||||
current: 0,
|
|
||||||
items: [],
|
|
||||||
};
|
};
|
||||||
componentDidMount(): void {
|
componentDidMount(): void {
|
||||||
const navBar = pt.get().navBar;
|
const navBar = pt.get().navBar;
|
||||||
|
|
@ -27,23 +14,12 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
title: navBar.ticketDetail,
|
title: navBar.ticketDetail,
|
||||||
});
|
});
|
||||||
const { router } = getCurrentInstance();
|
const { router } = getCurrentInstance();
|
||||||
const id = router?.params.id as number;
|
const id = router?.params.id;
|
||||||
const items = pt.get().ticketDetail.stepItems;
|
|
||||||
this.setState({
|
this.setState({
|
||||||
id: id,
|
id: id,
|
||||||
items: items,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
render(): ReactNode {
|
render(): ReactNode {
|
||||||
return (
|
return <View>TicketDetail: {this.state.id}</View>;
|
||||||
<View>
|
|
||||||
<AtSteps
|
|
||||||
items={this.state.items}
|
|
||||||
current={this.state.current}
|
|
||||||
onChange={() => {}}
|
|
||||||
/>
|
|
||||||
<View>TicketDetail: {this.state.id}</View>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,10 @@ export class DutyData {
|
||||||
}
|
}
|
||||||
|
|
||||||
isInDuty: boolean;
|
isInDuty: boolean;
|
||||||
inDutyCnt?: number;
|
inDutyCnt: number;
|
||||||
currentDuty?: 'off' | '1' | '2' | '3';
|
currentDuty: 'off' | '1' | '2' | '3';
|
||||||
offDutyReason?: string;
|
offDutyReason: string; // from backend
|
||||||
dutyRecoverTime?: string;
|
dutyRecoverTime: string; // from backend
|
||||||
}
|
}
|
||||||
|
|
||||||
class Card extends Component {
|
class Card extends Component {
|
||||||
|
|
@ -73,8 +73,8 @@ export class DutyInfo extends Component {
|
||||||
<Card isInDuty={data.isInDuty} />
|
<Card isInDuty={data.isInDuty} />
|
||||||
<AtTimeline
|
<AtTimeline
|
||||||
items={[
|
items={[
|
||||||
{ title: od.reason(data.offDutyReason as string) },
|
{ title: od.reason(data.offDutyReason) },
|
||||||
{ title: od.recoverTime(data.dutyRecoverTime as string) },
|
{ title: od.recoverTime(data.dutyRecoverTime) },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
@ -89,8 +89,8 @@ export class DutyInfo extends Component {
|
||||||
<Card isInDuty={data.isInDuty} />
|
<Card isInDuty={data.isInDuty} />
|
||||||
<AtTimeline
|
<AtTimeline
|
||||||
items={[
|
items={[
|
||||||
{ title: id.currentDutyText(data.currentDuty || 'off') },
|
{ title: id.currentDutyText(data.currentDuty) },
|
||||||
{ title: id.inDutyCnt(data.inDutyCnt as number) },
|
{ title: id.inDutyCnt(data.inDutyCnt) },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { AtCard, AtAccordion } 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 { getUrl } from '@/service';
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
import TitleCard from './TitleCard';
|
import TitleCard from './TitleCard';
|
||||||
import { DutyInfo, DutyData } from './DutyInfo';
|
import { DutyInfo, DutyData } from './DutyInfo';
|
||||||
|
|
@ -56,15 +56,7 @@ class ExpandItem extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MainPageState {
|
export default class Index extends Component {
|
||||||
dutyData: DutyData;
|
|
||||||
dutyInfoCard: CardContent;
|
|
||||||
stepInfoCard: CardContent;
|
|
||||||
tipsInfoCard: CardContent;
|
|
||||||
//rs: RequestState;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class MainPage extends Component<{}, MainPageState> {
|
|
||||||
state = {
|
state = {
|
||||||
dutyData: new DutyData(),
|
dutyData: new DutyData(),
|
||||||
dutyInfoCard: {
|
dutyInfoCard: {
|
||||||
|
|
@ -85,11 +77,46 @@ export default class MainPage extends Component<{}, MainPageState> {
|
||||||
extra: '额外信息',
|
extra: '额外信息',
|
||||||
content: () => <TipsInfo />,
|
content: () => <TipsInfo />,
|
||||||
},
|
},
|
||||||
// rs: new RequestState(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount(): void {
|
componentDidMount(): void {
|
||||||
getDutyInfo(this);
|
Taro.request({
|
||||||
|
url: getUrl('/dutyinfo'),
|
||||||
|
method: 'GET',
|
||||||
|
data: {
|
||||||
|
token: 'token_test',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
const data = res.data.data;
|
||||||
|
if (data.isInDuty) {
|
||||||
|
this.setState({
|
||||||
|
dutyData: {
|
||||||
|
isInDuty: data.isInDuty,
|
||||||
|
inDutyCnt: data.inDutyCnt,
|
||||||
|
currentDuty: data.currentDuty,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.setState({
|
||||||
|
dutyData: {
|
||||||
|
isInDuty: data.isInDuty,
|
||||||
|
offDutyReason: data.offDutyReason,
|
||||||
|
dutyRecoverTime: data.dutyRecoverTime,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.log(err);
|
||||||
|
this.setState({
|
||||||
|
dutyData: {
|
||||||
|
isInDuty: false,
|
||||||
|
offDutyReason: '获取失败!Network Error!',
|
||||||
|
dutyRecoverTime: '获取失败!Network Error!',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 以下是TabBar相关
|
// 以下是TabBar相关
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,10 @@
|
||||||
import { View } from '@tarojs/components';
|
import { View, Text } from '@tarojs/components';
|
||||||
import { Component, ReactNode } from 'react';
|
import { Component, ReactNode } from 'react';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import { AtForm, AtInput, AtButton, AtRadio } from 'taro-ui';
|
|
||||||
import pt from '@/plain-text';
|
|
||||||
import type CustomTabBar from '../../custom-tab-bar';
|
import type CustomTabBar from '../../custom-tab-bar';
|
||||||
import './repair.scss';
|
import './repair.scss';
|
||||||
|
|
||||||
export default class RepairPage extends Component {
|
export default class RepairPage extends Component {
|
||||||
state = {
|
|
||||||
type: 1,
|
|
||||||
device: '',
|
|
||||||
deviceModel: '',
|
|
||||||
owner: '',
|
|
||||||
phone: '',
|
|
||||||
description: '',
|
|
||||||
isLoading: false,
|
|
||||||
isDisable: false,
|
|
||||||
};
|
|
||||||
// 以下是TabBar相关
|
// 以下是TabBar相关
|
||||||
pageCtx = Taro.getCurrentInstance().page;
|
pageCtx = Taro.getCurrentInstance().page;
|
||||||
componentDidShow() {
|
componentDidShow() {
|
||||||
|
|
@ -25,121 +13,10 @@ export default class RepairPage extends Component {
|
||||||
}
|
}
|
||||||
// 以上是TabBar相关
|
// 以上是TabBar相关
|
||||||
|
|
||||||
handleTypeChange(type: number) {
|
|
||||||
this.setState({
|
|
||||||
type: type,
|
|
||||||
});
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleDeviceChange(device: string) {
|
|
||||||
this.setState({
|
|
||||||
device: device,
|
|
||||||
});
|
|
||||||
return device;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleDeviceModelChange(deviceModel: string) {
|
|
||||||
this.setState({
|
|
||||||
deviceModel: deviceModel,
|
|
||||||
});
|
|
||||||
return deviceModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleOwnerChange(owner: string) {
|
|
||||||
this.setState({
|
|
||||||
owner: owner,
|
|
||||||
});
|
|
||||||
return owner;
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePhoneChange(phone: string) {
|
|
||||||
this.setState({
|
|
||||||
phone: phone,
|
|
||||||
});
|
|
||||||
return phone;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleDescriptionChange(description: string) {
|
|
||||||
this.setState({
|
|
||||||
description: description,
|
|
||||||
});
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
onSubmit() {}
|
|
||||||
|
|
||||||
render(): ReactNode {
|
render(): ReactNode {
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<AtForm onSubmit={this.onSubmit.bind(this)}>
|
<Text>Repair Page</Text>
|
||||||
<AtRadio
|
|
||||||
options={[
|
|
||||||
{ label: pt.get().repairPage.typeText.appliance, value: 0 },
|
|
||||||
{ label: pt.get().repairPage.typeText.computer, value: 1 },
|
|
||||||
]}
|
|
||||||
value={this.state.type}
|
|
||||||
onClick={this.handleTypeChange.bind(this)}
|
|
||||||
/>
|
|
||||||
<AtInput
|
|
||||||
clear
|
|
||||||
required
|
|
||||||
name='device'
|
|
||||||
title={pt.get().repairPage.deviceText.title}
|
|
||||||
type='text'
|
|
||||||
placeholder={pt.get().repairPage.deviceText.placeholder}
|
|
||||||
value={this.state.device}
|
|
||||||
onChange={this.handleDeviceChange.bind(this)}
|
|
||||||
/>
|
|
||||||
<AtInput
|
|
||||||
clear
|
|
||||||
required
|
|
||||||
name='deviceModel'
|
|
||||||
title={pt.get().repairPage.deviceText.title}
|
|
||||||
type='text'
|
|
||||||
placeholder={pt.get().repairPage.deviceText.placeholder}
|
|
||||||
value={this.state.deviceModel}
|
|
||||||
onChange={this.handleDeviceModelChange.bind(this)}
|
|
||||||
/>
|
|
||||||
<AtInput
|
|
||||||
clear
|
|
||||||
required
|
|
||||||
name='owner'
|
|
||||||
title={pt.get().repairPage.ownerText.title}
|
|
||||||
type='text'
|
|
||||||
placeholder={pt.get().repairPage.ownerText.placeholder}
|
|
||||||
value={this.state.owner}
|
|
||||||
onChange={this.handleOwnerChange.bind(this)}
|
|
||||||
/>
|
|
||||||
<AtInput
|
|
||||||
clear
|
|
||||||
required
|
|
||||||
name='phone'
|
|
||||||
title={pt.get().repairPage.phoneText.title}
|
|
||||||
type='number'
|
|
||||||
placeholder={pt.get().repairPage.phoneText.placeholder}
|
|
||||||
value={this.state.phone}
|
|
||||||
onChange={this.handlePhoneChange.bind(this)}
|
|
||||||
/>
|
|
||||||
<AtInput
|
|
||||||
clear
|
|
||||||
required
|
|
||||||
name='description'
|
|
||||||
title={pt.get().repairPage.descriptionText.title}
|
|
||||||
type='text'
|
|
||||||
placeholder={pt.get().repairPage.descriptionText.placeholder}
|
|
||||||
value={this.state.description}
|
|
||||||
onChange={this.handleDescriptionChange.bind(this)}
|
|
||||||
/>
|
|
||||||
<AtButton
|
|
||||||
loading={this.state.isLoading}
|
|
||||||
formType='submit'
|
|
||||||
type='primary'
|
|
||||||
disabled={this.state.isDisable}
|
|
||||||
>
|
|
||||||
{pt.get().button.buttonText.submit}
|
|
||||||
</AtButton>
|
|
||||||
</AtForm>
|
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import { Component, ReactNode } from 'react';
|
import { Component, ReactNode } from 'react';
|
||||||
import { AtForm, AtInput, AtButton, AtMessage } from 'taro-ui';
|
import { AtForm, AtInput, AtButton, AtMessage } from 'taro-ui';
|
||||||
import { View } from '@tarojs/components';
|
import { View } from '@tarojs/components';
|
||||||
|
import { getUrl } from '@/service';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import pt from '@/plain-text';
|
import pt from '@/plain-text';
|
||||||
import { updateUserInfo } from '@/service/userData';
|
|
||||||
import './inform.scss';
|
import './inform.scss';
|
||||||
|
|
||||||
const submitInterval = 5000;
|
const submitInterval = 5000;
|
||||||
|
|
@ -40,7 +40,32 @@ export default class InformPage extends Component {
|
||||||
isDisable: true,
|
isDisable: true,
|
||||||
});
|
});
|
||||||
console.log(this.state.name, this.state.phone);
|
console.log(this.state.name, this.state.phone);
|
||||||
updateUserInfo(this);
|
Taro.request({
|
||||||
|
url: getUrl('/user/update'),
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
token: 'token_test',
|
||||||
|
name: this.state.name,
|
||||||
|
phone: this.state.phone,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
console.log(res.data);
|
||||||
|
Taro.atMessage({
|
||||||
|
message: pt.get().button.submitText.success,
|
||||||
|
type: 'success',
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.log(err);
|
||||||
|
Taro.atMessage({
|
||||||
|
message: pt.get().button.submitText.error + err.toString(),
|
||||||
|
type: 'error',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
this.setState({
|
||||||
|
isLoading: false,
|
||||||
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isDisable: false,
|
isDisable: false,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { AtList, AtListItem, AtToast } from 'taro-ui';
|
import { AtList, AtListItem, AtToast } from 'taro-ui';
|
||||||
import { Component, ReactNode } from 'react';
|
import { Component, ReactNode } from 'react';
|
||||||
import { View, Picker, Image, Text } from '@tarojs/components';
|
import { View, Picker, Image, Text } from '@tarojs/components';
|
||||||
|
import { getUrl } from '@/service';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
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';
|
||||||
|
|
@ -8,7 +9,6 @@ import aboutIcon from '@/assets/icons/AboutPage/about.svg';
|
||||||
import pt, { Lang } from '@/plain-text';
|
import pt, { Lang } from '@/plain-text';
|
||||||
import wechatUser from '@/wechat';
|
import wechatUser from '@/wechat';
|
||||||
import logo from '@/assets/images/UserPage/logo.png';
|
import logo from '@/assets/images/UserPage/logo.png';
|
||||||
import { setLocaleData } from '@/service/localeData';
|
|
||||||
import './user.scss';
|
import './user.scss';
|
||||||
|
|
||||||
const listLangInterval = 20;
|
const listLangInterval = 20;
|
||||||
|
|
@ -70,7 +70,16 @@ export default class UserPage extends Component {
|
||||||
});
|
});
|
||||||
let currentLang = this.showLangDict[this.state.selector[e.detail.value]];
|
let currentLang = this.showLangDict[this.state.selector[e.detail.value]];
|
||||||
pt.setLang(currentLang);
|
pt.setLang(currentLang);
|
||||||
setLocaleData(currentLang);
|
Taro.request({
|
||||||
|
url: getUrl('/user/locale/update'),
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
token: 'token_test',
|
||||||
|
lang: currentLang,
|
||||||
|
},
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res.data);
|
||||||
|
});
|
||||||
Taro.reLaunch({
|
Taro.reLaunch({
|
||||||
url: '/pages/user/user',
|
url: '/pages/user/user',
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,80 +0,0 @@
|
||||||
export interface RepairPageText {
|
|
||||||
typeText: {
|
|
||||||
computer: string;
|
|
||||||
appliance: string;
|
|
||||||
};
|
|
||||||
deviceText: {
|
|
||||||
title: string;
|
|
||||||
placeholder: string;
|
|
||||||
};
|
|
||||||
deviceModelText: {
|
|
||||||
title: string;
|
|
||||||
placeholder: string;
|
|
||||||
};
|
|
||||||
ownerText: {
|
|
||||||
title: string;
|
|
||||||
placeholder: string;
|
|
||||||
};
|
|
||||||
phoneText: {
|
|
||||||
title: string;
|
|
||||||
placeholder: string;
|
|
||||||
};
|
|
||||||
descriptionText: {
|
|
||||||
title: string;
|
|
||||||
placeholder: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export const repairPageZhCn: RepairPageText = {
|
|
||||||
typeText: {
|
|
||||||
computer: '电脑',
|
|
||||||
appliance: '电器',
|
|
||||||
},
|
|
||||||
deviceText: {
|
|
||||||
title: '设备品牌',
|
|
||||||
placeholder: '如:ROG',
|
|
||||||
},
|
|
||||||
deviceModelText: {
|
|
||||||
title: '设备型号',
|
|
||||||
placeholder: '如:幻 14 2022',
|
|
||||||
},
|
|
||||||
ownerText: {
|
|
||||||
title: '机主姓名',
|
|
||||||
placeholder: '如:晓洋',
|
|
||||||
},
|
|
||||||
phoneText: {
|
|
||||||
title: '联系方式',
|
|
||||||
placeholder: '如:18888888888',
|
|
||||||
},
|
|
||||||
descriptionText: {
|
|
||||||
title: '问题描述',
|
|
||||||
placeholder: '如:ZJUWLAN 无法登入校内网站',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const repairPageEnUs: RepairPageText = {
|
|
||||||
typeText: {
|
|
||||||
computer: '电脑',
|
|
||||||
appliance: '电器',
|
|
||||||
},
|
|
||||||
deviceText: {
|
|
||||||
title: '设备品牌',
|
|
||||||
placeholder: 'e.g. ROG',
|
|
||||||
},
|
|
||||||
deviceModelText: {
|
|
||||||
title: '设备型号',
|
|
||||||
placeholder: 'e.g. Zephyrus G14 2022',
|
|
||||||
},
|
|
||||||
ownerText: {
|
|
||||||
title: '机主姓名',
|
|
||||||
placeholder: 'e.g. Dean Ma',
|
|
||||||
},
|
|
||||||
phoneText: {
|
|
||||||
title: '联系方式',
|
|
||||||
placeholder: 'e.g. 18888888888',
|
|
||||||
},
|
|
||||||
descriptionText: {
|
|
||||||
title: '问题描述',
|
|
||||||
placeholder: 'e.g. ZJUWLAN 无法登入校内网站',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
interface StepItem {
|
|
||||||
title: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TicketDetailText {
|
|
||||||
stepItems: Array<StepItem>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const ticketDetailZhCn: TicketDetailText = {
|
|
||||||
stepItems: [{ title: '创建成功' }, { title: '维修中' }, { title: '待取回' }],
|
|
||||||
};
|
|
||||||
|
|
||||||
export const ticketDetailEnUs: TicketDetailText = {
|
|
||||||
stepItems: [
|
|
||||||
{ title: 'Ticket created' },
|
|
||||||
{ title: 'Repairing' },
|
|
||||||
{ title: 'Take home' },
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
@ -9,12 +9,6 @@ import { ButtonText, buttonEnUs, buttonZhCn } from './Button';
|
||||||
import { MemberPageText, memberPageEnUs, memberPageZhCn } from './MemberPage';
|
import { MemberPageText, memberPageEnUs, memberPageZhCn } from './MemberPage';
|
||||||
import { TicketListText, ticketListEnUs, ticketListZhCn } from './TicketList';
|
import { TicketListText, ticketListEnUs, ticketListZhCn } from './TicketList';
|
||||||
import { NavBarTitle, navBarTitleEnUs, navBarTitleZhCh } from './NavBarTitle';
|
import { NavBarTitle, navBarTitleEnUs, navBarTitleZhCh } from './NavBarTitle';
|
||||||
import { RepairPageText, repairPageEnUs, repairPageZhCn } from './RepairPage';
|
|
||||||
import {
|
|
||||||
TicketDetailText,
|
|
||||||
ticketDetailEnUs,
|
|
||||||
ticketDetailZhCn,
|
|
||||||
} from './TicketDetail';
|
|
||||||
|
|
||||||
interface TextRecord {
|
interface TextRecord {
|
||||||
pageFooter: PageFooterText;
|
pageFooter: PageFooterText;
|
||||||
|
|
@ -28,8 +22,6 @@ interface TextRecord {
|
||||||
memberPage: MemberPageText;
|
memberPage: MemberPageText;
|
||||||
ticketList: TicketListText;
|
ticketList: TicketListText;
|
||||||
navBar: NavBarTitle;
|
navBar: NavBarTitle;
|
||||||
repairPage: RepairPageText;
|
|
||||||
ticketDetail: TicketDetailText;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const textZhCn: TextRecord = {
|
const textZhCn: TextRecord = {
|
||||||
|
|
@ -44,8 +36,6 @@ const textZhCn: TextRecord = {
|
||||||
memberPage: memberPageZhCn,
|
memberPage: memberPageZhCn,
|
||||||
ticketList: ticketListZhCn,
|
ticketList: ticketListZhCn,
|
||||||
navBar: navBarTitleZhCh,
|
navBar: navBarTitleZhCh,
|
||||||
repairPage: repairPageZhCn,
|
|
||||||
ticketDetail: ticketDetailZhCn,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const textEnUs: TextRecord = {
|
const textEnUs: TextRecord = {
|
||||||
|
|
@ -60,8 +50,6 @@ const textEnUs: TextRecord = {
|
||||||
memberPage: memberPageEnUs,
|
memberPage: memberPageEnUs,
|
||||||
ticketList: ticketListEnUs,
|
ticketList: ticketListEnUs,
|
||||||
navBar: navBarTitleEnUs,
|
navBar: navBarTitleEnUs,
|
||||||
repairPage: repairPageEnUs,
|
|
||||||
ticketDetail: ticketDetailEnUs,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// type Lang = 'zh_CN' | 'en_US' | ...;
|
// type Lang = 'zh_CN' | 'en_US' | ...;
|
||||||
|
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
import MainPage from '@/pages/index';
|
|
||||||
import Taro from '@tarojs/taro';
|
|
||||||
import { getUrl } from '.';
|
|
||||||
|
|
||||||
export function getDutyInfo(that: MainPage) {
|
|
||||||
Taro.request({
|
|
||||||
url: getUrl('/dutyinfo'),
|
|
||||||
method: 'GET',
|
|
||||||
data: {
|
|
||||||
token: 'token_test',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.then(res => {
|
|
||||||
const data = res.data.data;
|
|
||||||
if (data.isInDuty) {
|
|
||||||
that.setState({
|
|
||||||
dutyData: {
|
|
||||||
isInDuty: data.isInDuty,
|
|
||||||
inDutyCnt: data.inDutyCnt,
|
|
||||||
currentDuty: data.currentDuty,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
that.setState({
|
|
||||||
dutyData: {
|
|
||||||
isInDuty: data.isInDuty,
|
|
||||||
offDutyReason: data.offDutyReason,
|
|
||||||
dutyRecoverTime: data.dutyRecoverTime,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
console.log(err);
|
|
||||||
that.setState({
|
|
||||||
dutyData: {
|
|
||||||
isInDuty: false,
|
|
||||||
offDutyReason: '获取失败!Network Error!',
|
|
||||||
dutyRecoverTime: '获取失败!Network Error!',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
import Taro from '@tarojs/taro';
|
|
||||||
import pt, { Lang } from '@/plain-text';
|
|
||||||
import { getUrl } from '.';
|
|
||||||
|
|
||||||
export function setLocaleData(lang: Lang) {
|
|
||||||
Taro.request({
|
|
||||||
url: getUrl('/user/locale/update'),
|
|
||||||
method: 'POST',
|
|
||||||
data: {
|
|
||||||
token: 'token_test',
|
|
||||||
lang: lang,
|
|
||||||
},
|
|
||||||
}).then(res => {
|
|
||||||
console.log(res.data);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getLocaleData() {
|
|
||||||
Taro.request({
|
|
||||||
url: getUrl('/user/locale/get'),
|
|
||||||
method: 'GET',
|
|
||||||
data: {
|
|
||||||
token: 'token_test',
|
|
||||||
},
|
|
||||||
}).then(res => {
|
|
||||||
console.log(res.data);
|
|
||||||
pt.setLang(res.data.data.lang);
|
|
||||||
Taro.reLaunch({
|
|
||||||
url: '/pages/index/index',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
import InformPage from '@/pages/user/inform/inform';
|
|
||||||
import Taro from '@tarojs/taro';
|
|
||||||
import pt from '@/plain-text';
|
|
||||||
import { getUrl } from '.';
|
|
||||||
|
|
||||||
export function updateUserInfo(that: InformPage) {
|
|
||||||
Taro.request({
|
|
||||||
url: getUrl('/user/update'),
|
|
||||||
method: 'POST',
|
|
||||||
data: {
|
|
||||||
token: 'token_test',
|
|
||||||
name: that.state.name,
|
|
||||||
phone: that.state.phone,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.then(res => {
|
|
||||||
console.log(res.data);
|
|
||||||
that.setState({
|
|
||||||
isLoading: false,
|
|
||||||
});
|
|
||||||
Taro.atMessage({
|
|
||||||
message: pt.get().button.submitText.success,
|
|
||||||
type: 'success',
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
console.log(err);
|
|
||||||
that.setState({
|
|
||||||
isLoading: false,
|
|
||||||
});
|
|
||||||
Taro.atMessage({
|
|
||||||
message: pt.get().button.submitText.error + err.toString(),
|
|
||||||
type: 'error',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue