fix status display bug in detailframework
parent
97a8d0570a
commit
24f71ed997
|
|
@ -9,7 +9,6 @@ import {
|
||||||
import pt from '@/plain-text';
|
import pt from '@/plain-text';
|
||||||
import { RequestState } from '@/service';
|
import { RequestState } from '@/service';
|
||||||
import { getTicketInfo } from '@/service/ticketsInfo';
|
import { getTicketInfo } from '@/service/ticketsInfo';
|
||||||
import { FixStatus } from '@/common';
|
|
||||||
import { AtCard, AtSteps } from 'taro-ui';
|
import { AtCard, AtSteps } from 'taro-ui';
|
||||||
import NoteList from '../NoteList/NoteList';
|
import NoteList from '../NoteList/NoteList';
|
||||||
|
|
||||||
|
|
@ -17,14 +16,6 @@ interface StepItemData {
|
||||||
title: string;
|
title: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStatusStep: Map<FixStatus, 0 | 1 | 2 | 3> = new Map([
|
|
||||||
[1, 0],
|
|
||||||
[2, 1],
|
|
||||||
[3, 2],
|
|
||||||
[4, 2],
|
|
||||||
[5, 3],
|
|
||||||
]);
|
|
||||||
|
|
||||||
interface DetailFrameworkState {
|
interface DetailFrameworkState {
|
||||||
current: number;
|
current: number;
|
||||||
items: Array<StepItemData>;
|
items: Array<StepItemData>;
|
||||||
|
|
@ -57,11 +48,6 @@ export default class DetailFramework extends Component<
|
||||||
title: navBar.ticketDetail,
|
title: navBar.ticketDetail,
|
||||||
});
|
});
|
||||||
getTicketInfo(this, this.props.id);
|
getTicketInfo(this, this.props.id);
|
||||||
const status = this.state.ticketInfo.status;
|
|
||||||
this.setState({
|
|
||||||
current: mapStatusStep.get(status) || 0,
|
|
||||||
items: pt.get().ticketDetail.stepItems,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
props: Readonly<DetailFrameworkProps> = {
|
props: Readonly<DetailFrameworkProps> = {
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,21 @@ import { TicketInfo, TicketNote } from '@/pages/TicketDetail/TicketNote';
|
||||||
import DetailFramework from '@/components/DetailFramework/DetailFramework';
|
import DetailFramework from '@/components/DetailFramework/DetailFramework';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
import { FixStatus } from '@/common';
|
||||||
|
import pt from '@/plain-text';
|
||||||
import { getUrl } from '.';
|
import { getUrl } from '.';
|
||||||
|
|
||||||
|
const mapStatusStep: Map<FixStatus, 0 | 1 | 2 | 3> = new Map([
|
||||||
|
[0, 0],
|
||||||
|
[1, 1],
|
||||||
|
[2, 2],
|
||||||
|
[3, 3],
|
||||||
|
[4, 2],
|
||||||
|
[5, 3],
|
||||||
|
[6, 2],
|
||||||
|
[7, 3],
|
||||||
|
]);
|
||||||
|
|
||||||
export function getTicketInfo(that: DetailFramework, id: number) {
|
export function getTicketInfo(that: DetailFramework, id: number) {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: getUrl('/tickets/info'),
|
url: getUrl('/tickets/info'),
|
||||||
|
|
@ -35,7 +48,15 @@ export function getTicketInfo(that: DetailFramework, id: number) {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const notes: Array<TicketNote> = [];
|
const notes: Array<TicketNote> = [];
|
||||||
data.notes.map((item) => {
|
data.notes.map(
|
||||||
|
(item: {
|
||||||
|
avatar: string;
|
||||||
|
id: number;
|
||||||
|
op: string;
|
||||||
|
type: 0 | 1 | 2;
|
||||||
|
content: string;
|
||||||
|
createdTime: string;
|
||||||
|
}) => {
|
||||||
notes.push({
|
notes.push({
|
||||||
avatar: item.avatar,
|
avatar: item.avatar,
|
||||||
id: item.id,
|
id: item.id,
|
||||||
|
|
@ -44,11 +65,14 @@ export function getTicketInfo(that: DetailFramework, id: number) {
|
||||||
content: item.content,
|
content: item.content,
|
||||||
createdTime: moment(item.createdTime as string),
|
createdTime: moment(item.createdTime as string),
|
||||||
});
|
});
|
||||||
});
|
},
|
||||||
|
);
|
||||||
that.setState({
|
that.setState({
|
||||||
ticketInfo: ticketDetail,
|
ticketInfo: ticketDetail,
|
||||||
notes: notes,
|
notes: notes,
|
||||||
rs: former.trans(true),
|
rs: former.trans(true),
|
||||||
|
current: mapStatusStep.get(data.status) || 0,
|
||||||
|
items: pt.get().ticketDetail.stepItems,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue