From f20a38af9bbad00a27876a58d2905f5d92c32d9b Mon Sep 17 00:00:00 2001 From: Dawn1Ocean <1785590531@qq.com> Date: Tue, 19 Mar 2024 02:19:39 +0800 Subject: [PATCH] beautify ui; fix current ticket card title display bug --- src/components/NoteCard/NoteCard.tsx | 1 - src/components/NoteList/NoteList.tsx | 7 +++- src/pages/index/index.tsx | 2 +- src/pages/repair/repair.tsx | 53 +++++++++++++++------------- src/plain-text/MainPage.ts | 2 +- src/plain-text/TicketDetail.ts | 5 ++- src/service/currentTicket.ts | 6 +++- 7 files changed, 46 insertions(+), 30 deletions(-) diff --git a/src/components/NoteCard/NoteCard.tsx b/src/components/NoteCard/NoteCard.tsx index 9dadce0..f486f39 100644 --- a/src/components/NoteCard/NoteCard.tsx +++ b/src/components/NoteCard/NoteCard.tsx @@ -3,7 +3,6 @@ import { Component, ReactNode } from 'react'; import { TicketNote, StatusStr } from '@/pages/TicketDetail/TicketNote'; import pt from '@/plain-text'; import { timeFormat } from '@/utils'; -import { AtDivider } from 'taro-ui'; import './NoteCard.scss'; interface NoteCardProps { diff --git a/src/components/NoteList/NoteList.tsx b/src/components/NoteList/NoteList.tsx index 28863ff..c0aa7cf 100644 --- a/src/components/NoteList/NoteList.tsx +++ b/src/components/NoteList/NoteList.tsx @@ -3,6 +3,7 @@ import NoteCard from '@/components/NoteCard/NoteCard'; import { TicketNote } from '@/pages/TicketDetail/TicketNote'; import { View } from '@tarojs/components'; import { AtDivider } from 'taro-ui'; +import pt from '@/plain-text'; interface NoteListProps { noteList: Array; @@ -15,7 +16,11 @@ export default class NoteList extends Component { render(): ReactNode { return ( - + {this.props.noteList.map((note, idx) => ( diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 639f405..572049c 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -20,7 +20,7 @@ class CardContent { function mainPageCard(c: CardContent): JSX.Element { return ( - + {c.content()} diff --git a/src/pages/repair/repair.tsx b/src/pages/repair/repair.tsx index b3b4697..dbe5c68 100644 --- a/src/pages/repair/repair.tsx +++ b/src/pages/repair/repair.tsx @@ -38,7 +38,7 @@ const submitInterval = 5000; const middleButton = ; const isInfoShow = { - device: true, + device: false, createdTime: true, description: false, current: true, @@ -183,29 +183,34 @@ export default class RepairPage extends Component<{}, RepairPageState> { } render(): ReactNode { - const ticketsRenderer = this.state.currentTicketsIdName.map((pair, idx) => ( - { - Taro.navigateTo({ - url: '/pages/TicketDetail/TicketDetail?id=' + pair.keys()[0], - }); - }} - note={ - pt.get().tips.tipsText[ - randomInt(0, pt.get().tips.tipsText.length - 1) - ] - } - > - - - )); + const ticketsRenderer = + this.state.currentTicketsIdName.length !== 0 ? ( + this.state.currentTicketsIdName.map((pair, idx) => ( + { + Taro.navigateTo({ + url: '/pages/TicketDetail/TicketDetail?id=' + pair.keys()[0], + }); + }} + note={ + pt.get().tips.tipsText[ + randomInt(0, pt.get().tips.tipsText.length - 1) + ] + } + > + + + )) + ) : ( + + ); return ( diff --git a/src/plain-text/MainPage.ts b/src/plain-text/MainPage.ts index 9b1a366..f0db6f8 100644 --- a/src/plain-text/MainPage.ts +++ b/src/plain-text/MainPage.ts @@ -66,7 +66,7 @@ export const mainPageZhCn: MainPageText = { { title: '维修结束,取回电脑' }, ], tipsList: [ - { title: '戴尔/外星人、Surface、苹果电脑不能拆机哦~' }, + { title: '戴尔/外星人、Surface、苹果电脑不能拆哦~' }, { title: '数据无价,请随时做好数据备份哦~' }, { title: '204 也是实验室,请勿在内饮食~' }, { title: '我们是志愿服务,不收取任何礼物哦~' }, diff --git a/src/plain-text/TicketDetail.ts b/src/plain-text/TicketDetail.ts index f38b14a..e992485 100644 --- a/src/plain-text/TicketDetail.ts +++ b/src/plain-text/TicketDetail.ts @@ -10,6 +10,7 @@ export interface TicketDetailText { statusModifyPrefix: string; statusModifyMessage: Map; descTitle: string; + divider: string; info: { title: string; extra: string; @@ -45,7 +46,7 @@ export const ticketDetailZhCn: TicketDetailText = { { title: '工单完成' }, ], createTicketMessage: '创建了维修', - statusModifyPrefix: '将维修状态更改为:', + statusModifyPrefix: '将维修状态改为:', statusModifyMessage: new Map([ ['0', '已创建/交接中'], ['1', '维修中'], @@ -57,6 +58,7 @@ export const ticketDetailZhCn: TicketDetailText = { ['7', '维修翻车已取回'], ]), descTitle: '问题描述', + divider: '评论 / 状态', info: { title: '机主姓名', extra: '联系方式', @@ -104,6 +106,7 @@ export const ticketDetailEnUs: TicketDetailText = { ['7', 'Retrieved (Failed)'], ]), descTitle: 'Description', + divider: 'Comment / Status', info: { title: 'Name', extra: 'Contact', diff --git a/src/service/currentTicket.ts b/src/service/currentTicket.ts index 8e42b55..83a0e02 100644 --- a/src/service/currentTicket.ts +++ b/src/service/currentTicket.ts @@ -16,7 +16,11 @@ export function getCurrentTicket(that: RepairPage) { const data = res.data.data; let newIdNameList: Array> = []; data.list.map((ticket: TicketListItem) => { - if (ticket['status'] !== 5) { + if ( + ticket['status'] !== 3 && + ticket['status'] !== 5 && + ticket['status'] !== 7 + ) { newIdNameList.push( new Map([ [ticket['id'], ticket['device'] + ' ' + ticket['deviceModel']],