add random tips on currentTicket card
parent
9931b23337
commit
60f10eaa8f
|
|
@ -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',
|
||||||
|
|
|
||||||
|
|
@ -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,10 +163,19 @@ 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])}
|
||||||
|
extra={pt.get().repairPage.currentTicket.extra}
|
||||||
|
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}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -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',
|
||||||
|
|
|
||||||
|
|
@ -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,3 @@
|
||||||
|
export const randomInt = (floor: number, ceiling: number) => {
|
||||||
|
return Math.floor(Math.random() * (ceiling - floor + 1) + floor);
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue