Compare commits

..

11 Commits

Author SHA1 Message Date
Dawn_Ocean 2920059ffa merging all into dev 2024-03-11 14:17:57 +08:00
Dawn_Ocean d2de74578b Merge branch 'yhy' into dev 2024-03-11 14:13:39 +08:00
Dawn_Ocean ac23f88cdd add member login mock 2024-03-11 14:03:23 +08:00
Dawn_Ocean e1e998628f remove reset button from inform page 2024-03-11 13:55:54 +08:00
Dawn_Ocean 806e7a393c add member login page 2024-03-11 13:52:09 +08:00
Dawn_Ocean fd6a60d1d3 add route for memberlogin page 2024-03-11 11:59:12 +08:00
Dawn_Ocean 36a9a35886 add member login entry in user page 2024-03-11 11:58:12 +08:00
Dawn_Ocean dd770b8ece add inform page request 2024-03-08 22:45:40 +08:00
Dawn_Ocean b174304d74 fix mock file structure 2024-03-08 22:27:13 +08:00
Dawn_Ocean 88cdb6cb92 add report request 2024-03-08 21:44:21 +08:00
Dawn_Ocean 00977db512 add locale request 2024-03-08 21:24:08 +08:00
24 changed files with 36446 additions and 36208 deletions

View File

@ -1,8 +1,5 @@
import userinfo from './userinfo.json';
import lang from './lang.json';
import report from './report.json';
import newComment from './newComment.json';
import ticket from './ticket.json';
import mytickets from './mytickets.json';
import ticketInfo from './ticketInfo.json';
export default {
'GET /dutyinfo': {
@ -23,95 +20,35 @@ export default {
},
},
'POST /user/update': {
file: userinfo,
data: {},
},
'GET /user/locale/get': {
success: true,
data: {
token: 'token_test',
lang: 'zn_CN',
lang: 'en_US',
},
},
'POST /user/locale/update': {
file: lang,
data: {},
},
'POST /report': {
file: report,
data: {},
},
'GET /user/mytickets': {
success: true,
data: {
list: [
{
id: 6830,
type: 1,
status: 5,
device: '主机',
deviceModel: '技嘉',
owner: '武技栏',
phone: '18888888888',
createdTime: '2024-03-06T19:49:27.043865',
isConfirmed: false,
},
],
},
data: mytickets,
},
'GET /tickets/info/': {
success: true,
data: {
id: 6847,
type: 1,
device: '华硕',
deviceModel: '灵耀X14',
owner: '唐姐姐',
phone: '15555555555',
description: '清灰',
workers: [],
createdTime: '2024-03-07T19:52:48.523303',
status: 5,
isConfirmed: false,
notes: [
{
avatar: 'https://....jpg',
id: 21368,
op: '宇航员',
type: 0,
content: '',
createdTime: '2024-03-07T19:52:48.523305',
},
{
avatar: 'https://....jpg',
id: 21370,
op: '宇航员',
type: 2,
content: '1',
createdTime: '2024-03-07T19:58:27.838816',
},
{
avatar: 'https://....jpg',
id: 21373,
op: '宇航员',
type: 2,
content: '4',
createdTime: '2024-03-07T20:28:12.070707',
},
{
avatar: 'https://....jpg',
id: 21374,
op: '宇航员',
type: 2,
content: '5',
createdTime: '2024-03-07T20:30:15.770486',
},
],
accessories: [2],
picked: false,
},
data: ticketInfo,
},
'POST /tickets/newcomment': {
file: newComment,
data: {},
},
'POST /tickets/create': {
file: ticket,
data: {},
},
'POST /member/login': {
data: {},
},
};

View File

@ -1,4 +0,0 @@
{
"token": "token_test",
"lang": "en_US"
}

View File

@ -0,0 +1,15 @@
{
"list": [
{
"id": 6830,
"type": 1,
"status": 5,
"device": "主机",
"deviceModel": "技嘉",
"owner": "武技栏",
"phone": "18888888888",
"createdTime": "2024-03-06T19:49:27.043865",
"isConfirmed": false
}
]
}

View File

@ -1,4 +0,0 @@
{
"token": "token_test",
"content": "这是一条评论"
}

View File

@ -1,4 +0,0 @@
{
"token": "token_test",
"content": "aaa bbbb cccc"
}

View File

@ -1,10 +0,0 @@
{
"token": "token_test",
"type": 1,
"device": "华硕",
"deviceModel": "天选3",
"owner": "西西弗",
"phone": "12333333333",
"description": "没法用pd充电",
"accessories": [0]
}

View File

@ -0,0 +1,49 @@
{
"id": 6847,
"type": 1,
"device": "华硕",
"deviceModel": "灵耀X14",
"owner": "唐姐姐",
"phone": "15555555555",
"description": "清灰",
"workers": [],
"createdTime": "2024-03-07T19:52:48.523303",
"status": 5,
"isConfirmed": false,
"notes": [
{
"avatar": "https://....jpg",
"id": 21368,
"op": "宇航员",
"type": 0,
"content": "",
"createdTime": "2024-03-07T19:52:48.523305"
},
{
"avatar": "https://....jpg",
"id": 21370,
"op": "宇航员",
"type": 2,
"content": "1",
"createdTime": "2024-03-07T19:58:27.838816"
},
{
"avatar": "https://....jpg",
"id": 21373,
"op": "宇航员",
"type": 2,
"content": "4",
"createdTime": "2024-03-07T20:28:12.070707"
},
{
"avatar": "https://....jpg",
"id": 21374,
"op": "宇航员",
"type": 2,
"content": "5",
"createdTime": "2024-03-07T20:30:15.770486"
}
],
"accessories": [2],
"picked": false
}

View File

@ -1,4 +0,0 @@
{
"name": "宇航员",
"phone": "12333332103"
}

2
package-lock.json generated
View File

@ -34,7 +34,7 @@
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
"@tarojs/cli": "3.6.24",
"@tarojs/plugin-mock": "^0.0.9",
"@tarojs/plugin-platform-h5": "^3.6.24",
"@tarojs/plugin-platform-h5": "3.6.24",
"@tarojs/taro-loader": "3.6.24",
"@tarojs/test-utils-react": "^0.1.1",
"@tarojs/webpack5-runner": "3.6.24",

View File

@ -66,7 +66,7 @@
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
"@tarojs/cli": "3.6.24",
"@tarojs/plugin-mock": "^0.0.9",
"@tarojs/plugin-platform-h5": "^3.6.24",
"@tarojs/plugin-platform-h5": "3.6.24",
"@tarojs/taro-loader": "3.6.24",
"@tarojs/test-utils-react": "^0.1.1",
"@tarojs/webpack5-runner": "3.6.24",

View File

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

View File

@ -1,11 +1,23 @@
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 './app.scss';
function App({ children }: PropsWithChildren<any>) {
useLaunch(() => {
console.log('App launched.');
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);
});
});
// children 是将要会渲染的页面

View File

@ -1,9 +1,12 @@
import { Component, ReactNode } from 'react';
import { AtForm, AtInput, AtButton, AtMessage } from 'taro-ui';
import { getUrl } from '@/service';
import Taro from '@tarojs/taro';
import pt from '@/plain-text';
import './inform.scss';
const submitInterval = 5000;
export default class InformPage extends Component {
state = {
phone: '',
@ -29,43 +32,56 @@ export default class InformPage extends Component {
isDisable: true,
});
console.log(this.state.name, this.state.phone);
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,
});
Taro.atMessage({
message: pt.get().informPage.submitText.success,
type: 'success',
});
setTimeout(() => {
this.setState({
isDisable: false,
});
}, 5000);
}
onReset() {
this.setState({
phone: '',
name: '',
});
}, submitInterval);
}
render(): ReactNode {
return (
<AtForm
onSubmit={this.onSubmit.bind(this)}
onReset={this.onReset.bind(this)}
>
<AtForm onSubmit={this.onSubmit.bind(this)}>
<AtMessage />
<AtInput
clear
required
name='phone'
title={pt.get().informPage.phoneText.title}
type='text'
type='number'
placeholder={pt.get().informPage.phoneText.placeholder}
value={this.state.phone}
onChange={this.handleChangePhone.bind(this)}
/>
<AtInput
required
clear
name='name'
title={pt.get().informPage.nameText.title}
type='text'
@ -79,10 +95,7 @@ export default class InformPage extends Component {
type='primary'
disabled={this.state.isDisable}
>
{pt.get().informPage.buttonText.submit}
</AtButton>
<AtButton formType='reset' type='secondary'>
{pt.get().informPage.buttonText.reset}
{pt.get().button.buttonText.submit}
</AtButton>
</AtForm>
);

View File

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

View File

View File

@ -0,0 +1,103 @@
import { Component, ReactNode } from 'react';
import { AtForm, AtInput, AtButton, AtMessage } from 'taro-ui';
import { getUrl } from '@/service';
import Taro from '@tarojs/taro';
import pt from '@/plain-text';
import './member.scss';
const loginInterval = 5000;
export default class MemberPage extends Component {
state = {
stuid: '',
passwd: '',
isLoading: false,
isDisable: false,
};
handleChangeStuid(stuid: string) {
this.setState({
stuid: stuid,
});
return stuid;
}
handleChangePasswd(passwd: string) {
this.setState({
passwd: passwd,
});
return passwd;
}
onSubmit() {
this.setState({
isLoading: true,
isDisable: true,
});
console.log([this.state.stuid, this.state.passwd]);
Taro.request({
url: getUrl('/member/login'),
method: 'POST',
data: {
token: 'token_test',
name: this.state.stuid,
passwd: this.state.passwd,
},
})
.then(res => {
console.log(res.data);
Taro.atMessage({
message: pt.get().button.loginText.success,
type: 'success',
});
})
.catch(err => {
console.log(err);
Taro.atMessage({
message: pt.get().button.loginText.error + err.toString(),
type: 'error',
});
});
this.setState({
isLoading: false,
});
setTimeout(() => {
this.setState({
isDisable: false,
});
}, loginInterval);
}
render(): ReactNode {
return (
<AtForm onSubmit={this.onSubmit.bind(this)}>
<AtMessage />
<AtInput
required
name='stuid'
title={pt.get().memberPage.stuidText.title}
type='number'
clear
placeholder={pt.get().memberPage.stuidText.placeholder}
value={this.state.stuid}
onChange={this.handleChangeStuid.bind(this)}
/>
<AtInput
clear
required
name='name'
title={pt.get().memberPage.passwdText.title}
type='password'
placeholder={pt.get().memberPage.passwdText.placeholder}
value={this.state.passwd}
onChange={this.handleChangePasswd.bind(this)}
/>
<AtButton
loading={this.state.isLoading}
formType='submit'
type='primary'
disabled={this.state.isDisable}
>
{pt.get().button.buttonText.login}
</AtButton>
</AtForm>
);
}
}

View File

@ -1,9 +1,12 @@
import { AtTextarea, AtButton, AtForm, AtMessage } from 'taro-ui';
import { Component, ReactNode } from 'react';
import { getUrl } from '@/service';
import Taro from '@tarojs/taro';
import pt from '@/plain-text';
import './report.scss';
const submitInterval = 5000;
export default class SettingsPage extends Component {
state = {
report: '',
@ -21,18 +24,36 @@ export default class SettingsPage extends Component {
isDisable: true,
});
console.log(this.state.report);
Taro.request({
url: getUrl('/report'),
method: 'POST',
data: {
token: 'token_test',
report: this.state.report,
},
})
.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,
});
Taro.atMessage({
message: '提交成功',
type: 'success',
});
setTimeout(() => {
this.setState({
isDisable: false,
});
}, 5000);
}, submitInterval);
}
onReset() {
this.setState({
@ -58,10 +79,10 @@ export default class SettingsPage extends Component {
type='primary'
disabled={this.state.isDisable}
>
{pt.get().reportPage.buttonText.submit}
{pt.get().button.buttonText.submit}
</AtButton>
<AtButton formType='reset' type='secondary'>
{pt.get().reportPage.buttonText.reset}
{pt.get().button.buttonText.reset}
</AtButton>
</AtForm>
);

View File

@ -1,6 +1,7 @@
import { AtList, AtListItem } from 'taro-ui';
import { AtList, AtListItem, AtToast } from 'taro-ui';
import { Component, ReactNode } from 'react';
import { View, Picker, Image, Text } from '@tarojs/components';
import { getUrl } from '@/service';
import Taro from '@tarojs/taro';
import type CustomTabBar from '@/custom-tab-bar';
import PageFooter from '@/components/PageFooter/PageFooter';
@ -9,6 +10,9 @@ import pt, { Lang } from '@/plain-text';
import logo from '@/assets/images/UserPage/logo.png';
import './user.scss';
const listLangInterval = 20;
const memberClickTimes = 7;
export default class UserPage extends Component {
state = {
selector: ['简体中文', 'English'],
@ -16,6 +20,9 @@ export default class UserPage extends Component {
zh_CN: '简体中文',
en_US: 'English',
}[pt.getCurLang()],
clicks: memberClickTimes,
isToastOpen: false,
toastText: '',
};
// 以下是TabBar相关
@ -26,6 +33,30 @@ export default class UserPage extends Component {
}
// 以上是TabBar相关
onTapImage = () => {
this.setState({
clicks: this.state.clicks - 1,
});
if (this.state.clicks < 3) {
this.setState({
toastText:
pt.get().userPage.memberEntry.front +
(this.state.clicks + 1).toString() + // React State's feature
pt.get().userPage.memberEntry.behind,
isToastOpen: true,
});
if (this.state.clicks == 0) {
this.setState({
isToastOpen: false,
clicks: memberClickTimes,
});
Taro.navigateTo({
url: '/pages/user/member/member',
});
}
}
};
showLangDict: Record<string, Lang> = {
: 'zh_CN',
English: 'en_US',
@ -35,7 +66,18 @@ export default class UserPage extends Component {
this.setState({
selectorChecked: this.state.selector[e.detail.value],
});
pt.setLang(this.showLangDict[this.state.selector[e.detail.value]]);
let currentLang = this.showLangDict[this.state.selector[e.detail.value]];
pt.setLang(currentLang);
Taro.request({
url: getUrl('/user/locale/update'),
method: 'POST',
data: {
token: 'token_test',
lang: currentLang,
},
}).then(res => {
console.log(res.data);
});
Taro.reLaunch({
url: '/pages/user/user',
});
@ -72,13 +114,21 @@ export default class UserPage extends Component {
className='at-row at-row__justify--center at-row__align--end'
style='height:110px;'
>
<Image style='width: 100px;height: 100px;' src={logo} />
<Image
onTap={this.onTapImage}
style='width: 100px;height: 100px;'
src={logo}
/>
</View>
<AtToast
isOpened={this.state.isToastOpen}
text={this.state.toastText}
></AtToast>
<View
className='at-row at-row__justify--center at-row__align--center'
style='height:60px;color:#696969;'
>
<Text> EVA Notify v0.0.1</Text>
<Text> EVA Notify v1.0.0</Text>
</View>
<AtList>
<AtListItem
@ -111,7 +161,7 @@ export default class UserPage extends Component {
thumb={aboutIcon}
onClick={this.aboutPage}
/>
<View style={{ height: 20 }}></View>
<View style={{ height: listLangInterval }}></View>
<Picker
mode='selector'
range={this.state.selector}

View File

@ -0,0 +1,47 @@
export interface ButtonText {
buttonText: {
submit: string;
reset: string;
login: string;
};
submitText: {
success: string;
error: string;
};
loginText: {
success: string;
error: string;
};
}
export const buttonZhCn: ButtonText = {
buttonText: {
submit: '提交',
reset: '清空',
login: '登录',
},
submitText: {
success: '提交成功',
error: '提交失败:',
},
loginText: {
success: '登录成功',
error: '登录失败',
},
};
export const buttonEnUs: ButtonText = {
buttonText: {
submit: 'Submit',
reset: 'Reset',
login: 'Login',
},
submitText: {
success: 'Success',
error: 'Error: ',
},
loginText: {
success: '登录成功',
error: '登录失败',
},
};

View File

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

View File

@ -0,0 +1,32 @@
export interface MemberPageText {
stuidText: {
title: string;
placeholder: string;
};
passwdText: {
title: string;
placeholder: string;
};
}
export const memberPageZhCn: MemberPageText = {
stuidText: {
title: '学号',
placeholder: '与统一身份认证学号一致',
},
passwdText: {
title: '密码',
placeholder: '与 EVA 统一身份认证一致',
},
};
export const memberPageEnUs: MemberPageText = {
stuidText: {
title: 'Student ID',
placeholder: '与统一身份认证学号一致',
},
passwdText: {
title: 'Password',
placeholder: '与 EVA 统一身份认证一致',
},
};

View File

@ -1,25 +1,13 @@
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,6 +1,8 @@
export interface UserPageText {
mainTitleLine: string;
subTitleLine: string;
memberEntry: {
front: string;
behind: string;
};
ticketColumn: {
title: string;
note: string;
@ -24,8 +26,10 @@ export interface UserPageText {
}
export const userPageZhCn: UserPageText = {
mainTitleLine: '您好这里是E志者协会',
subTitleLine: '维修请至【东三-204】实验室',
memberEntry: {
front: '再点击 ',
behind: ' 次以进入协会成员登录页面',
},
ticketColumn: {
title: '我的工单',
note: '在这里查看历史工单!',
@ -49,8 +53,10 @@ export const userPageZhCn: UserPageText = {
};
export const userPageEnUs: UserPageText = {
mainTitleLine: '您好这里是E志者协会',
subTitleLine: '维修请至【东三-204】实验室',
memberEntry: {
front: '再点击 ',
behind: ' 次以进入协会成员登录页面',
},
ticketColumn: {
title: '我的工单',
note: '在这里查看历史工单!',

View File

@ -3,8 +3,10 @@ import { MainPageText, mainPageZhCn, mainPageEnUs } from './MainPage';
import { UserPageText, userPageZhCn, userPageEnUs } from './UserPage';
import { TabBarText, tabBarEnUs, tabBarZhCn } from './TabBar';
import { ReportPageText, reportPageEnUs, reportPageZhCn } from './ReportPage';
import { InformPageText, informPageZhCn, informtPageEnUs } from './InformPage';
import { InformPageText, informPageZhCn, informPageEnUs } from './InformPage';
import { AboutPageText, aboutPageEnUs, aboutPageZhCn } from './AboutPage';
import { ButtonText, buttonEnUs, buttonZhCn } from './Button';
import { MemberPageText, memberPageEnUs, memberPageZhCn } from './MemberPage';
import { TicketListText, ticketListEnUs, ticketListZhCn } from './TicketList';
interface TextRecord {
@ -15,6 +17,8 @@ interface TextRecord {
reportPage: ReportPageText;
informPage: InformPageText;
aboutPage: AboutPageText;
button: ButtonText;
memberPage: MemberPageText;
ticketList: TicketListText;
}
@ -26,6 +30,8 @@ const textZhCn: TextRecord = {
reportPage: reportPageZhCn,
informPage: informPageZhCn,
aboutPage: aboutPageZhCn,
button: buttonZhCn,
memberPage: memberPageZhCn,
ticketList: ticketListZhCn,
};
@ -35,8 +41,10 @@ const textEnUs: TextRecord = {
userPage: userPageEnUs,
tabBar: tabBarEnUs,
reportPage: reportPageEnUs,
informPage: informtPageEnUs,
informPage: informPageEnUs,
aboutPage: aboutPageEnUs,
button: buttonEnUs,
memberPage: memberPageEnUs,
ticketList: ticketListEnUs,
};