Compare commits
4
Commits
yhy
..
2d5ce655ef
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d5ce655ef | ||
|
|
5614ce5818 | ||
|
|
fc3ef61e5d | ||
|
|
60f10eaa8f |
+8
-2
@@ -3,7 +3,7 @@ import ticketInfo from './ticketInfo.json';
|
|||||||
import uncompleted from './uncompleted.json';
|
import uncompleted from './uncompleted.json';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
'GET /dutyinfo': {
|
'GET /duty/info': {
|
||||||
success: true,
|
success: true,
|
||||||
data: {
|
data: {
|
||||||
token: 'token_test',
|
token: 'token_test',
|
||||||
@@ -50,10 +50,16 @@ export default {
|
|||||||
data: {},
|
data: {},
|
||||||
},
|
},
|
||||||
'POST /member/login': {
|
'POST /member/login': {
|
||||||
data: {},
|
success: true,
|
||||||
|
data: {
|
||||||
|
isMember: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
'GET /member/tickets/uncompleted': {
|
'GET /member/tickets/uncompleted': {
|
||||||
success: true,
|
success: true,
|
||||||
data: uncompleted,
|
data: uncompleted,
|
||||||
},
|
},
|
||||||
|
'POST /member/logout': {
|
||||||
|
success: true,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { Component, ReactNode } from 'react';
|
|||||||
import NoteCard from '@/components/NoteCard/NoteCard';
|
import NoteCard from '@/components/NoteCard/NoteCard';
|
||||||
import { TicketNote } from '@/pages/TicketDetail/TicketNote';
|
import { TicketNote } from '@/pages/TicketDetail/TicketNote';
|
||||||
import { View } from '@tarojs/components';
|
import { View } from '@tarojs/components';
|
||||||
|
import { AtDivider } from 'taro-ui';
|
||||||
|
|
||||||
interface NoteListProps {
|
interface NoteListProps {
|
||||||
noteList: Array<TicketNote>;
|
noteList: Array<TicketNote>;
|
||||||
@@ -14,6 +15,7 @@ export default class NoteList extends Component<NoteListProps, {}> {
|
|||||||
render(): ReactNode {
|
render(): ReactNode {
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
|
<AtDivider />
|
||||||
{this.props.noteList.map((note, idx) => (
|
{this.props.noteList.map((note, idx) => (
|
||||||
<View key={idx}>
|
<View key={idx}>
|
||||||
<NoteCard note={note} />
|
<NoteCard note={note} />
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export class TicketListItem {
|
|||||||
status: FixStatus;
|
status: FixStatus;
|
||||||
createAt: moment.Moment;
|
createAt: moment.Moment;
|
||||||
iconMap: Map<FixStatus, string>;
|
iconMap: Map<FixStatus, string>;
|
||||||
|
isMember: boolean;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
id: number,
|
id: number,
|
||||||
@@ -22,12 +23,14 @@ export class TicketListItem {
|
|||||||
model: string,
|
model: string,
|
||||||
status: FixStatus,
|
status: FixStatus,
|
||||||
createAt: moment.Moment,
|
createAt: moment.Moment,
|
||||||
|
isMember: boolean,
|
||||||
) {
|
) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.brand = brand;
|
this.brand = brand;
|
||||||
this.model = model;
|
this.model = model;
|
||||||
this.status = status;
|
this.status = status;
|
||||||
this.createAt = createAt;
|
this.createAt = createAt;
|
||||||
|
this.isMember = isMember;
|
||||||
this.iconMap = new Map<FixStatus, string>([
|
this.iconMap = new Map<FixStatus, string>([
|
||||||
[1, repair],
|
[1, repair],
|
||||||
[2, repair],
|
[2, repair],
|
||||||
@@ -48,7 +51,11 @@ export class TicketListItem {
|
|||||||
thumb={this.iconMap.get(this.status)}
|
thumb={this.iconMap.get(this.status)}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: '/pages/TicketDetail/TicketDetail?id=' + this.id,
|
url:
|
||||||
|
'/pages/TicketDetail/TicketDetail?id=' +
|
||||||
|
this.id +
|
||||||
|
'&isMember=' +
|
||||||
|
this.isMember,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import wechatUser from '@/wechat';
|
|||||||
import 'taro-ui/dist/style/index.scss';
|
import 'taro-ui/dist/style/index.scss';
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
|
|
||||||
const navList: Array<Taro.TabBarItem> = [
|
const navList: () => Array<Taro.TabBarItem> = () => {
|
||||||
|
return wechatUser.getAccess()
|
||||||
|
? [
|
||||||
{
|
{
|
||||||
pagePath: '/pages/index/index',
|
pagePath: '/pages/index/index',
|
||||||
text: pt.get().tabBar.indexText,
|
text: pt.get().tabBar.indexText,
|
||||||
@@ -23,12 +25,25 @@ const navList: Array<Taro.TabBarItem> = [
|
|||||||
pagePath: '/pages/user/user',
|
pagePath: '/pages/user/user',
|
||||||
text: pt.get().tabBar.userText,
|
text: pt.get().tabBar.userText,
|
||||||
},
|
},
|
||||||
];
|
]
|
||||||
|
: [
|
||||||
|
{
|
||||||
|
pagePath: '/pages/index/index',
|
||||||
|
text: pt.get().tabBar.indexText,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pagePath: '/pages/repair/repair',
|
||||||
|
text: pt.get().tabBar.repairText,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pagePath: '/pages/user/user',
|
||||||
|
text: pt.get().tabBar.userText,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
export default class Index extends Component {
|
const tabList = () => {
|
||||||
state = {
|
return wechatUser.getAccess()
|
||||||
selected: 0,
|
|
||||||
tabList: wechatUser.getAccess()
|
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
title: pt.get().tabBar.indexText,
|
title: pt.get().tabBar.indexText,
|
||||||
@@ -60,11 +75,16 @@ export default class Index extends Component {
|
|||||||
title: pt.get().tabBar.userText,
|
title: pt.get().tabBar.userText,
|
||||||
iconType: 'user',
|
iconType: 'user',
|
||||||
},
|
},
|
||||||
],
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
export default class Index extends Component {
|
||||||
|
state = {
|
||||||
|
selected: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
handleClick(idx: number) {
|
handleClick(idx: number) {
|
||||||
this.switchTab(idx, navList[idx].pagePath);
|
this.switchTab(idx, navList()[idx].pagePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
switchTab(idx: number, url: string) {
|
switchTab(idx: number, url: string) {
|
||||||
@@ -82,7 +102,7 @@ export default class Index extends Component {
|
|||||||
return (
|
return (
|
||||||
<AtTabBar
|
<AtTabBar
|
||||||
fixed
|
fixed
|
||||||
tabList={this.state.tabList}
|
tabList={tabList()}
|
||||||
onClick={this.handleClick.bind(this)}
|
onClick={this.handleClick.bind(this)}
|
||||||
current={this.state.selected}
|
current={this.state.selected}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -8,23 +8,45 @@ import PageFooter from '@/components/PageFooter/PageFooter';
|
|||||||
|
|
||||||
interface TicketDetailState {
|
interface TicketDetailState {
|
||||||
id: number;
|
id: number;
|
||||||
|
isMember: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class TicketDetail extends Component<{}, TicketDetailState> {
|
export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
state: Readonly<TicketDetailState> = {
|
state: Readonly<TicketDetailState> = {
|
||||||
id: 0,
|
id: 0,
|
||||||
|
isMember: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount(): void {
|
componentDidMount(): void {
|
||||||
const { router } = getCurrentInstance();
|
const { router } = getCurrentInstance();
|
||||||
const id = router?.params.id as number;
|
const id = router?.params.id as number;
|
||||||
|
const isMember = router?.params.isMember as boolean;
|
||||||
this.setState({
|
this.setState({
|
||||||
id: id,
|
id: id,
|
||||||
|
isMember: isMember,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
render(): ReactNode {
|
render(): ReactNode {
|
||||||
const middleButton = (
|
const middleButton = this.state.isMember ? (
|
||||||
|
<View
|
||||||
|
className='at-row'
|
||||||
|
style={{ paddingTop: 10, paddingBottom: 10, width: '100%' }}
|
||||||
|
>
|
||||||
|
<View
|
||||||
|
className='at-col'
|
||||||
|
style={{ marginLeft: 10, paddingRight: 5, width: '50%' }}
|
||||||
|
>
|
||||||
|
<AtButton type='primary'>{pt.get().ticketDetail.addToOreo}</AtButton>
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
className='at-col'
|
||||||
|
style={{ marginRight: 10, paddingLeft: 5, width: '50%' }}
|
||||||
|
>
|
||||||
|
<AtButton type='secondary'>{pt.get().ticketDetail.addNote}</AtButton>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
) : (
|
||||||
<View
|
<View
|
||||||
className='at-row'
|
className='at-row'
|
||||||
style={{ paddingTop: 10, paddingBottom: 10, width: '100%' }}
|
style={{ paddingTop: 10, paddingBottom: 10, width: '100%' }}
|
||||||
|
|||||||
@@ -1,10 +1,33 @@
|
|||||||
import { View, Text } from '@tarojs/components';
|
import { View } from '@tarojs/components';
|
||||||
import { Component, ReactNode } from 'react';
|
import { Component, ReactNode } from 'react';
|
||||||
|
import { AtButton, AtCard, AtList } from 'taro-ui';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import type CustomTabBar from '../../custom-tab-bar';
|
import pt from '@/plain-text';
|
||||||
|
import { getUncompletedTicketList } from '@/service/uncompletedTicket';
|
||||||
|
import type CustomTabBar from '@/custom-tab-bar';
|
||||||
|
import { TicketListItem } from '@/components/TicketListItem/TicketListItem';
|
||||||
|
import { RequestState } from '@/service';
|
||||||
|
import moment from 'moment';
|
||||||
import './member.scss';
|
import './member.scss';
|
||||||
|
|
||||||
export default class MemberPage extends Component {
|
interface UncompletedTicketState {
|
||||||
|
fixList: Array<TicketListItem>;
|
||||||
|
rs: RequestState;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class MemberPage extends Component<{}, UncompletedTicketState> {
|
||||||
|
state = {
|
||||||
|
fixList: [new TicketListItem(0, '', '', 1, moment(), false)],
|
||||||
|
rs: new RequestState(),
|
||||||
|
};
|
||||||
|
|
||||||
|
componentDidMount(): void {
|
||||||
|
Taro.setNavigationBarTitle({
|
||||||
|
title: pt.get().navBar.user.member,
|
||||||
|
});
|
||||||
|
getUncompletedTicketList(this);
|
||||||
|
}
|
||||||
|
|
||||||
// 以下是TabBar相关
|
// 以下是TabBar相关
|
||||||
pageCtx = Taro.getCurrentInstance().page;
|
pageCtx = Taro.getCurrentInstance().page;
|
||||||
componentDidShow() {
|
componentDidShow() {
|
||||||
@@ -14,9 +37,16 @@ export default class MemberPage extends Component {
|
|||||||
// 以上是TabBar相关
|
// 以上是TabBar相关
|
||||||
|
|
||||||
render(): ReactNode {
|
render(): ReactNode {
|
||||||
|
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 (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<Text>Member Page</Text>
|
<AtList>{fixListRenderer}</AtList>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import type CustomTabBar from '@/custom-tab-bar';
|
|||||||
import repairLogo from '@/assets/icons/RepairPage/repair.svg';
|
import repairLogo from '@/assets/icons/RepairPage/repair.svg';
|
||||||
import DetailFramework from '@/components/DetailFramework/DetailFramework';
|
import DetailFramework from '@/components/DetailFramework/DetailFramework';
|
||||||
import { getCurrentTicket } from '@/service/currentTicket';
|
import { getCurrentTicket } from '@/service/currentTicket';
|
||||||
|
import { randomInt } from '@/utils/random';
|
||||||
import './repair.scss';
|
import './repair.scss';
|
||||||
|
|
||||||
interface RepairPageState {
|
interface RepairPageState {
|
||||||
@@ -29,7 +30,7 @@ interface RepairPageState {
|
|||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
isDisable: boolean;
|
isDisable: boolean;
|
||||||
checkedList: Array<number>;
|
checkedList: Array<number>;
|
||||||
currentTicketsId: Array<number>;
|
currentTicketsIdName: Array<Map<number, string>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const submitInterval = 5000;
|
const submitInterval = 5000;
|
||||||
@@ -56,11 +57,11 @@ export default class RepairPage extends Component<{}, RepairPageState> {
|
|||||||
isLoading: false,
|
isLoading: false,
|
||||||
isDisable: true,
|
isDisable: true,
|
||||||
checkedList: [0],
|
checkedList: [0],
|
||||||
currentTicketsId: [] as Array<number>,
|
currentTicketsIdName: [] as Array<Map<number, string>>,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount(): void {
|
componentDidMount(): void {
|
||||||
getCurrentTicket(this, middleButton, isInfoShow);
|
getCurrentTicket(this);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -162,16 +163,29 @@ export default class RepairPage extends Component<{}, RepairPageState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render(): ReactNode {
|
render(): ReactNode {
|
||||||
const ticketsRenderer = this.state.currentTicketsId.map((id, idx) => (
|
const ticketsRenderer = this.state.currentTicketsIdName.map((pair, idx) => (
|
||||||
<AtCard key={idx}>
|
<AtCard
|
||||||
|
key={idx}
|
||||||
|
title={pair.get(pair.keys()[0])} //pair.keys()[0] == id
|
||||||
|
extra={pt.get().repairPage.currentTicket.extra}
|
||||||
|
onClick={() => {
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: '/pages/TicketDetail/TicketDetail?id=' + pair.keys()[0],
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
note={
|
||||||
|
pt.get().tips.tipsText[
|
||||||
|
randomInt(0, pt.get().tips.tipsText.length - 1)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
>
|
||||||
<DetailFramework
|
<DetailFramework
|
||||||
id={id}
|
id={pair.keys()[0]}
|
||||||
isInfoShow={isInfoShow}
|
isInfoShow={isInfoShow}
|
||||||
middleButton={middleButton}
|
middleButton={middleButton}
|
||||||
/>
|
/>
|
||||||
</AtCard>
|
</AtCard>
|
||||||
));
|
));
|
||||||
console.log(ticketsRenderer);
|
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<AtMessage />
|
<AtMessage />
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import { Component, ReactNode } from 'react';
|
import { Component, ReactNode } from 'react';
|
||||||
import { AtForm, AtInput, AtButton, AtMessage } from 'taro-ui';
|
import { AtForm, AtInput, AtButton, AtMessage } from 'taro-ui';
|
||||||
import { getUrl } from '@/service';
|
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import pt from '@/plain-text';
|
import pt from '@/plain-text';
|
||||||
|
import { memberLogin, memberLogout } from '@/service/memberLogin';
|
||||||
|
import wechatUser from '@/wechat';
|
||||||
import './member.scss';
|
import './member.scss';
|
||||||
|
|
||||||
const loginInterval = 5000;
|
export default class UserMemberPage extends Component {
|
||||||
|
|
||||||
export default class MemberPage extends Component {
|
|
||||||
state = {
|
state = {
|
||||||
stuid: '',
|
stuid: '',
|
||||||
passwd: '',
|
passwd: '',
|
||||||
@@ -16,7 +15,7 @@ export default class MemberPage extends Component {
|
|||||||
};
|
};
|
||||||
componentDidMount(): void {
|
componentDidMount(): void {
|
||||||
Taro.setNavigationBarTitle({
|
Taro.setNavigationBarTitle({
|
||||||
title: pt.get().navBar.user.member,
|
title: pt.get().navBar.user.memberLogin,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
handleChangeStuid(stuid: string) {
|
handleChangeStuid(stuid: string) {
|
||||||
@@ -32,46 +31,15 @@ export default class MemberPage extends Component {
|
|||||||
return passwd;
|
return passwd;
|
||||||
}
|
}
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
this.setState({
|
memberLogin(this);
|
||||||
isLoading: true,
|
}
|
||||||
isDisable: true,
|
|
||||||
});
|
onLogout() {
|
||||||
console.log([this.state.stuid, this.state.passwd]);
|
memberLogout(this);
|
||||||
Taro.request({
|
|
||||||
url: getUrl('/member/login'),
|
|
||||||
method: 'POST',
|
|
||||||
data: {
|
|
||||||
token: 'token_test',
|
|
||||||
name: this.state.stuid,
|
|
||||||
passwd: this.state.passwd,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
console.log(res.data);
|
|
||||||
Taro.atMessage({
|
|
||||||
message: pt.get().button.loginText.success,
|
|
||||||
type: 'success',
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.log(err);
|
|
||||||
Taro.atMessage({
|
|
||||||
message: pt.get().button.loginText.error + err.toString(),
|
|
||||||
type: 'error',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
this.setState({
|
|
||||||
isLoading: false,
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
this.setState({
|
|
||||||
isDisable: false,
|
|
||||||
});
|
|
||||||
}, loginInterval);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render(): ReactNode {
|
render(): ReactNode {
|
||||||
return (
|
return !wechatUser.getAccess() ? (
|
||||||
<AtForm onSubmit={this.onSubmit.bind(this)}>
|
<AtForm onSubmit={this.onSubmit.bind(this)}>
|
||||||
<AtMessage />
|
<AtMessage />
|
||||||
<AtInput
|
<AtInput
|
||||||
@@ -103,6 +71,10 @@ export default class MemberPage extends Component {
|
|||||||
{pt.get().button.buttonText.login}
|
{pt.get().button.buttonText.login}
|
||||||
</AtButton>
|
</AtButton>
|
||||||
</AtForm>
|
</AtForm>
|
||||||
|
) : (
|
||||||
|
<AtButton type='primary' onClick={this.onLogout.bind(this)}>
|
||||||
|
{pt.get().button.buttonText.logout}
|
||||||
|
</AtButton>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ interface MyTicketState {
|
|||||||
|
|
||||||
export default class MyTicketPage extends Component<{}, MyTicketState> {
|
export default class MyTicketPage extends Component<{}, MyTicketState> {
|
||||||
state = {
|
state = {
|
||||||
fixList: [new TicketListItem(0, '', '', 1, moment())],
|
fixList: [new TicketListItem(0, '', '', 1, moment(), false)],
|
||||||
rs: new RequestState(),
|
rs: new RequestState(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -24,14 +24,13 @@ export default class UserPage extends Component {
|
|||||||
clicks: memberClickTimes,
|
clicks: memberClickTimes,
|
||||||
isToastOpen: false,
|
isToastOpen: false,
|
||||||
toastText: '',
|
toastText: '',
|
||||||
haveAccess: wechatUser.getAccess(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 以下是TabBar相关
|
// 以下是TabBar相关
|
||||||
pageCtx = Taro.getCurrentInstance().page;
|
pageCtx = Taro.getCurrentInstance().page;
|
||||||
componentDidShow() {
|
componentDidShow() {
|
||||||
const tabbar = Taro.getTabBar<CustomTabBar>(this.pageCtx);
|
const tabbar = Taro.getTabBar<CustomTabBar>(this.pageCtx);
|
||||||
tabbar?.setSelected(this.state.haveAccess ? 3 : 2);
|
tabbar?.setSelected(wechatUser.getAccess() ? 3 : 2);
|
||||||
}
|
}
|
||||||
// 以上是TabBar相关
|
// 以上是TabBar相关
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ export interface ButtonText {
|
|||||||
submit: string;
|
submit: string;
|
||||||
reset: string;
|
reset: string;
|
||||||
login: string;
|
login: string;
|
||||||
|
logout: string;
|
||||||
};
|
};
|
||||||
submitText: {
|
submitText: {
|
||||||
success: string;
|
success: string;
|
||||||
@@ -12,6 +13,10 @@ export interface ButtonText {
|
|||||||
success: string;
|
success: string;
|
||||||
error: string;
|
error: string;
|
||||||
};
|
};
|
||||||
|
logoutText: {
|
||||||
|
success: string;
|
||||||
|
error: string;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const buttonZhCn: ButtonText = {
|
export const buttonZhCn: ButtonText = {
|
||||||
@@ -19,6 +24,7 @@ export const buttonZhCn: ButtonText = {
|
|||||||
submit: '提交',
|
submit: '提交',
|
||||||
reset: '清空',
|
reset: '清空',
|
||||||
login: '登录',
|
login: '登录',
|
||||||
|
logout: '登出',
|
||||||
},
|
},
|
||||||
submitText: {
|
submitText: {
|
||||||
success: '提交成功',
|
success: '提交成功',
|
||||||
@@ -28,6 +34,10 @@ export const buttonZhCn: ButtonText = {
|
|||||||
success: '登录成功',
|
success: '登录成功',
|
||||||
error: '登录失败',
|
error: '登录失败',
|
||||||
},
|
},
|
||||||
|
logoutText: {
|
||||||
|
success: '登出成功',
|
||||||
|
error: '登出失败',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const buttonEnUs: ButtonText = {
|
export const buttonEnUs: ButtonText = {
|
||||||
@@ -35,6 +45,7 @@ export const buttonEnUs: ButtonText = {
|
|||||||
submit: 'Submit',
|
submit: 'Submit',
|
||||||
reset: 'Reset',
|
reset: 'Reset',
|
||||||
login: 'Login',
|
login: 'Login',
|
||||||
|
logout: 'Logout',
|
||||||
},
|
},
|
||||||
submitText: {
|
submitText: {
|
||||||
success: 'Success',
|
success: 'Success',
|
||||||
@@ -44,4 +55,8 @@ export const buttonEnUs: ButtonText = {
|
|||||||
success: 'Login Success',
|
success: 'Login Success',
|
||||||
error: 'Login Failed',
|
error: 'Login Failed',
|
||||||
},
|
},
|
||||||
|
logoutText: {
|
||||||
|
success: 'Logout Success',
|
||||||
|
error: 'Logout Failed',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ export interface MemberPageText {
|
|||||||
title: string;
|
title: string;
|
||||||
placeholder: string;
|
placeholder: string;
|
||||||
};
|
};
|
||||||
|
uncompletedTicket: {
|
||||||
|
extra: string;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const memberPageZhCn: MemberPageText = {
|
export const memberPageZhCn: MemberPageText = {
|
||||||
@@ -18,6 +21,9 @@ export const memberPageZhCn: MemberPageText = {
|
|||||||
title: '密码',
|
title: '密码',
|
||||||
placeholder: '与 EVA 统一身份认证一致',
|
placeholder: '与 EVA 统一身份认证一致',
|
||||||
},
|
},
|
||||||
|
uncompletedTicket: {
|
||||||
|
extra: '详细信息',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const memberPageEnUs: MemberPageText = {
|
export const memberPageEnUs: MemberPageText = {
|
||||||
@@ -29,4 +35,7 @@ export const memberPageEnUs: MemberPageText = {
|
|||||||
title: 'Password',
|
title: 'Password',
|
||||||
placeholder: 'Consistent with EVA Auth',
|
placeholder: 'Consistent with EVA Auth',
|
||||||
},
|
},
|
||||||
|
uncompletedTicket: {
|
||||||
|
extra: 'Details',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,9 +3,10 @@ export interface NavBarTitle {
|
|||||||
user: {
|
user: {
|
||||||
myTicket: string;
|
myTicket: string;
|
||||||
report: string;
|
report: string;
|
||||||
member: string;
|
memberLogin: string;
|
||||||
inform: string;
|
inform: string;
|
||||||
about: string;
|
about: string;
|
||||||
|
member: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -16,7 +17,8 @@ export const navBarTitleZhCn: NavBarTitle = {
|
|||||||
report: '意见反馈',
|
report: '意见反馈',
|
||||||
inform: '我的信息',
|
inform: '我的信息',
|
||||||
about: '关于我们',
|
about: '关于我们',
|
||||||
member: '协会成员登录',
|
memberLogin: '协会成员登录',
|
||||||
|
member: '协会成员',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -27,6 +29,7 @@ export const navBarTitleEnUs: NavBarTitle = {
|
|||||||
report: 'Report',
|
report: 'Report',
|
||||||
inform: 'Information',
|
inform: 'Information',
|
||||||
about: 'About us',
|
about: 'About us',
|
||||||
member: 'Member login',
|
memberLogin: 'Member login',
|
||||||
|
member: 'Member Page',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export const repairPageZhCn: RepairPageText = {
|
|||||||
errorMessage: '未获取到工单!',
|
errorMessage: '未获取到工单!',
|
||||||
title: '',
|
title: '',
|
||||||
note: '',
|
note: '',
|
||||||
extra: '',
|
extra: '详细信息',
|
||||||
},
|
},
|
||||||
typeText: {
|
typeText: {
|
||||||
computer: '电脑',
|
computer: '电脑',
|
||||||
@@ -94,10 +94,10 @@ export const repairPageZhCn: RepairPageText = {
|
|||||||
|
|
||||||
export const repairPageEnUs: RepairPageText = {
|
export const repairPageEnUs: RepairPageText = {
|
||||||
currentTicket: {
|
currentTicket: {
|
||||||
errorMessage: '未获取到工单!',
|
errorMessage: 'Cannot get the ticket!',
|
||||||
title: '',
|
title: '',
|
||||||
note: '',
|
note: '',
|
||||||
extra: '',
|
extra: 'Details',
|
||||||
},
|
},
|
||||||
typeText: {
|
typeText: {
|
||||||
computer: 'Computer',
|
computer: 'Computer',
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export interface TicketDetailText {
|
|||||||
statusModifyMessage: Map<StatusStr, string>;
|
statusModifyMessage: Map<StatusStr, string>;
|
||||||
descTitle: string;
|
descTitle: string;
|
||||||
tookAway: string;
|
tookAway: string;
|
||||||
|
addToOreo: string;
|
||||||
addNote: string;
|
addNote: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,6 +33,7 @@ export const ticketDetailZhCn: TicketDetailText = {
|
|||||||
]),
|
]),
|
||||||
descTitle: '问题描述',
|
descTitle: '问题描述',
|
||||||
tookAway: '已取回',
|
tookAway: '已取回',
|
||||||
|
addToOreo: '加入 Oreo',
|
||||||
addNote: '添加评论',
|
addNote: '添加评论',
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -53,5 +55,6 @@ export const ticketDetailEnUs: TicketDetailText = {
|
|||||||
]),
|
]),
|
||||||
descTitle: 'Problem description',
|
descTitle: 'Problem description',
|
||||||
tookAway: 'Already retrieved',
|
tookAway: 'Already retrieved',
|
||||||
|
addToOreo: 'Add to Oreo',
|
||||||
addNote: 'Add a comment',
|
addNote: 'Add a comment',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
export interface TipsText {
|
||||||
|
tipsText: Array<string>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const tipsZhCn: TipsText = {
|
||||||
|
tipsText: [
|
||||||
|
'提示:请在 20:30 之前取走自己的物品哦!',
|
||||||
|
'提示:戴尔/外星人、Surface、苹果电脑不能拆机哦~',
|
||||||
|
'提示:数据无价,请随时做好数据备份哦~',
|
||||||
|
'提示:204 也是实验室,请勿在内饮食~',
|
||||||
|
'提示:我们是志愿服务,不收取任何礼物哦~',
|
||||||
|
'提示:无论是有关于小程序的建议,还是关于E志者协会的建议,都可以在【意见反馈】处提出来哦!',
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
export const tipsEnUs: TipsText = {
|
||||||
|
tipsText: [
|
||||||
|
'Tips: Please retrieve your devices before 20:30!',
|
||||||
|
'Tips: Dell/Alienware, Surface, Apple cannot be dissassembled.',
|
||||||
|
'Tips: Data is priceless, please backup your data at any time!',
|
||||||
|
'Tips: 204 is also a laboratory. Do not eat inside.',
|
||||||
|
'Tips: We are volunteers and do not take any gifts.',
|
||||||
|
'Tips: Feel free to post your suggestions about the weapp or about us at [Account-Report]!',
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -16,6 +16,7 @@ import {
|
|||||||
ticketDetailZhCn,
|
ticketDetailZhCn,
|
||||||
} from './TicketDetail';
|
} from './TicketDetail';
|
||||||
import { CommonText, commonTextEnUs, commonTextZhCn } from './common';
|
import { CommonText, commonTextEnUs, commonTextZhCn } from './common';
|
||||||
|
import { TipsText, tipsEnUs, tipsZhCn } from './Tips';
|
||||||
|
|
||||||
interface TextRecord {
|
interface TextRecord {
|
||||||
common: CommonText;
|
common: CommonText;
|
||||||
@@ -32,6 +33,7 @@ interface TextRecord {
|
|||||||
navBar: NavBarTitle;
|
navBar: NavBarTitle;
|
||||||
repairPage: RepairPageText;
|
repairPage: RepairPageText;
|
||||||
ticketDetail: TicketDetailText;
|
ticketDetail: TicketDetailText;
|
||||||
|
tips: TipsText;
|
||||||
}
|
}
|
||||||
|
|
||||||
const textZhCn: TextRecord = {
|
const textZhCn: TextRecord = {
|
||||||
@@ -49,6 +51,7 @@ const textZhCn: TextRecord = {
|
|||||||
navBar: navBarTitleZhCn,
|
navBar: navBarTitleZhCn,
|
||||||
repairPage: repairPageZhCn,
|
repairPage: repairPageZhCn,
|
||||||
ticketDetail: ticketDetailZhCn,
|
ticketDetail: ticketDetailZhCn,
|
||||||
|
tips: tipsZhCn,
|
||||||
};
|
};
|
||||||
|
|
||||||
const textEnUs: TextRecord = {
|
const textEnUs: TextRecord = {
|
||||||
@@ -66,6 +69,7 @@ const textEnUs: TextRecord = {
|
|||||||
navBar: navBarTitleEnUs,
|
navBar: navBarTitleEnUs,
|
||||||
repairPage: repairPageEnUs,
|
repairPage: repairPageEnUs,
|
||||||
ticketDetail: ticketDetailEnUs,
|
ticketDetail: ticketDetailEnUs,
|
||||||
|
tips: tipsEnUs,
|
||||||
};
|
};
|
||||||
|
|
||||||
// type Lang = 'zh_CN' | 'en_US' | ...;
|
// type Lang = 'zh_CN' | 'en_US' | ...;
|
||||||
|
|||||||
@@ -2,10 +2,9 @@ import RepairPage from '@/pages/repair/repair';
|
|||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import { TicketListItem } from '@/components/TicketListItem/TicketListItem';
|
import { TicketListItem } from '@/components/TicketListItem/TicketListItem';
|
||||||
import pt from '@/plain-text';
|
import pt from '@/plain-text';
|
||||||
import DetailFramework from '@/components/DetailFramework/DetailFramework';
|
|
||||||
import { getUrl } from '.';
|
import { getUrl } from '.';
|
||||||
|
|
||||||
export function getCurrentTicket(that: RepairPage, middleButton, isInfoShow) {
|
export function getCurrentTicket(that: RepairPage) {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: getUrl('/user/mytickets'),
|
url: getUrl('/user/mytickets'),
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@@ -15,14 +14,19 @@ export function getCurrentTicket(that: RepairPage, middleButton, isInfoShow) {
|
|||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.data;
|
const data = res.data.data;
|
||||||
let newIdList: Array<number> = [];
|
let newIdNameList: Array<Map<number, string>> = [];
|
||||||
data.list.map((ticket: TicketListItem) => {
|
data.list.map((ticket: TicketListItem) => {
|
||||||
if (ticket['status'] !== 5) {
|
if (ticket['status'] !== 5) {
|
||||||
newIdList.push(ticket.id);
|
newIdNameList.push(
|
||||||
|
new Map([
|
||||||
|
[ticket['id'], ticket['device'] + ' ' + ticket['deviceModel']],
|
||||||
|
]),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
console.log(newIdNameList);
|
||||||
that.setState({
|
that.setState({
|
||||||
currentTicketsId: newIdList,
|
currentTicketsIdName: newIdNameList,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { getUrl } from '.';
|
|||||||
|
|
||||||
export function getDutyInfo(that: MainPage) {
|
export function getDutyInfo(that: MainPage) {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: getUrl('/dutyinfo'),
|
url: getUrl('/duty/info'),
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
data: {
|
data: {
|
||||||
token: 'token_test',
|
token: 'token_test',
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
import UserMemberPage from '@/pages/user/member/member';
|
||||||
|
import Taro from '@tarojs/taro';
|
||||||
|
import pt from '@/plain-text';
|
||||||
|
import wechatUser from '@/wechat';
|
||||||
|
import { getUrl } from '.';
|
||||||
|
|
||||||
|
const logInterval = 5000;
|
||||||
|
|
||||||
|
export function memberLogin(that: UserMemberPage) {
|
||||||
|
that.setState({
|
||||||
|
isLoading: true,
|
||||||
|
});
|
||||||
|
Taro.request({
|
||||||
|
url: getUrl('/member/login'),
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
token: 'token_test',
|
||||||
|
name: that.state.stuid,
|
||||||
|
phone: that.state.passwd,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res.data);
|
||||||
|
that.setState({
|
||||||
|
isLoading: false,
|
||||||
|
});
|
||||||
|
Taro.atMessage({
|
||||||
|
message: pt.get().button.loginText.success,
|
||||||
|
type: 'success',
|
||||||
|
});
|
||||||
|
wechatUser.setAccess(true);
|
||||||
|
Taro.reLaunch({
|
||||||
|
url: '/pages/member/member',
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
that.setState({
|
||||||
|
isLoading: false,
|
||||||
|
});
|
||||||
|
Taro.atMessage({
|
||||||
|
message: pt.get().button.loginText.error + err.toString(),
|
||||||
|
type: 'error',
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({
|
||||||
|
isDisable: false,
|
||||||
|
});
|
||||||
|
}, logInterval);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function memberLogout(that: UserMemberPage) {
|
||||||
|
that.setState({
|
||||||
|
isLoading: true,
|
||||||
|
});
|
||||||
|
Taro.request({
|
||||||
|
url: getUrl('/member/logout'),
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
token: 'token_test',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res.data);
|
||||||
|
that.setState({
|
||||||
|
isLoading: false,
|
||||||
|
});
|
||||||
|
Taro.atMessage({
|
||||||
|
message: pt.get().button.logoutText.success,
|
||||||
|
type: 'success',
|
||||||
|
});
|
||||||
|
wechatUser.setAccess(false);
|
||||||
|
Taro.reLaunch({
|
||||||
|
url: '/pages/index/index',
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
that.setState({
|
||||||
|
isLoading: false,
|
||||||
|
});
|
||||||
|
Taro.atMessage({
|
||||||
|
message: pt.get().button.logoutText.error + err.toString(),
|
||||||
|
type: 'error',
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({
|
||||||
|
isDisable: false,
|
||||||
|
});
|
||||||
|
}, logInterval);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
import MemberPage from '@/pages/member/member';
|
||||||
|
import Taro from '@tarojs/taro';
|
||||||
|
import { TicketListItem } from '@/components/TicketListItem/TicketListItem';
|
||||||
|
import moment from 'moment';
|
||||||
|
import { getUrl } from '.';
|
||||||
|
|
||||||
|
export function getUncompletedTicketList(that: MemberPage) {
|
||||||
|
Taro.request({
|
||||||
|
url: getUrl('/member/tickets/uncompleted'),
|
||||||
|
method: 'GET',
|
||||||
|
data: {
|
||||||
|
token: 'token_test',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
let former = that.state.rs;
|
||||||
|
if (!res.data.success) {
|
||||||
|
that.setState({
|
||||||
|
rs: former.trans(false),
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
that.setState({
|
||||||
|
rs: former.trans(true),
|
||||||
|
fixList: res.data.data.list.map(
|
||||||
|
(item) =>
|
||||||
|
new TicketListItem(
|
||||||
|
item.id,
|
||||||
|
item.device,
|
||||||
|
item.deviceModel,
|
||||||
|
item.status,
|
||||||
|
moment(item.createdTime),
|
||||||
|
true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((reason) => {
|
||||||
|
let former = that.state.rs;
|
||||||
|
that.setState({
|
||||||
|
rs: former.trans(false),
|
||||||
|
});
|
||||||
|
console.log(reason);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export const randomInt = (floor: number, ceiling: number) => {
|
||||||
|
return Math.floor(Math.random() * (ceiling - floor + 1) + floor);
|
||||||
|
};
|
||||||
+1
-1
@@ -6,7 +6,7 @@ class WechatUser {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.userInfo = '';
|
this.userInfo = '';
|
||||||
this.hasUserInfo = false;
|
this.hasUserInfo = false;
|
||||||
this.isMember = true;
|
this.isMember = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAccess() {
|
getAccess() {
|
||||||
|
|||||||
Reference in New Issue
Block a user