Compare commits

...

28 Commits

Author SHA1 Message Date
Dawn1Ocean d705970d1f beautify /user/inform /user/report ui 2024-03-19 19:42:29 +08:00
Dawn1Ocean 2ef04b96a1 add relaunch after change inDutyCnt 2024-03-19 19:19:59 +08:00
Dawn1Ocean 599166e603 add change inDutyCnt button and service 2024-03-19 19:12:33 +08:00
Dawn1Ocean 787b37fc42 beautify member page layout 2024-03-19 17:35:59 +08:00
Dawn1Ocean 3c2b613d87 add support for rendering ui on various devices 2024-03-19 11:31:23 +08:00
Dawn1Ocean f20a38af9b beautify ui; fix current ticket card title display bug 2024-03-19 02:19:39 +08:00
Dawn1Ocean 31d7aea480 beautify ui! 2024-03-19 00:14:13 +08:00
Dawn_Ocean 3db6425dc3 add relaunch ticketdetail after changing it 2024-03-18 14:56:02 +08:00
Dawn_Ocean cd3064c90f add relaunch ticketdetail after changing it 2024-03-18 14:55:27 +08:00
Dawn_Ocean 4640f89ea8 add changeStatus service 2024-03-18 14:40:03 +08:00
Dawn_Ocean 3d5cd6c8da add retrieve in service 2024-03-18 14:22:49 +08:00
Dawn_Ocean 7ced70ab21 fix Fixstatus; add support to all statuses 2024-03-18 14:08:52 +08:00
Dawn_Ocean 2398644cc3 add pickTicket in service 2024-03-18 13:44:39 +08:00
Dawn_Ocean 501f27bfbb add addToOreo in service 2024-03-18 13:39:15 +08:00
Dawn1Ocean e39e8d4e13 update mock 2024-03-17 18:34:58 +08:00
Dawn_Ocean 7cf2cbb798 add en_US localization 2024-03-17 11:34:14 +08:00
Dawn_Ocean d525f0288b add owner's info in ticketdetail 2024-03-17 02:05:08 +08:00
Dawn_Ocean 7f345af777 change README.md 2024-03-17 01:29:56 +08:00
Dawn_Ocean 563a0c42ea add memberpage layout 2024-03-17 01:00:06 +08:00
Dawn_Ocean cce351750d add confirm modal for buttons in ticketdetail 2024-03-16 16:45:41 +08:00
Dawn1Ocean ac9645b987 add comment floatlayout in ticketdetail 2024-03-15 22:19:30 +08:00
Dawn_Ocean e7b0b3239e add modal in ticketdetail-addtooreo 2024-03-15 15:48:19 +08:00
Dawn_Ocean b41498976e add blank judgement; fixed setstate in render bug 2024-03-15 14:28:26 +08:00
Dawn1Ocean 6b554196b3 add blank judgement for forms; fixing setstate bug in detailframework 2024-03-15 13:42:16 +08:00
Dawn1Ocean 2d5ce655ef add member status judgement 2024-03-15 01:58:59 +08:00
Dawn1Ocean 5614ce5818 add uncompleted ticket list in member page 2024-03-15 00:54:05 +08:00
Dawn1Ocean fc3ef61e5d add entry for ticket detail in current ticket card 2024-03-14 23:55:51 +08:00
Dawn1Ocean 60f10eaa8f add random tips on currentTicket card 2024-03-14 23:30:48 +08:00
53 changed files with 2147 additions and 292 deletions

View File

@ -10,25 +10,25 @@
1. 能看到现在维修状况:有几台正在维修,有几个人值班(空闲状态)
2. 能看到自己机器的维修情况:维修进度、评论等
1. 使用手机号确定id
1. 使用手机号查询工单
## 互动
1. 提醒:当修好之后会向你发送信息,提醒来取
2. 线上答疑:协会成员登录账号,看到机主提出的问题可以回答(暂定由值班组长管理)
1. 提醒:当修好(工单状态改变为待取回)之后会向你发送信息,提醒来取
2. 线上答疑:协会成员登录账号(通过 EVA Auth 授权),看到机主提出的问题可以回答(暂定由值班组长管理)
1. 公开答疑仅回复能不能修更复杂的问题推荐其来204
2. 当自己的机器正在维修时,可以与维修人员交流进度和问题等
3. (暂定)答疑功能使用预填写工单、工单的评论实现
3. 答疑功能使用预填写工单的评论实现
## 信息展示
1. 展示协会值班时间(现在是否在值班),若不在值班显示预计值班时间、不值班的原因
1. 展示协会值班时间(现在是否在值班),若不在值班显示预计值班时间、不值班的原因
2. 展示维修流程,包括注意事项等
1. 戴尔、Surface等不拆
2. 数据备份提醒
3. 不收礼物
4. 不要在204饮食
3. (备选)其他语言本地化
3. 其他语言本地化
## 面向协会成员
@ -42,13 +42,13 @@
## 对接
1. 与EVA统一身份认证对接
1. 与 EVA 统一身份认证对接
1. 协会成员登录入口
2. 个人信息同步
2. 与Oreo对接
1. 维修工单列表查看
2. 将预填写工单加入Oreo
3. 防恶意行为
2. 与 Oreo 对接
1. 维修工单列表查看:七天内未取回的工单
2. 将预填写工单加入 Oreo
3. 防恶意行为(尚未设置)
1. 工单填写间隔限制为【1】分钟
2. 一个人一天最多能创建【10】个预填写工单
3. 黑名单机制
@ -65,20 +65,20 @@
## 维修
1. (面向机主)预填写工单
2. 维修进度提示
3. (面向协会成员)维修列表
1. 预填写工单
2. 正在进行工单的展示
## 成员
1. 最近七天内未取回的工单列表
2. 值班组长上传本班相关信息
3. 现在自己是否要值班(值班时间显示)
4. 提醒事项
## 我的
1. 更改手机号等个人信息(手机号可以填写多个)
1. 更改手机号、姓名(手机号暂时只能填写一个)
2. (备选)修改用户名、头像
3. 设置真名(可帮助预填写工单)

View File

@ -34,7 +34,7 @@
## 主页面
### 值班信息 `GET /dutyinfo`
### 值班信息 `GET /duty/info`
#### 当前在值班
@ -141,7 +141,7 @@ data (same as oreo):
## 工单详情
### 创建评论 `POST /tickets/newcomment/{id}`
### 创建评论 `POST /tickets/newcomment?id={id}`
Request
@ -169,7 +169,74 @@ Request
}
```
### 工单信息 `GET /tickets/info/{id}`
### 添加评论 `POST /tickets/addnote`
Request
```json
{
"token": "token_test",
"id": "id",
"content" : "为什么 PD 不能充电呢?"
}
```
### 加入 Oreo `POST /tickets/addtooreo`
Request
```json
{
"token": "token_test",
"id": 4234
}
```
### 认领工单 `POST /tickets/pick`
Request
```json
{
"token": "token_test",
"id": 4234
}
```
### 更新工单状态 `POST /tickets/update`
Request
```json
{
"token": "token_test",
"id": "id",
"status": 3
}
```
### 确认已取回 `POST /tickets/retrieve`
Request
```json
{
"token": "token_test",
"id": "id",
}
```
### 获取七天内未完成工单 `POST /tickets/uncompleted`
Request
```json
{
"token": "token_test",
}
```
### 工单信息 `GET /tickets/info?id={id}`
data (same as oreo):
@ -224,3 +291,53 @@ data (same as oreo):
"picked": false
}
```
## 成员相关
### 成员登录 `POST /member/login`
Request
```json
{
"token": "token_test",
"stuid": "3220101984",
"passwd": "sonvidiafuckyou"
}
```
### 成员登出 `POST /member/logout`
Request
```json
{
"token": "token_test"
}
```
### 成员值班信息 `GET /member/duty/info`
#### 当前在值班
data:
```json
{
"isInDuty": true,
"inDutyCnt": 3,
"currentDuty": "2"
}
```
#### 当前未值班
data:
```json
{
"isInDuty": false,
"offDutyReason": "学园维修",
"dutyRecoverTime": "下周一"
}
```

View File

@ -3,7 +3,7 @@ import ticketInfo from './ticketInfo.json';
import uncompleted from './uncompleted.json';
export default {
'GET /dutyinfo': {
'GET /duty/info': {
success: true,
data: {
token: 'token_test',
@ -26,7 +26,7 @@ export default {
'GET /user/locale/get': {
success: true,
data: {
lang: 'en_US',
lang: 'zh_CN',
},
},
'POST /user/locale/update': {
@ -43,17 +43,44 @@ export default {
success: true,
data: ticketInfo,
},
'POST /tickets/newcomment': {
'POST /tickets/addnote': {
data: {},
},
'POST /tickets/create': {
data: {},
},
'POST /member/login': {
'POST /tickets/addtooreo': {
data: {},
},
'GET /member/tickets/uncompleted': {
'POST /tickets/pick': {
data: {},
},
'POST /tickets/update': {
data: {},
},
'POST /tickets/retrieve': {
data: {},
},
'POST /member/login': {
success: true,
data: {
isMember: true,
},
},
'GET /tickets/uncompleted': {
success: true,
data: uncompleted,
},
'POST /member/logout': {
success: true,
},
'GET /member/duty/info': {
success: true,
data: {
token: 'token_test',
isInDuty: true,
inDutyCnt: 6,
currentDuty: '3',
},
},
};

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1710604932901" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4288" xmlns:xlink="http://www.w3.org/1999/xlink" width="24" height="24"><path d="M512 121.6c217.6 0 390.4 172.8 390.4 390.4S729.6 902.4 512 902.4 121.6 729.6 121.6 512 294.4 121.6 512 121.6m0-89.6C246.4 32 32 249.6 32 512s217.6 480 480 480 480-217.6 480-480S774.4 32 512 32z" p-id="4289"></path><path d="M675.2 512H508.8V284.8c0-25.6-19.2-41.6-41.6-41.6H464c-25.6 0-41.6 19.2-41.6 41.6v272c0 25.6 19.2 41.6 41.6 41.6h214.4c25.6 0 44.8-22.4 44.8-44.8s-22.4-41.6-48-41.6z" p-id="4290"></path></svg>

After

Width:  |  Height:  |  Size: 746 B

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1710604932901" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4288" xmlns:xlink="http://www.w3.org/1999/xlink" width="24" height="24"><path d="M512 121.6c217.6 0 390.4 172.8 390.4 390.4S729.6 902.4 512 902.4 121.6 729.6 121.6 512 294.4 121.6 512 121.6m0-89.6C246.4 32 32 249.6 32 512s217.6 480 480 480 480-217.6 480-480S774.4 32 512 32z" p-id="4289"></path><path d="M675.2 512H508.8V284.8c0-25.6-19.2-41.6-41.6-41.6H464c-25.6 0-41.6 19.2-41.6 41.6v272c0 25.6 19.2 41.6 41.6 41.6h214.4c25.6 0 44.8-22.4 44.8-44.8s-22.4-41.6-48-41.6z" p-id="4290"></path></svg>

After

Width:  |  Height:  |  Size: 746 B

View File

@ -1 +1,6 @@
export type FixStatus = 1 | 2 | 3 | 4 | 5;
export type FixStatus = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
export type Info = {
phone: string;
name: string;
};

View File

@ -57,6 +57,11 @@ export default class DetailFramework extends Component<
title: navBar.ticketDetail,
});
getTicketInfo(this, this.props.id);
const status = this.state.ticketInfo.status;
this.setState({
current: mapStatusStep.get(status) || 0,
items: pt.get().ticketDetail.stepItems,
});
}
props: Readonly<DetailFrameworkProps> = {
@ -69,6 +74,7 @@ export default class DetailFramework extends Component<
current: true,
notelist: true,
showAllNotes: true,
info: true,
},
};
@ -79,12 +85,6 @@ export default class DetailFramework extends Component<
return <View>Request failed</View>;
}
const status = this.state.ticketInfo.status;
this.setState({
current: mapStatusStep.get(status) || 0,
items: pt.get().ticketDetail.stepItems,
});
const elements: ShowElements = {
device: this.props.isInfoShow['device'] ? (
<View className='at-article__h1'>
@ -103,8 +103,15 @@ export default class DetailFramework extends Component<
<View></View>
),
description: this.props.isInfoShow['description'] ? (
<View style={{ marginTop: 10, marginBottom: 10 }}>
<AtCard title={pt.get().ticketDetail.descTitle}>
<View
style={{
paddingTop: '20rpx',
paddingBottom: '20rpx',
width: '94%',
marginLeft: '3%',
}}
>
<AtCard isFull title={pt.get().ticketDetail.descTitle}>
<View className='at-article__h3'>
{this.state.ticketInfo.description}
</View>
@ -113,8 +120,36 @@ export default class DetailFramework extends Component<
) : (
<View></View>
),
info: this.props.isInfoShow['info'] ? (
<View
style={{
paddingTop: '20rpx',
paddingBottom: '20rpx',
width: '94%',
marginLeft: '3%',
}}
>
<AtCard
isFull
title={pt.get().ticketDetail.info.title}
extra={pt.get().ticketDetail.info.extra}
extraStyle={{ fontSize: '32rpx', marginRight: '40rpx' }}
>
<View style={{ display: 'flex' }}>
<View className='at-article__h3'>
{this.state.ticketInfo.info.name}
</View>
<View style={{ marginLeft: 'auto' }} className='at-article__h3'>
{this.state.ticketInfo.info.phone}
</View>
</View>
</AtCard>
</View>
) : (
<View></View>
),
current: this.props.isInfoShow['current'] ? (
<View style={{ padding: 10 }}>
<View style={{ padding: '20rpx' }}>
<AtSteps
items={this.state.items}
current={this.state.current}
@ -126,11 +161,11 @@ export default class DetailFramework extends Component<
),
notelist: this.props.isInfoShow['notelist'] ? (
this.props.isInfoShow['showAllNotes'] ? (
<View style={{ padding: 10 }}>
<View style={{ padding: '20rpx' }}>
<NoteList noteList={this.state.notes} />
</View>
) : (
<View style={{ padding: 10 }}>
<View style={{ padding: '20rpx' }}>
<NoteList
noteList={[this.state.notes[this.state.notes.length - 1]]}
/>
@ -146,6 +181,7 @@ export default class DetailFramework extends Component<
{elements.device}
{elements.createdTime}
{elements.description}
{elements.info}
{elements.current}
{this.props.middleButton}
{elements.notelist}

View File

@ -3,7 +3,6 @@ import { Component, ReactNode } from 'react';
import { TicketNote, StatusStr } from '@/pages/TicketDetail/TicketNote';
import pt from '@/plain-text';
import { timeFormat } from '@/utils';
import { AtDivider } from 'taro-ui';
import './NoteCard.scss';
interface NoteCardProps {
@ -36,13 +35,12 @@ export default class NoteCard extends Component<NoteCardProps, {}> {
}
return (
<View>
<View className='at-article__h2'>{note.op}</View>
<View style={{ marginTop: '40rpx', marginBottom: '40rpx' }}>
<View className='at-article__p'>{note.op}</View>
<View className='at-article__info'>
{note.createdTime.format(timeFormat)}
</View>
<View className='at-article__p'>{message}</View>
<AtDivider />
<View className='at-article__h3'>{message}</View>
</View>
);
}

View File

@ -2,6 +2,8 @@ import { Component, ReactNode } from 'react';
import NoteCard from '@/components/NoteCard/NoteCard';
import { TicketNote } from '@/pages/TicketDetail/TicketNote';
import { View } from '@tarojs/components';
import { AtDivider } from 'taro-ui';
import pt from '@/plain-text';
interface NoteListProps {
noteList: Array<TicketNote>;
@ -14,6 +16,11 @@ export default class NoteList extends Component<NoteListProps, {}> {
render(): ReactNode {
return (
<View>
<AtDivider
fontColor='#CCC'
content={pt.get().ticketDetail.divider}
height='80rpx'
/>
{this.props.noteList.map((note, idx) => (
<View key={idx}>
<NoteCard note={note} />

View File

@ -3,8 +3,8 @@ import { AtDivider } from 'taro-ui';
import pt from '@/plain-text';
export default () => {
const blankHeightUpper = 15;
const blankHeightLower = 110;
const blankHeightUpper = '30rpx';
const blankHeightLower = '220rpx';
return (
<View>
<View style={{ height: blankHeightUpper }}></View>
@ -16,7 +16,7 @@ export default () => {
/>
</View>
<View className='at-row at-row__justify--center'>
<Text style='color:#dddddd;'>© 2024 EVA Tech</Text>
<Text style='color:#dddddd; fontSize:32rpx'>© 2024 EVA Tech</Text>
</View>
<View style={{ height: blankHeightLower }}></View>
</View>

View File

@ -3,10 +3,10 @@ import repair from '@/assets/icons/MyTickets/repair.svg';
import finished from '@/assets/icons/MyTickets/finished.svg';
import tick from '@/assets/icons/MyTickets/tick.svg';
import fail from '@/assets/icons/MyTickets/fail.svg';
import clock from '@/assets/icons/MyTickets/clock.svg';
import pt from '@/plain-text';
import Taro from '@tarojs/taro';
type FixStatus = 1 | 2 | 3 | 4 | 5;
import { FixStatus } from '@/common';
export class TicketListItem {
id: number;
@ -29,11 +29,14 @@ export class TicketListItem {
this.status = status;
this.createAt = createAt;
this.iconMap = new Map<FixStatus, string>([
[0, repair],
[1, repair],
[2, repair],
[2, clock],
[3, finished],
[4, tick],
[5, fail],
[4, clock],
[5, tick],
[6, clock],
[7, fail],
]);
}

View File

@ -6,65 +6,85 @@ import wechatUser from '@/wechat';
import 'taro-ui/dist/style/index.scss';
import './index.scss';
const navList: Array<Taro.TabBarItem> = [
{
pagePath: '/pages/index/index',
text: pt.get().tabBar.indexText,
},
{
pagePath: '/pages/repair/repair',
text: pt.get().tabBar.repairText,
},
{
pagePath: '/pages/member/member',
text: pt.get().tabBar.memberText,
},
{
pagePath: '/pages/user/user',
text: pt.get().tabBar.userText,
},
];
const navList: () => Array<Taro.TabBarItem> = () => {
return wechatUser.getAccess()
? [
{
pagePath: '/pages/index/index',
text: pt.get().tabBar.indexText,
},
{
pagePath: '/pages/repair/repair',
text: pt.get().tabBar.repairText,
},
{
pagePath: '/pages/member/member',
text: pt.get().tabBar.memberText,
},
{
pagePath: '/pages/user/user',
text: pt.get().tabBar.userText,
},
]
: [
{
pagePath: '/pages/index/index',
text: pt.get().tabBar.indexText,
},
{
pagePath: '/pages/repair/repair',
text: pt.get().tabBar.repairText,
},
{
pagePath: '/pages/user/user',
text: pt.get().tabBar.userText,
},
];
};
const tabList = () => {
return wechatUser.getAccess()
? [
{
title: pt.get().tabBar.indexText,
iconType: 'home',
},
{
title: pt.get().tabBar.repairText,
iconType: 'settings',
},
{
title: pt.get().tabBar.memberText,
iconType: 'sketch',
},
{
title: pt.get().tabBar.userText,
iconType: 'user',
},
]
: [
{
title: pt.get().tabBar.indexText,
iconType: 'home',
},
{
title: pt.get().tabBar.repairText,
iconType: 'settings',
},
{
title: pt.get().tabBar.userText,
iconType: 'user',
},
];
};
export default class Index extends Component {
state = {
selected: 0,
tabList: wechatUser.getAccess()
? [
{
title: pt.get().tabBar.indexText,
iconType: 'home',
},
{
title: pt.get().tabBar.repairText,
iconType: 'settings',
},
{
title: pt.get().tabBar.memberText,
iconType: 'sketch',
},
{
title: pt.get().tabBar.userText,
iconType: 'user',
},
]
: [
{
title: pt.get().tabBar.indexText,
iconType: 'home',
},
{
title: pt.get().tabBar.repairText,
iconType: 'settings',
},
{
title: pt.get().tabBar.userText,
iconType: 'user',
},
],
};
handleClick(idx: number) {
this.switchTab(idx, navList[idx].pagePath);
this.switchTab(idx, navList()[idx].pagePath);
}
switchTab(idx: number, url: string) {
@ -82,7 +102,7 @@ export default class Index extends Component {
return (
<AtTabBar
fixed
tabList={this.state.tabList}
tabList={tabList()}
onClick={this.handleClick.bind(this)}
current={this.state.selected}
/>

View File

@ -2,17 +2,69 @@ import { Component, ReactNode } from 'react';
import { View } from '@tarojs/components';
import { getCurrentInstance } from '@tarojs/runtime';
import pt from '@/plain-text';
import { AtButton } from 'taro-ui';
import {
AtActionSheet,
AtActionSheetItem,
AtButton,
AtFloatLayout,
AtForm,
AtMessage,
AtModal,
AtTextarea,
} from 'taro-ui';
import DetailFramework from '@/components/DetailFramework/DetailFramework';
import PageFooter from '@/components/PageFooter/PageFooter';
import { submitComment } from '@/service/submitComment';
import Taro from '@tarojs/taro';
import wechatUser from '@/wechat';
import { addToOreo } from '@/service/addToOreo';
import { pickTicket } from '@/service/pickTicket';
import { retrieve } from '@/service/retrieve';
import { changeStatus } from '@/service/changeStatus';
const submitInterval = 5000;
interface TicketDetailState {
id: number;
isMember: boolean;
showOreoModal: boolean;
showCommentLayout: boolean;
showRetrieveModal: boolean;
showStatusSheet: boolean;
showPickModal: boolean;
comment: string;
isOreoLoading: boolean;
isOreoDisable: boolean;
isPickLoading: boolean;
isPickDisable: boolean;
isRetrieveLoading: boolean;
isRetrieveDisable: boolean;
isStatusLoading: boolean;
isStatusDisable: boolean;
isCommentLoading: boolean;
isCommentDisable: boolean;
}
export default class TicketDetail extends Component<{}, TicketDetailState> {
state: Readonly<TicketDetailState> = {
id: 0,
isMember: false,
showOreoModal: false,
showCommentLayout: false,
showRetrieveModal: false,
showStatusSheet: false,
showPickModal: false,
comment: '',
isOreoLoading: false,
isOreoDisable: false,
isPickLoading: false,
isPickDisable: false,
isRetrieveLoading: false,
isRetrieveDisable: false,
isStatusLoading: false,
isStatusDisable: false,
isCommentLoading: false,
isCommentDisable: false,
};
componentDidMount(): void {
@ -20,26 +72,254 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
const id = router?.params.id as number;
this.setState({
id: id,
isMember: wechatUser.getAccess(),
});
}
onAddToOreo(): void {
this.setState({
showOreoModal: true,
});
}
onAddComment(): void {
this.setState({
showCommentLayout: true,
});
}
onRetrieved(): void {
this.setState({
showRetrieveModal: true,
});
}
onPick(): void {
this.setState({
showPickModal: true,
});
}
onChangeStatus(): void {
this.setState({
showStatusSheet: true,
});
}
handleOreoCancel(): void {
this.setState({
showOreoModal: false,
});
}
handleCommentCancel(): void {
this.setState({
showCommentLayout: false,
});
}
handleRetrieveCancel(): void {
this.setState({
showRetrieveModal: false,
});
}
handleStatusCancel(): void {
this.setState({
showStatusSheet: false,
});
}
handlePickCancel(): void {
this.setState({
showPickModal: false,
});
}
handleOreoConfirm(): void {
this.setState({
isOreoDisable: true,
showOreoModal: false,
});
addToOreo(this);
setTimeout(() => {
this.setState({
isOreoDisable: false,
});
}, submitInterval);
return;
}
handleRetrieveConfirm(): void {
this.setState({
isRetrieveDisable: true,
showRetrieveModal: false,
});
retrieve(this);
setTimeout(() => {
this.setState({
isRetrieveDisable: false,
});
}, submitInterval);
return;
}
handlePickConfirm(): void {
this.setState({
isPickDisable: true,
showPickModal: false,
});
pickTicket(this);
setTimeout(() => {
this.setState({
isPickDisable: false,
});
}, submitInterval);
return;
}
handleStatusChange(status: number): void {
this.setState({
showStatusSheet: false,
isStatusDisable: true,
});
changeStatus(this, status);
setTimeout(() => {
this.setState({
isStatusDisable: false,
});
}, submitInterval);
return;
}
handleCommentChange(comment: string) {
this.setState({
comment: comment,
});
return comment;
}
onCommentSubmit() {
this.setState({
isCommentDisable: true,
showCommentLayout: false,
});
if (this.state.comment == '') {
Taro.atMessage({
message: pt.get().button.submitText.blank,
type: 'error',
});
setTimeout(() => {
this.setState({
isCommentDisable: false,
});
}, submitInterval);
return;
}
submitComment(this);
setTimeout(() => {
this.setState({
isCommentDisable: false,
});
}, submitInterval);
}
render(): ReactNode {
const middleButton = (
const middleButton = this.state.isMember ? (
<View>
<View
className='at-row'
style={{ paddingTop: '20rpx', paddingBottom: '20rpx', width: '100%' }}
>
<View
className='at-col'
style={{ marginLeft: '20rpx', paddingRight: '10rpx', width: '50%' }}
>
<AtButton
loading={this.state.isPickLoading}
disabled={this.state.isPickDisable}
type='secondary'
onClick={this.onPick.bind(this)}
>
{pt.get().ticketDetail.pick}
</AtButton>
</View>
<View
className='at-col'
style={{ marginLeft: '20rpx', paddingRight: '10rpx', width: '50%' }}
>
<AtButton
loading={this.state.isOreoLoading}
disabled={this.state.isOreoDisable}
type='primary'
onClick={this.onAddToOreo.bind(this)}
>
{pt.get().ticketDetail.addToOreo}
</AtButton>
</View>
</View>
<View
className='at-row'
style={{ paddingTop: '20rpx', paddingBottom: '20rpx', width: '100%' }}
>
<View
className='at-col'
style={{ marginLeft: '20rpx', paddingRight: '10rpx', width: '50%' }}
>
<AtButton
loading={this.state.isStatusLoading}
disabled={this.state.isStatusDisable}
type='primary'
onClick={this.onChangeStatus.bind(this)}
>
{pt.get().ticketDetail.status.button}
</AtButton>
</View>
<View
className='at-col'
style={{ marginLeft: '20rpx', paddingRight: '10rpx', width: '50%' }}
>
<AtButton
disabled={this.state.isCommentDisable}
loading={this.state.isCommentLoading}
type='secondary'
onClick={this.onAddComment.bind(this)}
>
{pt.get().ticketDetail.addNote}
</AtButton>
</View>
</View>
</View>
) : (
<View
className='at-row'
style={{ paddingTop: 10, paddingBottom: 10, width: '100%' }}
style={{ paddingTop: '20rpx', paddingBottom: '20rpx', width: '100%' }}
>
<View
className='at-col'
style={{ marginLeft: 10, paddingRight: 5, width: '50%' }}
style={{ marginLeft: '20rpx', paddingRight: '10rpx', width: '50%' }}
>
<AtButton type='primary'>{pt.get().ticketDetail.tookAway}</AtButton>
<AtButton
loading={this.state.isRetrieveLoading}
disabled={this.state.isRetrieveDisable}
type='primary'
onClick={this.onRetrieved.bind(this)}
>
{pt.get().ticketDetail.tookAway}
</AtButton>
</View>
<View
className='at-col'
style={{ marginRight: 10, paddingLeft: 5, width: '50%' }}
style={{ marginRight: '20rpx', paddingLeft: '10rpx', width: '50%' }}
>
<AtButton type='secondary'>{pt.get().ticketDetail.addNote}</AtButton>
<AtButton
disabled={this.state.isCommentDisable}
loading={this.state.isCommentLoading}
type='secondary'
onClick={this.onAddComment.bind(this)}
>
{pt.get().ticketDetail.addNote}
</AtButton>
</View>
</View>
);
@ -48,6 +328,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
device: true,
createdTime: true,
description: true,
info: wechatUser.getAccess() ? true : false,
current: true,
notelist: true,
showAllNotes: true,
@ -55,6 +336,84 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
return (
<View>
<AtMessage />
<AtModal
isOpened={this.state.showOreoModal}
title={pt.get().modal.addToOreo.title}
cancelText={pt.get().modal.cancel}
confirmText={pt.get().modal.confirm}
onCancel={this.handleOreoCancel.bind(this)}
onConfirm={this.handleOreoConfirm.bind(this)}
content={pt.get().modal.addToOreo.content}
/>
<AtModal
isOpened={this.state.showRetrieveModal}
title={pt.get().modal.retrieve.title}
cancelText={pt.get().modal.cancel}
confirmText={pt.get().modal.confirm}
onCancel={this.handleRetrieveCancel.bind(this)}
onConfirm={this.handleRetrieveConfirm.bind(this)}
content={pt.get().modal.retrieve.content}
/>
<AtModal
isOpened={this.state.showPickModal}
title={pt.get().modal.pick.title}
cancelText={pt.get().modal.cancel}
confirmText={pt.get().modal.confirm}
onCancel={this.handlePickCancel.bind(this)}
onConfirm={this.handlePickConfirm.bind(this)}
content={pt.get().modal.pick.content}
/>
<AtFloatLayout
isOpened={this.state.showCommentLayout}
title={pt.get().ticketDetail.comment.title}
onClose={this.handleCommentCancel.bind(this)}
>
<AtForm onSubmit={this.onCommentSubmit.bind(this)}>
<AtTextarea
value={this.state.comment}
onChange={this.handleCommentChange.bind(this)}
maxLength={200}
height='400rpx'
placeholder={pt.get().ticketDetail.comment.placeholder}
/>
<AtButton formType='submit' type='primary'>
{pt.get().button.buttonText.submit}
</AtButton>
</AtForm>
</AtFloatLayout>
<AtActionSheet
isOpened={this.state.showStatusSheet}
cancelText={pt.get().ticketDetail.status.cancel}
title={pt.get().ticketDetail.status.title}
onCancel={this.handleStatusCancel.bind(this)}
onClose={this.handleStatusCancel.bind(this)}
>
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 0)}>
{pt.get().ticketDetail.status.status0}
</AtActionSheetItem>
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 1)}>
{pt.get().ticketDetail.status.status1}
</AtActionSheetItem>
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 2)}>
{pt.get().ticketDetail.status.status2}
</AtActionSheetItem>
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 3)}>
{pt.get().ticketDetail.status.status3}
</AtActionSheetItem>
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 4)}>
{pt.get().ticketDetail.status.status4}
</AtActionSheetItem>
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 5)}>
{pt.get().ticketDetail.status.status5}
</AtActionSheetItem>
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 6)}>
{pt.get().ticketDetail.status.status6}
</AtActionSheetItem>
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 7)}>
{pt.get().ticketDetail.status.status7}
</AtActionSheetItem>
</AtActionSheet>
<DetailFramework
middleButton={middleButton}
id={this.state.id}

View File

@ -1,4 +1,4 @@
import { FixStatus } from '@/common';
import { FixStatus, Info } from '@/common';
export class TicketInfo {
id: number;
@ -8,6 +8,7 @@ export class TicketInfo {
description: string;
createdTime: moment.Moment;
status: FixStatus;
info: Info;
}
export class TicketNote {
@ -22,6 +23,7 @@ export class ShowElements {
device: JSX.Element;
createdTime: JSX.Element;
description: JSX.Element;
info: JSX.Element;
current: JSX.Element;
notelist: JSX.Element;
}

View File

@ -36,20 +36,20 @@ class Card extends Component {
style={{
display: 'flex',
alignItems: 'center',
marginBottom: 20,
marginBottom: '40rpx',
}}
>
<Image
src={iconsrc}
style={{
width: 24,
height: 24,
width: '48rpx',
height: '48rpx',
}}
/>
<View
style={{
marginLeft: 10,
fontSize: 30,
marginLeft: '20rpx',
fontSize: '60rpx',
fontWeight: 'bold',
}}
>

View File

@ -10,7 +10,7 @@ export default class TitleCard extends React.Component {
<View className='at-row at-row__align--center'>
<View className='at-col at-col-1 at-col--auto'>
<Image
style='width: 50px; height: 50px; margin-left: 15px;'
style='width: 100rpx; height: 100rpx; margin-left: 30rpx;'
src={logo}
mode='aspectFit'
/>

View File

@ -20,7 +20,7 @@ class CardContent {
function mainPageCard(c: CardContent): JSX.Element {
return (
<View style={{ marginTop: 10 }}>
<View style={{ marginTop: '20rpx', marginBottom: '40rpx' }}>
<AtCard note={c.note} extra={c.extra} title={c.title}>
{c.content()}
</AtCard>
@ -105,15 +105,17 @@ export default class MainPage extends Component<{}, MainPageState> {
return (
<View>
<TitleCard />
<View style={{ marginTop: 30 }}>
{mainPageCard(this.state.dutyInfoCard)}
{mainPageCard(this.state.tipsInfoCard)}
<ExpandItem
title={mainPage.expandTitle.stepInfo}
content={mainPageCard(this.state.stepInfoCard)}
/>
<View style={{ width: '94%', marginLeft: '3%' }}>
<View style={{ marginTop: '60rpx' }}>
{mainPageCard(this.state.dutyInfoCard)}
{mainPageCard(this.state.tipsInfoCard)}
<ExpandItem
title={mainPage.expandTitle.stepInfo}
content={mainPageCard(this.state.stepInfoCard)}
/>
</View>
<PageFooter />
</View>
<PageFooter />
</View>
);
}

View File

@ -0,0 +1,120 @@
import { Component, ReactNode } from 'react';
import { View, Image } from '@tarojs/components';
import { AtTimeline } from 'taro-ui';
import pt from '@/plain-text';
import tick from '@/assets/icons/MainPage/tick.svg';
import clock from '@/assets/icons/MemberPage/clock.svg';
export class MemberDutyData {
constructor() {
this.isInDuty = false;
this.currentDuty = '2';
this.inDutyCnt = 3;
this.offDutyReason = '学园维修';
this.dutyRecoverTime = '下周一';
}
isInDuty: boolean;
currentDuty?: 'off' | '1' | '2' | '3' | 'others';
offDutyReason?: string;
dutyRecoverTime?: string;
inDutyCnt?: number;
}
class Card extends Component {
props = {
isInDuty: false,
};
render(): ReactNode {
const inDuty = this.props.isInDuty;
const dc = pt.get().memberPage.dutyCard;
const title = inDuty ? dc.inDuty.title : dc.offDuty.title;
const iconsrc = inDuty ? tick : clock;
return (
<View>
<View
style={{
display: 'flex',
alignItems: 'center',
marginBottom: '40rpx',
}}
>
<Image
src={iconsrc}
style={{
width: '48rpx',
height: '48rpx',
}}
/>
<View
style={{
marginLeft: '20rpx',
fontSize: '60rpx',
fontWeight: 'bold',
}}
>
{title}
</View>
</View>
</View>
);
}
}
export class MemberDutyInfo extends Component {
state: {
isLoading: false;
isDisable: false;
};
props = {
data: new MemberDutyData(),
};
offDutyContent(): ReactNode {
const data = this.props.data;
const od = pt.get().memberPage.dutyCard.offDuty;
return (
<View>
<Card isInDuty={data.isInDuty} />
<AtTimeline
items={[
{ title: od.reason(data.offDutyReason as string) },
{ title: od.recoverTime(data.dutyRecoverTime as string) },
]}
/>
</View>
);
}
inDutyContent(): ReactNode {
const data = this.props.data;
const id = pt.get().memberPage.dutyCard.inDuty;
return (
<View>
<Card isInDuty={data.isInDuty} />
<View
style={{
display: 'flex',
alignItems: 'center',
}}
>
<AtTimeline
items={[
{ title: id.currentDutyText(data.currentDuty || 'off') },
{ title: id.inDutyCnt(data.inDutyCnt as number) },
]}
/>
</View>
</View>
);
}
render(): ReactNode {
if (this.props.data.isInDuty) {
return this.inDutyContent();
} else {
return this.offDutyContent();
}
}
}

View File

@ -0,0 +1,24 @@
import { Component, ReactNode } from 'react';
import { View } from '@tarojs/components';
import { AtTimeline } from 'taro-ui';
import pt from '@/plain-text';
export class MemberStepInfo extends Component {
render(): ReactNode {
return (
<View>
<AtTimeline items={pt.get().memberPage.stepList}></AtTimeline>
</View>
);
}
}
export class MemberTipsInfo extends Component {
render(): ReactNode {
return (
<View>
<AtTimeline items={pt.get().memberPage.tipsList}></AtTimeline>
</View>
);
}
}

View File

@ -0,0 +1,27 @@
import React from 'react';
import { View, Image } from '@tarojs/components';
import pt from '@/plain-text';
import logo from '@/assets/images/UserPage/logo.png';
export default class MemberTitleCard extends React.Component {
render(): React.ReactNode {
const memberPage = pt.get().memberPage;
return (
<View className='at-row at-row__align--center'>
<View className='at-col at-col-1 at-col--auto'>
<Image
style='width: 100rpx; height: 100rpx; margin-left: 30rpx;'
src={logo}
mode='aspectFit'
/>
</View>
<View className='page-title'>
<View className='at-article__h1' style={{ fontWeight: 'bold' }}>
{memberPage.mainTitleLine}
</View>
<View className='at-article__h2'>{memberPage.subTitleLine}</View>
</View>
</View>
);
}
}

View File

@ -1,10 +1,123 @@
import { View, Text } from '@tarojs/components';
import { View } from '@tarojs/components';
import { Component, ReactNode } from 'react';
import {
AtAccordion,
AtButton,
AtCard,
AtInputNumber,
AtList,
AtMessage,
} from 'taro-ui';
import Taro from '@tarojs/taro';
import type CustomTabBar from '../../custom-tab-bar';
import pt from '@/plain-text';
import { getUncompletedTicketList } from '@/service/uncompletedTicket';
import type CustomTabBar from '@/custom-tab-bar';
import { TicketListItem } from '@/components/TicketListItem/TicketListItem';
import { RequestState } from '@/service';
import moment from 'moment';
import { getMemberDutyInfo } from '@/service/memberDutyInfo';
import PageFooter from '@/components/PageFooter/PageFooter';
import { changeDutyCnt } from '@/service/changeDutyCount';
import './member.scss';
import { MemberDutyData, MemberDutyInfo } from './MemberDutyInfo';
import { MemberStepInfo, MemberTipsInfo } from './MemberStepTipsInfo';
import MemberTitleCard from './MemberTitleCard';
const submitInterval = 5000;
class CardContent {
title: string;
note: string;
extra: JSX.Element | string;
content: () => JSX.Element;
}
function memberPageCard(c: CardContent): JSX.Element {
return (
<View style={{ marginTop: '20rpx', marginBottom: '40rpx' }}>
<AtCard note={c.note} extra={c.extra} title={c.title}>
{c.content()}
</AtCard>
</View>
);
}
class ExpandItem extends Component {
state = {
open: false,
};
props = {
title: '',
content: <View></View>,
};
handleClick(value: boolean) {
this.setState({ open: value });
}
render(): ReactNode {
return (
<View>
<AtAccordion
open={this.state.open}
onClick={this.handleClick.bind(this)}
title={this.props.title}
>
{this.props.content}
</AtAccordion>
</View>
);
}
}
interface MemberPageState {
fixList: Array<TicketListItem>;
rs: RequestState;
dutyData: MemberDutyData;
inDutyCnt: number;
dutyInfoCard: CardContent;
stepInfoCard: CardContent;
tipsInfoCard: CardContent;
isLoading: boolean;
isDisable: boolean;
}
export default class MemberPage extends Component<{}, MemberPageState> {
state = {
dutyData: new MemberDutyData(),
inDutyCnt: 0,
dutyInfoCard: {
title: pt.get().mainPage.cardTitle.dutyInfo,
note: pt.get().mainPage.cardTips.dutyInfo,
extra: pt.get().mainPage.extraInfo.dutyInfo,
content: () => <MemberDutyInfo data={this.state.dutyData} />,
},
stepInfoCard: {
title: pt.get().mainPage.cardTitle.stepInfo,
note: pt.get().mainPage.cardTips.stepInfo,
extra: pt.get().mainPage.extraInfo.dutyInfo,
content: () => <MemberStepInfo />,
},
tipsInfoCard: {
title: pt.get().mainPage.cardTitle.tipsInfo,
note: pt.get().mainPage.cardTips.tipsInfo,
extra: pt.get().mainPage.extraInfo.dutyInfo,
content: () => <MemberTipsInfo />,
},
fixList: [new TicketListItem(0, '', '', 1, moment())],
rs: new RequestState(),
isLoading: false,
isDisable: false,
};
componentDidMount(): void {
getMemberDutyInfo(this);
Taro.setNavigationBarTitle({
title: pt.get().navBar.user.member,
});
getUncompletedTicketList(this);
}
export default class MemberPage extends Component {
// 以下是TabBar相关
pageCtx = Taro.getCurrentInstance().page;
componentDidShow() {
@ -13,10 +126,100 @@ export default class MemberPage extends Component {
}
// 以上是TabBar相关
handleCnt(inDutyCnt: number) {
this.setState({
inDutyCnt: inDutyCnt,
});
return inDutyCnt;
}
onChangeCnt() {
this.setState({
isDisable: true,
});
changeDutyCnt(this);
setTimeout(() => {
this.setState({
isDisable: false,
});
}, submitInterval);
}
render(): ReactNode {
const memberPage = pt.get().memberPage;
if (this.state.rs.loading) {
return <View>loading</View>;
}
if (!this.state.rs.success) {
return <View>Failed</View>;
}
const fixListRenderer = this.state.fixList.map((item) => item.render());
return (
<View>
<Text>Member Page</Text>
<AtMessage />
<MemberTitleCard />
<View style={{ width: '94%', marginLeft: '3%' }}>
<View style={{ marginTop: '60rpx' }}>
{memberPageCard(this.state.dutyInfoCard)}
{memberPageCard(this.state.tipsInfoCard)}
{this.state.dutyData.isInDuty ? (
<ExpandItem
title={memberPage.expandTitle.admin}
content={
<View
style={{
display: 'flex',
alignItems: 'center',
marginBottom: '40rpx',
}}
>
<View
className='.at-article__h3'
style={{
marginTop: '40rpx',
}}
>
{pt.get().memberPage.dutyCount.text}
</View>
<View
style={{
marginTop: '40rpx',
}}
>
<AtInputNumber
type='number'
min={0}
max={10}
step={1}
value={this.state.inDutyCnt}
onChange={this.handleCnt.bind(this)}
/>
</View>
<View style={{ marginLeft: 'auto', marginTop: '40rpx' }}>
<AtButton
type='secondary'
size='small'
loading={this.state.isLoading}
disabled={this.state.isDisable}
onClick={this.onChangeCnt.bind(this)}
>
{pt.get().memberPage.dutyCount.button}
</AtButton>
</View>
</View>
}
/>
) : (
<View></View>
)}
<ExpandItem
title={memberPage.expandTitle.stepInfo}
content={memberPageCard(this.state.stepInfoCard)}
/>
</View>
<AtList>{fixListRenderer}</AtList>
<PageFooter />
</View>
</View>
);
}

View File

@ -17,6 +17,7 @@ import type CustomTabBar from '@/custom-tab-bar';
import repairLogo from '@/assets/icons/RepairPage/repair.svg';
import DetailFramework from '@/components/DetailFramework/DetailFramework';
import { getCurrentTicket } from '@/service/currentTicket';
import { randomInt } from '@/utils/random';
import './repair.scss';
interface RepairPageState {
@ -29,7 +30,7 @@ interface RepairPageState {
isLoading: boolean;
isDisable: boolean;
checkedList: Array<number>;
currentTicketsId: Array<number>;
currentTicketsIdName: Array<Map<number, string>>;
}
const submitInterval = 5000;
@ -37,7 +38,7 @@ const submitInterval = 5000;
const middleButton = <View></View>;
const isInfoShow = {
device: true,
device: false,
createdTime: true,
description: false,
current: true,
@ -56,11 +57,11 @@ export default class RepairPage extends Component<{}, RepairPageState> {
isLoading: false,
isDisable: true,
checkedList: [0],
currentTicketsId: [] as Array<number>,
currentTicketsIdName: [] as Array<Map<number, string>>,
};
componentDidMount(): void {
getCurrentTicket(this, middleButton, isInfoShow);
getCurrentTicket(this);
setTimeout(() => {
this.setState({
@ -152,30 +153,77 @@ export default class RepairPage extends Component<{}, RepairPageState> {
onSubmit() {
this.setState({
isLoading: true,
isDisable: true,
});
if (
this.state.description == '' ||
this.state.device == '' ||
this.state.deviceModel == '' ||
this.state.owner == '' ||
this.state.phone == '' ||
this.state.checkedList.length === 0
) {
Taro.atMessage({
message: pt.get().button.submitText.blank,
type: 'error',
});
setTimeout(() => {
this.setState({
isDisable: false,
});
}, submitInterval);
return;
}
submitTicket(this);
Taro.reLaunch({
url: '/pages/repair/repair',
});
setTimeout(() => {
this.setState({
isDisable: false,
});
}, submitInterval);
}
render(): ReactNode {
const ticketsRenderer = this.state.currentTicketsId.map((id, idx) => (
<AtCard key={idx}>
<DetailFramework
id={id}
isInfoShow={isInfoShow}
middleButton={middleButton}
/>
</AtCard>
));
console.log(ticketsRenderer);
const ticketsRenderer =
this.state.currentTicketsIdName.length !== 0 ? (
this.state.currentTicketsIdName.map((pair, idx) => (
<AtCard
key={idx}
title={pair.values().next().value} //pair.keys().next().value == ticket['device'] + ' ' + ticket['deviceModel']
extra={pt.get().repairPage.currentTicket.extra}
onClick={() => {
Taro.navigateTo({
url:
'/pages/TicketDetail/TicketDetail?id=' +
pair.keys().next().value,
});
}}
note={
pt.get().tips.tipsText[
randomInt(0, pt.get().tips.tipsText.length - 1)
]
}
>
<DetailFramework
id={pair.keys().next().value} //pair.keys().next().value == id
isInfoShow={isInfoShow}
middleButton={middleButton}
/>
</AtCard>
))
) : (
<View></View>
);
return (
<View>
<View style={{ width: '94%', marginLeft: '3%' }}>
<AtMessage />
{ticketsRenderer}
<View
style={{
marginTop: '20rpx',
marginBottom: '40rpx',
}}
>
{ticketsRenderer}
</View>
<AtCard
note={pt.get().repairPage.cardText.note}
title={pt.get().repairPage.cardText.title}

View File

@ -36,10 +36,20 @@ export default class InformPage extends Component {
}
onSubmit() {
this.setState({
isLoading: true,
isDisable: true,
});
console.log(this.state.name, this.state.phone);
if (this.state.name == '' || this.state.phone == '') {
Taro.atMessage({
message: pt.get().button.submitText.blank,
type: 'error',
});
setTimeout(() => {
this.setState({
isDisable: false,
});
}, submitInterval);
return;
}
updateUserInfo(this);
setTimeout(() => {
this.setState({
@ -50,7 +60,7 @@ export default class InformPage extends Component {
render(): ReactNode {
return (
<View>
<View style={{ marginTop: '30rpx', width: '94%', marginLeft: '3%' }}>
<AtForm onSubmit={this.onSubmit.bind(this)}>
<AtMessage />
<AtInput
@ -73,14 +83,16 @@ export default class InformPage extends Component {
value={this.state.name}
onChange={this.handleChangeName.bind(this)}
/>
<AtButton
loading={this.state.isLoading}
formType='submit'
type='primary'
disabled={this.state.isDisable}
>
{pt.get().button.buttonText.submit}
</AtButton>
<View style={{ marginTop: '30rpx' }}>
<AtButton
loading={this.state.isLoading}
formType='submit'
type='primary'
disabled={this.state.isDisable}
>
{pt.get().button.buttonText.submit}
</AtButton>
</View>
</AtForm>
</View>
);

View File

@ -1,13 +1,14 @@
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 { memberLogin, memberLogout } from '@/service/memberLogin';
import wechatUser from '@/wechat';
import './member.scss';
const loginInterval = 5000;
const logInterval = 5000;
export default class MemberPage extends Component {
export default class UserMemberPage extends Component {
state = {
stuid: '',
passwd: '',
@ -16,7 +17,7 @@ export default class MemberPage extends Component {
};
componentDidMount(): void {
Taro.setNavigationBarTitle({
title: pt.get().navBar.user.member,
title: pt.get().navBar.user.memberLogin,
});
}
handleChangeStuid(stuid: string) {
@ -33,45 +34,42 @@ export default class MemberPage extends Component {
}
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',
});
if (this.state.stuid == '' || this.state.passwd == '') {
Taro.atMessage({
message: pt.get().button.submitText.blank,
type: 'error',
});
this.setState({
isLoading: false,
});
setTimeout(() => {
this.setState({
isDisable: false,
});
}, logInterval);
return;
}
memberLogin(this);
setTimeout(() => {
this.setState({
isDisable: false,
});
}, loginInterval);
}, logInterval);
}
onLogout() {
this.setState({
isDisable: true,
});
memberLogout(this);
setTimeout(() => {
this.setState({
isDisable: false,
});
}, logInterval);
}
render(): ReactNode {
return (
return !wechatUser.getAccess() ? (
<AtForm onSubmit={this.onSubmit.bind(this)}>
<AtMessage />
<AtInput
@ -103,6 +101,10 @@ export default class MemberPage extends Component {
{pt.get().button.buttonText.login}
</AtButton>
</AtForm>
) : (
<AtButton type='primary' onClick={this.onLogout.bind(this)}>
{pt.get().button.buttonText.logout}
</AtButton>
);
}
}

View File

@ -1,8 +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 { reportMessage } from '@/service/report';
import { View } from '@tarojs/components';
import './report.scss';
const submitInterval = 5000;
@ -27,35 +28,21 @@ export default class ReportPage extends Component {
}
onSubmit() {
this.setState({
isLoading: true,
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',
});
if (this.state.report == '') {
Taro.atMessage({
message: pt.get().button.submitText.blank,
type: 'error',
});
this.setState({
isLoading: false,
});
setTimeout(() => {
this.setState({
isDisable: false,
});
}, submitInterval);
return;
}
reportMessage(this);
setTimeout(() => {
this.setState({
isDisable: false,
@ -69,29 +56,53 @@ export default class ReportPage extends Component {
}
render(): ReactNode {
return (
<AtForm
onSubmit={this.onSubmit.bind(this)}
onReset={this.onReset.bind(this)}
>
<AtMessage />
<AtTextarea
value={this.state.report}
onChange={this.handleChange.bind(this)}
maxLength={200}
placeholder={pt.get().reportPage.placeHolderText}
/>
<AtButton
loading={this.state.isLoading}
formType='submit'
type='primary'
disabled={this.state.isDisable}
<View style={{ marginTop: '30rpx', width: '94%', marginLeft: '3%' }}>
<AtForm
onSubmit={this.onSubmit.bind(this)}
onReset={this.onReset.bind(this)}
>
{pt.get().button.buttonText.submit}
</AtButton>
<AtButton formType='reset' type='secondary'>
{pt.get().button.buttonText.reset}
</AtButton>
</AtForm>
<AtMessage />
<AtTextarea
value={this.state.report}
onChange={this.handleChange.bind(this)}
maxLength={200}
placeholder={pt.get().reportPage.placeHolderText}
/>
<View className='at-row'>
<View
className='at-col'
style={{
marginTop: '30rpx',
marginRight: '10rpx',
marginLeft: '10rpx',
width: '50%',
}}
>
<AtButton formType='reset' type='secondary'>
{pt.get().button.buttonText.reset}
</AtButton>
</View>
<View
className='at-col'
style={{
marginTop: '30rpx',
marginRight: '10rpx',
marginLeft: '10rpx',
width: '50%',
}}
>
<AtButton
loading={this.state.isLoading}
formType='submit'
type='primary'
disabled={this.state.isDisable}
>
{pt.get().button.buttonText.submit}
</AtButton>
</View>
</View>
</AtForm>
</View>
);
}
}

View File

@ -11,7 +11,6 @@ import logo from '@/assets/images/UserPage/logo.png';
import { setLocaleData } from '@/service/localeData';
import './user.scss';
const listLangInterval = 20;
const memberClickTimes = 7;
export default class UserPage extends Component {
@ -24,14 +23,13 @@ export default class UserPage extends Component {
clicks: memberClickTimes,
isToastOpen: false,
toastText: '',
haveAccess: wechatUser.getAccess(),
};
// 以下是TabBar相关
pageCtx = Taro.getCurrentInstance().page;
componentDidShow() {
const tabbar = Taro.getTabBar<CustomTabBar>(this.pageCtx);
tabbar?.setSelected(this.state.haveAccess ? 3 : 2);
tabbar?.setSelected(wechatUser.getAccess() ? 3 : 2);
}
// 以上是TabBar相关
@ -105,11 +103,11 @@ export default class UserPage extends Component {
<View>
<View
className='at-row at-row__justify--center at-row__align--end'
style='height:110px;'
style='height:220rpx;'
>
<Image
onTap={this.onTapImage}
style='width: 100px;height: 100px;'
style='width: 200rpx;height: 200rpx;'
src={logo}
mode='aspectFit'
/>
@ -120,23 +118,29 @@ export default class UserPage extends Component {
></AtToast>
<View
className='at-row at-row__justify--center at-row__align--center'
style='height:60px;color:#696969;'
style='height:120rpx;color:#696969;'
>
<Text> EVA Notify v1.0.0</Text>
<Text style={{ fontSize: '32rpx' }}> EVA Notify v1.0.0</Text>
</View>
<AtList>
<AtListItem
title={pt.get().userPage.ticketColumn.title}
note={pt.get().userPage.ticketColumn.note}
arrow='right'
iconInfo={{ color: '#E69966', value: 'clock' }}
iconInfo={{
color: '#E69966',
value: 'clock',
}}
onClick={this.myTicketPage}
/>
<AtListItem
title={pt.get().userPage.infoColumn.title}
note={pt.get().userPage.infoColumn.note}
arrow='right'
iconInfo={{ color: '#78A4FA', value: 'user' }}
iconInfo={{
color: '#78A4FA',
value: 'user',
}}
onClick={this.informPage}
/>
<AtListItem
@ -144,7 +148,10 @@ export default class UserPage extends Component {
note={pt.get().userPage.reportColumn.note}
extraText=''
arrow='right'
iconInfo={{ color: '#9ACD32', value: 'message' }}
iconInfo={{
color: '#9ACD32',
value: 'message',
}}
onClick={this.reportPage}
/>
<AtListItem
@ -155,7 +162,7 @@ export default class UserPage extends Component {
thumb={aboutIcon}
onClick={this.aboutPage}
/>
<View style={{ height: listLangInterval }}></View>
<View style={{ height: '40rpx' }}></View>
<Picker
mode='selector'
range={this.state.selector}

View File

@ -3,15 +3,21 @@ export interface ButtonText {
submit: string;
reset: string;
login: string;
logout: string;
};
submitText: {
success: string;
error: string;
blank: string;
};
loginText: {
success: string;
error: string;
};
logoutText: {
success: string;
error: string;
};
}
export const buttonZhCn: ButtonText = {
@ -19,15 +25,21 @@ export const buttonZhCn: ButtonText = {
submit: '提交',
reset: '清空',
login: '登录',
logout: '登出',
},
submitText: {
success: '提交成功',
error: '提交失败:',
blank: '请填写完整!',
},
loginText: {
success: '登录成功',
error: '登录失败',
},
logoutText: {
success: '登出成功',
error: '登出失败',
},
};
export const buttonEnUs: ButtonText = {
@ -35,13 +47,19 @@ export const buttonEnUs: ButtonText = {
submit: 'Submit',
reset: 'Reset',
login: 'Login',
logout: 'Logout',
},
submitText: {
success: 'Success',
error: 'Error: ',
blank: 'Please fill in the blanks!',
},
loginText: {
success: 'Login Success',
error: 'Login Failed',
},
logoutText: {
success: 'Logout Success',
error: 'Logout Failed',
},
};

View File

@ -66,7 +66,7 @@ export const mainPageZhCn: MainPageText = {
{ title: '维修结束,取回电脑' },
],
tipsList: [
{ title: '戴尔/外星人、Surface、苹果电脑不能拆哦~' },
{ title: '戴尔/外星人、Surface、苹果电脑不能拆哦~' },
{ title: '数据无价,请随时做好数据备份哦~' },
{ title: '204 也是实验室,请勿在内饮食~' },
{ title: '我们是志愿服务,不收取任何礼物哦~' },

View File

@ -1,4 +1,10 @@
export interface MemberPageText {
mainTitleLine: string;
subTitleLine: string;
dutyCount: {
button: string;
text: string;
};
stuidText: {
title: string;
placeholder: string;
@ -7,9 +13,37 @@ export interface MemberPageText {
title: string;
placeholder: string;
};
uncompletedTicket: {
extra: string;
};
dutyCard: {
offDuty: {
title: string;
reason: (s: string) => string;
recoverTime: (t: string) => string;
};
inDuty: {
title: string;
currentDutyText: (c: 'off' | '1' | '2' | '3' | 'others') => string;
inDutyCnt: (n: number) => string;
};
};
expandTitle: {
stepInfo: string;
tipsInfo: string;
admin: string;
};
stepList: Array<{ title: string }>;
tipsList: Array<{ title: string }>;
}
export const memberPageZhCn: MemberPageText = {
mainTitleLine: '您好这里是E志者协会',
subTitleLine: '祝你满绩每一天',
dutyCount: {
button: '更新值班人数',
text: '当前值班人数:',
},
stuidText: {
title: '学号',
placeholder: '与统一身份认证学号一致',
@ -18,9 +52,60 @@ export const memberPageZhCn: MemberPageText = {
title: '密码',
placeholder: '与 EVA 统一身份认证一致',
},
uncompletedTicket: {
extra: '详细信息',
},
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';
case 'others':
return '其他值班时间,见通知';
}
},
inDutyCnt: (n) => '当前值班人数:' + n,
},
},
expandTitle: {
stepInfo: '查看维修步骤',
tipsInfo: '查看注意事项',
admin: '组长管理入口',
},
stepList: [
{ title: '机主线上填写工单,审核接取维修后加入 Oreo' },
{ title: '进行维修工作,认领工单,通过小程序与机主交流' },
{ title: '维修结束,清点机主物品,待机主取回' },
{ title: '机主取回机器确认无误后,修改工单状态' },
],
tipsList: [
{ title: '戴尔/外星人、Surface、苹果电脑不能拆机' },
{ title: '数据无价,请提醒机主随时做好数据备份' },
{ title: '离开 204 前清点好维修物资!' },
{ title: '螺丝上了吗?电源排线插了吗?' },
],
};
export const memberPageEnUs: MemberPageText = {
mainTitleLine: 'Hi! This is EVA.',
subTitleLine: 'Have a great day!',
dutyCount: {
button: 'Update Duty Count',
text: 'The duty count: ',
},
stuidText: {
title: 'Student ID',
placeholder: 'Consistent with EVA Auth',
@ -29,4 +114,52 @@ export const memberPageEnUs: MemberPageText = {
title: 'Password',
placeholder: 'Consistent with EVA Auth',
},
uncompletedTicket: {
extra: 'Details',
},
dutyCard: {
offDuty: {
title: 'Off Duty',
reason: (s) => 'Off duty reason: ' + s,
recoverTime: (t) => 'Resumption of duty: ' + t,
},
inDuty: {
title: 'On Duty',
currentDutyText: (c) => {
switch (c) {
case 'off':
return 'Currently not on duty';
case '1':
return '1st Shift 13:30-16:00';
case '2':
return '2nd Shift 16:00-18:00';
case '3':
return '3rd Shift 18:00-20:30';
case 'others':
return 'Other duty hours, see notice';
}
},
inDutyCnt: (n) => 'EVA members on duty: ' + n,
},
},
expandTitle: {
stepInfo: 'Check for maintenance steps',
tipsInfo: 'Check for tips',
admin: 'Entry for admin',
},
stepList: [
{ title: 'The owner fills out ticket online. Add it to Oreo after audit.' },
{ title: 'Repair, pick the ticket, and communicate with the owner online' },
{
title:
"Maintenance completed, inventory owner's belongings and await retrieving",
},
{ title: 'Modify the work order status after the owner retrieves.' },
],
tipsList: [
{ title: 'Dell/Alienware, Surface, Apple cannot be dissassembled.' },
{ title: 'Please remind the owner to backup data at any time!' },
{ title: '204 is a laboratory. Do not eat inside.' },
{ title: 'Are the screws on? Is the power cable plugged in?' },
],
};

View File

@ -0,0 +1,52 @@
export interface ModalText {
pick: {
title: string;
content: string;
};
addToOreo: {
title: string;
content: string;
};
retrieve: {
title: string;
content: string;
};
cancel: string;
confirm: string;
}
export const modalZhCn: ModalText = {
pick: {
title: '认领此工单',
content: '工单可多人认领!认领后将无法撤销!',
},
addToOreo: {
title: '将工单加入 Oreo',
content: '确认加入 Oreo加入后将无法撤回',
},
retrieve: {
title: '机器取回确认',
content: '确认该机器已取回?取回后工单完成,将无法添加评论!',
},
cancel: '取消',
confirm: '确认',
};
export const modalEnUs: ModalText = {
pick: {
title: 'Pick this ticket',
content:
'Tickets can be claimed by multiple members! Once claimed, it will not be able to be revoked!',
},
addToOreo: {
title: 'Add ticket to Oreo',
content: 'Once Confirmed, the change will be irrevocably!',
},
retrieve: {
title: 'Confirm the retrieving',
content:
'Once Confirmed, the ticket will be closed and cannot add any comment!',
},
cancel: 'Cancel',
confirm: 'Confirm',
};

View File

@ -3,9 +3,10 @@ export interface NavBarTitle {
user: {
myTicket: string;
report: string;
member: string;
memberLogin: string;
inform: string;
about: string;
member: string;
};
}
@ -16,7 +17,8 @@ export const navBarTitleZhCn: NavBarTitle = {
report: '意见反馈',
inform: '我的信息',
about: '关于我们',
member: '协会成员登录',
memberLogin: '协会成员登录',
member: '协会成员',
},
};
@ -27,6 +29,7 @@ export const navBarTitleEnUs: NavBarTitle = {
report: 'Report',
inform: 'Information',
about: 'About us',
member: 'Member login',
memberLogin: 'Member login',
member: 'Member Page',
},
};

View File

@ -50,7 +50,7 @@ export const repairPageZhCn: RepairPageText = {
errorMessage: '未获取到工单!',
title: '',
note: '',
extra: '',
extra: '详细信息',
},
typeText: {
computer: '电脑',
@ -74,7 +74,7 @@ export const repairPageZhCn: RepairPageText = {
},
descriptionText: {
title: '问题描述',
placeholder: '如:ZJUWLAN 无法登入校内网站',
placeholder: '如:无法登入校内网站',
},
checkboxText: {
none: '无附件',
@ -94,10 +94,10 @@ export const repairPageZhCn: RepairPageText = {
export const repairPageEnUs: RepairPageText = {
currentTicket: {
errorMessage: '未获取到工单!',
errorMessage: 'Cannot get the ticket!',
title: '',
note: '',
extra: '',
extra: 'Details',
},
typeText: {
computer: 'Computer',

View File

@ -2,7 +2,7 @@ interface StepItem {
title: string;
}
type StatusStr = '1' | '2' | '3' | '4' | '5';
type StatusStr = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7';
export interface TicketDetailText {
stepItems: Array<StepItem>;
@ -10,8 +10,32 @@ export interface TicketDetailText {
statusModifyPrefix: string;
statusModifyMessage: Map<StatusStr, string>;
descTitle: string;
divider: string;
info: {
title: string;
extra: string;
};
tookAway: string;
addToOreo: string;
addNote: string;
pick: string;
comment: {
title: string;
placeholder: string;
};
status: {
button: string;
title: string;
cancel: string;
status0: string;
status1: string;
status2: string;
status3: string;
status4: string;
status5: string;
status6: string;
status7: string;
};
}
export const ticketDetailZhCn: TicketDetailText = {
@ -22,17 +46,44 @@ export const ticketDetailZhCn: TicketDetailText = {
{ title: '工单完成' },
],
createTicketMessage: '创建了维修',
statusModifyPrefix: '将维修状态改为:',
statusModifyPrefix: '将维修状态改为:',
statusModifyMessage: new Map<StatusStr, string>([
['0', '已创建/交接中'],
['1', '维修中'],
['2', '2(?)'],
['3', '3(?)'],
['2', '劝退待取回'],
['3', '劝退已取回'],
['4', '维修成功待取回'],
['5', '维修成功已取回'],
['6', '维修翻车待取回'],
['7', '维修翻车已取回'],
]),
descTitle: '问题描述',
tookAway: '已取回',
divider: '评论 / 状态',
info: {
title: '机主姓名',
extra: '联系方式',
},
tookAway: '我已取回',
addToOreo: '加入 Oreo',
addNote: '添加评论',
pick: '认领',
comment: {
title: '添加评论',
placeholder: '可以在这里交流机器情况、维修进度、提出问题~',
},
status: {
button: '改变工单状态',
title: '请选择要改变成为的状态',
cancel: '取消',
status0: '已创建/交接中',
status1: '维修中',
status2: '劝退待取回',
status3: '劝退已取回',
status4: '维修成功待取回',
status5: '维修成功已取回',
status6: '维修翻车待取回',
status7: '维修翻车已取回',
},
};
export const ticketDetailEnUs: TicketDetailText = {
@ -45,13 +96,41 @@ export const ticketDetailEnUs: TicketDetailText = {
createTicketMessage: 'Created ticket',
statusModifyPrefix: 'Modified repair status to: ',
statusModifyMessage: new Map<StatusStr, string>([
['0', 'Created / Handovering'],
['1', 'Repairing'],
['2', '2(?)'],
['3', '3(?)'],
['4', 'Device to be retrieved'],
['5', 'Ticket finished'],
['2', 'Pending Retrieval (Refused)'],
['3', 'Retrieved (Refused)'],
['4', 'Pending Retrieval (Finished)'],
['5', 'Retrieved (Finished)'],
['6', 'Pending Retrieval (Failed)'],
['7', 'Retrieved (Failed)'],
]),
descTitle: 'Problem description',
descTitle: 'Description',
divider: 'Comment / Status',
info: {
title: 'Name',
extra: 'Contact',
},
tookAway: 'Already retrieved',
addNote: 'Add a comment',
addToOreo: 'Add to Oreo',
addNote: 'Comment',
pick: 'Pick',
comment: {
title: 'Add Comment',
placeholder:
'You can exchange information the device, the progress of repairs, and ask questions here.',
},
status: {
button: 'Modify Status',
title: 'Please select the status you want to modify to',
cancel: 'Cancel',
status0: 'Created / Handovering',
status1: 'Repairing',
status2: 'Pending Retrieval (Refused)',
status3: 'Retrieved (Refused)',
status4: 'Pending Retrieval (Finished)',
status5: 'Retrieved (Finished)',
status6: 'Pending Retrieval (Failed)',
status7: 'Retrieved (Failed)',
},
};

View File

@ -1,4 +1,4 @@
type FixStatus = 1 | 2 | 3 | 4 | 5;
import { FixStatus } from '@/common';
export interface TicketListText {
createdAt(time: string): string;
@ -10,11 +10,14 @@ export const ticketListZhCn: TicketListText = {
return '创建于' + ' ' + time;
},
statusMap: new Map([
[1, '创建成功'],
[2, '维修中'],
[3, '待取回'],
[4, '已取回'],
[5, '已取回'],
[0, '已创建/交接中'],
[1, '维修中'],
[2, '劝退待取回'],
[3, '劝退已取回'],
[4, '维修成功待取回'],
[5, '维修成功已取回'],
[6, '维修翻车待取回'],
[7, '维修翻车已取回'],
]),
};
@ -23,10 +26,13 @@ export const ticketListEnUs: TicketListText = {
return 'Created at' + ' ' + time;
},
statusMap: new Map([
[1, 'Created'],
[2, 'Repairing'],
[3, 'Pending Retrieval'],
[4, 'Retrieved'],
[5, 'Retrieved'],
[0, 'Created / Handovering'],
[1, 'Repairing'],
[2, 'Pending Retrieval (Refused)'],
[3, 'Retrieved (Refused)'],
[4, 'Pending Retrieval (Finished)'],
[5, 'Retrieved (Finished)'],
[6, 'Pending Retrieval (Failed)'],
[7, 'Retrieved (Failed)'],
]),
};

View File

@ -0,0 +1,25 @@
export interface TipsText {
tipsText: Array<string>;
}
export const tipsZhCn: TipsText = {
tipsText: [
'提示:请在 20:30 之前取走自己的物品哦!',
'提示:戴尔/外星人、Surface、苹果电脑不能拆机哦~',
'提示:数据无价,请随时做好数据备份哦~',
'提示204 也是实验室,请勿在内饮食~',
'提示:我们是志愿服务,不收取任何礼物哦~',
'提示无论是有关于小程序的建议还是关于E志者协会的建议都可以在【意见反馈】处提出来哦',
],
};
export const tipsEnUs: TipsText = {
tipsText: [
'Tips: Please retrieve your devices before 20:30!',
'Tips: Dell/Alienware, Surface, Apple cannot be dissassembled.',
'Tips: Data is priceless, please backup your data at any time!',
'Tips: 204 is also a laboratory. Do not eat inside.',
'Tips: We are volunteers and do not take any gifts.',
'Tips: Feel free to post your suggestions about the weapp or about us at [Account-Report]!',
],
};

View File

@ -16,6 +16,8 @@ import {
ticketDetailZhCn,
} from './TicketDetail';
import { CommonText, commonTextEnUs, commonTextZhCn } from './common';
import { TipsText, tipsEnUs, tipsZhCn } from './Tips';
import { ModalText, modalEnUs, modalZhCn } from './Modal';
interface TextRecord {
common: CommonText;
@ -32,6 +34,8 @@ interface TextRecord {
navBar: NavBarTitle;
repairPage: RepairPageText;
ticketDetail: TicketDetailText;
tips: TipsText;
modal: ModalText;
}
const textZhCn: TextRecord = {
@ -49,6 +53,8 @@ const textZhCn: TextRecord = {
navBar: navBarTitleZhCn,
repairPage: repairPageZhCn,
ticketDetail: ticketDetailZhCn,
tips: tipsZhCn,
modal: modalZhCn,
};
const textEnUs: TextRecord = {
@ -66,6 +72,8 @@ const textEnUs: TextRecord = {
navBar: navBarTitleEnUs,
repairPage: repairPageEnUs,
ticketDetail: ticketDetailEnUs,
tips: tipsEnUs,
modal: modalEnUs,
};
// type Lang = 'zh_CN' | 'en_US' | ...;

View File

@ -0,0 +1,38 @@
import TicketDetail from '@/pages/TicketDetail/TicketDetail';
import Taro from '@tarojs/taro';
import pt from '@/plain-text';
import { getUrl } from '.';
export function addToOreo(that: TicketDetail) {
that.setState({
isOreoLoading: true,
});
Taro.request({
url: getUrl('/tickets/addtooreo'),
method: 'POST',
data: {
token: 'token_test',
id: that.state.id,
},
})
.then((res) => {
console.log(res.data);
that.setState({
isOreoLoading: false,
});
Taro.atMessage({
message: pt.get().button.submitText.success,
type: 'success',
});
})
.catch((err) => {
console.log(err);
that.setState({
isOreoLoading: false,
});
Taro.atMessage({
message: pt.get().button.submitText.error + err.toString(),
type: 'error',
});
});
}

View File

@ -0,0 +1,45 @@
import MemberPage from '@/pages/member/member';
import Taro from '@tarojs/taro';
import pt from '@/plain-text';
import { getUrl } from '.';
const reLaunchInterval = 1000;
export function changeDutyCnt(that: MemberPage) {
that.setState({
isLoading: true,
});
Taro.request({
url: getUrl('/tickets/addtooreo'),
method: 'POST',
data: {
token: 'token_test',
dutyCnt: that.state.inDutyCnt,
},
})
.then((res) => {
console.log(res.data);
that.setState({
isLoading: false,
});
Taro.atMessage({
message: pt.get().button.submitText.success,
type: 'success',
});
setTimeout(() => {
Taro.reLaunch({
url: '/pages/member/member',
});
}, reLaunchInterval);
})
.catch((err) => {
console.log(err);
that.setState({
isLoading: false,
});
Taro.atMessage({
message: pt.get().button.submitText.error + err.toString(),
type: 'error',
});
});
}

View File

@ -0,0 +1,46 @@
import TicketDetail from '@/pages/TicketDetail/TicketDetail';
import Taro from '@tarojs/taro';
import pt from '@/plain-text';
import { getUrl } from '.';
const reLaunchInterval = 1000;
export function changeStatus(that: TicketDetail, status: number) {
that.setState({
isStatusLoading: true,
});
Taro.request({
url: getUrl('/tickets/update'),
method: 'POST',
data: {
token: 'token_test',
id: that.state.id,
status: status,
},
})
.then((res) => {
console.log(res.data);
that.setState({
isStatusLoading: false,
});
Taro.atMessage({
message: pt.get().button.submitText.success,
type: 'success',
});
setTimeout(() => {
Taro.reLaunch({
url: '/pages/TicketDetail/TicketDetail?id=' + that.state.id,
});
}, reLaunchInterval);
})
.catch((err) => {
console.log(err);
that.setState({
isStatusLoading: false,
});
Taro.atMessage({
message: pt.get().button.submitText.error + err.toString(),
type: 'error',
});
});
}

View File

@ -2,10 +2,9 @@ import RepairPage from '@/pages/repair/repair';
import Taro from '@tarojs/taro';
import { TicketListItem } from '@/components/TicketListItem/TicketListItem';
import pt from '@/plain-text';
import DetailFramework from '@/components/DetailFramework/DetailFramework';
import { getUrl } from '.';
export function getCurrentTicket(that: RepairPage, middleButton, isInfoShow) {
export function getCurrentTicket(that: RepairPage) {
Taro.request({
url: getUrl('/user/mytickets'),
method: 'GET',
@ -15,14 +14,22 @@ export function getCurrentTicket(that: RepairPage, middleButton, isInfoShow) {
})
.then((res) => {
const data = res.data.data;
let newIdList: Array<number> = [];
let newIdNameList: Array<Map<number, string>> = [];
data.list.map((ticket: TicketListItem) => {
if (ticket['status'] !== 5) {
newIdList.push(ticket.id);
if (
ticket['status'] !== 3 &&
ticket['status'] !== 5 &&
ticket['status'] !== 7
) {
newIdNameList.push(
new Map([
[ticket['id'], ticket['device'] + ' ' + ticket['deviceModel']],
]),
);
}
});
that.setState({
currentTicketsId: newIdList,
currentTicketsIdName: newIdNameList,
});
})
.catch((err) => {

View File

@ -4,7 +4,7 @@ import { getUrl } from '.';
export function getDutyInfo(that: MainPage) {
Taro.request({
url: getUrl('/dutyinfo'),
url: getUrl('/duty/info'),
method: 'GET',
data: {
token: 'token_test',

View File

@ -0,0 +1,44 @@
import MemberPage from '@/pages/member/member';
import Taro from '@tarojs/taro';
import { getUrl } from '.';
export function getMemberDutyInfo(that: MemberPage) {
Taro.request({
url: getUrl('/member/duty/info'),
method: 'GET',
data: {
token: 'token_test',
},
})
.then((res) => {
const data = res.data.data;
if (data.isInDuty) {
that.setState({
dutyData: {
isInDuty: data.isInDuty,
inDutyCnt: data.inDutyCnt,
currentDuty: data.currentDuty,
},
inDutyCnt: data.inDutyCnt,
});
} else {
that.setState({
dutyData: {
isInDuty: data.isInDuty,
offDutyReason: data.offDutyReason,
dutyRecoverTime: data.dutyRecoverTime,
},
});
}
})
.catch((err) => {
console.log(err);
that.setState({
dutyData: {
isInDuty: false,
offDutyReason: '获取失败Network Error!',
dutyRecoverTime: '获取失败Network Error!',
},
});
});
}

View File

@ -0,0 +1,81 @@
import UserMemberPage from '@/pages/user/member/member';
import Taro from '@tarojs/taro';
import pt from '@/plain-text';
import wechatUser from '@/wechat';
import { getUrl } from '.';
export function memberLogin(that: UserMemberPage) {
that.setState({
isLoading: true,
});
Taro.request({
url: getUrl('/member/login'),
method: 'POST',
data: {
token: 'token_test',
name: that.state.stuid,
phone: that.state.passwd,
},
})
.then((res) => {
console.log(res.data);
that.setState({
isLoading: false,
});
Taro.atMessage({
message: pt.get().button.loginText.success,
type: 'success',
});
wechatUser.setAccess(true);
Taro.reLaunch({
url: '/pages/member/member',
});
})
.catch((err) => {
console.log(err);
that.setState({
isLoading: false,
});
Taro.atMessage({
message: pt.get().button.loginText.error + err.toString(),
type: 'error',
});
});
}
export function memberLogout(that: UserMemberPage) {
that.setState({
isLoading: true,
});
Taro.request({
url: getUrl('/member/logout'),
method: 'POST',
data: {
token: 'token_test',
},
})
.then((res) => {
console.log(res.data);
that.setState({
isLoading: false,
});
Taro.atMessage({
message: pt.get().button.logoutText.success,
type: 'success',
});
wechatUser.setAccess(false);
Taro.reLaunch({
url: '/pages/index/index',
});
})
.catch((err) => {
console.log(err);
that.setState({
isLoading: false,
});
Taro.atMessage({
message: pt.get().button.logoutText.error + err.toString(),
type: 'error',
});
});
}

View File

@ -2,6 +2,7 @@ import MyTicketPage from '@/pages/user/myTicket/myTicket';
import { TicketListItem } from '@/components/TicketListItem/TicketListItem';
import Taro from '@tarojs/taro';
import moment from 'moment';
import { FixStatus } from '@/common';
import { getUrl } from '.';
export function getMyTicketList(that: MyTicketPage) {
@ -23,13 +24,19 @@ export function getMyTicketList(that: MyTicketPage) {
that.setState({
rs: former.trans(true),
fixList: res.data.data.list.map(
(item) =>
(item: {
id: number;
device: string;
deviceModel: string;
status: FixStatus;
createdTime: moment.MomentInput;
}) =>
new TicketListItem(
item.id,
item.device,
item.deviceModel,
item.status,
moment(),
moment(item.createdTime),
),
),
});

View File

@ -0,0 +1,45 @@
import TicketDetail from '@/pages/TicketDetail/TicketDetail';
import Taro from '@tarojs/taro';
import pt from '@/plain-text';
import { getUrl } from '.';
const reLaunchInterval = 1000;
export function pickTicket(that: TicketDetail) {
that.setState({
isPickLoading: true,
});
Taro.request({
url: getUrl('/tickets/pick'),
method: 'POST',
data: {
token: 'token_test',
id: that.state.id,
},
})
.then((res) => {
console.log(res.data);
that.setState({
isPickLoading: false,
});
Taro.atMessage({
message: pt.get().button.submitText.success,
type: 'success',
});
setTimeout(() => {
Taro.reLaunch({
url: '/pages/TicketDetail/TicketDetail?id=' + that.state.id,
});
}, reLaunchInterval);
})
.catch((err) => {
console.log(err);
that.setState({
isPickLoading: false,
});
Taro.atMessage({
message: pt.get().button.submitText.error + err.toString(),
type: 'error',
});
});
}

View File

@ -0,0 +1,38 @@
import ReportPage from '@/pages/user/report/report';
import Taro from '@tarojs/taro';
import pt from '@/plain-text';
import { getUrl } from '.';
export function reportMessage(that: ReportPage) {
that.setState({
isLoading: true,
});
Taro.request({
url: getUrl('/report'),
method: 'POST',
data: {
token: 'token_test',
report: that.state.report,
},
})
.then((res) => {
console.log(res.data);
that.setState({
isLoading: false,
});
Taro.atMessage({
message: pt.get().button.submitText.success,
type: 'success',
});
})
.catch((err) => {
console.log(err);
that.setState({
isLoading: false,
});
Taro.atMessage({
message: pt.get().button.submitText.error + err.toString(),
type: 'error',
});
});
}

View File

@ -0,0 +1,45 @@
import TicketDetail from '@/pages/TicketDetail/TicketDetail';
import Taro from '@tarojs/taro';
import pt from '@/plain-text';
import { getUrl } from '.';
const reLaunchInterval = 1000;
export function retrieve(that: TicketDetail) {
that.setState({
isRetrieveLoading: true,
});
Taro.request({
url: getUrl('/tickets/retrieve'),
method: 'POST',
data: {
token: 'token_test',
id: that.state.id,
},
})
.then((res) => {
console.log(res.data);
that.setState({
isRetrieveLoading: false,
});
Taro.atMessage({
message: pt.get().button.submitText.success,
type: 'success',
});
setTimeout(() => {
Taro.reLaunch({
url: '/pages/TicketDetail/TicketDetail?id=' + that.state.id,
});
}, reLaunchInterval);
})
.catch((err) => {
console.log(err);
that.setState({
isRetrieveLoading: false,
});
Taro.atMessage({
message: pt.get().button.submitText.error + err.toString(),
type: 'error',
});
});
}

View File

@ -0,0 +1,45 @@
import TicketDetail from '@/pages/TicketDetail/TicketDetail';
import Taro from '@tarojs/taro';
import pt from '@/plain-text';
import { getUrl } from '.';
const reLaunchInterval = 1000;
export function submitComment(that: TicketDetail) {
that.setState({
isCommentLoading: true,
});
Taro.request({
url: getUrl('/report'),
method: 'POST',
data: {
token: 'token_test',
comment: that.state.comment,
},
})
.then((res) => {
console.log(res.data);
that.setState({
isCommentLoading: false,
});
Taro.atMessage({
message: pt.get().button.submitText.success,
type: 'success',
});
setTimeout(() => {
Taro.reLaunch({
url: '/pages/TicketDetail/TicketDetail?id=' + that.state.id,
});
}, reLaunchInterval);
})
.catch((err) => {
console.log(err);
that.setState({
isCommentLoading: false,
});
Taro.atMessage({
message: pt.get().button.submitText.error + err.toString(),
type: 'error',
});
});
}

View File

@ -3,6 +3,8 @@ import Taro from '@tarojs/taro';
import pt from '@/plain-text';
import { getUrl } from '.';
const relaunchInterval = 1000;
export function submitTicket(that: RepairPage) {
that.setState({
isLoading: true,
@ -30,6 +32,11 @@ export function submitTicket(that: RepairPage) {
message: pt.get().button.submitText.success,
type: 'success',
});
setTimeout(() => {
Taro.reLaunch({
url: '/pages/repair/repair',
});
}, relaunchInterval);
})
.catch((err) => {
console.log(err);

View File

@ -28,6 +28,10 @@ export function getTicketInfo(that: DetailFramework, id: number) {
description: data.description,
createdTime: moment(data.createdTime as string),
status: data.status,
info: {
phone: data.phone,
name: data.owner,
},
};
const notes: Array<TicketNote> = [];
data.notes.map((item) => {

View File

@ -0,0 +1,44 @@
import MemberPage from '@/pages/member/member';
import Taro from '@tarojs/taro';
import { TicketListItem } from '@/components/TicketListItem/TicketListItem';
import moment from 'moment';
import { getUrl } from '.';
export function getUncompletedTicketList(that: MemberPage) {
Taro.request({
url: getUrl('/tickets/uncompleted'),
method: 'GET',
data: {
token: 'token_test',
},
})
.then((res) => {
let former = that.state.rs;
if (!res.data.success) {
that.setState({
rs: former.trans(false),
});
return;
}
that.setState({
rs: former.trans(true),
fixList: res.data.data.list.map(
(item) =>
new TicketListItem(
item.id,
item.device,
item.deviceModel,
item.status,
moment(item.createdTime),
),
),
});
})
.catch((reason) => {
let former = that.state.rs;
that.setState({
rs: former.trans(false),
});
console.log(reason);
});
}

View File

@ -0,0 +1,3 @@
export const randomInt = (floor: number, ceiling: number) => {
return Math.floor(Math.random() * (ceiling - floor + 1) + floor);
};

View File

@ -6,7 +6,7 @@ class WechatUser {
constructor() {
this.userInfo = '';
this.hasUserInfo = false;
this.isMember = true;
this.isMember = false;
}
getAccess() {