Compare commits
No commits in common. "24f71ed997f0ef1c1fceef75bde8c32c4cffa6e2" and "d705970d1ffb4583498c2d3906437c44ebca2c8a" have entirely different histories.
24f71ed997
...
d705970d1f
64
doc/api.md
64
doc/api.md
|
|
@ -44,8 +44,7 @@ data:
|
|||
{
|
||||
"isInDuty": true,
|
||||
"inDutyCnt": 3,
|
||||
"currentDuty": "2",
|
||||
"place": "东三-204"
|
||||
"currentDuty": "2"
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -61,44 +60,6 @@ data:
|
|||
}
|
||||
```
|
||||
|
||||
## 账号登陆
|
||||
|
||||
### 微信小程序登陆 `POST /login` OK
|
||||
|
||||
- Request
|
||||
|
||||
```json
|
||||
{
|
||||
"code": "wechat_login_code"
|
||||
}
|
||||
```
|
||||
|
||||
- Response
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"token": "your_token"
|
||||
}
|
||||
```
|
||||
|
||||
### 检查 token 是否登陆 `GET /checklogin?token={token}` OK
|
||||
|
||||
```json
|
||||
{
|
||||
"islogin": true
|
||||
}
|
||||
```
|
||||
|
||||
- Response
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"token": "your_token"
|
||||
}
|
||||
```
|
||||
|
||||
## 用户页面
|
||||
|
||||
### 个人信息 `GET /user/info`
|
||||
|
|
@ -180,6 +141,17 @@ data (same as oreo):
|
|||
|
||||
## 工单详情
|
||||
|
||||
### 创建评论 `POST /tickets/newcomment?id={id}`
|
||||
|
||||
Request
|
||||
|
||||
```json
|
||||
{
|
||||
"content": "这是一条评论",
|
||||
"token": "token_test"
|
||||
}
|
||||
```
|
||||
|
||||
### 创建工单 `POST /tickets/create`
|
||||
|
||||
Request
|
||||
|
|
@ -334,18 +306,6 @@ Request
|
|||
}
|
||||
```
|
||||
|
||||
### 检查 token 是否登陆 `GET /member/checklogin?token={token}` OK
|
||||
|
||||
data
|
||||
|
||||
```json
|
||||
{
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
|
||||
"name": "宇航员",
|
||||
"phone": "13311451419",
|
||||
}
|
||||
```
|
||||
|
||||
### 成员登出 `POST /member/logout`
|
||||
|
||||
Request
|
||||
|
|
|
|||
37
mock/api.ts
37
mock/api.ts
|
|
@ -10,7 +10,6 @@ export default {
|
|||
isInDuty: true,
|
||||
inDutyCnt: 3,
|
||||
currentDuty: '2',
|
||||
place: '204',
|
||||
},
|
||||
},
|
||||
'GET /user/info': {
|
||||
|
|
@ -22,7 +21,6 @@ export default {
|
|||
},
|
||||
},
|
||||
'POST /user/update': {
|
||||
success: true,
|
||||
data: {},
|
||||
},
|
||||
'GET /user/locale/get': {
|
||||
|
|
@ -32,11 +30,9 @@ export default {
|
|||
},
|
||||
},
|
||||
'POST /user/locale/update': {
|
||||
success: true,
|
||||
data: {},
|
||||
},
|
||||
'POST /report': {
|
||||
success: true,
|
||||
data: {},
|
||||
},
|
||||
'GET /user/mytickets': {
|
||||
|
|
@ -48,36 +44,27 @@ export default {
|
|||
data: ticketInfo,
|
||||
},
|
||||
'POST /tickets/addnote': {
|
||||
success: true,
|
||||
data: {},
|
||||
},
|
||||
'POST /tickets/create': {
|
||||
success: true,
|
||||
data: {},
|
||||
},
|
||||
'POST /tickets/addtooreo': {
|
||||
success: true,
|
||||
data: {},
|
||||
},
|
||||
'POST /tickets/pick': {
|
||||
success: true,
|
||||
data: {},
|
||||
},
|
||||
'POST /tickets/update': {
|
||||
success: true,
|
||||
data: {},
|
||||
},
|
||||
'POST /tickets/retrieve': {
|
||||
success: true,
|
||||
data: {},
|
||||
},
|
||||
'POST /member/login': {
|
||||
success: true,
|
||||
data: {
|
||||
avatar:
|
||||
'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png',
|
||||
name: '宇航员',
|
||||
phone: '13311451419',
|
||||
isMember: true,
|
||||
},
|
||||
},
|
||||
'GET /tickets/uncompleted': {
|
||||
|
|
@ -87,15 +74,6 @@ export default {
|
|||
'POST /member/logout': {
|
||||
success: true,
|
||||
},
|
||||
'POST /member/checklogin': {
|
||||
success: true,
|
||||
data: {
|
||||
avatar:
|
||||
'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png',
|
||||
name: '宇航员',
|
||||
phone: '13311451419',
|
||||
},
|
||||
},
|
||||
'GET /member/duty/info': {
|
||||
success: true,
|
||||
data: {
|
||||
|
|
@ -103,19 +81,6 @@ export default {
|
|||
isInDuty: true,
|
||||
inDutyCnt: 6,
|
||||
currentDuty: '3',
|
||||
place: '204',
|
||||
},
|
||||
},
|
||||
'POST /login': {
|
||||
success: true,
|
||||
data: {
|
||||
token: '__token_test_zjueva1984__',
|
||||
},
|
||||
},
|
||||
'GET /checklogin': {
|
||||
success: true,
|
||||
data: {
|
||||
islogin: false,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@
|
|||
"owner": "唐姐姐",
|
||||
"phone": "15555555555",
|
||||
"description": "清灰",
|
||||
"workers": ["宇航员"],
|
||||
"workers": [],
|
||||
"createdTime": "2024-03-07T19:52:48.523303",
|
||||
"status": 5,
|
||||
"status": 2,
|
||||
"isConfirmed": false,
|
||||
"notes": [
|
||||
{
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
|
||||
"avatar": "https://....jpg",
|
||||
"id": 21368,
|
||||
"op": "宇航员",
|
||||
"type": 0,
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
"createdTime": "2024-03-07T19:52:48.523305"
|
||||
},
|
||||
{
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
|
||||
"avatar": "https://....jpg",
|
||||
"id": 21370,
|
||||
"op": "宇航员",
|
||||
"type": 2,
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
"createdTime": "2024-03-07T19:58:27.838816"
|
||||
},
|
||||
{
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
|
||||
"avatar": "https://....jpg",
|
||||
"id": 21373,
|
||||
"op": "宇航员",
|
||||
"type": 2,
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
"createdTime": "2024-03-07T20:28:12.070707"
|
||||
},
|
||||
{
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
|
||||
"avatar": "https://....jpg",
|
||||
"id": 21374,
|
||||
"op": "宇航员",
|
||||
"type": 2,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ export default defineAppConfig({
|
|||
pages: [
|
||||
'pages/index/index',
|
||||
'pages/repair/repair',
|
||||
'pages/member/member',
|
||||
'pages/user/user',
|
||||
'pages/user/myTicket/myTicket',
|
||||
'pages/user/inform/inform',
|
||||
|
|
@ -27,6 +28,10 @@ export default defineAppConfig({
|
|||
pagePath: 'pages/repair/repair',
|
||||
text: '维修',
|
||||
},
|
||||
{
|
||||
pagePath: 'pages/member/member',
|
||||
text: '管理',
|
||||
},
|
||||
{
|
||||
pagePath: 'pages/user/user',
|
||||
text: '我的',
|
||||
|
|
|
|||
20
src/app.ts
20
src/app.ts
|
|
@ -2,28 +2,12 @@ import { PropsWithChildren } from 'react';
|
|||
import { useLaunch } from '@tarojs/taro';
|
||||
import 'taro-ui/dist/style/index.scss';
|
||||
import './app.scss';
|
||||
import { checkLogin, checkToken } from './service/checkLogin';
|
||||
import wechatUser from './wechat';
|
||||
import { loginAte } from './service/login';
|
||||
import { getInfo } from './service/getInfo';
|
||||
import { getLocaleData } from './service/localeData';
|
||||
|
||||
function App({ children }: PropsWithChildren<any>) {
|
||||
useLaunch(() => {
|
||||
console.log('App launched.');
|
||||
// if (checkLogin()) {
|
||||
// wechatUser.setToken(checkToken());
|
||||
// if(getMemberInfo());
|
||||
// } else {
|
||||
// loginAte();
|
||||
// }
|
||||
checkLogin((success) => {
|
||||
if (success) {
|
||||
wechatUser.setToken(checkToken());
|
||||
getInfo();
|
||||
} else {
|
||||
loginAte();
|
||||
}
|
||||
});
|
||||
getLocaleData();
|
||||
});
|
||||
|
||||
// children 是将要会渲染的页面
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 710 B After Width: | Height: | Size: 710 B |
|
|
@ -1 +0,0 @@
|
|||
<?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="1710991023487" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12657" xmlns:xlink="http://www.w3.org/1999/xlink" width="24" height="24"><path d="M512 42.666667q95.658667 0 182.485333 37.162667t149.674667 100.010667 100.010667 149.674667 37.162667 182.485333-37.162667 182.485333-100.010667 149.674667-149.674667 100.010667-182.485333 37.162667-182.485333-37.162667-149.674667-100.010667-100.010667-149.674667-37.162667-182.485333 37.162667-182.485333 100.010667-149.674667 149.674667-100.010667 182.485333-37.162667zM512 128q-77.994667 0-149.162667 30.506667t-122.496 81.834667-81.834667 122.496-30.506667 149.162667 30.506667 149.162667 81.834667 122.496 122.496 81.834667 149.162667 30.506667 149.162667-30.506667 122.496-81.834667 81.834667-122.496 30.506667-149.162667-30.506667-149.162667-81.834667-122.496-122.496-81.834667-149.162667-30.506667zM512 213.333333q17.664 0 30.165333 12.501333t12.501333 30.165333l0 238.336 115.669333 115.328q12.330667 12.330667 12.330667 30.336t-12.330667 30.336-30.336 12.330667-30.336-12.330667l-128-128q-12.330667-12.330667-12.330667-30.336l0-256q0-17.664 12.501333-30.165333t30.165333-12.501333z" fill="#E69966" p-id="12658"></path></svg>
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
|
|
@ -1 +0,0 @@
|
|||
<?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="1710991348108" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="26534" xmlns:xlink="http://www.w3.org/1999/xlink" width="24" height="24"><path d="M512 512m-48 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0Z" p-id="26535" fill="#9ACD32"></path><path d="M712 512m-48 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0Z" p-id="26536" fill="#9ACD32"></path><path d="M312 512m-48 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0Z" p-id="26537" fill="#9ACD32"></path><path d="M925.2 338.4c-22.6-53.7-55-101.9-96.3-143.3-41.3-41.3-89.5-73.8-143.3-96.3C630.6 75.7 572.2 64 512 64h-2c-60.6 0.3-119.3 12.3-174.5 35.9-53.3 22.8-101.1 55.2-142 96.5-40.9 41.3-73 89.3-95.2 142.8-23 55.4-34.6 114.3-34.3 174.9 0.3 69.4 16.9 138.3 48 199.9v152c0 25.4 20.6 46 46 46h152.1c61.6 31.1 130.5 47.7 199.9 48h2.1c59.9 0 118-11.6 172.7-34.3 53.5-22.3 101.6-54.3 142.8-95.2 41.3-40.9 73.8-88.7 96.5-142 23.6-55.2 35.6-113.9 35.9-174.5 0.3-60.9-11.5-120-34.8-175.6z m-151.1 438C704 845.8 611 884 512 884h-1.7c-60.3-0.3-120.2-15.3-173.1-43.5l-8.4-4.5H188V695.2l-4.5-8.4C155.3 633.9 140.3 574 140 513.7c-0.4-99.7 37.7-193.3 107.6-263.8 69.8-70.5 163.1-109.5 262.8-109.9h1.7c50 0 98.5 9.7 144.2 28.9 44.6 18.7 84.6 45.6 119 80 34.3 34.3 61.3 74.4 80 119 19.4 46.2 29.1 95.2 28.9 145.8-0.6 99.6-39.7 192.9-110.1 262.7z" p-id="26538" fill="#9ACD32"></path></svg>
|
||||
|
Before Width: | Height: | Size: 1.4 KiB |
|
|
@ -1 +0,0 @@
|
|||
<?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="1710990953433" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11565" xmlns:xlink="http://www.w3.org/1999/xlink" width="24" height="24"><path d="M510 64.4c-246.5 0-447.6 200-447.6 447.6 0 246.5 200 447.6 447.6 447.6 246.5 0 447.6-200 447.6-447.6 0-246.5-200.1-447.6-447.6-447.6z m0 831.9c-212.3 0-384.3-172-384.3-384.3s172-384.3 384.3-384.3 384.3 172 384.3 384.3-172 384.3-384.3 384.3z m229.1-181.2c-18.4-70.4-67.9-125.5-131.2-153.6 48-30.6 79.6-84.2 79.6-144.9 0-94.9-77.1-172-172-172s-172 77.1-172 172c0 61.2 31.6 114.8 79.6 144.9-63.8 27.6-113.3 83.2-131.7 153.6-4.1 16.3 5.6 33.2 21.9 37.3 2.6 0.5 5.1 1 7.7 1 13.8 0 26-9.2 29.6-23 19.4-75 87.3-127.1 164.3-127.1S660 655.4 679.4 730.4c4.1 16.3 20.9 26 37.3 21.9 16.8-4 27-20.9 22.4-37.2zM515.6 305.8c61.2 0 110.7 49.5 110.7 110.7s-49.5 110.7-110.7 110.7-110.7-49.5-110.7-110.7 49.5-110.7 110.7-110.7z" p-id="11566" fill="#78A4FA"></path></svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
|
|
@ -1,10 +1,5 @@
|
|||
export type FixStatus = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
||||
|
||||
export const defaultAvatar =
|
||||
'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png';
|
||||
|
||||
export const tmplIds = ['hbblqs928F2kd1s0IR_pDIAjYrNscUmz6tv6NZKsctM'];
|
||||
|
||||
export type Info = {
|
||||
phone: string;
|
||||
name: string;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import {
|
|||
import pt from '@/plain-text';
|
||||
import { RequestState } from '@/service';
|
||||
import { getTicketInfo } from '@/service/ticketsInfo';
|
||||
import { FixStatus } from '@/common';
|
||||
import { AtCard, AtSteps } from 'taro-ui';
|
||||
import NoteList from '../NoteList/NoteList';
|
||||
|
||||
|
|
@ -16,6 +17,14 @@ interface StepItemData {
|
|||
title: string;
|
||||
}
|
||||
|
||||
const mapStatusStep: Map<FixStatus, 0 | 1 | 2 | 3> = new Map([
|
||||
[1, 0],
|
||||
[2, 1],
|
||||
[3, 2],
|
||||
[4, 2],
|
||||
[5, 3],
|
||||
]);
|
||||
|
||||
interface DetailFrameworkState {
|
||||
current: number;
|
||||
items: Array<StepItemData>;
|
||||
|
|
@ -48,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> = {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Image, View } from '@tarojs/components';
|
||||
import { View } from '@tarojs/components';
|
||||
import { Component, ReactNode } from 'react';
|
||||
import { TicketNote, StatusStr } from '@/pages/TicketDetail/TicketNote';
|
||||
import pt from '@/plain-text';
|
||||
|
|
@ -35,25 +35,13 @@ export default class NoteCard extends Component<NoteCardProps, {}> {
|
|||
}
|
||||
|
||||
return (
|
||||
<View className='at-row at-row__align--center'>
|
||||
<View className='at-col at-col-1 at-col--auto'>
|
||||
<Image
|
||||
style='width: 70rpx; height: 70rpx; border-radius: 35px;'
|
||||
src={note.avatar}
|
||||
mode='aspectFit'
|
||||
/>
|
||||
</View>
|
||||
<View
|
||||
className='at-col'
|
||||
style={{ marginTop: '40rpx', marginBottom: '40rpx' }}
|
||||
>
|
||||
<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__h3'>{message}</View>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export default class NoteList extends Component<NoteListProps, {}> {
|
|||
<AtDivider
|
||||
fontColor='#CCC'
|
||||
content={pt.get().ticketDetail.divider}
|
||||
height={20}
|
||||
height='80rpx'
|
||||
/>
|
||||
{this.props.noteList.map((note, idx) => (
|
||||
<View key={idx}>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,26 @@ import 'taro-ui/dist/style/index.scss';
|
|||
import './index.scss';
|
||||
|
||||
const navList: () => Array<Taro.TabBarItem> = () => {
|
||||
return [
|
||||
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,
|
||||
|
|
@ -27,13 +46,17 @@ const tabList = () => {
|
|||
return wechatUser.getAccess()
|
||||
? [
|
||||
{
|
||||
title: pt.get().tabBar.memberText,
|
||||
iconType: 'sketch',
|
||||
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',
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import { addToOreo } from '@/service/addToOreo';
|
|||
import { pickTicket } from '@/service/pickTicket';
|
||||
import { retrieve } from '@/service/retrieve';
|
||||
import { changeStatus } from '@/service/changeStatus';
|
||||
import { getDisable } from '@/service/getDisable';
|
||||
|
||||
const submitInterval = 5000;
|
||||
|
||||
|
|
@ -36,18 +35,14 @@ interface TicketDetailState {
|
|||
comment: string;
|
||||
isOreoLoading: boolean;
|
||||
isOreoDisable: boolean;
|
||||
isOreoDisable_main: boolean;
|
||||
isPickLoading: boolean;
|
||||
isPickDisable: boolean;
|
||||
isPickDisable_main: boolean;
|
||||
isRetrieveLoading: boolean;
|
||||
isRetrieveDisable: boolean;
|
||||
isRetrieveDisable_main: boolean;
|
||||
isStatusLoading: boolean;
|
||||
isStatusDisable: boolean;
|
||||
isCommentLoading: boolean;
|
||||
isCommentDisable: boolean;
|
||||
isCommentDisable_main: boolean;
|
||||
}
|
||||
|
||||
export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||
|
|
@ -62,18 +57,14 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
comment: '',
|
||||
isOreoLoading: false,
|
||||
isOreoDisable: false,
|
||||
isOreoDisable_main: false,
|
||||
isPickLoading: false,
|
||||
isPickDisable: false,
|
||||
isPickDisable_main: false,
|
||||
isRetrieveLoading: false,
|
||||
isRetrieveDisable: false,
|
||||
isRetrieveDisable_main: false,
|
||||
isStatusLoading: false,
|
||||
isStatusDisable: false,
|
||||
isCommentLoading: false,
|
||||
isCommentDisable: false,
|
||||
isCommentDisable_main: false,
|
||||
};
|
||||
|
||||
componentDidMount(): void {
|
||||
|
|
@ -83,7 +74,6 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
id: id,
|
||||
isMember: wechatUser.getAccess(),
|
||||
});
|
||||
getDisable(this, id);
|
||||
}
|
||||
|
||||
onAddToOreo(): void {
|
||||
|
|
@ -247,9 +237,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
>
|
||||
<AtButton
|
||||
loading={this.state.isPickLoading}
|
||||
disabled={
|
||||
this.state.isPickDisable || this.state.isPickDisable_main
|
||||
}
|
||||
disabled={this.state.isPickDisable}
|
||||
type='secondary'
|
||||
onClick={this.onPick.bind(this)}
|
||||
>
|
||||
|
|
@ -262,9 +250,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
>
|
||||
<AtButton
|
||||
loading={this.state.isOreoLoading}
|
||||
disabled={
|
||||
this.state.isOreoDisable || this.state.isOreoDisable_main
|
||||
}
|
||||
disabled={this.state.isOreoDisable}
|
||||
type='primary'
|
||||
onClick={this.onAddToOreo.bind(this)}
|
||||
>
|
||||
|
|
@ -274,7 +260,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
</View>
|
||||
<View
|
||||
className='at-row'
|
||||
style={{ paddingTop: '20rpx', paddingBottom: '40rpx', width: '100%' }}
|
||||
style={{ paddingTop: '20rpx', paddingBottom: '20rpx', width: '100%' }}
|
||||
>
|
||||
<View
|
||||
className='at-col'
|
||||
|
|
@ -294,9 +280,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
style={{ marginLeft: '20rpx', paddingRight: '10rpx', width: '50%' }}
|
||||
>
|
||||
<AtButton
|
||||
disabled={
|
||||
this.state.isCommentDisable || this.state.isCommentDisable_main
|
||||
}
|
||||
disabled={this.state.isCommentDisable}
|
||||
loading={this.state.isCommentLoading}
|
||||
type='secondary'
|
||||
onClick={this.onAddComment.bind(this)}
|
||||
|
|
@ -309,7 +293,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
) : (
|
||||
<View
|
||||
className='at-row'
|
||||
style={{ paddingTop: '20rpx', paddingBottom: '40rpx', width: '100%' }}
|
||||
style={{ paddingTop: '20rpx', paddingBottom: '20rpx', width: '100%' }}
|
||||
>
|
||||
<View
|
||||
className='at-col'
|
||||
|
|
@ -317,9 +301,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
>
|
||||
<AtButton
|
||||
loading={this.state.isRetrieveLoading}
|
||||
disabled={
|
||||
this.state.isRetrieveDisable || this.state.isRetrieveDisable_main
|
||||
}
|
||||
disabled={this.state.isRetrieveDisable}
|
||||
type='primary'
|
||||
onClick={this.onRetrieved.bind(this)}
|
||||
>
|
||||
|
|
@ -331,9 +313,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
style={{ marginRight: '20rpx', paddingLeft: '10rpx', width: '50%' }}
|
||||
>
|
||||
<AtButton
|
||||
disabled={
|
||||
this.state.isCommentDisable || this.state.isCommentDisable_main
|
||||
}
|
||||
disabled={this.state.isCommentDisable}
|
||||
loading={this.state.isCommentLoading}
|
||||
type='secondary'
|
||||
onClick={this.onAddComment.bind(this)}
|
||||
|
|
|
|||
|
|
@ -9,11 +9,9 @@ export class TicketInfo {
|
|||
createdTime: moment.Moment;
|
||||
status: FixStatus;
|
||||
info: Info;
|
||||
workers: string[];
|
||||
}
|
||||
|
||||
export class TicketNote {
|
||||
avatar: string;
|
||||
id: number;
|
||||
op: string;
|
||||
type: 0 | 1 | 2;
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ import { AtTimeline } from 'taro-ui';
|
|||
import pt from '@/plain-text';
|
||||
import tick from '@/assets/icons/MainPage/tick.svg';
|
||||
import cross from '@/assets/icons/MainPage/cross.svg';
|
||||
import clock from '@/assets/icons/MemberPage/clock.svg';
|
||||
import wechatUser from '@/wechat';
|
||||
|
||||
export class DutyData {
|
||||
constructor() {
|
||||
|
|
@ -14,28 +12,24 @@ export class DutyData {
|
|||
this.currentDuty = '2';
|
||||
this.offDutyReason = '学园维修';
|
||||
this.dutyRecoverTime = '下周一';
|
||||
this.place = '东三-204';
|
||||
}
|
||||
|
||||
isInDuty: boolean;
|
||||
inDutyCnt?: number;
|
||||
currentDuty?: 'off' | '1' | '2' | '3' | 'others';
|
||||
currentDuty?: 'off' | '1' | '2' | '3';
|
||||
offDutyReason?: string;
|
||||
dutyRecoverTime?: string;
|
||||
place: string;
|
||||
}
|
||||
|
||||
class Card extends Component {
|
||||
props = {
|
||||
isInDuty: false,
|
||||
place: '东三-204',
|
||||
};
|
||||
render(): ReactNode {
|
||||
const inDuty = this.props.isInDuty;
|
||||
const place = this.props.place;
|
||||
const dc = pt.get().mainPage.dutyCard;
|
||||
const title = inDuty ? dc.inDuty.title : dc.offDuty.title;
|
||||
const iconsrc = inDuty ? tick : wechatUser.getAccess() ? clock : cross;
|
||||
const iconsrc = inDuty ? tick : cross;
|
||||
return (
|
||||
<View>
|
||||
<View
|
||||
|
|
@ -59,7 +53,7 @@ class Card extends Component {
|
|||
fontWeight: 'bold',
|
||||
}}
|
||||
>
|
||||
{'[' + place + '] ' + title}
|
||||
{title}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
|
@ -68,11 +62,6 @@ class Card extends Component {
|
|||
}
|
||||
|
||||
export class DutyInfo extends Component {
|
||||
state: {
|
||||
isLoading: false;
|
||||
isDisable: false;
|
||||
};
|
||||
|
||||
props = {
|
||||
data: new DutyData(),
|
||||
};
|
||||
|
|
@ -82,7 +71,7 @@ export class DutyInfo extends Component {
|
|||
const od = pt.get().mainPage.dutyCard.offDuty;
|
||||
return (
|
||||
<View>
|
||||
<Card isInDuty={data.isInDuty} place={data.place} />
|
||||
<Card isInDuty={data.isInDuty} />
|
||||
<AtTimeline
|
||||
items={[
|
||||
{ title: od.reason(data.offDutyReason as string) },
|
||||
|
|
@ -98,7 +87,7 @@ export class DutyInfo extends Component {
|
|||
const id = pt.get().mainPage.dutyCard.inDuty;
|
||||
return (
|
||||
<View>
|
||||
<Card isInDuty={data.isInDuty} place={data.place} />
|
||||
<Card isInDuty={data.isInDuty} />
|
||||
<AtTimeline
|
||||
items={[
|
||||
{ title: id.currentDutyText(data.currentDuty || 'off') },
|
||||
|
|
|
|||
|
|
@ -2,19 +2,12 @@ import { Component, ReactNode } from 'react';
|
|||
import { View } from '@tarojs/components';
|
||||
import { AtTimeline } from 'taro-ui';
|
||||
import pt from '@/plain-text';
|
||||
import wechatUser from '@/wechat';
|
||||
|
||||
export class StepInfo extends Component {
|
||||
render(): ReactNode {
|
||||
return (
|
||||
<View>
|
||||
<AtTimeline
|
||||
items={
|
||||
wechatUser.getAccess()
|
||||
? pt.get().memberPage.stepList
|
||||
: pt.get().mainPage.stepList
|
||||
}
|
||||
></AtTimeline>
|
||||
<AtTimeline items={pt.get().mainPage.stepList}></AtTimeline>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
|
@ -24,13 +17,7 @@ export class TipsInfo extends Component {
|
|||
render(): ReactNode {
|
||||
return (
|
||||
<View>
|
||||
<AtTimeline
|
||||
items={
|
||||
wechatUser.getAccess()
|
||||
? pt.get().memberPage.tipsList
|
||||
: pt.get().mainPage.tipsList
|
||||
}
|
||||
></AtTimeline>
|
||||
<AtTimeline items={pt.get().mainPage.tipsList}></AtTimeline>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,32 +2,24 @@ import React from 'react';
|
|||
import { View, Image } from '@tarojs/components';
|
||||
import pt from '@/plain-text';
|
||||
import logo from '@/assets/images/UserPage/logo.png';
|
||||
import wechatUser from '@/wechat';
|
||||
|
||||
export default class TitleCard extends React.Component {
|
||||
render(): React.ReactNode {
|
||||
const mainPage = pt.get().mainPage;
|
||||
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={wechatUser.getAccess() ? wechatUser.getInfo().avatar : logo}
|
||||
src={logo}
|
||||
mode='aspectFit'
|
||||
/>
|
||||
</View>
|
||||
<View className='page-title'>
|
||||
<View className='at-article__h1' style={{ fontWeight: 'bold' }}>
|
||||
{wechatUser.getAccess()
|
||||
? memberPage.mainTitleLine + wechatUser.getInfo().name
|
||||
: mainPage.mainTitleLine}
|
||||
</View>
|
||||
<View className='at-article__h2'>
|
||||
{wechatUser.getAccess()
|
||||
? memberPage.subTitleLine
|
||||
: mainPage.subTitleLine}
|
||||
{mainPage.mainTitleLine}
|
||||
</View>
|
||||
<View className='at-article__h2'>{mainPage.subTitleLine}</View>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,25 +1,16 @@
|
|||
import { View } from '@tarojs/components';
|
||||
import { Component, ReactNode } from 'react';
|
||||
import Taro from '@tarojs/taro';
|
||||
import { AtCard, AtAccordion, AtInputNumber, AtButton, AtList } from 'taro-ui';
|
||||
import { AtCard, AtAccordion } from 'taro-ui';
|
||||
import type CustomTabBar from '@/custom-tab-bar';
|
||||
import PageFooter from '@/components/PageFooter/PageFooter';
|
||||
import pt from '@/plain-text';
|
||||
import { getDutyInfo } from '@/service/dutyInfo';
|
||||
import { RequestState } from '@/service';
|
||||
import moment from 'moment';
|
||||
import wechatUser from '@/wechat';
|
||||
import { getMemberDutyInfo } from '@/service/memberDutyInfo';
|
||||
import { getUncompletedTicketList } from '@/service/uncompletedTicket';
|
||||
import { changeDutyCnt } from '@/service/changeDutyCount';
|
||||
import { TicketListItem } from '@/components/TicketListItem/TicketListItem';
|
||||
import './index.scss';
|
||||
import TitleCard from './TitleCard';
|
||||
import { DutyInfo, DutyData } from './DutyInfo';
|
||||
import { StepInfo, TipsInfo } from './StepTipsInfo';
|
||||
|
||||
const submitInterval = 5000;
|
||||
|
||||
class CardContent {
|
||||
title: string;
|
||||
note: string;
|
||||
|
|
@ -66,78 +57,40 @@ class ExpandItem extends Component {
|
|||
}
|
||||
|
||||
interface MainPageState {
|
||||
fixList: Array<TicketListItem>;
|
||||
rs: RequestState;
|
||||
dutyData: DutyData;
|
||||
inDutyCnt: number;
|
||||
dutyInfoCard: CardContent;
|
||||
stepInfoCard: CardContent;
|
||||
tipsInfoCard: CardContent;
|
||||
isLoading: boolean;
|
||||
isDisable: boolean;
|
||||
//rs: RequestState;
|
||||
}
|
||||
|
||||
export default class MainPage extends Component<{}, MainPageState> {
|
||||
state = {
|
||||
dutyData: new DutyData(),
|
||||
inDutyCnt: 0,
|
||||
dutyInfoCard: {
|
||||
title: '',
|
||||
note: '',
|
||||
extra: '',
|
||||
content: () => <></>,
|
||||
},
|
||||
stepInfoCard: {
|
||||
title: '',
|
||||
note: '',
|
||||
extra: '',
|
||||
content: () => <></>,
|
||||
},
|
||||
tipsInfoCard: {
|
||||
title: '',
|
||||
note: '',
|
||||
extra: '',
|
||||
content: () => <></>,
|
||||
},
|
||||
fixList: [new TicketListItem(0, '', '', 1, moment())],
|
||||
rs: new RequestState(),
|
||||
isLoading: false,
|
||||
isDisable: false,
|
||||
};
|
||||
|
||||
componentDidMount(): void {
|
||||
const ptPage = wechatUser.getAccess() ? 'mainPage' : 'memberPage';
|
||||
|
||||
this.setState({
|
||||
dutyData: new DutyData(),
|
||||
inDutyCnt: 0,
|
||||
dutyInfoCard: {
|
||||
title: pt.get()[ptPage].cardTitle.dutyInfo,
|
||||
note: pt.get()[ptPage].cardTips.dutyInfo,
|
||||
extra: pt.get()[ptPage].extraInfo.dutyInfo,
|
||||
title: pt.get().mainPage.cardTitle.dutyInfo,
|
||||
note: pt.get().mainPage.cardTips.dutyInfo,
|
||||
extra: pt.get().mainPage.extraInfo.dutyInfo,
|
||||
content: () => <DutyInfo data={this.state.dutyData} />,
|
||||
},
|
||||
stepInfoCard: {
|
||||
title: pt.get()[ptPage].cardTitle.stepInfo,
|
||||
note: pt.get()[ptPage].cardTips.stepInfo,
|
||||
extra: pt.get()[ptPage].extraInfo.dutyInfo,
|
||||
title: pt.get().mainPage.cardTitle.stepInfo,
|
||||
note: pt.get().mainPage.cardTips.stepInfo,
|
||||
extra: pt.get().mainPage.extraInfo.dutyInfo,
|
||||
content: () => <StepInfo />,
|
||||
},
|
||||
tipsInfoCard: {
|
||||
title: pt.get()[ptPage].cardTitle.tipsInfo,
|
||||
note: pt.get()[ptPage].cardTips.tipsInfo,
|
||||
extra: pt.get()[ptPage].extraInfo.dutyInfo,
|
||||
title: pt.get().mainPage.cardTitle.tipsInfo,
|
||||
note: pt.get().mainPage.cardTips.tipsInfo,
|
||||
extra: pt.get().mainPage.extraInfo.dutyInfo,
|
||||
content: () => <TipsInfo />,
|
||||
},
|
||||
});
|
||||
// rs: new RequestState(),
|
||||
};
|
||||
|
||||
if (wechatUser.getAccess()) {
|
||||
getMemberDutyInfo(this);
|
||||
getUncompletedTicketList(this);
|
||||
} else {
|
||||
componentDidMount(): void {
|
||||
getDutyInfo(this);
|
||||
}
|
||||
}
|
||||
|
||||
// 以下是TabBar相关
|
||||
pageCtx = Taro.getCurrentInstance().page;
|
||||
|
|
@ -147,35 +100,8 @@ export default class MainPage extends Component<{}, MainPageState> {
|
|||
}
|
||||
// 以上是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 mainPage = pt.get().mainPage;
|
||||
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>
|
||||
<TitleCard />
|
||||
|
|
@ -183,66 +109,11 @@ export default class MainPage extends Component<{}, MainPageState> {
|
|||
<View style={{ marginTop: '60rpx' }}>
|
||||
{mainPageCard(this.state.dutyInfoCard)}
|
||||
{mainPageCard(this.state.tipsInfoCard)}
|
||||
{wechatUser.getAccess() && 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={mainPage.expandTitle.stepInfo}
|
||||
content={mainPageCard(this.state.stepInfoCard)}
|
||||
/>
|
||||
</View>
|
||||
{wechatUser.getAccess() ? (
|
||||
<AtList>{fixListRenderer}</AtList>
|
||||
) : (
|
||||
<View></View>
|
||||
)}
|
||||
<PageFooter />
|
||||
</View>
|
||||
</View>
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -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>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
export default definePageConfig({
|
||||
usingComponents: {},
|
||||
});
|
||||
|
|
@ -0,0 +1,226 @@
|
|||
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 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);
|
||||
}
|
||||
|
||||
// 以下是TabBar相关
|
||||
pageCtx = Taro.getCurrentInstance().page;
|
||||
componentDidShow() {
|
||||
const tabbar = Taro.getTabBar<CustomTabBar>(this.pageCtx);
|
||||
tabbar?.setSelected(2);
|
||||
}
|
||||
// 以上是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>
|
||||
<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>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -18,7 +18,6 @@ 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 wechatUser from '@/wechat';
|
||||
import './repair.scss';
|
||||
|
||||
interface RepairPageState {
|
||||
|
|
@ -52,8 +51,8 @@ export default class RepairPage extends Component<{}, RepairPageState> {
|
|||
type: 1 as 0 | 1,
|
||||
device: '',
|
||||
deviceModel: '',
|
||||
owner: wechatUser.getInfo().name,
|
||||
phone: wechatUser.getInfo().phone,
|
||||
owner: '',
|
||||
phone: '',
|
||||
description: '',
|
||||
isLoading: false,
|
||||
isDisable: true,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, ReactNode } from 'react';
|
||||
import { Image, View } from '@tarojs/components';
|
||||
import { View } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
import pt from '@/plain-text';
|
||||
import './about.scss';
|
||||
|
|
@ -11,61 +11,6 @@ export default class AboutPage extends Component {
|
|||
});
|
||||
}
|
||||
render(): ReactNode {
|
||||
return (
|
||||
<View>
|
||||
<View
|
||||
style={{ marginTop: '60rpx', marginBottom: '60rpx' }}
|
||||
className='at-row at-row__align--start'
|
||||
>
|
||||
<View className='at-col at-col-1 at-col--auto'>
|
||||
<Image
|
||||
style='width: 240rpx; height: 240rpx; margin-left: 60rpx; margin-right: 30rpx; margin-top: 30rpx; border-radius: 120rpx'
|
||||
src='https://wiki.zjueva.net/images/1/10/%E5%A4%B4%E5%83%8F.jpg?20240319171222'
|
||||
mode='aspectFit'
|
||||
/>
|
||||
</View>
|
||||
<View className='at-article at-col'>
|
||||
<View className='at-article__h1'>
|
||||
{pt.get().aboutPage.dean.nickname}
|
||||
</View>
|
||||
<View className='at-article__h3'>
|
||||
{pt.get().aboutPage.dean.username}
|
||||
</View>
|
||||
<View className='at-article__p'>
|
||||
{pt.get().aboutPage.dean.status}
|
||||
</View>
|
||||
<View className='at-article__info'>
|
||||
{pt.get().aboutPage.dean.note}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
<View
|
||||
style={{ marginTop: '60rpx', marginBottom: '60rpx' }}
|
||||
className='at-row at-row__align--start'
|
||||
>
|
||||
<View className='at-col at-col-1 at-col--auto'>
|
||||
<Image
|
||||
style='width: 240rpx; height: 240rpx; margin-left: 60rpx; margin-right: 30rpx; margin-top: 30rpx; border-radius: 120rpx'
|
||||
src='https://wiki.zjueva.net/images/1/10/%E5%A4%B4%E5%83%8F.jpg?20240319171222'
|
||||
mode='aspectFit'
|
||||
/>
|
||||
</View>
|
||||
<View className='at-article at-col'>
|
||||
<View className='at-article__h1'>
|
||||
{pt.get().aboutPage.fracher.nickname}
|
||||
</View>
|
||||
<View className='at-article__h3'>
|
||||
{pt.get().aboutPage.fracher.username}
|
||||
</View>
|
||||
<View className='at-article__p'>
|
||||
{pt.get().aboutPage.fracher.status}
|
||||
</View>
|
||||
<View className='at-article__info'>
|
||||
{pt.get().aboutPage.fracher.note}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
return <View></View>;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ import { View } from '@tarojs/components';
|
|||
import Taro from '@tarojs/taro';
|
||||
import pt from '@/plain-text';
|
||||
import { updateUserInfo } from '@/service/userData';
|
||||
import wechatUser from '@/wechat';
|
||||
import './inform.scss';
|
||||
|
||||
const submitInterval = 5000;
|
||||
|
||||
export default class InformPage extends Component {
|
||||
state = {
|
||||
phone: wechatUser.getInfo().phone,
|
||||
name: wechatUser.getInfo().name,
|
||||
phone: '',
|
||||
name: '',
|
||||
isLoading: false,
|
||||
isDisable: false,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import Taro from '@tarojs/taro';
|
|||
import pt from '@/plain-text';
|
||||
import { memberLogin, memberLogout } from '@/service/memberLogin';
|
||||
import wechatUser from '@/wechat';
|
||||
import { View } from '@tarojs/components';
|
||||
import './member.scss';
|
||||
|
||||
const logInterval = 5000;
|
||||
|
|
@ -71,7 +70,6 @@ export default class UserMemberPage extends Component {
|
|||
|
||||
render(): ReactNode {
|
||||
return !wechatUser.getAccess() ? (
|
||||
<View style={{ marginTop: '30rpx', width: '94%', marginLeft: '3%' }}>
|
||||
<AtForm onSubmit={this.onSubmit.bind(this)}>
|
||||
<AtMessage />
|
||||
<AtInput
|
||||
|
|
@ -103,13 +101,10 @@ export default class UserMemberPage extends Component {
|
|||
{pt.get().button.buttonText.login}
|
||||
</AtButton>
|
||||
</AtForm>
|
||||
</View>
|
||||
) : (
|
||||
<View style={{ marginTop: '30rpx', width: '94%', marginLeft: '3%' }}>
|
||||
<AtButton type='primary' onClick={this.onLogout.bind(this)}>
|
||||
{pt.get().button.buttonText.logout}
|
||||
</AtButton>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,14 +4,11 @@ import { View, Picker, Image, Text } 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/UserPage/about.svg';
|
||||
import userIcon from '@/assets/icons/UserPage/user.svg';
|
||||
import clockIcon from '@/assets/icons/UserPage/clock.svg';
|
||||
import messageIcon from '@/assets/icons/UserPage/message.svg';
|
||||
import aboutIcon from '@/assets/icons/AboutPage/about.svg';
|
||||
import pt, { Lang } from '@/plain-text';
|
||||
import wechatUser from '@/wechat';
|
||||
import logo from '@/assets/images/UserPage/logo.png';
|
||||
import { setLocaleData } from '@/service/localeData';
|
||||
import wechatUser from '@/wechat';
|
||||
import './user.scss';
|
||||
|
||||
const memberClickTimes = 7;
|
||||
|
|
@ -32,7 +29,7 @@ export default class UserPage extends Component {
|
|||
pageCtx = Taro.getCurrentInstance().page;
|
||||
componentDidShow() {
|
||||
const tabbar = Taro.getTabBar<CustomTabBar>(this.pageCtx);
|
||||
tabbar?.setSelected(2);
|
||||
tabbar?.setSelected(wechatUser.getAccess() ? 3 : 2);
|
||||
}
|
||||
// 以上是TabBar相关
|
||||
|
||||
|
|
@ -130,27 +127,31 @@ export default class UserPage extends Component {
|
|||
title={pt.get().userPage.ticketColumn.title}
|
||||
note={pt.get().userPage.ticketColumn.note}
|
||||
arrow='right'
|
||||
thumb={clockIcon}
|
||||
iconInfo={{
|
||||
color: '#E69966',
|
||||
value: 'clock',
|
||||
}}
|
||||
onClick={this.myTicketPage}
|
||||
/>
|
||||
{wechatUser.getAccess() ? (
|
||||
<View></View>
|
||||
) : (
|
||||
<AtListItem
|
||||
title={pt.get().userPage.infoColumn.title}
|
||||
note={pt.get().userPage.infoColumn.note}
|
||||
arrow='right'
|
||||
thumb={userIcon}
|
||||
iconInfo={{
|
||||
color: '#78A4FA',
|
||||
value: 'user',
|
||||
}}
|
||||
onClick={this.informPage}
|
||||
/>
|
||||
)}
|
||||
|
||||
<AtListItem
|
||||
title={pt.get().userPage.reportColumn.title}
|
||||
note={pt.get().userPage.reportColumn.note}
|
||||
extraText=''
|
||||
arrow='right'
|
||||
thumb={messageIcon}
|
||||
iconInfo={{
|
||||
color: '#9ACD32',
|
||||
value: 'message',
|
||||
}}
|
||||
onClick={this.reportPage}
|
||||
/>
|
||||
<AtListItem
|
||||
|
|
|
|||
|
|
@ -1,44 +1,5 @@
|
|||
export interface AboutPageText {
|
||||
dean: {
|
||||
nickname: string;
|
||||
username: string;
|
||||
status: string;
|
||||
note: string;
|
||||
};
|
||||
fracher: {
|
||||
nickname: string;
|
||||
username: string;
|
||||
status: string;
|
||||
note: string;
|
||||
};
|
||||
}
|
||||
export interface AboutPageText {}
|
||||
|
||||
export const aboutPageZhCn: AboutPageText = {
|
||||
dean: {
|
||||
nickname: '晓洋',
|
||||
username: '@ Dawn_Ocean',
|
||||
status: 'Eta & Tea 总设计',
|
||||
note: '摸鱼与开发叠加态',
|
||||
},
|
||||
fracher: {
|
||||
nickname: '宇航员',
|
||||
username: '@ FrozenArcher',
|
||||
status: 'Ate 总设计, Eta 合作贡献者',
|
||||
note: '6~',
|
||||
},
|
||||
};
|
||||
export const aboutPageZhCn: AboutPageText = {};
|
||||
|
||||
export const aboutPageEnUs: AboutPageText = {
|
||||
dean: {
|
||||
nickname: 'Dean Ma',
|
||||
username: '@ Dawn_Ocean',
|
||||
status: "Eta & Tea's General Designer",
|
||||
note: 'Struggling between developing & laziness',
|
||||
},
|
||||
fracher: {
|
||||
nickname: 'Fracher',
|
||||
username: '@ FrozenArcher',
|
||||
status: "Ate's General Designer, Eta's Contributor",
|
||||
note: '6~',
|
||||
},
|
||||
};
|
||||
export const aboutPageEnUs: AboutPageText = {};
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ export interface ButtonText {
|
|||
loginText: {
|
||||
success: string;
|
||||
error: string;
|
||||
fail: string;
|
||||
};
|
||||
logoutText: {
|
||||
success: string;
|
||||
|
|
@ -36,7 +35,6 @@ export const buttonZhCn: ButtonText = {
|
|||
loginText: {
|
||||
success: '登录成功',
|
||||
error: '登录失败',
|
||||
fail: '请检查用户名或密码!',
|
||||
},
|
||||
logoutText: {
|
||||
success: '登出成功',
|
||||
|
|
@ -59,7 +57,6 @@ export const buttonEnUs: ButtonText = {
|
|||
loginText: {
|
||||
success: 'Login Success',
|
||||
error: 'Login Failed',
|
||||
fail: 'Please check username or password!',
|
||||
},
|
||||
logoutText: {
|
||||
success: 'Logout Success',
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export interface MainPageText {
|
|||
};
|
||||
inDuty: {
|
||||
title: string;
|
||||
currentDutyText: (c: 'off' | '1' | '2' | '3' | 'others') => string;
|
||||
currentDutyText: (c: 'off' | '1' | '2' | '3') => string;
|
||||
inDutyCnt: (n: number) => string;
|
||||
};
|
||||
};
|
||||
|
|
@ -41,7 +41,7 @@ export const mainPageZhCn: MainPageText = {
|
|||
mainTitleLine: '您好,这里是E志者协会',
|
||||
subTitleLine: '维修请至【东三-204】实验室',
|
||||
cardTitle: {
|
||||
dutyInfo: '值班情况',
|
||||
dutyInfo: '204 值班情况',
|
||||
stepInfo: '维修步骤',
|
||||
tipsInfo: '注意事项',
|
||||
},
|
||||
|
|
@ -89,8 +89,6 @@ export const mainPageZhCn: MainPageText = {
|
|||
return '第二班 16:00-18:00';
|
||||
case '3':
|
||||
return '第三班 18:00-20:30';
|
||||
case 'others':
|
||||
return '其他值班时间,见通知';
|
||||
}
|
||||
},
|
||||
inDutyCnt: (n) => '当前值班人数:' + n,
|
||||
|
|
@ -150,8 +148,6 @@ export const mainPageEnUs: MainPageText = {
|
|||
return '2nd Shift 16:00-18:00';
|
||||
case '3':
|
||||
return '3rd Shift 18:00-20:30';
|
||||
case 'others':
|
||||
return 'Other duty time, see notice';
|
||||
}
|
||||
},
|
||||
inDutyCnt: (n) => 'EVA members on duty: ' + n,
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
export interface MemberPageText {
|
||||
mainTitleLine: string;
|
||||
subTitleLine: string;
|
||||
cardTitle: {
|
||||
dutyInfo: string;
|
||||
stepInfo: string;
|
||||
tipsInfo: string;
|
||||
};
|
||||
dutyCount: {
|
||||
button: string;
|
||||
text: string;
|
||||
|
|
@ -38,28 +33,13 @@ export interface MemberPageText {
|
|||
tipsInfo: string;
|
||||
admin: string;
|
||||
};
|
||||
cardTips: {
|
||||
dutyInfo: string;
|
||||
stepInfo: string;
|
||||
tipsInfo: string;
|
||||
};
|
||||
extraInfo: {
|
||||
dutyInfo: string;
|
||||
stepInfo: string;
|
||||
tipsInfo: string;
|
||||
};
|
||||
stepList: Array<{ title: string }>;
|
||||
tipsList: Array<{ title: string }>;
|
||||
}
|
||||
|
||||
export const memberPageZhCn: MemberPageText = {
|
||||
mainTitleLine: '您好,',
|
||||
mainTitleLine: '您好,这里是E志者协会',
|
||||
subTitleLine: '祝你满绩每一天',
|
||||
cardTitle: {
|
||||
dutyInfo: '值班情况',
|
||||
stepInfo: '维修步骤',
|
||||
tipsInfo: '注意事项',
|
||||
},
|
||||
dutyCount: {
|
||||
button: '更新值班人数',
|
||||
text: '当前值班人数:',
|
||||
|
|
@ -105,16 +85,6 @@ export const memberPageZhCn: MemberPageText = {
|
|||
tipsInfo: '查看注意事项',
|
||||
admin: '组长管理入口',
|
||||
},
|
||||
cardTips: {
|
||||
dutyInfo: '提示:可以先前往【维修】页面在线上预填写工单!',
|
||||
stepInfo: '提示:请在 20:30 之前取走自己的物品哦!',
|
||||
tipsInfo: '',
|
||||
},
|
||||
extraInfo: {
|
||||
dutyInfo: '',
|
||||
stepInfo: '',
|
||||
tipsInfo: '',
|
||||
},
|
||||
stepList: [
|
||||
{ title: '机主线上填写工单,审核接取维修后加入 Oreo' },
|
||||
{ title: '进行维修工作,认领工单,通过小程序与机主交流' },
|
||||
|
|
@ -130,13 +100,8 @@ export const memberPageZhCn: MemberPageText = {
|
|||
};
|
||||
|
||||
export const memberPageEnUs: MemberPageText = {
|
||||
mainTitleLine: 'Hi! ',
|
||||
mainTitleLine: 'Hi! This is EVA.',
|
||||
subTitleLine: 'Have a great day!',
|
||||
cardTitle: {
|
||||
dutyInfo: 'Duty Situation',
|
||||
stepInfo: 'Maintenance Steps',
|
||||
tipsInfo: 'Tips',
|
||||
},
|
||||
dutyCount: {
|
||||
button: 'Update Duty Count',
|
||||
text: 'The duty count: ',
|
||||
|
|
@ -182,16 +147,6 @@ export const memberPageEnUs: MemberPageText = {
|
|||
tipsInfo: 'Check for tips',
|
||||
admin: 'Entry for admin',
|
||||
},
|
||||
cardTips: {
|
||||
dutyInfo: '提示:可以先前往【维修】页面在线上预填写工单!',
|
||||
stepInfo: '提示:请在 20:30 之前取走自己的物品哦!',
|
||||
tipsInfo: '',
|
||||
},
|
||||
extraInfo: {
|
||||
dutyInfo: '',
|
||||
stepInfo: '',
|
||||
tipsInfo: '',
|
||||
},
|
||||
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' },
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import TicketDetail from '@/pages/TicketDetail/TicketDetail';
|
||||
import Taro from '@tarojs/taro';
|
||||
import pt from '@/plain-text';
|
||||
import wechatUser from '@/wechat';
|
||||
import { getUrl } from '.';
|
||||
|
||||
export function addToOreo(that: TicketDetail) {
|
||||
|
|
@ -12,7 +11,7 @@ export function addToOreo(that: TicketDetail) {
|
|||
url: getUrl('/tickets/addtooreo'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
token: 'token_test',
|
||||
id: that.state.id,
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
import MainPage from '@/pages/index';
|
||||
import MemberPage from '@/pages/member/member';
|
||||
import Taro from '@tarojs/taro';
|
||||
import pt from '@/plain-text';
|
||||
import wechatUser from '@/wechat';
|
||||
import { getUrl } from '.';
|
||||
|
||||
const reLaunchInterval = 1000;
|
||||
|
||||
export function changeDutyCnt(that: MainPage) {
|
||||
export function changeDutyCnt(that: MemberPage) {
|
||||
that.setState({
|
||||
isLoading: true,
|
||||
});
|
||||
|
|
@ -14,7 +13,7 @@ export function changeDutyCnt(that: MainPage) {
|
|||
url: getUrl('/tickets/addtooreo'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
token: 'token_test',
|
||||
dutyCnt: that.state.inDutyCnt,
|
||||
},
|
||||
})
|
||||
|
|
@ -29,7 +28,7 @@ export function changeDutyCnt(that: MainPage) {
|
|||
});
|
||||
setTimeout(() => {
|
||||
Taro.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
url: '/pages/member/member',
|
||||
});
|
||||
}, reLaunchInterval);
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import TicketDetail from '@/pages/TicketDetail/TicketDetail';
|
||||
import Taro from '@tarojs/taro';
|
||||
import pt from '@/plain-text';
|
||||
import wechatUser from '@/wechat';
|
||||
import { getUrl } from '.';
|
||||
|
||||
const reLaunchInterval = 1000;
|
||||
|
|
@ -14,7 +13,7 @@ export function changeStatus(that: TicketDetail, status: number) {
|
|||
url: getUrl('/tickets/update'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
token: 'token_test',
|
||||
id: that.state.id,
|
||||
status: status,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
import Taro from '@tarojs/taro';
|
||||
import { getUrl } from '.';
|
||||
|
||||
export function checkLogin(callback: (success: boolean) => void) {
|
||||
let token = checkToken();
|
||||
if (token.length !== 0) {
|
||||
Taro.request({
|
||||
url: getUrl('/checklogin'),
|
||||
method: 'GET',
|
||||
data: {
|
||||
token: token,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.data.data.islogin) {
|
||||
callback(true);
|
||||
}
|
||||
callback(false);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
callback(false);
|
||||
});
|
||||
} else {
|
||||
callback(false);
|
||||
}
|
||||
}
|
||||
|
||||
export function checkToken(): string {
|
||||
try {
|
||||
let token: string = Taro.getStorageSync('token');
|
||||
if (token) {
|
||||
return token;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,6 @@ import RepairPage from '@/pages/repair/repair';
|
|||
import Taro from '@tarojs/taro';
|
||||
import { TicketListItem } from '@/components/TicketListItem/TicketListItem';
|
||||
import pt from '@/plain-text';
|
||||
import wechatUser from '@/wechat';
|
||||
import { getUrl } from '.';
|
||||
|
||||
export function getCurrentTicket(that: RepairPage) {
|
||||
|
|
@ -10,7 +9,7 @@ export function getCurrentTicket(that: RepairPage) {
|
|||
url: getUrl('/user/mytickets'),
|
||||
method: 'GET',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
token: 'token_test',
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import MainPage from '@/pages/index';
|
||||
import Taro from '@tarojs/taro';
|
||||
import wechatUser from '@/wechat';
|
||||
import { getUrl } from '.';
|
||||
|
||||
export function getDutyInfo(that: MainPage) {
|
||||
|
|
@ -8,50 +7,36 @@ export function getDutyInfo(that: MainPage) {
|
|||
url: getUrl('/duty/info'),
|
||||
method: 'GET',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
token: 'token_test',
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
let former = that.state.rs;
|
||||
if (!res.data.success) {
|
||||
that.setState({
|
||||
rs: former.trans(false),
|
||||
});
|
||||
return;
|
||||
}
|
||||
const data = res.data.data;
|
||||
if (data.isInDuty) {
|
||||
that.setState({
|
||||
rs: former.trans(true),
|
||||
dutyData: {
|
||||
isInDuty: data.isInDuty,
|
||||
inDutyCnt: data.inDutyCnt,
|
||||
currentDuty: data.currentDuty,
|
||||
place: data.place,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
that.setState({
|
||||
rs: former.trans(true),
|
||||
dutyData: {
|
||||
isInDuty: data.isInDuty,
|
||||
offDutyReason: data.offDutyReason,
|
||||
dutyRecoverTime: data.dutyRecoverTime,
|
||||
place: data.place,
|
||||
},
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
let former = that.state.rs;
|
||||
that.setState({
|
||||
rs: former.trans(false),
|
||||
dutyData: {
|
||||
isInDuty: false,
|
||||
offDutyReason: '获取失败!Network Error!',
|
||||
dutyRecoverTime: '获取失败!Network Error!',
|
||||
place: '204',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
import TicketDetail from '@/pages/TicketDetail/TicketDetail';
|
||||
import Taro from '@tarojs/taro';
|
||||
import wechatUser from '@/wechat';
|
||||
import { getUrl } from '.';
|
||||
|
||||
export function getDisable(that: TicketDetail, id: number) {
|
||||
Taro.request({
|
||||
url: getUrl('/tickets/info'),
|
||||
method: 'GET',
|
||||
data: {
|
||||
id: id,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
const data = res.data.data;
|
||||
if (data.status === 3 || data.status === 5 || data.status === 7) {
|
||||
that.setState({
|
||||
isRetrieveDisable_main: true,
|
||||
isCommentDisable_main: true,
|
||||
});
|
||||
}
|
||||
if (wechatUser.getAccess()) {
|
||||
if (data.workers.includes(wechatUser.getInfo().name)) {
|
||||
that.setState({
|
||||
isPickDisable_main: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((reason) => {
|
||||
console.error(reason);
|
||||
});
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
import Taro from '@tarojs/taro';
|
||||
import wechatUser, { UserInfo } from '@/wechat';
|
||||
import { defaultAvatar } from '@/common';
|
||||
import { getUrl } from '.';
|
||||
import { getLocaleData } from './localeData';
|
||||
|
||||
export function getInfo() {
|
||||
Taro.request({
|
||||
url: getUrl('/member/login'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
const data = res.data.data;
|
||||
if (res.data.success) {
|
||||
wechatUser.setInfo(data as UserInfo);
|
||||
wechatUser.setAccess(true);
|
||||
} else {
|
||||
Taro.request({
|
||||
url: getUrl('/user/info'),
|
||||
method: 'GET',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
},
|
||||
})
|
||||
.then((re) => {
|
||||
const info = re.data.data;
|
||||
const userInfo: UserInfo = {
|
||||
name: info.name,
|
||||
phone: info.phone,
|
||||
avatar: defaultAvatar,
|
||||
};
|
||||
console.log(userInfo);
|
||||
wechatUser.setInfo(userInfo);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
getLocaleData();
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
import Taro from '@tarojs/taro';
|
||||
import pt, { Lang } from '@/plain-text';
|
||||
import wechatUser from '@/wechat';
|
||||
import { getUrl } from '.';
|
||||
|
||||
export function setLocaleData(lang: Lang) {
|
||||
|
|
@ -8,7 +7,7 @@ export function setLocaleData(lang: Lang) {
|
|||
url: getUrl('/user/locale/update'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
token: 'token_test',
|
||||
lang: lang,
|
||||
},
|
||||
}).then((res) => {
|
||||
|
|
@ -21,7 +20,7 @@ export function getLocaleData() {
|
|||
url: getUrl('/user/locale/get'),
|
||||
method: 'GET',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
token: 'token_test',
|
||||
},
|
||||
}).then((res) => {
|
||||
console.log(res.data);
|
||||
|
|
|
|||
|
|
@ -1,35 +0,0 @@
|
|||
import Taro from '@tarojs/taro';
|
||||
import wechatUser from '@/wechat';
|
||||
import { getUrl } from '.';
|
||||
import { getLocaleData } from './localeData';
|
||||
|
||||
export function loginAte() {
|
||||
Taro.login({
|
||||
success: function (res) {
|
||||
if (res.code) {
|
||||
Taro.request({
|
||||
url: getUrl('/login'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
code: res.code,
|
||||
},
|
||||
})
|
||||
.then((re) => {
|
||||
const data = re.data.data;
|
||||
Taro.setStorage({
|
||||
key: 'token',
|
||||
data: data.token,
|
||||
});
|
||||
wechatUser.setToken(data.token);
|
||||
getLocaleData();
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
getLocaleData();
|
||||
} else {
|
||||
console.log('Login Failed: ' + res.errMsg);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
@ -1,14 +1,13 @@
|
|||
import MainPage from '@/pages/index';
|
||||
import MemberPage from '@/pages/member/member';
|
||||
import Taro from '@tarojs/taro';
|
||||
import wechatUser from '@/wechat';
|
||||
import { getUrl } from '.';
|
||||
|
||||
export function getMemberDutyInfo(that: MainPage) {
|
||||
export function getMemberDutyInfo(that: MemberPage) {
|
||||
Taro.request({
|
||||
url: getUrl('/member/duty/info'),
|
||||
method: 'GET',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
token: 'token_test',
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
|
|
@ -19,7 +18,6 @@ export function getMemberDutyInfo(that: MainPage) {
|
|||
isInDuty: data.isInDuty,
|
||||
inDutyCnt: data.inDutyCnt,
|
||||
currentDuty: data.currentDuty,
|
||||
place: data.place,
|
||||
},
|
||||
inDutyCnt: data.inDutyCnt,
|
||||
});
|
||||
|
|
@ -29,7 +27,6 @@ export function getMemberDutyInfo(that: MainPage) {
|
|||
isInDuty: data.isInDuty,
|
||||
offDutyReason: data.offDutyReason,
|
||||
dutyRecoverTime: data.dutyRecoverTime,
|
||||
place: data.place,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
@ -41,7 +38,6 @@ export function getMemberDutyInfo(that: MainPage) {
|
|||
isInDuty: false,
|
||||
offDutyReason: '获取失败!Network Error!',
|
||||
dutyRecoverTime: '获取失败!Network Error!',
|
||||
place: '204',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import UserMemberPage from '@/pages/user/member/member';
|
||||
import Taro from '@tarojs/taro';
|
||||
import pt from '@/plain-text';
|
||||
import wechatUser, { UserInfo } from '@/wechat';
|
||||
import wechatUser from '@/wechat';
|
||||
import { getUrl } from '.';
|
||||
|
||||
export function memberLogin(that: UserMemberPage) {
|
||||
|
|
@ -12,7 +12,7 @@ export function memberLogin(that: UserMemberPage) {
|
|||
url: getUrl('/member/login'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
token: 'token_test',
|
||||
name: that.state.stuid,
|
||||
phone: that.state.passwd,
|
||||
},
|
||||
|
|
@ -22,22 +22,14 @@ export function memberLogin(that: UserMemberPage) {
|
|||
that.setState({
|
||||
isLoading: false,
|
||||
});
|
||||
if (res.data.success) {
|
||||
Taro.atMessage({
|
||||
message: pt.get().button.loginText.success,
|
||||
type: 'success',
|
||||
});
|
||||
wechatUser.setInfo(res.data.data as UserInfo);
|
||||
wechatUser.setAccess(true);
|
||||
Taro.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
url: '/pages/member/member',
|
||||
});
|
||||
} else {
|
||||
Taro.atMessage({
|
||||
message: pt.get().button.loginText.fail,
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
|
|
@ -59,7 +51,7 @@ export function memberLogout(that: UserMemberPage) {
|
|||
url: getUrl('/member/logout'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
token: 'token_test',
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import { TicketListItem } from '@/components/TicketListItem/TicketListItem';
|
|||
import Taro from '@tarojs/taro';
|
||||
import moment from 'moment';
|
||||
import { FixStatus } from '@/common';
|
||||
import wechatUser from '@/wechat';
|
||||
import { getUrl } from '.';
|
||||
|
||||
export function getMyTicketList(that: MyTicketPage) {
|
||||
|
|
@ -11,7 +10,7 @@ export function getMyTicketList(that: MyTicketPage) {
|
|||
url: getUrl('/user/mytickets'),
|
||||
method: 'GET',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
token: 'token_test',
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import TicketDetail from '@/pages/TicketDetail/TicketDetail';
|
||||
import Taro from '@tarojs/taro';
|
||||
import pt from '@/plain-text';
|
||||
import wechatUser from '@/wechat';
|
||||
import { getUrl } from '.';
|
||||
|
||||
const reLaunchInterval = 1000;
|
||||
|
|
@ -14,7 +13,7 @@ export function pickTicket(that: TicketDetail) {
|
|||
url: getUrl('/tickets/pick'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
token: 'token_test',
|
||||
id: that.state.id,
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import ReportPage from '@/pages/user/report/report';
|
||||
import Taro from '@tarojs/taro';
|
||||
import pt from '@/plain-text';
|
||||
import wechatUser from '@/wechat';
|
||||
import { getUrl } from '.';
|
||||
|
||||
export function reportMessage(that: ReportPage) {
|
||||
|
|
@ -12,7 +11,7 @@ export function reportMessage(that: ReportPage) {
|
|||
url: getUrl('/report'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
token: 'token_test',
|
||||
report: that.state.report,
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import TicketDetail from '@/pages/TicketDetail/TicketDetail';
|
||||
import Taro from '@tarojs/taro';
|
||||
import pt from '@/plain-text';
|
||||
import wechatUser from '@/wechat';
|
||||
import { getUrl } from '.';
|
||||
|
||||
const reLaunchInterval = 1000;
|
||||
|
|
@ -14,7 +13,7 @@ export function retrieve(that: TicketDetail) {
|
|||
url: getUrl('/tickets/retrieve'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
token: 'token_test',
|
||||
id: that.state.id,
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import TicketDetail from '@/pages/TicketDetail/TicketDetail';
|
||||
import Taro from '@tarojs/taro';
|
||||
import pt from '@/plain-text';
|
||||
import wechatUser from '@/wechat';
|
||||
import { getUrl } from '.';
|
||||
|
||||
const reLaunchInterval = 1000;
|
||||
|
|
@ -14,7 +13,7 @@ export function submitComment(that: TicketDetail) {
|
|||
url: getUrl('/report'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
token: 'token_test',
|
||||
comment: that.state.comment,
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import RepairPage from '@/pages/repair/repair';
|
||||
import Taro from '@tarojs/taro';
|
||||
import pt from '@/plain-text';
|
||||
import wechatUser, { UserInfo } from '@/wechat';
|
||||
import { defaultAvatar, tmplIds } from '@/common';
|
||||
import { getUrl } from '.';
|
||||
|
||||
const relaunchInterval = 1000;
|
||||
|
|
@ -11,40 +9,11 @@ export function submitTicket(that: RepairPage) {
|
|||
that.setState({
|
||||
isLoading: true,
|
||||
});
|
||||
if (!wechatUser.getAccess()) {
|
||||
const userInfo = wechatUser.getInfo();
|
||||
if (userInfo.name == '' || userInfo.phone == '') {
|
||||
Taro.request({
|
||||
url: getUrl('/user/update'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
name: that.state.owner,
|
||||
phone: that.state.phone,
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
const userTicketInfo: UserInfo = {
|
||||
name: that.state.owner,
|
||||
phone: that.state.phone,
|
||||
avatar: defaultAvatar,
|
||||
};
|
||||
wechatUser.setInfo(userTicketInfo);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
Taro.atMessage({
|
||||
message: pt.get().button.submitText.error + err.toString(),
|
||||
type: 'error',
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
Taro.request({
|
||||
url: getUrl('/tickets/create'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
token: 'token_test',
|
||||
type: that.state.type,
|
||||
device: that.state.device,
|
||||
deviceModel: that.state.deviceModel,
|
||||
|
|
@ -63,23 +32,11 @@ export function submitTicket(that: RepairPage) {
|
|||
message: pt.get().button.submitText.success,
|
||||
type: 'success',
|
||||
});
|
||||
Taro.requestSubscribeMessage({
|
||||
tmplIds: tmplIds,
|
||||
success: function (re) {
|
||||
console.log(re);
|
||||
},
|
||||
fail: function (err) {
|
||||
console.log(err);
|
||||
},
|
||||
complete: function () {
|
||||
setTimeout(() => {
|
||||
Taro.reLaunch({
|
||||
url: '/pages/repair/repair',
|
||||
});
|
||||
}, relaunchInterval);
|
||||
},
|
||||
entityIds: tmplIds,
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
|
|
|
|||
|
|
@ -2,21 +2,8 @@ import { TicketInfo, TicketNote } from '@/pages/TicketDetail/TicketNote';
|
|||
import DetailFramework from '@/components/DetailFramework/DetailFramework';
|
||||
import Taro from '@tarojs/taro';
|
||||
import moment from 'moment';
|
||||
import { FixStatus } from '@/common';
|
||||
import pt from '@/plain-text';
|
||||
import { getUrl } from '.';
|
||||
|
||||
const mapStatusStep: Map<FixStatus, 0 | 1 | 2 | 3> = new Map([
|
||||
[0, 0],
|
||||
[1, 1],
|
||||
[2, 2],
|
||||
[3, 3],
|
||||
[4, 2],
|
||||
[5, 3],
|
||||
[6, 2],
|
||||
[7, 3],
|
||||
]);
|
||||
|
||||
export function getTicketInfo(that: DetailFramework, id: number) {
|
||||
Taro.request({
|
||||
url: getUrl('/tickets/info'),
|
||||
|
|
@ -37,7 +24,6 @@ export function getTicketInfo(that: DetailFramework, id: number) {
|
|||
id: data.id,
|
||||
type: data.type,
|
||||
device: data.device,
|
||||
workers: data.workers,
|
||||
deviceModel: data.deviceModel,
|
||||
description: data.description,
|
||||
createdTime: moment(data.createdTime as string),
|
||||
|
|
@ -48,31 +34,19 @@ export function getTicketInfo(that: DetailFramework, id: number) {
|
|||
},
|
||||
};
|
||||
const notes: Array<TicketNote> = [];
|
||||
data.notes.map(
|
||||
(item: {
|
||||
avatar: string;
|
||||
id: number;
|
||||
op: string;
|
||||
type: 0 | 1 | 2;
|
||||
content: string;
|
||||
createdTime: string;
|
||||
}) => {
|
||||
data.notes.map((item) => {
|
||||
notes.push({
|
||||
avatar: item.avatar,
|
||||
id: item.id,
|
||||
op: item.op,
|
||||
type: item.type,
|
||||
content: item.content,
|
||||
createdTime: moment(item.createdTime as string),
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
that.setState({
|
||||
ticketInfo: ticketDetail,
|
||||
notes: notes,
|
||||
rs: former.trans(true),
|
||||
current: mapStatusStep.get(data.status) || 0,
|
||||
items: pt.get().ticketDetail.stepItems,
|
||||
});
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
import MainPage from '@/pages/index';
|
||||
import MemberPage from '@/pages/member/member';
|
||||
import Taro from '@tarojs/taro';
|
||||
import { TicketListItem } from '@/components/TicketListItem/TicketListItem';
|
||||
import moment from 'moment';
|
||||
import wechatUser from '@/wechat';
|
||||
import { getUrl } from '.';
|
||||
|
||||
export function getUncompletedTicketList(that: MainPage) {
|
||||
export function getUncompletedTicketList(that: MemberPage) {
|
||||
Taro.request({
|
||||
url: getUrl('/tickets/uncompleted'),
|
||||
method: 'GET',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
token: 'token_test',
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import InformPage from '@/pages/user/inform/inform';
|
||||
import Taro from '@tarojs/taro';
|
||||
import pt from '@/plain-text';
|
||||
import wechatUser from '@/wechat';
|
||||
import { getUrl } from '.';
|
||||
|
||||
export function updateUserInfo(that: InformPage) {
|
||||
|
|
@ -12,7 +11,7 @@ export function updateUserInfo(that: InformPage) {
|
|||
url: getUrl('/user/update'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
token: wechatUser.getToken(),
|
||||
token: 'token_test',
|
||||
name: that.state.name,
|
||||
phone: that.state.phone,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,22 +1,11 @@
|
|||
import { defaultAvatar } from '@/common';
|
||||
|
||||
export interface UserInfo {
|
||||
name: string;
|
||||
phone: string;
|
||||
avatar: string;
|
||||
}
|
||||
|
||||
class WechatUser {
|
||||
private userInfo: UserInfo;
|
||||
private userInfo: any;
|
||||
private isMember: boolean;
|
||||
private token: string;
|
||||
hasUserInfo: boolean;
|
||||
|
||||
constructor() {
|
||||
this.userInfo = {
|
||||
name: '',
|
||||
phone: '',
|
||||
avatar: defaultAvatar,
|
||||
};
|
||||
this.userInfo = '';
|
||||
this.hasUserInfo = false;
|
||||
this.isMember = false;
|
||||
}
|
||||
|
||||
|
|
@ -28,21 +17,14 @@ class WechatUser {
|
|||
return this.userInfo;
|
||||
}
|
||||
|
||||
getToken() {
|
||||
return this.token;
|
||||
}
|
||||
|
||||
setInfo(userInfo: UserInfo) {
|
||||
setInfo(userInfo: any) {
|
||||
this.userInfo = userInfo;
|
||||
this.hasUserInfo = true;
|
||||
}
|
||||
|
||||
setAccess(isMember: boolean) {
|
||||
this.isMember = isMember;
|
||||
}
|
||||
|
||||
setToken(token: string) {
|
||||
this.token = token;
|
||||
}
|
||||
}
|
||||
|
||||
const wechatUser = new WechatUser();
|
||||
|
|
|
|||
Loading…
Reference in New Issue