add random tips on currentTicket card

This commit is contained in:
Dawn1Ocean
2024-03-14 23:30:48 +08:00
parent 9931b23337
commit 60f10eaa8f
8 changed files with 62 additions and 16 deletions
+16 -6
View File
@@ -17,6 +17,7 @@ import type CustomTabBar from '@/custom-tab-bar';
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 './repair.scss';
interface RepairPageState {
@@ -29,7 +30,7 @@ interface RepairPageState {
isLoading: boolean;
isDisable: boolean;
checkedList: Array<number>;
currentTicketsId: Array<number>;
currentTicketsIdName: Array<Map<number, string>>;
}
const submitInterval = 5000;
@@ -56,11 +57,11 @@ export default class RepairPage extends Component<{}, RepairPageState> {
isLoading: false,
isDisable: true,
checkedList: [0],
currentTicketsId: [] as Array<number>,
currentTicketsIdName: [] as Array<Map<number, string>>,
};
componentDidMount(): void {
getCurrentTicket(this, middleButton, isInfoShow);
getCurrentTicket(this);
setTimeout(() => {
this.setState({
@@ -162,10 +163,19 @@ export default class RepairPage extends Component<{}, RepairPageState> {
}
render(): ReactNode {
const ticketsRenderer = this.state.currentTicketsId.map((id, idx) => (
<AtCard key={idx}>
const ticketsRenderer = this.state.currentTicketsIdName.map((pair, 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
id={id}
id={pair.keys()[0]}
isInfoShow={isInfoShow}
middleButton={middleButton}
/>