Compare commits
13 Commits
a7fd2b2856
...
ac23f88cdd
| Author | SHA1 | Date |
|---|---|---|
|
|
ac23f88cdd | |
|
|
e1e998628f | |
|
|
806e7a393c | |
|
|
fd6a60d1d3 | |
|
|
36a9a35886 | |
|
|
dd770b8ece | |
|
|
b174304d74 | |
|
|
88cdb6cb92 | |
|
|
00977db512 | |
|
|
1907f1e967 | |
|
|
39dd945020 | |
|
|
b603ad24b3 | |
|
|
dd07c1da10 |
50
mock/api.ts
50
mock/api.ts
|
|
@ -1,8 +1,54 @@
|
||||||
|
import mytickets from './mytickets.json';
|
||||||
|
import ticketInfo from './ticketInfo.json';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
'GET /testdata': {
|
'GET /dutyinfo': {
|
||||||
success: true,
|
success: true,
|
||||||
data: {
|
data: {
|
||||||
test: 'test',
|
token: 'token_test',
|
||||||
|
isInDuty: true,
|
||||||
|
inDutyCnt: 3,
|
||||||
|
currentDuty: '2',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
'GET /user/info': {
|
||||||
|
success: true,
|
||||||
|
data: {
|
||||||
|
token: 'token_test',
|
||||||
|
name: '马保国',
|
||||||
|
phone: 13333333333,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'POST /user/update': {
|
||||||
|
data: {},
|
||||||
|
},
|
||||||
|
'GET /user/locale/get': {
|
||||||
|
success: true,
|
||||||
|
data: {
|
||||||
|
lang: 'en_US',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'POST /user/locale/update': {
|
||||||
|
data: {},
|
||||||
|
},
|
||||||
|
'POST /report': {
|
||||||
|
data: {},
|
||||||
|
},
|
||||||
|
'GET /user/mytickets': {
|
||||||
|
success: true,
|
||||||
|
data: mytickets,
|
||||||
|
},
|
||||||
|
'GET /tickets/info/': {
|
||||||
|
success: true,
|
||||||
|
data: ticketInfo,
|
||||||
|
},
|
||||||
|
'POST /tickets/newcomment': {
|
||||||
|
data: {},
|
||||||
|
},
|
||||||
|
'POST /tickets/create': {
|
||||||
|
data: {},
|
||||||
|
},
|
||||||
|
'POST /member/login': {
|
||||||
|
data: {},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
|
||||||
"@tarojs/cli": "3.6.24",
|
"@tarojs/cli": "3.6.24",
|
||||||
"@tarojs/plugin-mock": "^0.0.9",
|
"@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/taro-loader": "3.6.24",
|
||||||
"@tarojs/test-utils-react": "^0.1.1",
|
"@tarojs/test-utils-react": "^0.1.1",
|
||||||
"@tarojs/webpack5-runner": "3.6.24",
|
"@tarojs/webpack5-runner": "3.6.24",
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
|
||||||
"@tarojs/cli": "3.6.24",
|
"@tarojs/cli": "3.6.24",
|
||||||
"@tarojs/plugin-mock": "^0.0.9",
|
"@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/taro-loader": "3.6.24",
|
||||||
"@tarojs/test-utils-react": "^0.1.1",
|
"@tarojs/test-utils-react": "^0.1.1",
|
||||||
"@tarojs/webpack5-runner": "3.6.24",
|
"@tarojs/webpack5-runner": "3.6.24",
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ export default defineAppConfig({
|
||||||
'pages/user/inform/inform',
|
'pages/user/inform/inform',
|
||||||
'pages/user/about/about',
|
'pages/user/about/about',
|
||||||
'pages/user/report/report',
|
'pages/user/report/report',
|
||||||
|
'pages/user/member/member',
|
||||||
],
|
],
|
||||||
window: {
|
window: {
|
||||||
backgroundTextStyle: 'light',
|
backgroundTextStyle: 'light',
|
||||||
|
|
|
||||||
14
src/app.ts
14
src/app.ts
|
|
@ -1,11 +1,23 @@
|
||||||
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';
|
||||||
|
|
||||||
function App({ children }: PropsWithChildren<any>) {
|
function App({ children }: PropsWithChildren<any>) {
|
||||||
useLaunch(() => {
|
useLaunch(() => {
|
||||||
console.log('App launched.');
|
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 是将要会渲染的页面
|
// children 是将要会渲染的页面
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
|
|
@ -1,17 +1,24 @@
|
||||||
import { View } from '@tarojs/components';
|
import { View, Text } from '@tarojs/components';
|
||||||
import { AtDivider } from 'taro-ui';
|
import { AtDivider } from 'taro-ui';
|
||||||
import pt from '@/plain-text';
|
import pt from '@/plain-text';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const blankHeight = 120;
|
const blankHeightUpper = 15;
|
||||||
|
const blankHeightLower = 110;
|
||||||
return (
|
return (
|
||||||
|
<View>
|
||||||
|
<View style={{ height: blankHeightUpper }}></View>
|
||||||
<View>
|
<View>
|
||||||
<AtDivider
|
<AtDivider
|
||||||
content={pt.get().pageFooter.dividerText}
|
content={pt.get().pageFooter.dividerText}
|
||||||
fontColor='#dddddd'
|
fontColor='#dddddd'
|
||||||
lineColor='#dddddd'
|
lineColor='#dddddd'
|
||||||
/>
|
/>
|
||||||
<View style={{ height: blankHeight }}></View>
|
</View>
|
||||||
|
<View className='at-row at-row__justify--center'>
|
||||||
|
<Text style='color:#dddddd;'>© 2024 EVA Tech</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ height: blankHeightLower }}></View>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
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 { getUrl } from '@/service';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import pt from '@/plain-text';
|
import pt from '@/plain-text';
|
||||||
import './inform.scss';
|
import './inform.scss';
|
||||||
|
|
||||||
|
const submitInterval = 5000;
|
||||||
|
|
||||||
export default class InformPage extends Component {
|
export default class InformPage extends Component {
|
||||||
state = {
|
state = {
|
||||||
phone: '',
|
phone: '',
|
||||||
|
|
@ -29,43 +32,56 @@ 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);
|
||||||
|
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({
|
this.setState({
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
});
|
});
|
||||||
Taro.atMessage({
|
|
||||||
message: pt.get().informPage.submitText.success,
|
|
||||||
type: 'success',
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isDisable: false,
|
isDisable: false,
|
||||||
});
|
});
|
||||||
}, 5000);
|
}, submitInterval);
|
||||||
}
|
|
||||||
onReset() {
|
|
||||||
this.setState({
|
|
||||||
phone: '',
|
|
||||||
name: '',
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render(): ReactNode {
|
render(): ReactNode {
|
||||||
return (
|
return (
|
||||||
<AtForm
|
<AtForm onSubmit={this.onSubmit.bind(this)}>
|
||||||
onSubmit={this.onSubmit.bind(this)}
|
|
||||||
onReset={this.onReset.bind(this)}
|
|
||||||
>
|
|
||||||
<AtMessage />
|
<AtMessage />
|
||||||
<AtInput
|
<AtInput
|
||||||
|
clear
|
||||||
|
required
|
||||||
name='phone'
|
name='phone'
|
||||||
title={pt.get().informPage.phoneText.title}
|
title={pt.get().informPage.phoneText.title}
|
||||||
type='text'
|
type='number'
|
||||||
placeholder={pt.get().informPage.phoneText.placeholder}
|
placeholder={pt.get().informPage.phoneText.placeholder}
|
||||||
value={this.state.phone}
|
value={this.state.phone}
|
||||||
onChange={this.handleChangePhone.bind(this)}
|
onChange={this.handleChangePhone.bind(this)}
|
||||||
/>
|
/>
|
||||||
<AtInput
|
<AtInput
|
||||||
required
|
required
|
||||||
|
clear
|
||||||
name='name'
|
name='name'
|
||||||
title={pt.get().informPage.nameText.title}
|
title={pt.get().informPage.nameText.title}
|
||||||
type='text'
|
type='text'
|
||||||
|
|
@ -79,10 +95,7 @@ export default class InformPage extends Component {
|
||||||
type='primary'
|
type='primary'
|
||||||
disabled={this.state.isDisable}
|
disabled={this.state.isDisable}
|
||||||
>
|
>
|
||||||
{pt.get().informPage.buttonText.submit}
|
{pt.get().button.buttonText.submit}
|
||||||
</AtButton>
|
|
||||||
<AtButton formType='reset' type='secondary'>
|
|
||||||
{pt.get().informPage.buttonText.reset}
|
|
||||||
</AtButton>
|
</AtButton>
|
||||||
</AtForm>
|
</AtForm>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
export default definePageConfig({
|
||||||
|
usingComponents: {},
|
||||||
|
});
|
||||||
|
|
@ -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>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
import { AtTextarea, AtButton, AtForm, AtMessage } from 'taro-ui';
|
import { AtTextarea, AtButton, AtForm, AtMessage } from 'taro-ui';
|
||||||
import { Component, ReactNode } from 'react';
|
import { Component, ReactNode } from 'react';
|
||||||
|
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 './report.scss';
|
import './report.scss';
|
||||||
|
|
||||||
|
const submitInterval = 5000;
|
||||||
|
|
||||||
export default class SettingsPage extends Component {
|
export default class SettingsPage extends Component {
|
||||||
state = {
|
state = {
|
||||||
report: '',
|
report: '',
|
||||||
|
|
@ -21,18 +24,36 @@ export default class SettingsPage extends Component {
|
||||||
isDisable: true,
|
isDisable: true,
|
||||||
});
|
});
|
||||||
console.log(this.state.report);
|
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({
|
this.setState({
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
});
|
});
|
||||||
Taro.atMessage({
|
|
||||||
message: '提交成功',
|
|
||||||
type: 'success',
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isDisable: false,
|
isDisable: false,
|
||||||
});
|
});
|
||||||
}, 5000);
|
}, submitInterval);
|
||||||
}
|
}
|
||||||
onReset() {
|
onReset() {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|
@ -58,10 +79,10 @@ export default class SettingsPage extends Component {
|
||||||
type='primary'
|
type='primary'
|
||||||
disabled={this.state.isDisable}
|
disabled={this.state.isDisable}
|
||||||
>
|
>
|
||||||
{pt.get().reportPage.buttonText.submit}
|
{pt.get().button.buttonText.submit}
|
||||||
</AtButton>
|
</AtButton>
|
||||||
<AtButton formType='reset' type='secondary'>
|
<AtButton formType='reset' type='secondary'>
|
||||||
{pt.get().reportPage.buttonText.reset}
|
{pt.get().button.buttonText.reset}
|
||||||
</AtButton>
|
</AtButton>
|
||||||
</AtForm>
|
</AtForm>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,18 @@
|
||||||
import { AtList, AtListItem } from 'taro-ui';
|
import { AtList, AtListItem, AtToast } from 'taro-ui';
|
||||||
import { Component, ReactNode } from 'react';
|
import { Component, ReactNode } from 'react';
|
||||||
import { View, Picker } 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';
|
||||||
import aboutIcon from '@/assets/icons/AboutPage/about.svg';
|
import aboutIcon from '@/assets/icons/AboutPage/about.svg';
|
||||||
import pt, { Lang } from '@/plain-text';
|
import pt, { Lang } from '@/plain-text';
|
||||||
|
import logo from '@/assets/images/UserPage/logo.png';
|
||||||
import './user.scss';
|
import './user.scss';
|
||||||
|
|
||||||
|
const listLangInterval = 20;
|
||||||
|
const memberClickTimes = 7;
|
||||||
|
|
||||||
export default class UserPage extends Component {
|
export default class UserPage extends Component {
|
||||||
state = {
|
state = {
|
||||||
selector: ['简体中文', 'English'],
|
selector: ['简体中文', 'English'],
|
||||||
|
|
@ -15,6 +20,9 @@ export default class UserPage extends Component {
|
||||||
zh_CN: '简体中文',
|
zh_CN: '简体中文',
|
||||||
en_US: 'English',
|
en_US: 'English',
|
||||||
}[pt.getCurLang()],
|
}[pt.getCurLang()],
|
||||||
|
clicks: memberClickTimes,
|
||||||
|
isToastOpen: false,
|
||||||
|
toastText: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
// 以下是TabBar相关
|
// 以下是TabBar相关
|
||||||
|
|
@ -25,6 +33,30 @@ export default class UserPage extends Component {
|
||||||
}
|
}
|
||||||
// 以上是TabBar相关
|
// 以上是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> = {
|
showLangDict: Record<string, Lang> = {
|
||||||
简体中文: 'zh_CN',
|
简体中文: 'zh_CN',
|
||||||
English: 'en_US',
|
English: 'en_US',
|
||||||
|
|
@ -34,7 +66,18 @@ export default class UserPage extends Component {
|
||||||
this.setState({
|
this.setState({
|
||||||
selectorChecked: this.state.selector[e.detail.value],
|
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({
|
Taro.reLaunch({
|
||||||
url: '/pages/user/user',
|
url: '/pages/user/user',
|
||||||
});
|
});
|
||||||
|
|
@ -67,6 +110,26 @@ export default class UserPage extends Component {
|
||||||
render(): ReactNode {
|
render(): ReactNode {
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
|
<View
|
||||||
|
className='at-row at-row__justify--center at-row__align--end'
|
||||||
|
style='height:110px;'
|
||||||
|
>
|
||||||
|
<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>
|
||||||
|
</View>
|
||||||
<AtList>
|
<AtList>
|
||||||
<AtListItem
|
<AtListItem
|
||||||
title={pt.get().userPage.ticketColumn.title}
|
title={pt.get().userPage.ticketColumn.title}
|
||||||
|
|
@ -98,6 +161,7 @@ export default class UserPage extends Component {
|
||||||
thumb={aboutIcon}
|
thumb={aboutIcon}
|
||||||
onClick={this.aboutPage}
|
onClick={this.aboutPage}
|
||||||
/>
|
/>
|
||||||
|
<View style={{ height: listLangInterval }}></View>
|
||||||
<Picker
|
<Picker
|
||||||
mode='selector'
|
mode='selector'
|
||||||
range={this.state.selector}
|
range={this.state.selector}
|
||||||
|
|
|
||||||
|
|
@ -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: '登录失败',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
export interface InformPageText {
|
export interface InformPageText {
|
||||||
submitText: {
|
|
||||||
success: string;
|
|
||||||
};
|
|
||||||
phoneText: {
|
phoneText: {
|
||||||
title: string;
|
title: string;
|
||||||
placeholder: string;
|
placeholder: string;
|
||||||
|
|
@ -10,16 +7,9 @@ export interface InformPageText {
|
||||||
title: string;
|
title: string;
|
||||||
placeholder: string;
|
placeholder: string;
|
||||||
};
|
};
|
||||||
buttonText: {
|
|
||||||
submit: string;
|
|
||||||
reset: string;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const informPageZhCn: InformPageText = {
|
export const informPageZhCn: InformPageText = {
|
||||||
submitText: {
|
|
||||||
success: '提交成功',
|
|
||||||
},
|
|
||||||
phoneText: {
|
phoneText: {
|
||||||
title: '手机号码',
|
title: '手机号码',
|
||||||
placeholder: '便于查询工单',
|
placeholder: '便于查询工单',
|
||||||
|
|
@ -28,16 +18,9 @@ export const informPageZhCn: InformPageText = {
|
||||||
title: '真实姓名',
|
title: '真实姓名',
|
||||||
placeholder: '必填,与工单绑定',
|
placeholder: '必填,与工单绑定',
|
||||||
},
|
},
|
||||||
buttonText: {
|
|
||||||
submit: '提交',
|
|
||||||
reset: '清空',
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const informtPageEnUs: InformPageText = {
|
export const informPageEnUs: InformPageText = {
|
||||||
submitText: {
|
|
||||||
success: 'Success',
|
|
||||||
},
|
|
||||||
phoneText: {
|
phoneText: {
|
||||||
title: 'Phone',
|
title: 'Phone',
|
||||||
placeholder: '便于查询工单',
|
placeholder: '便于查询工单',
|
||||||
|
|
@ -46,8 +29,4 @@ export const informtPageEnUs: InformPageText = {
|
||||||
title: 'Real Name',
|
title: 'Real Name',
|
||||||
placeholder: '必填,与工单绑定',
|
placeholder: '必填,与工单绑定',
|
||||||
},
|
},
|
||||||
buttonText: {
|
|
||||||
submit: 'Submit',
|
|
||||||
reset: 'Reset',
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -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 统一身份认证一致',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
@ -1,25 +1,13 @@
|
||||||
export interface ReportPageText {
|
export interface ReportPageText {
|
||||||
placeHolderText: string;
|
placeHolderText: string;
|
||||||
buttonText: {
|
|
||||||
submit: string;
|
|
||||||
reset: string;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const reportPageZhCn: ReportPageText = {
|
export const reportPageZhCn: ReportPageText = {
|
||||||
placeHolderText:
|
placeHolderText:
|
||||||
'无论是有关于小程序的建议,还是关于E志者协会的建议,都可以提出来哦!',
|
'无论是有关于小程序的建议,还是关于E志者协会的建议,都可以提出来哦!',
|
||||||
buttonText: {
|
|
||||||
submit: '提交',
|
|
||||||
reset: '清空',
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const reportPageEnUs: ReportPageText = {
|
export const reportPageEnUs: ReportPageText = {
|
||||||
placeHolderText:
|
placeHolderText:
|
||||||
'无论是有关于小程序的建议,还是关于E志者协会的建议,都可以提出来哦!',
|
'无论是有关于小程序的建议,还是关于E志者协会的建议,都可以提出来哦!',
|
||||||
buttonText: {
|
|
||||||
submit: 'Submit',
|
|
||||||
reset: 'Reset',
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
export interface UserPageText {
|
export interface UserPageText {
|
||||||
mainTitleLine: string;
|
memberEntry: {
|
||||||
subTitleLine: string;
|
front: string;
|
||||||
|
behind: string;
|
||||||
|
};
|
||||||
ticketColumn: {
|
ticketColumn: {
|
||||||
title: string;
|
title: string;
|
||||||
note: string;
|
note: string;
|
||||||
|
|
@ -24,8 +26,10 @@ export interface UserPageText {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const userPageZhCn: UserPageText = {
|
export const userPageZhCn: UserPageText = {
|
||||||
mainTitleLine: '您好,这里是E志者协会',
|
memberEntry: {
|
||||||
subTitleLine: '维修请至【东三-204】实验室',
|
front: '再点击 ',
|
||||||
|
behind: ' 次以进入协会成员登录页面',
|
||||||
|
},
|
||||||
ticketColumn: {
|
ticketColumn: {
|
||||||
title: '我的工单',
|
title: '我的工单',
|
||||||
note: '在这里查看历史工单!',
|
note: '在这里查看历史工单!',
|
||||||
|
|
@ -49,8 +53,10 @@ export const userPageZhCn: UserPageText = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const userPageEnUs: UserPageText = {
|
export const userPageEnUs: UserPageText = {
|
||||||
mainTitleLine: '您好,这里是E志者协会',
|
memberEntry: {
|
||||||
subTitleLine: '维修请至【东三-204】实验室',
|
front: '再点击 ',
|
||||||
|
behind: ' 次以进入协会成员登录页面',
|
||||||
|
},
|
||||||
ticketColumn: {
|
ticketColumn: {
|
||||||
title: '我的工单',
|
title: '我的工单',
|
||||||
note: '在这里查看历史工单!',
|
note: '在这里查看历史工单!',
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,10 @@ import { MainPageText, mainPageZhCn, mainPageEnUs } from './MainPage';
|
||||||
import { UserPageText, userPageZhCn, userPageEnUs } from './UserPage';
|
import { UserPageText, userPageZhCn, userPageEnUs } from './UserPage';
|
||||||
import { TabBarText, tabBarEnUs, tabBarZhCn } from './TabBar';
|
import { TabBarText, tabBarEnUs, tabBarZhCn } from './TabBar';
|
||||||
import { ReportPageText, reportPageEnUs, reportPageZhCn } from './ReportPage';
|
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 { AboutPageText, aboutPageEnUs, aboutPageZhCn } from './AboutPage';
|
||||||
|
import { ButtonText, buttonEnUs, buttonZhCn } from './Button';
|
||||||
|
import { MemberPageText, memberPageEnUs, memberPageZhCn } from './MemberPage';
|
||||||
|
|
||||||
interface TextRecord {
|
interface TextRecord {
|
||||||
pageFooter: PageFooterText;
|
pageFooter: PageFooterText;
|
||||||
|
|
@ -14,6 +16,8 @@ interface TextRecord {
|
||||||
reportPage: ReportPageText;
|
reportPage: ReportPageText;
|
||||||
informPage: InformPageText;
|
informPage: InformPageText;
|
||||||
aboutPage: AboutPageText;
|
aboutPage: AboutPageText;
|
||||||
|
button: ButtonText;
|
||||||
|
memberPage: MemberPageText;
|
||||||
}
|
}
|
||||||
|
|
||||||
const textZhCn: TextRecord = {
|
const textZhCn: TextRecord = {
|
||||||
|
|
@ -24,6 +28,8 @@ const textZhCn: TextRecord = {
|
||||||
reportPage: reportPageZhCn,
|
reportPage: reportPageZhCn,
|
||||||
informPage: informPageZhCn,
|
informPage: informPageZhCn,
|
||||||
aboutPage: aboutPageZhCn,
|
aboutPage: aboutPageZhCn,
|
||||||
|
button: buttonZhCn,
|
||||||
|
memberPage: memberPageZhCn,
|
||||||
};
|
};
|
||||||
|
|
||||||
const textEnUs: TextRecord = {
|
const textEnUs: TextRecord = {
|
||||||
|
|
@ -32,8 +38,10 @@ const textEnUs: TextRecord = {
|
||||||
userPage: userPageEnUs,
|
userPage: userPageEnUs,
|
||||||
tabBar: tabBarEnUs,
|
tabBar: tabBarEnUs,
|
||||||
reportPage: reportPageEnUs,
|
reportPage: reportPageEnUs,
|
||||||
informPage: informtPageEnUs,
|
informPage: informPageEnUs,
|
||||||
aboutPage: aboutPageEnUs,
|
aboutPage: aboutPageEnUs,
|
||||||
|
button: buttonEnUs,
|
||||||
|
memberPage: memberPageEnUs,
|
||||||
};
|
};
|
||||||
|
|
||||||
// type Lang = 'zh_CN' | 'en_US' | ...;
|
// type Lang = 'zh_CN' | 'en_US' | ...;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue