Compare commits

..

5 Commits

Author SHA1 Message Date
FrozenArcher a7fd2b2856 Merge branch 'yhy' into dev
merge api doc into dev
2024-03-08 00:04:20 +08:00
FrozenArcher 0baf91fadf add api doc 2024-03-08 00:01:32 +08:00
Dawn_Ocean c756e74778 remove oreo id from service 2024-03-07 23:54:59 +08:00
Dawn_Ocean 133d60375a remove settings page 2024-03-07 23:50:32 +08:00
Dawn_Ocean bea23f4705 move about page to user page 2024-03-07 21:47:16 +08:00
19 changed files with 311 additions and 141 deletions

View File

@ -1,4 +1,3 @@
# 配置文档参考 https://taro-docs.jd.com/docs/next/env-mode-config
TARO_APP_ID="wx636eb7cf2b84f305"
TARO_APP_API="http://127.0.0.1:9527"
TARO_APP_API_OREO="http://127.0.0.1:9527"

View File

@ -1,3 +1,2 @@
TARO_APP_ID="wx636eb7cf2b84f305"
TARO_APP_API=""
TARO_APP_API_OREO=""

View File

@ -1,3 +1,4 @@
.eslintignore
**/.gitignore
dist/
deploy_versions/

226
doc/api.md 100644
View File

@ -0,0 +1,226 @@
# 接口文档
## 基本格式
### 成功响应格式
```json
{
"success": true,
"data": {
"foo": "bar"
}
}
```
**NOTE:** 若无特殊说明,`POST`请求的响应`data`字段为空(`{}`),可以不用管。
### 失败响应格式
```json
{
"success": false,
"err": "some error"
}
```
### `GET`请求默认格式(若无特殊说明)
```json
{
"token": "token_test"
}
```
## 主页面
### 值班信息 `GET /dutyinfo`
#### 当前在值班
data:
```json
{
"isInDuty": true,
"inDutyCnt": 3,
"currentDuty": "2"
}
```
#### 当前未值班
data:
```json
{
"isInDuty": false,
"offDutyReason": "学园维修",
"dutyRecoverTime": "下周一"
}
```
## 用户页面
### 个人信息 `GET /user/info`
data:
```json
{
"name": "马保国",
"phone": "13333333333"
}
```
### 修改个人信息 `POST /user/update`
Request body:
```json
{
"name": "宇航员",
"phone": "1233333210"
}
```
### 本地化设置
#### 获取本地化设置 `GET /user/locale/get`
data:
```json
{
"lang": "zh_CN"
}
```
#### 更新本地化设置 `POST /user/locale/update`
Request body:
```json
{
"lang": "en_US"
}
```
### 意见反馈 `POST /report`
Request body:
```json
{
"token": "token_test",
"content": "aaa bbbb ccccc"
}
```
### 我的工单(查询)`GET /user/mytickets`
data (same as oreo):
```json
{
"list": [
{
"id": 6830,
"type": 1,
"status": 5,
"device": "主机",
"deviceModel": "技嘉",
"owner": "武技栏",
"phone": "18888888888",
"createdTime": "2024-03-06T19:49:27.043865",
"isConfirmed": false
}
]
}
```
## 工单详情
### 创建评论 `POST /tickets/newcomment/{id}`
Request
```json
{
"content": "这是一条评论",
"token": "token_test"
}
```
### 创建工单 `POST /tickets/create`
Request
```json
{
"token": "token_test",
"type": 1, // 电器是0电脑是1(bushi)
"device": "华硕",
"deviceModel": "天选3",
"owner": "西西弗",
"phone": "12333333333",
"description": "没法用pd充电",
"accessories": [0]
}
```
### 工单信息 `GET /tickets/info/{id}`
data (same as oreo):
```json
{
"id": 6847,
"type": 1,
"device": "华硕",
"deviceModel": "灵耀X14",
"owner": "唐姐姐",
"phone": "15555555555",
"description": "清灰",
"workers": [],
"createdTime": "2024-03-07T19:52:48.523303",
"status": 5,
"isConfirmed": false,
"notes": [
{
"avatar": "https://....jpg",
"id": 21368,
"op": "宇航员",
"type": 0,
"content": "",
"createdTime": "2024-03-07T19:52:48.523305"
},
{
"avatar": "https://....jpg",
"id": 21370,
"op": "宇航员",
"type": 2,
"content": "1",
"createdTime": "2024-03-07T19:58:27.838816"
},
{
"avatar": "https://....jpg",
"id": 21373,
"op": "宇航员",
"type": 2,
"content": "4",
"createdTime": "2024-03-07T20:28:12.070707"
},
{
"avatar": "https://....jpg",
"id": 21374,
"op": "宇航员",
"type": 2,
"content": "5",
"createdTime": "2024-03-07T20:30:15.770486"
}
],
"accessories": [2],
"picked": false
}
```

View File

@ -97,6 +97,7 @@
"webpack": "5.78.0"
},
"lint-staged": {
"*": "prettier --write"
"*.ts": "prettier --write",
"*.tsx": "prettier --write"
}
}

View File

@ -5,8 +5,7 @@ export default defineAppConfig({
'pages/user/user',
'pages/user/myTicket/myTicket',
'pages/user/inform/inform',
'pages/user/settings/settings',
'pages/user/settings/about/about',
'pages/user/about/about',
'pages/user/report/report',
],
window: {

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="1709817911051" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4420" width="24" height="24" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M523.52 965.12a448 448 0 1 1 448-448 448 448 0 0 1-448 448z m0-832a384 384 0 1 0 384 384 384 384 0 0 0-384-384z" p-id="4421" fill="#c89bc7"></path><path d="M523.52 772.16a32 32 0 0 1-32-32V448a32 32 0 0 1 64 0v292.8a32 32 0 0 1-32 31.36z" p-id="4422" fill="#c89bc7"></path><path d="M523.52 293.12m-48 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0Z" p-id="4423" fill="#c89bc7"></path></svg>

After

Width:  |  Height:  |  Size: 710 B

View File

@ -1,6 +1,6 @@
import { Component, ReactNode } from 'react';
import './about.scss';
import { View } from '@tarojs/components';
import './about.scss';
export default class SettingsPage extends Component {
render(): ReactNode {

View File

@ -1,4 +0,0 @@
export default definePageConfig({
navigationBarTitleText: '设置',
usingComponents: {},
});

View File

@ -1,68 +0,0 @@
import { AtButton, AtList, AtListItem } from 'taro-ui';
import { Component, ReactNode } from 'react';
import Taro from '@tarojs/taro';
import { View, Picker } from '@tarojs/components';
import pt, { Lang } from '@/plain-text';
import './settings.scss';
export default class SettingsPage extends Component {
state = {
selector: ['简体中文', 'English'],
selectorChecked: {
zh_CN: '简体中文',
en_US: 'English',
}[pt.getCurLang()],
};
showLangDict: Record<string, Lang> = {
: 'zh_CN',
English: 'en_US',
};
onSelect = (e: { detail: { value: string | number } }) => {
this.setState({
selectorChecked: this.state.selector[e.detail.value],
});
pt.setLang(this.showLangDict[this.state.selector[e.detail.value]]);
Taro.reLaunch({
url: '/pages/index/index',
});
};
handleQuit() {
console.log('Quit');
}
handleAbout() {
Taro.navigateTo({
url: '/pages/user/settings/about/about',
});
}
render(): ReactNode {
return (
<View>
<View>
<Picker
mode='selector'
range={this.state.selector}
onChange={this.onSelect}
>
<AtList>
<AtListItem
title='语言 / Language'
extraText={this.state.selectorChecked}
/>
</AtList>
</Picker>
</View>
<AtButton type='secondary' onClick={this.handleAbout.bind(this)}>
{pt.get().settingsPage.aboutText}
</AtButton>
<AtButton type='primary' onClick={this.handleQuit.bind(this)}>
{pt.get().settingsPage.quitText}
</AtButton>
</View>
);
}
}

View File

@ -1,13 +1,22 @@
import { View } from '@tarojs/components';
import { AtList, AtListItem } from 'taro-ui';
import { Component, ReactNode } from 'react';
import { View, Picker } from '@tarojs/components';
import Taro from '@tarojs/taro';
import type CustomTabBar from '@/custom-tab-bar';
import { AtList, AtListItem } from 'taro-ui';
import PageFooter from '@/components/PageFooter/PageFooter';
import pt from '@/plain-text';
import aboutIcon from '@/assets/icons/AboutPage/about.svg';
import pt, { Lang } from '@/plain-text';
import './user.scss';
export default class UserPage extends Component {
state = {
selector: ['简体中文', 'English'],
selectorChecked: {
zh_CN: '简体中文',
en_US: 'English',
}[pt.getCurLang()],
};
// 以下是TabBar相关
pageCtx = Taro.getCurrentInstance().page;
componentDidShow() {
@ -16,6 +25,21 @@ export default class UserPage extends Component {
}
// 以上是TabBar相关
showLangDict: Record<string, Lang> = {
: 'zh_CN',
English: 'en_US',
};
onSelect = (e: { detail: { value: string | number } }) => {
this.setState({
selectorChecked: this.state.selector[e.detail.value],
});
pt.setLang(this.showLangDict[this.state.selector[e.detail.value]]);
Taro.reLaunch({
url: '/pages/user/user',
});
};
myTicketPage() {
Taro.navigateTo({
url: '/pages/user/myTicket/myTicket',
@ -28,18 +52,18 @@ export default class UserPage extends Component {
});
}
settingsPage() {
Taro.navigateTo({
url: '/pages/user/settings/settings',
});
}
reportPage() {
Taro.navigateTo({
url: '/pages/user/report/report',
});
}
aboutPage() {
Taro.navigateTo({
url: '/pages/user/about/about',
});
}
render(): ReactNode {
return (
<View>
@ -48,32 +72,44 @@ export default class UserPage extends Component {
title={pt.get().userPage.ticketColumn.title}
note={pt.get().userPage.ticketColumn.note}
arrow='right'
iconInfo={{ size: 25, 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={{ size: 25, color: '#78A4FA', value: 'user' }}
iconInfo={{ color: '#78A4FA', value: 'user' }}
onClick={this.informPage}
/>
<AtListItem
title={pt.get().userPage.settingsColumn.title}
note={pt.get().userPage.settingsColumn.note}
extraText=''
arrow='right'
iconInfo={{ size: 25, color: '#808080', value: 'filter' }}
onClick={this.settingsPage}
/>
<AtListItem
title={pt.get().userPage.reportColumn.title}
note={pt.get().userPage.reportColumn.note}
extraText=''
arrow='right'
iconInfo={{ size: 25, color: '#9ACD32', value: 'message' }}
iconInfo={{ color: '#9ACD32', value: 'message' }}
onClick={this.reportPage}
/>
<AtListItem
title={pt.get().userPage.aboutColumn.title}
note={pt.get().userPage.aboutColumn.note}
extraText=''
arrow='right'
thumb={aboutIcon}
onClick={this.aboutPage}
/>
<Picker
mode='selector'
range={this.state.selector}
onChange={this.onSelect}
>
<AtList>
<AtListItem
title='语言 / Language'
extraText={this.state.selectorChecked}
/>
</AtList>
</Picker>
</AtList>
<PageFooter />
</View>

View File

@ -0,0 +1,5 @@
export interface AboutPageText {}
export const aboutPageZhCn: AboutPageText = {};
export const aboutPageEnUs: AboutPageText = {};

View File

@ -1,14 +0,0 @@
export interface SettingsPageText {
aboutText: string;
quitText: string;
}
export const settingsPageZhCn: SettingsPageText = {
aboutText: '关于 EVA Notify',
quitText: '退出账号',
};
export const settingsPageEnUs: SettingsPageText = {
aboutText: 'About EVA Notify',
quitText: 'Log Out',
};

View File

@ -17,6 +17,10 @@ export interface UserPageText {
title: string;
note: string;
};
aboutColumn: {
title: string;
note: string;
};
}
export const userPageZhCn: UserPageText = {
@ -38,6 +42,10 @@ export const userPageZhCn: UserPageText = {
title: '意见反馈',
note: '有什么想说的都可以告诉亦可哦!',
},
aboutColumn: {
title: '关于我们',
note: '查看开发者信息',
},
};
export const userPageEnUs: UserPageText = {
@ -59,4 +67,8 @@ export const userPageEnUs: UserPageText = {
title: '意见反馈',
note: '有什么想说的都可以告诉亦可哦!',
},
aboutColumn: {
title: '关于我们',
note: '查看开发者信息',
},
};

View File

@ -2,22 +2,18 @@ import { PageFooterText, pageFooterZhCn, pageFooterEnUs } from './PageFooter';
import { MainPageText, mainPageZhCn, mainPageEnUs } from './MainPage';
import { UserPageText, userPageZhCn, userPageEnUs } from './UserPage';
import { TabBarText, tabBarEnUs, tabBarZhCn } from './TabBar';
import {
SettingsPageText,
settingsPageEnUs,
settingsPageZhCn,
} from './SettingsPage';
import { ReportPageText, reportPageEnUs, reportPageZhCn } from './ReportPage';
import { InformPageText, informPageZhCn, informtPageEnUs } from './InformPage';
import { AboutPageText, aboutPageEnUs, aboutPageZhCn } from './AboutPage';
interface TextRecord {
pageFooter: PageFooterText;
mainPage: MainPageText;
userPage: UserPageText;
tabBar: TabBarText;
settingsPage: SettingsPageText;
reportPage: ReportPageText;
informPage: InformPageText;
aboutPage: AboutPageText;
}
const textZhCn: TextRecord = {
@ -25,9 +21,9 @@ const textZhCn: TextRecord = {
mainPage: mainPageZhCn,
userPage: userPageZhCn,
tabBar: tabBarZhCn,
settingsPage: settingsPageZhCn,
reportPage: reportPageZhCn,
informPage: informPageZhCn,
aboutPage: aboutPageZhCn,
};
const textEnUs: TextRecord = {
@ -35,9 +31,9 @@ const textEnUs: TextRecord = {
mainPage: mainPageEnUs,
userPage: userPageEnUs,
tabBar: tabBarEnUs,
settingsPage: settingsPageEnUs,
reportPage: reportPageEnUs,
informPage: informtPageEnUs,
aboutPage: aboutPageEnUs,
};
// type Lang = 'zh_CN' | 'en_US' | ...;

View File

@ -39,22 +39,3 @@ export function getUrl(path: string): string {
return '';
}
}
/**
* Get URL of Oreo backend
* @param path Relative path to base url, begins with `/`
* @returns Full url
*
* @example
* // see example of `getUrl`
*/
export function getUrlOreo(path: string): string {
const baseUrlOreo = process.env.TARO_APP_API_OREO;
// console.log('buo:', baseUrlOreo);
if (baseUrlOreo) {
return baseUrlOreo + path;
} else {
console.log('env TARO_APP_API_OREO is undefined');
return '';
}
}