From fc9347e7c1438749e314ea9d38165baa1727c90b Mon Sep 17 00:00:00 2001 From: Dawn1Ocean <1785590531@qq.com> Date: Fri, 10 May 2024 11:14:23 +0800 Subject: [PATCH] fix: changestatus --- src/pages/TicketDetail/TicketDetail.tsx | 8 +++++--- src/plain-text/MainPage.ts | 12 ------------ src/service/changeStatus.ts | 4 ++-- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/pages/TicketDetail/TicketDetail.tsx b/src/pages/TicketDetail/TicketDetail.tsx index 82e1860..4566e74 100644 --- a/src/pages/TicketDetail/TicketDetail.tsx +++ b/src/pages/TicketDetail/TicketDetail.tsx @@ -343,7 +343,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> { } handleStatusChange(status: number): void { - if (status == 3 || status == 5 || status == 7) { + if (status >= 3 && status <= 7) { this.setState({ isDisable: { ...this.state.isDisable, @@ -376,8 +376,10 @@ export default class TicketDetail extends Component<{}, TicketDetailState> { status: false, }, }, + // eslint-disable-next-line react/no-unused-state + statusToBe: status, }); - changeStatus(this); + changeStatus(this, status); } setTimeout(() => { this.setState({ @@ -427,7 +429,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> { }, }, }); - changeStatus(this); + changeStatus(this, this.state.statusToBe); } else { this.setState({ isDisable: { diff --git a/src/plain-text/MainPage.ts b/src/plain-text/MainPage.ts index fc64b6d..6b54143 100644 --- a/src/plain-text/MainPage.ts +++ b/src/plain-text/MainPage.ts @@ -1,8 +1,4 @@ export interface MainPageText { - normal: { - recoverTime: string; - reason: string; - }; askLeave: string; conclusion: string; titleLine: { @@ -46,10 +42,6 @@ export interface MainPageText { } export const mainPageZhCn: MainPageText = { - normal: { - recoverTime: '明天 13:30', - reason: '正常下班', - }, askLeave: '我要请假', conclusion: '提交值班总结', titleLine: { @@ -117,10 +109,6 @@ export const mainPageZhCn: MainPageText = { }; export const mainPageEnUs: MainPageText = { - normal: { - recoverTime: 'Tomorrow 13:30', - reason: 'Normal shift', - }, askLeave: 'Absence', conclusion: 'Submit Duty Conclusion', titleLine: { diff --git a/src/service/changeStatus.ts b/src/service/changeStatus.ts index 39b4445..c0f9f74 100644 --- a/src/service/changeStatus.ts +++ b/src/service/changeStatus.ts @@ -6,7 +6,7 @@ import { getUrl } from '.'; const reLaunchInterval = 1000; -export function changeStatus(that: TicketDetail) { +export function changeStatus(that: TicketDetail, status: number) { that.setState({ isLoading: { ...that.state.isLoading, @@ -19,7 +19,7 @@ export function changeStatus(that: TicketDetail) { data: { token: wechatUser.getToken(), id: that.state.id, - status: that.state.statusToBe, + status: status, }, }) .then((res) => {