Compare commits
No commits in common. "ac23f88cddfc2bd9f0ad669c1ff60a7767aaf9fc" and "a7fd2b2856f9f6b7f8678b95c09883ec735458d6" have entirely different histories.
ac23f88cdd
...
a7fd2b2856
50
mock/api.ts
50
mock/api.ts
|
|
@ -1,54 +1,8 @@
|
|||
import mytickets from './mytickets.json';
|
||||
import ticketInfo from './ticketInfo.json';
|
||||
|
||||
export default {
|
||||
'GET /dutyinfo': {
|
||||
'GET /testdata': {
|
||||
success: true,
|
||||
data: {
|
||||
token: 'token_test',
|
||||
isInDuty: true,
|
||||
inDutyCnt: 3,
|
||||
currentDuty: '2',
|
||||
test: 'test',
|
||||
},
|
||||
},
|
||||
'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: {},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"list": [
|
||||
{
|
||||
"id": 6830,
|
||||
"type": 1,
|
||||
"status": 5,
|
||||
"device": "主机",
|
||||
"deviceModel": "技嘉",
|
||||
"owner": "武技栏",
|
||||
"phone": "18888888888",
|
||||
"createdTime": "2024-03-06T19:49:27.043865",
|
||||
"isConfirmed": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
{
|
||||
"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
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
202
package.json
202
package.json
|
|
@ -1,103 +1,103 @@
|
|||
{
|
||||
"name": "eva-notify",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"description": "A Wechat miniprogram project of EVA platform",
|
||||
"templateInfo": {
|
||||
"name": "default",
|
||||
"typescript": true,
|
||||
"css": "Sass",
|
||||
"framework": "React"
|
||||
},
|
||||
"scripts": {
|
||||
"build:weapp": "taro build --type weapp",
|
||||
"build:swan": "taro build --type swan",
|
||||
"build:alipay": "taro build --type alipay",
|
||||
"build:tt": "taro build --type tt",
|
||||
"build:h5": "taro build --type h5",
|
||||
"build:rn": "taro build --type rn",
|
||||
"build:qq": "taro build --type qq",
|
||||
"build:jd": "taro build --type jd",
|
||||
"build:quickapp": "taro build --type quickapp",
|
||||
"build:harmony-hybrid": "taro build --type harmony-hybrid",
|
||||
"dev:weapp": "npm run build:weapp -- --watch --mode dev",
|
||||
"dev:swan": "npm run build:swan -- --watch",
|
||||
"dev:alipay": "npm run build:alipay -- --watch",
|
||||
"dev:tt": "npm run build:tt -- --watch",
|
||||
"dev:h5": "npm run build:h5 -- --watch",
|
||||
"dev:rn": "npm run build:rn -- --watch",
|
||||
"dev:qq": "npm run build:qq -- --watch",
|
||||
"dev:jd": "npm run build:jd -- --watch",
|
||||
"dev:quickapp": "npm run build:quickapp -- --watch",
|
||||
"dev:harmony-hybrid": "npm run build:harmony-hybrid -- --watch",
|
||||
"test": "jest",
|
||||
"prepare": "husky install"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 3 versions",
|
||||
"Android >= 4.1",
|
||||
"ios >= 8"
|
||||
],
|
||||
"author": "",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.21.5",
|
||||
"@tarojs/components": "3.6.24",
|
||||
"@tarojs/helper": "3.6.24",
|
||||
"@tarojs/plugin-framework-react": "3.6.24",
|
||||
"@tarojs/plugin-platform-alipay": "3.6.24",
|
||||
"@tarojs/plugin-platform-harmony-hybrid": "3.6.24",
|
||||
"@tarojs/plugin-platform-jd": "3.6.24",
|
||||
"@tarojs/plugin-platform-qq": "3.6.24",
|
||||
"@tarojs/plugin-platform-swan": "3.6.24",
|
||||
"@tarojs/plugin-platform-tt": "3.6.24",
|
||||
"@tarojs/plugin-platform-weapp": "3.6.24",
|
||||
"@tarojs/react": "3.6.24",
|
||||
"@tarojs/runtime": "3.6.24",
|
||||
"@tarojs/shared": "3.6.24",
|
||||
"@tarojs/taro": "3.6.24",
|
||||
"process": "^0.11.10",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0",
|
||||
"taro-ui": "^3.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.8.0",
|
||||
"@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/taro-loader": "3.6.24",
|
||||
"@tarojs/test-utils-react": "^0.1.1",
|
||||
"@tarojs/webpack5-runner": "3.6.24",
|
||||
"@types/jest": "^29.3.1",
|
||||
"@types/node": "^18.15.11",
|
||||
"@types/react": "^18.0.0",
|
||||
"@types/sass": "^1.43.1",
|
||||
"@types/webpack-env": "^1.13.6",
|
||||
"@typescript-eslint/eslint-plugin": "^6.2.0",
|
||||
"@typescript-eslint/parser": "^6.2.0",
|
||||
"babel-preset-taro": "3.6.24",
|
||||
"eslint": "^8.12.0",
|
||||
"eslint-config-taro": "3.6.24",
|
||||
"eslint-plugin-import": "^2.12.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"eslint-plugin-react": "^7.8.2",
|
||||
"eslint-plugin-react-hooks": "^4.2.0",
|
||||
"husky": "^9.0.11",
|
||||
"jest": "^29.3.1",
|
||||
"jest-environment-jsdom": "^29.5.0",
|
||||
"lint-staged": "^15.2.2",
|
||||
"mockjs": "^1.1.0",
|
||||
"postcss": "^8.4.18",
|
||||
"react-refresh": "^0.11.0",
|
||||
"stylelint": "^14.4.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"tsconfig-paths-webpack-plugin": "^4.1.0",
|
||||
"typescript": "^5.1.0",
|
||||
"webpack": "5.78.0"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.ts": "prettier --write",
|
||||
"*.tsx": "prettier --write"
|
||||
}
|
||||
"name": "eva-notify",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"description": "A Wechat miniprogram project of EVA platform",
|
||||
"templateInfo": {
|
||||
"name": "default",
|
||||
"typescript": true,
|
||||
"css": "Sass",
|
||||
"framework": "React"
|
||||
},
|
||||
"scripts": {
|
||||
"build:weapp": "taro build --type weapp",
|
||||
"build:swan": "taro build --type swan",
|
||||
"build:alipay": "taro build --type alipay",
|
||||
"build:tt": "taro build --type tt",
|
||||
"build:h5": "taro build --type h5",
|
||||
"build:rn": "taro build --type rn",
|
||||
"build:qq": "taro build --type qq",
|
||||
"build:jd": "taro build --type jd",
|
||||
"build:quickapp": "taro build --type quickapp",
|
||||
"build:harmony-hybrid": "taro build --type harmony-hybrid",
|
||||
"dev:weapp": "npm run build:weapp -- --watch --mode dev",
|
||||
"dev:swan": "npm run build:swan -- --watch",
|
||||
"dev:alipay": "npm run build:alipay -- --watch",
|
||||
"dev:tt": "npm run build:tt -- --watch",
|
||||
"dev:h5": "npm run build:h5 -- --watch",
|
||||
"dev:rn": "npm run build:rn -- --watch",
|
||||
"dev:qq": "npm run build:qq -- --watch",
|
||||
"dev:jd": "npm run build:jd -- --watch",
|
||||
"dev:quickapp": "npm run build:quickapp -- --watch",
|
||||
"dev:harmony-hybrid": "npm run build:harmony-hybrid -- --watch",
|
||||
"test": "jest",
|
||||
"prepare": "husky install"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 3 versions",
|
||||
"Android >= 4.1",
|
||||
"ios >= 8"
|
||||
],
|
||||
"author": "",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.21.5",
|
||||
"@tarojs/components": "3.6.24",
|
||||
"@tarojs/helper": "3.6.24",
|
||||
"@tarojs/plugin-framework-react": "3.6.24",
|
||||
"@tarojs/plugin-platform-alipay": "3.6.24",
|
||||
"@tarojs/plugin-platform-harmony-hybrid": "3.6.24",
|
||||
"@tarojs/plugin-platform-jd": "3.6.24",
|
||||
"@tarojs/plugin-platform-qq": "3.6.24",
|
||||
"@tarojs/plugin-platform-swan": "3.6.24",
|
||||
"@tarojs/plugin-platform-tt": "3.6.24",
|
||||
"@tarojs/plugin-platform-weapp": "3.6.24",
|
||||
"@tarojs/react": "3.6.24",
|
||||
"@tarojs/runtime": "3.6.24",
|
||||
"@tarojs/shared": "3.6.24",
|
||||
"@tarojs/taro": "3.6.24",
|
||||
"process": "^0.11.10",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0",
|
||||
"taro-ui": "^3.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.8.0",
|
||||
"@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/taro-loader": "3.6.24",
|
||||
"@tarojs/test-utils-react": "^0.1.1",
|
||||
"@tarojs/webpack5-runner": "3.6.24",
|
||||
"@types/jest": "^29.3.1",
|
||||
"@types/node": "^18.15.11",
|
||||
"@types/react": "^18.0.0",
|
||||
"@types/sass": "^1.43.1",
|
||||
"@types/webpack-env": "^1.13.6",
|
||||
"@typescript-eslint/eslint-plugin": "^6.2.0",
|
||||
"@typescript-eslint/parser": "^6.2.0",
|
||||
"babel-preset-taro": "3.6.24",
|
||||
"eslint": "^8.12.0",
|
||||
"eslint-config-taro": "3.6.24",
|
||||
"eslint-plugin-import": "^2.12.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"eslint-plugin-react": "^7.8.2",
|
||||
"eslint-plugin-react-hooks": "^4.2.0",
|
||||
"husky": "^9.0.11",
|
||||
"jest": "^29.3.1",
|
||||
"jest-environment-jsdom": "^29.5.0",
|
||||
"lint-staged": "^15.2.2",
|
||||
"mockjs": "^1.1.0",
|
||||
"postcss": "^8.4.18",
|
||||
"react-refresh": "^0.11.0",
|
||||
"stylelint": "^14.4.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"tsconfig-paths-webpack-plugin": "^4.1.0",
|
||||
"typescript": "^5.1.0",
|
||||
"webpack": "5.78.0"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.ts": "prettier --write",
|
||||
"*.tsx": "prettier --write"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ export default defineAppConfig({
|
|||
'pages/user/inform/inform',
|
||||
'pages/user/about/about',
|
||||
'pages/user/report/report',
|
||||
'pages/user/member/member',
|
||||
],
|
||||
window: {
|
||||
backgroundTextStyle: 'light',
|
||||
|
|
|
|||
14
src/app.ts
14
src/app.ts
|
|
@ -1,23 +1,11 @@
|
|||
import { PropsWithChildren } from 'react';
|
||||
import Taro, { useLaunch } from '@tarojs/taro';
|
||||
import { getUrl } from '@/service';
|
||||
import pt from '@/plain-text';
|
||||
import { useLaunch } from '@tarojs/taro';
|
||||
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 是将要会渲染的页面
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 MiB |
|
|
@ -1,24 +1,17 @@
|
|||
import { View, Text } from '@tarojs/components';
|
||||
import { View } from '@tarojs/components';
|
||||
import { AtDivider } from 'taro-ui';
|
||||
import pt from '@/plain-text';
|
||||
|
||||
export default () => {
|
||||
const blankHeightUpper = 15;
|
||||
const blankHeightLower = 110;
|
||||
const blankHeight = 120;
|
||||
return (
|
||||
<View>
|
||||
<View style={{ height: blankHeightUpper }}></View>
|
||||
<View>
|
||||
<AtDivider
|
||||
content={pt.get().pageFooter.dividerText}
|
||||
fontColor='#dddddd'
|
||||
lineColor='#dddddd'
|
||||
/>
|
||||
</View>
|
||||
<View className='at-row at-row__justify--center'>
|
||||
<Text style='color:#dddddd;'>© 2024 EVA Tech</Text>
|
||||
</View>
|
||||
<View style={{ height: blankHeightLower }}></View>
|
||||
<AtDivider
|
||||
content={pt.get().pageFooter.dividerText}
|
||||
fontColor='#dddddd'
|
||||
lineColor='#dddddd'
|
||||
/>
|
||||
<View style={{ height: blankHeight }}></View>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
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: '',
|
||||
|
|
@ -32,56 +29,43 @@ 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,
|
||||
});
|
||||
}, submitInterval);
|
||||
}, 5000);
|
||||
}
|
||||
onReset() {
|
||||
this.setState({
|
||||
phone: '',
|
||||
name: '',
|
||||
});
|
||||
}
|
||||
|
||||
render(): ReactNode {
|
||||
return (
|
||||
<AtForm onSubmit={this.onSubmit.bind(this)}>
|
||||
<AtForm
|
||||
onSubmit={this.onSubmit.bind(this)}
|
||||
onReset={this.onReset.bind(this)}
|
||||
>
|
||||
<AtMessage />
|
||||
<AtInput
|
||||
clear
|
||||
required
|
||||
name='phone'
|
||||
title={pt.get().informPage.phoneText.title}
|
||||
type='number'
|
||||
type='text'
|
||||
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'
|
||||
|
|
@ -95,7 +79,10 @@ export default class InformPage extends Component {
|
|||
type='primary'
|
||||
disabled={this.state.isDisable}
|
||||
>
|
||||
{pt.get().button.buttonText.submit}
|
||||
{pt.get().informPage.buttonText.submit}
|
||||
</AtButton>
|
||||
<AtButton formType='reset' type='secondary'>
|
||||
{pt.get().informPage.buttonText.reset}
|
||||
</AtButton>
|
||||
</AtForm>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
export default definePageConfig({
|
||||
usingComponents: {},
|
||||
});
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
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,12 +1,9 @@
|
|||
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: '',
|
||||
|
|
@ -24,36 +21,18 @@ 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,
|
||||
});
|
||||
}, submitInterval);
|
||||
}, 5000);
|
||||
}
|
||||
onReset() {
|
||||
this.setState({
|
||||
|
|
@ -79,10 +58,10 @@ export default class SettingsPage extends Component {
|
|||
type='primary'
|
||||
disabled={this.state.isDisable}
|
||||
>
|
||||
{pt.get().button.buttonText.submit}
|
||||
{pt.get().reportPage.buttonText.submit}
|
||||
</AtButton>
|
||||
<AtButton formType='reset' type='secondary'>
|
||||
{pt.get().button.buttonText.reset}
|
||||
{pt.get().reportPage.buttonText.reset}
|
||||
</AtButton>
|
||||
</AtForm>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,18 +1,13 @@
|
|||
import { AtList, AtListItem, AtToast } from 'taro-ui';
|
||||
import { AtList, AtListItem } from 'taro-ui';
|
||||
import { Component, ReactNode } from 'react';
|
||||
import { View, Picker, Image, Text } from '@tarojs/components';
|
||||
import { getUrl } from '@/service';
|
||||
import { View, Picker } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
import type CustomTabBar from '@/custom-tab-bar';
|
||||
import PageFooter from '@/components/PageFooter/PageFooter';
|
||||
import aboutIcon from '@/assets/icons/AboutPage/about.svg';
|
||||
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'],
|
||||
|
|
@ -20,9 +15,6 @@ export default class UserPage extends Component {
|
|||
zh_CN: '简体中文',
|
||||
en_US: 'English',
|
||||
}[pt.getCurLang()],
|
||||
clicks: memberClickTimes,
|
||||
isToastOpen: false,
|
||||
toastText: '',
|
||||
};
|
||||
|
||||
// 以下是TabBar相关
|
||||
|
|
@ -33,30 +25,6 @@ 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',
|
||||
|
|
@ -66,18 +34,7 @@ export default class UserPage extends Component {
|
|||
this.setState({
|
||||
selectorChecked: 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);
|
||||
});
|
||||
pt.setLang(this.showLangDict[this.state.selector[e.detail.value]]);
|
||||
Taro.reLaunch({
|
||||
url: '/pages/user/user',
|
||||
});
|
||||
|
|
@ -110,26 +67,6 @@ export default class UserPage extends Component {
|
|||
render(): ReactNode {
|
||||
return (
|
||||
<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>
|
||||
<AtListItem
|
||||
title={pt.get().userPage.ticketColumn.title}
|
||||
|
|
@ -161,7 +98,6 @@ export default class UserPage extends Component {
|
|||
thumb={aboutIcon}
|
||||
onClick={this.aboutPage}
|
||||
/>
|
||||
<View style={{ height: listLangInterval }}></View>
|
||||
<Picker
|
||||
mode='selector'
|
||||
range={this.state.selector}
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
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,4 +1,7 @@
|
|||
export interface InformPageText {
|
||||
submitText: {
|
||||
success: string;
|
||||
};
|
||||
phoneText: {
|
||||
title: string;
|
||||
placeholder: string;
|
||||
|
|
@ -7,9 +10,16 @@ export interface InformPageText {
|
|||
title: string;
|
||||
placeholder: string;
|
||||
};
|
||||
buttonText: {
|
||||
submit: string;
|
||||
reset: string;
|
||||
};
|
||||
}
|
||||
|
||||
export const informPageZhCn: InformPageText = {
|
||||
submitText: {
|
||||
success: '提交成功',
|
||||
},
|
||||
phoneText: {
|
||||
title: '手机号码',
|
||||
placeholder: '便于查询工单',
|
||||
|
|
@ -18,9 +28,16 @@ export const informPageZhCn: InformPageText = {
|
|||
title: '真实姓名',
|
||||
placeholder: '必填,与工单绑定',
|
||||
},
|
||||
buttonText: {
|
||||
submit: '提交',
|
||||
reset: '清空',
|
||||
},
|
||||
};
|
||||
|
||||
export const informPageEnUs: InformPageText = {
|
||||
export const informtPageEnUs: InformPageText = {
|
||||
submitText: {
|
||||
success: 'Success',
|
||||
},
|
||||
phoneText: {
|
||||
title: 'Phone',
|
||||
placeholder: '便于查询工单',
|
||||
|
|
@ -29,4 +46,8 @@ export const informPageEnUs: InformPageText = {
|
|||
title: 'Real Name',
|
||||
placeholder: '必填,与工单绑定',
|
||||
},
|
||||
buttonText: {
|
||||
submit: 'Submit',
|
||||
reset: 'Reset',
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
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,13 +1,25 @@
|
|||
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',
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
export interface UserPageText {
|
||||
memberEntry: {
|
||||
front: string;
|
||||
behind: string;
|
||||
};
|
||||
mainTitleLine: string;
|
||||
subTitleLine: string;
|
||||
ticketColumn: {
|
||||
title: string;
|
||||
note: string;
|
||||
|
|
@ -26,10 +24,8 @@ export interface UserPageText {
|
|||
}
|
||||
|
||||
export const userPageZhCn: UserPageText = {
|
||||
memberEntry: {
|
||||
front: '再点击 ',
|
||||
behind: ' 次以进入协会成员登录页面',
|
||||
},
|
||||
mainTitleLine: '您好,这里是E志者协会',
|
||||
subTitleLine: '维修请至【东三-204】实验室',
|
||||
ticketColumn: {
|
||||
title: '我的工单',
|
||||
note: '在这里查看历史工单!',
|
||||
|
|
@ -53,10 +49,8 @@ export const userPageZhCn: UserPageText = {
|
|||
};
|
||||
|
||||
export const userPageEnUs: UserPageText = {
|
||||
memberEntry: {
|
||||
front: '再点击 ',
|
||||
behind: ' 次以进入协会成员登录页面',
|
||||
},
|
||||
mainTitleLine: '您好,这里是E志者协会',
|
||||
subTitleLine: '维修请至【东三-204】实验室',
|
||||
ticketColumn: {
|
||||
title: '我的工单',
|
||||
note: '在这里查看历史工单!',
|
||||
|
|
|
|||
|
|
@ -3,10 +3,8 @@ 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, informPageEnUs } from './InformPage';
|
||||
import { InformPageText, informPageZhCn, informtPageEnUs } from './InformPage';
|
||||
import { AboutPageText, aboutPageEnUs, aboutPageZhCn } from './AboutPage';
|
||||
import { ButtonText, buttonEnUs, buttonZhCn } from './Button';
|
||||
import { MemberPageText, memberPageEnUs, memberPageZhCn } from './MemberPage';
|
||||
|
||||
interface TextRecord {
|
||||
pageFooter: PageFooterText;
|
||||
|
|
@ -16,8 +14,6 @@ interface TextRecord {
|
|||
reportPage: ReportPageText;
|
||||
informPage: InformPageText;
|
||||
aboutPage: AboutPageText;
|
||||
button: ButtonText;
|
||||
memberPage: MemberPageText;
|
||||
}
|
||||
|
||||
const textZhCn: TextRecord = {
|
||||
|
|
@ -28,8 +24,6 @@ const textZhCn: TextRecord = {
|
|||
reportPage: reportPageZhCn,
|
||||
informPage: informPageZhCn,
|
||||
aboutPage: aboutPageZhCn,
|
||||
button: buttonZhCn,
|
||||
memberPage: memberPageZhCn,
|
||||
};
|
||||
|
||||
const textEnUs: TextRecord = {
|
||||
|
|
@ -38,10 +32,8 @@ const textEnUs: TextRecord = {
|
|||
userPage: userPageEnUs,
|
||||
tabBar: tabBarEnUs,
|
||||
reportPage: reportPageEnUs,
|
||||
informPage: informPageEnUs,
|
||||
informPage: informtPageEnUs,
|
||||
aboutPage: aboutPageEnUs,
|
||||
button: buttonEnUs,
|
||||
memberPage: memberPageEnUs,
|
||||
};
|
||||
|
||||
// type Lang = 'zh_CN' | 'en_US' | ...;
|
||||
|
|
|
|||
Loading…
Reference in New Issue