Compare commits
No commits in common. "a7fd2b2856f9f6b7f8678b95c09883ec735458d6" and "229dffa9a1ae1c878a6db36cc055433aab88e39d" have entirely different histories.
a7fd2b2856
...
229dffa9a1
1
.env.dev
1
.env.dev
|
|
@ -1,3 +1,4 @@
|
|||
# 配置文档参考 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"
|
||||
|
|
@ -1,2 +1,3 @@
|
|||
TARO_APP_ID="wx636eb7cf2b84f305"
|
||||
TARO_APP_API=""
|
||||
TARO_APP_API_OREO=""
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
.eslintignore
|
||||
**/.gitignore
|
||||
dist/
|
||||
deploy_versions/
|
||||
|
|
|
|||
226
doc/api.md
226
doc/api.md
|
|
@ -1,226 +0,0 @@
|
|||
# 接口文档
|
||||
|
||||
## 基本格式
|
||||
|
||||
### 成功响应格式
|
||||
|
||||
```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
|
||||
}
|
||||
```
|
||||
|
|
@ -97,7 +97,6 @@
|
|||
"webpack": "5.78.0"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.ts": "prettier --write",
|
||||
"*.tsx": "prettier --write"
|
||||
"*": "prettier --write"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ export default defineAppConfig({
|
|||
'pages/user/user',
|
||||
'pages/user/myTicket/myTicket',
|
||||
'pages/user/inform/inform',
|
||||
'pages/user/about/about',
|
||||
'pages/user/settings/settings',
|
||||
'pages/user/settings/about/about',
|
||||
'pages/user/report/report',
|
||||
],
|
||||
window: {
|
||||
|
|
|
|||
|
|
@ -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="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>
|
||||
|
Before Width: | Height: | Size: 710 B |
|
|
@ -1,6 +1,6 @@
|
|||
import { Component, ReactNode } from 'react';
|
||||
import { View } from '@tarojs/components';
|
||||
import './about.scss';
|
||||
import { View } from '@tarojs/components';
|
||||
|
||||
export default class SettingsPage extends Component {
|
||||
render(): ReactNode {
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
export default definePageConfig({
|
||||
navigationBarTitleText: '设置',
|
||||
usingComponents: {},
|
||||
});
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
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>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +1,13 @@
|
|||
import { AtList, AtListItem } from 'taro-ui';
|
||||
import { View } from '@tarojs/components';
|
||||
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 aboutIcon from '@/assets/icons/AboutPage/about.svg';
|
||||
import pt, { Lang } from '@/plain-text';
|
||||
import pt 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() {
|
||||
|
|
@ -25,21 +16,6 @@ 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',
|
||||
|
|
@ -52,15 +28,15 @@ export default class UserPage extends Component {
|
|||
});
|
||||
}
|
||||
|
||||
reportPage() {
|
||||
settingsPage() {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/user/report/report',
|
||||
url: '/pages/user/settings/settings',
|
||||
});
|
||||
}
|
||||
|
||||
aboutPage() {
|
||||
reportPage() {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/user/about/about',
|
||||
url: '/pages/user/report/report',
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -72,44 +48,32 @@ export default class UserPage extends Component {
|
|||
title={pt.get().userPage.ticketColumn.title}
|
||||
note={pt.get().userPage.ticketColumn.note}
|
||||
arrow='right'
|
||||
iconInfo={{ color: '#E69966', value: 'clock' }}
|
||||
iconInfo={{ size: 25, 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={{ size: 25, 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={{ color: '#9ACD32', value: 'message' }}
|
||||
iconInfo={{ size: 25, 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>
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
export interface AboutPageText {}
|
||||
|
||||
export const aboutPageZhCn: AboutPageText = {};
|
||||
|
||||
export const aboutPageEnUs: AboutPageText = {};
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
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',
|
||||
};
|
||||
|
|
@ -17,10 +17,6 @@ export interface UserPageText {
|
|||
title: string;
|
||||
note: string;
|
||||
};
|
||||
aboutColumn: {
|
||||
title: string;
|
||||
note: string;
|
||||
};
|
||||
}
|
||||
|
||||
export const userPageZhCn: UserPageText = {
|
||||
|
|
@ -42,10 +38,6 @@ export const userPageZhCn: UserPageText = {
|
|||
title: '意见反馈',
|
||||
note: '有什么想说的都可以告诉亦可哦!',
|
||||
},
|
||||
aboutColumn: {
|
||||
title: '关于我们',
|
||||
note: '查看开发者信息',
|
||||
},
|
||||
};
|
||||
|
||||
export const userPageEnUs: UserPageText = {
|
||||
|
|
@ -67,8 +59,4 @@ export const userPageEnUs: UserPageText = {
|
|||
title: '意见反馈',
|
||||
note: '有什么想说的都可以告诉亦可哦!',
|
||||
},
|
||||
aboutColumn: {
|
||||
title: '关于我们',
|
||||
note: '查看开发者信息',
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,18 +2,22 @@ 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 = {
|
||||
|
|
@ -21,9 +25,9 @@ const textZhCn: TextRecord = {
|
|||
mainPage: mainPageZhCn,
|
||||
userPage: userPageZhCn,
|
||||
tabBar: tabBarZhCn,
|
||||
settingsPage: settingsPageZhCn,
|
||||
reportPage: reportPageZhCn,
|
||||
informPage: informPageZhCn,
|
||||
aboutPage: aboutPageZhCn,
|
||||
};
|
||||
|
||||
const textEnUs: TextRecord = {
|
||||
|
|
@ -31,9 +35,9 @@ const textEnUs: TextRecord = {
|
|||
mainPage: mainPageEnUs,
|
||||
userPage: userPageEnUs,
|
||||
tabBar: tabBarEnUs,
|
||||
settingsPage: settingsPageEnUs,
|
||||
reportPage: reportPageEnUs,
|
||||
informPage: informtPageEnUs,
|
||||
aboutPage: aboutPageEnUs,
|
||||
};
|
||||
|
||||
// type Lang = 'zh_CN' | 'en_US' | ...;
|
||||
|
|
|
|||
|
|
@ -39,3 +39,22 @@ 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 '';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue