Compare commits

..

No commits in common. "74f644b3eed06f2b2dd9a18c9778197d0e97aaa0" and "a408ac9e39dd6714262242bd17c5a11e146c9756" have entirely different histories.

17 changed files with 32 additions and 394 deletions

View File

@ -6,7 +6,6 @@ export default defineAppConfig({
'pages/user/myTicket/myTicket', 'pages/user/myTicket/myTicket',
'pages/user/inform/inform', 'pages/user/inform/inform',
'pages/user/settings/settings', 'pages/user/settings/settings',
'pages/user/settings/about/about',
'pages/user/report/report', 'pages/user/report/report',
], ],
window: { window: {

View File

@ -3,20 +3,19 @@ import { AtTabBar } from 'taro-ui';
import Taro from '@tarojs/taro'; import Taro from '@tarojs/taro';
import 'taro-ui/dist/style/index.scss'; import 'taro-ui/dist/style/index.scss';
import './index.scss'; import './index.scss';
import pt from '@/plain-text';
const navList: Array<Taro.TabBarItem> = [ const navList: Array<Taro.TabBarItem> = [
{ {
pagePath: '/pages/index/index', pagePath: '/pages/index/index',
text: pt.get().tabBar.indexText, text: '主页',
}, },
{ {
pagePath: '/pages/repair/repair', pagePath: '/pages/repair/repair',
text: pt.get().tabBar.repairText, text: '维修',
}, },
{ {
pagePath: '/pages/user/user', pagePath: '/pages/user/user',
text: pt.get().tabBar.userText, text: '我的',
}, },
]; ];
@ -25,15 +24,15 @@ export default class Index extends Component {
selected: 0, selected: 0,
tabList: [ tabList: [
{ {
title: pt.get().tabBar.indexText, title: '主页',
iconType: 'home', iconType: 'home',
}, },
{ {
title: pt.get().tabBar.repairText, title: '维修',
iconType: 'settings', iconType: 'settings',
}, },
{ {
title: pt.get().tabBar.userText, title: '我的',
iconType: 'user', iconType: 'user',
}, },
], ],

View File

@ -1,15 +1,12 @@
import { Component, ReactNode } from 'react'; import { Component, ReactNode } from 'react';
import { AtForm, AtInput, AtButton, AtMessage } from 'taro-ui'; import { AtForm, AtInput, AtButton } from 'taro-ui';
import './inform.scss'; import './inform.scss';
import Taro from '@tarojs/taro';
import pt from '@/plain-text';
export default class InformPage extends Component { export default class InformPage extends Component {
state = { state = {
phone: '', phone: '',
name: '', name: '',
isLoading: false, isLoading: false,
isDisable: false,
}; };
handleChangePhone(phone: string) { handleChangePhone(phone: string) {
this.setState({ this.setState({
@ -26,21 +23,11 @@ export default class InformPage extends Component {
onSubmit() { onSubmit() {
this.setState({ this.setState({
isLoading: true, isLoading: true,
isDisable: true,
}); });
console.log(this.state.name, this.state.phone); console.log(this.state.name, this.state.phone);
this.setState({ this.setState({
isLoading: false, isLoading: false,
}); });
Taro.atMessage({
message: pt.get().informPage.submitText.success,
type: 'success',
});
setTimeout(() => {
this.setState({
isDisable: false,
});
}, 5000);
} }
onReset() { onReset() {
this.setState({ this.setState({
@ -55,21 +42,20 @@ export default class InformPage extends Component {
onSubmit={this.onSubmit.bind(this)} onSubmit={this.onSubmit.bind(this)}
onReset={this.onReset.bind(this)} onReset={this.onReset.bind(this)}
> >
<AtMessage />
<AtInput <AtInput
name='phone' name='phone'
title={pt.get().informPage.phoneText.title} title='手机号码'
type='text' type='text'
placeholder={pt.get().informPage.phoneText.placeholder} placeholder='便于查询工单'
value={this.state.phone} value={this.state.phone}
onChange={this.handleChangePhone.bind(this)} onChange={this.handleChangePhone.bind(this)}
/> />
<AtInput <AtInput
required required
name='name' name='name'
title={pt.get().informPage.nameText.title} title='真实姓名'
type='text' type='text'
placeholder={pt.get().informPage.nameText.placeholder} placeholder='必填,与工单绑定'
value={this.state.name} value={this.state.name}
onChange={this.handleChangeName.bind(this)} onChange={this.handleChangeName.bind(this)}
/> />
@ -77,12 +63,11 @@ export default class InformPage extends Component {
loading={this.state.isLoading} loading={this.state.isLoading}
formType='submit' formType='submit'
type='primary' type='primary'
disabled={this.state.isDisable}
> >
{pt.get().informPage.buttonText.submit}
</AtButton> </AtButton>
<AtButton formType='reset' type='secondary'> <AtButton formType='reset' type='secondary'>
{pt.get().informPage.buttonText.reset}
</AtButton> </AtButton>
</AtForm> </AtForm>
); );

View File

@ -1,14 +1,11 @@
import { AtTextarea, AtButton, AtForm, AtMessage } from 'taro-ui'; import { AtTextarea, AtButton, AtForm } from 'taro-ui';
import { Component, ReactNode } from 'react'; import { Component, ReactNode } from 'react';
import './report.scss'; import './report.scss';
import Taro from '@tarojs/taro';
import pt from '@/plain-text';
export default class SettingsPage extends Component { export default class SettingsPage extends Component {
state = { state = {
report: '', report: '',
isLoading: false, isLoading: false,
isDisable: false,
}; };
handleChange(report: string) { handleChange(report: string) {
this.setState({ this.setState({
@ -18,21 +15,11 @@ export default class SettingsPage extends Component {
onSubmit() { onSubmit() {
this.setState({ this.setState({
isLoading: true, isLoading: true,
isDisable: true,
}); });
console.log(this.state.report); console.log(this.state.report);
this.setState({ this.setState({
isLoading: false, isLoading: false,
}); });
Taro.atMessage({
message: '提交成功',
type: 'success',
});
setTimeout(() => {
this.setState({
isDisable: false,
});
}, 5000);
} }
onReset() { onReset() {
this.setState({ this.setState({
@ -45,23 +32,21 @@ export default class SettingsPage extends Component {
onSubmit={this.onSubmit.bind(this)} onSubmit={this.onSubmit.bind(this)}
onReset={this.onReset.bind(this)} onReset={this.onReset.bind(this)}
> >
<AtMessage />
<AtTextarea <AtTextarea
value={this.state.report} value={this.state.report}
onChange={this.handleChange.bind(this)} onChange={this.handleChange.bind(this)}
maxLength={200} maxLength={200}
placeholder={pt.get().reportPage.placeHolderText} placeholder='无论是有关于小程序的建议还是关于E志者协会的建议都可以提出来哦'
/> />
<AtButton <AtButton
loading={this.state.isLoading} loading={this.state.isLoading}
formType='submit' formType='submit'
type='primary' type='primary'
disabled={this.state.isDisable}
> >
{pt.get().reportPage.buttonText.submit}
</AtButton> </AtButton>
<AtButton formType='reset' type='secondary'> <AtButton formType='reset' type='secondary'>
{pt.get().reportPage.buttonText.reset}
</AtButton> </AtButton>
</AtForm> </AtForm>
); );

View File

@ -1,3 +0,0 @@
export default definePageConfig({
usingComponents: {},
});

View File

@ -1,9 +0,0 @@
import { Component, ReactNode } from 'react';
import './about.scss';
import { View } from '@tarojs/components';
export default class SettingsPage extends Component {
render(): ReactNode {
return <View></View>;
}
}

View File

@ -1,70 +1,16 @@
import { AtButton, AtList, AtListItem } from 'taro-ui'; import { AtButton } from 'taro-ui';
import { Component, ReactNode } from 'react'; import { Component, ReactNode } from 'react';
import './settings.scss'; import './settings.scss';
import Taro from '@tarojs/taro';
import { View, Picker } from '@tarojs/components';
import pt, { Lang } from '@/plain-text';
export default class SettingsPage extends Component { export default class SettingsPage extends Component {
showLangDict: Record<string, Lang> = {
: 'zh_CN',
English: 'en_US',
};
reversedShowLangDict: Record<Lang, string> = {
zh_CN: '简体中文',
en_US: 'English',
};
state = {
selector: ['简体中文', 'English'],
selectorChecked: this.reversedShowLangDict[pt.getCurLang()],
};
onSelect = (e: { detail: { value: string | number } }) => {
this.setState({
selectorChecked: this.state.selector[e.detail.value],
});
pt.setLang(this.showLangDict[this.state.selector[e.detail.value]]);
Taro.reLaunch({
url: '/pages/index/index',
});
};
handleQuit() { handleQuit() {
console.log('Quit'); console.log('Quit');
} }
handleAbout() {
Taro.navigateTo({
url: '/pages/user/settings/about/about',
});
}
render(): ReactNode { render(): ReactNode {
return ( return (
<View>
<View>
<Picker
mode='selector'
range={this.state.selector}
onChange={this.onSelect}
>
<AtList>
<AtListItem
title='语言 / Language'
extraText={this.state.selectorChecked}
/>
</AtList>
</Picker>
</View>
<AtButton type='secondary' onClick={this.handleAbout.bind(this)}>
{pt.get().settingsPage.aboutText}
</AtButton>
<AtButton type='primary' onClick={this.handleQuit.bind(this)}> <AtButton type='primary' onClick={this.handleQuit.bind(this)}>
{pt.get().settingsPage.quitText} 退
</AtButton> </AtButton>
</View>
); );
} }
} }

View File

@ -4,8 +4,6 @@ import Taro from '@tarojs/taro';
import type CustomTabBar from '../../custom-tab-bar'; import type CustomTabBar from '../../custom-tab-bar';
import './user.scss'; import './user.scss';
import { AtList, AtListItem } from 'taro-ui'; import { AtList, AtListItem } from 'taro-ui';
import PageFooter from '@/components/PageFooter/PageFooter';
import pt from '@/plain-text';
export default class UserPage extends Component { export default class UserPage extends Component {
// 以下是TabBar相关 // 以下是TabBar相关
@ -45,37 +43,36 @@ export default class UserPage extends Component {
<View> <View>
<AtList> <AtList>
<AtListItem <AtListItem
title={pt.get().userPage.ticketColumn.title} title='我的工单'
note={pt.get().userPage.ticketColumn.note} note='在这里查看历史工单!'
arrow='right' arrow='right'
iconInfo={{ size: 25, color: '#E69966', value: 'clock' }} iconInfo={{ size: 25, color: '#E69966', value: 'clock' }}
onClick={this.myTicketPage} onClick={this.myTicketPage}
/> />
<AtListItem <AtListItem
title={pt.get().userPage.infoColumn.title} title='我的信息'
note={pt.get().userPage.infoColumn.note} note='能帮助亦可更好地找到你哦!'
arrow='right' arrow='right'
iconInfo={{ size: 25, color: '#78A4FA', value: 'user' }} iconInfo={{ size: 25, color: '#78A4FA', value: 'user' }}
onClick={this.informPage} onClick={this.informPage}
/> />
<AtListItem <AtListItem
title={pt.get().userPage.settingsColumn.title} title='设置'
note={pt.get().userPage.settingsColumn.note} note='配置小程序'
extraText='' extraText=''
arrow='right' arrow='right'
iconInfo={{ size: 25, color: '#808080', value: 'filter' }} iconInfo={{ size: 25, color: '#808080', value: 'filter' }}
onClick={this.settingsPage} onClick={this.settingsPage}
/> />
<AtListItem <AtListItem
title={pt.get().userPage.reportColumn.title} title='意见反馈'
note={pt.get().userPage.reportColumn.note} note='有什么想说的都可以告诉我们哦!'
extraText='' extraText=''
arrow='right' arrow='right'
iconInfo={{ size: 25, color: '#9ACD32', value: 'message' }} iconInfo={{ size: 25, color: '#9ACD32', value: 'message' }}
onClick={this.reportPage} onClick={this.reportPage}
/> />
</AtList> </AtList>
<PageFooter />
</View> </View>
); );
} }

View File

@ -1,53 +0,0 @@
export interface InformPageText {
submitText: {
success: string;
};
phoneText: {
title: string;
placeholder: string;
};
nameText: {
title: string;
placeholder: string;
};
buttonText: {
submit: string;
reset: string;
};
}
export const informPageZhCn: InformPageText = {
submitText: {
success: '提交成功',
},
phoneText: {
title: '手机号码',
placeholder: '便于查询工单',
},
nameText: {
title: '真实姓名',
placeholder: '必填,与工单绑定',
},
buttonText: {
submit: '提交',
reset: '清空',
},
};
export const informtPageEnUs: InformPageText = {
submitText: {
success: 'Success',
},
phoneText: {
title: 'Phone',
placeholder: '便于查询工单',
},
nameText: {
title: 'Real Name',
placeholder: '必填,与工单绑定',
},
buttonText: {
submit: 'Submit',
reset: 'Reset',
},
};

View File

@ -75,52 +75,3 @@ export const mainPageZhCn: MainPageText = {
}, },
}, },
}; };
export const mainPageEnUs: MainPageText = {
mainTitleLine: '您好这里是E志者协会',
subTitleLine: '维修请至【东三-204】实验室',
cardTitle: {
dutyInfo: '204值班情况',
stepInfo: '维修步骤',
tipsInfo: '注意事项',
},
expandTitle: {
stepInfo: '查看维修步骤',
tipsInfo: '查看注意事项',
},
stepList: [
{ title: '线上填写工单' },
{ title: '去`东三-204`实验室维修电脑' },
{ title: '等待电脑维修' },
{ title: '维修结束,取回电脑' },
],
tipsList: [
{ title: '戴尔、Surface、外星人、苹果电脑不能拆机哦~' },
{ title: '数据无价,请随时做好数据备份哦~' },
{ title: '204也是实验室请遵守实验室纪律请勿饮食~' },
{ title: '我们是志愿服务,不收任何礼物哦~' },
],
dutyCard: {
offDuty: {
title: '未值班',
reason: s => '值班停止原因:' + s,
recoverTime: t => '恢复值班时间:' + t,
},
inDuty: {
title: '值班中',
currentDutyText: c => {
switch (c) {
case 'off':
return '当前未值班';
case '1':
return '第一班 13:30-16:00';
case '2':
return '第二班 16:00-18:00';
case '3':
return '第三班 18:00-20:30';
}
},
inDutyCnt: n => '当前值班人数:' + n,
},
},
};

View File

@ -5,7 +5,3 @@ export interface PageFooterText {
export const pageFooterZhCn: PageFooterText = { export const pageFooterZhCn: PageFooterText = {
dividerText: 'EVA Notify', dividerText: 'EVA Notify',
}; };
export const pageFooterEnUs: PageFooterText = {
dividerText: 'EVA Notify',
};

View File

@ -1,25 +0,0 @@
export interface ReportPageText {
placeHolderText: string;
buttonText: {
submit: string;
reset: string;
};
}
export const reportPageZhCn: ReportPageText = {
placeHolderText:
'无论是有关于小程序的建议还是关于E志者协会的建议都可以提出来哦',
buttonText: {
submit: '提交',
reset: '清空',
},
};
export const reportPageEnUs: ReportPageText = {
placeHolderText:
'无论是有关于小程序的建议还是关于E志者协会的建议都可以提出来哦',
buttonText: {
submit: 'Submit',
reset: 'Reset',
},
};

View File

@ -1,14 +0,0 @@
export interface SettingsPageText {
aboutText: string;
quitText: string;
}
export const settingsPageZhCn: SettingsPageText = {
aboutText: '关于 EVA Notify',
quitText: '退出账号',
};
export const settingsPageEnUs: SettingsPageText = {
aboutText: 'About EVA Notify',
quitText: 'Log Out',
};

View File

@ -1,17 +0,0 @@
export interface TabBarText {
indexText: string;
repairText: string;
userText: string;
}
export const tabBarZhCn: TabBarText = {
indexText: '主页',
repairText: '维修',
userText: '我的',
};
export const tabBarEnUs: TabBarText = {
indexText: 'Home',
repairText: 'Repair',
userText: 'Account',
};

View File

@ -1,62 +0,0 @@
export interface UserPageText {
mainTitleLine: string;
subTitleLine: string;
ticketColumn: {
title: string;
note: string;
};
infoColumn: {
title: string;
note: string;
};
settingsColumn: {
title: string;
note: string;
};
reportColumn: {
title: string;
note: string;
};
}
export const userPageZhCn: UserPageText = {
mainTitleLine: '您好这里是E志者协会',
subTitleLine: '维修请至【东三-204】实验室',
ticketColumn: {
title: '我的工单',
note: '在这里查看历史工单!',
},
infoColumn: {
title: '我的信息',
note: '能帮助亦可更好地找到你哦!',
},
settingsColumn: {
title: '应用设置',
note: '在这里配置小程序',
},
reportColumn: {
title: '意见反馈',
note: '有什么想说的都可以告诉亦可哦!',
},
};
export const userPageEnUs: UserPageText = {
mainTitleLine: '您好这里是E志者协会',
subTitleLine: '维修请至【东三-204】实验室',
ticketColumn: {
title: '我的工单',
note: '在这里查看历史工单!',
},
infoColumn: {
title: '我的信息',
note: '能帮助亦可更好地找到你哦!',
},
settingsColumn: {
title: 'Settings',
note: '在这里配置小程序',
},
reportColumn: {
title: '意见反馈',
note: '有什么想说的都可以告诉亦可哦!',
},
};

View File

@ -1,56 +1,25 @@
import { PageFooterText, pageFooterZhCn, pageFooterEnUs } from './PageFooter'; import { PageFooterText, pageFooterZhCn } from './PageFooter';
import { MainPageText, mainPageZhCn, mainPageEnUs } from './MainPage'; import { MainPageText, mainPageZhCn } from './MainPage';
import { UserPageText, userPageZhCn, userPageEnUs } from './UserPage';
import { TabBarText, tabBarEnUs, tabBarZhCn } from './TabBar';
import {
SettingsPageText,
settingsPageEnUs,
settingsPageZhCn,
} from './SettingsPage';
import { ReportPageText, reportPageEnUs, reportPageZhCn } from './ReportPage';
import { InformPageText, informPageZhCn, informtPageEnUs } from './InformPage';
interface TextRecord { interface TextRecord {
pageFooter: PageFooterText; pageFooter: PageFooterText;
mainPage: MainPageText; mainPage: MainPageText;
userPage: UserPageText;
tabBar: TabBarText;
settingsPage: SettingsPageText;
reportPage: ReportPageText;
informPage: InformPageText;
} }
const textZhCn: TextRecord = { const textZhCn: TextRecord = {
pageFooter: pageFooterZhCn, pageFooter: pageFooterZhCn,
mainPage: mainPageZhCn, mainPage: mainPageZhCn,
userPage: userPageZhCn,
tabBar: tabBarZhCn,
settingsPage: settingsPageZhCn,
reportPage: reportPageZhCn,
informPage: informPageZhCn,
};
const textEnUs: TextRecord = {
pageFooter: pageFooterEnUs,
mainPage: mainPageEnUs,
userPage: userPageEnUs,
tabBar: tabBarEnUs,
settingsPage: settingsPageEnUs,
reportPage: reportPageEnUs,
informPage: informtPageEnUs,
}; };
// type Lang = 'zh_CN' | 'en_US' | ...; // type Lang = 'zh_CN' | 'en_US' | ...;
export type Lang = 'zh_CN' | 'en_US'; type Lang = 'zh_CN';
class PlainText { class PlainText {
private readonly textZhCn: TextRecord; private readonly textZhCn: TextRecord;
private readonly textEnUs: TextRecord;
private lang: Lang; private lang: Lang;
constructor() { constructor() {
this.textZhCn = textZhCn; this.textZhCn = textZhCn;
this.textEnUs = textEnUs;
this.lang = 'zh_CN'; this.lang = 'zh_CN';
} }
@ -61,15 +30,9 @@ class PlainText {
get(): TextRecord { get(): TextRecord {
if (this.lang == 'zh_CN') { if (this.lang == 'zh_CN') {
return this.textZhCn; return this.textZhCn;
} else if (this.lang == 'en_US') {
return this.textEnUs;
} }
return this.textZhCn; return this.textZhCn;
} }
getCurLang(): Lang {
return this.lang;
}
} }
const pt = new PlainText(); const pt = new PlainText();