add pic display in ticketnote

mgy
Dawn_Ocean 2024-04-08 14:56:51 +08:00
parent c487187451
commit ab52ffe7ae
7 changed files with 42 additions and 9 deletions

View File

@ -55,9 +55,9 @@
"content": "清灰换硅脂",
"createdTime": "2024-03-07T20:30:15.780486",
"pic": [
"https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
"https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png",
"https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png"
"https://storage.360buyimg.com/mtd/home/111543234387022.jpg",
"https://storage.360buyimg.com/mtd/home/221543234387016.jpg",
"https://storage.360buyimg.com/mtd/home/331543234387025.jpg"
]
}
],

View File

@ -160,12 +160,13 @@ export default class DetailFramework extends Component<
notelist: this.props.isInfoShow['notelist'] ? (
this.props.isInfoShow['showAllNotes'] ? (
<View style={{ padding: '20rpx' }}>
<NoteList noteList={this.state.notes} />
<NoteList noteList={this.state.notes} showPic />
</View>
) : (
<View style={{ padding: '20rpx' }}>
<NoteList
noteList={[this.state.notes[this.state.notes.length - 1]]}
showPic={false}
/>
</View>
)

View File

@ -7,15 +7,18 @@ import './NoteCard.scss';
interface NoteCardProps {
note: TicketNote;
showPic: boolean;
}
export default class NoteCard extends Component<NoteCardProps, {}> {
props: Readonly<NoteCardProps> = {
note: new TicketNote(),
showPic: true,
};
render(): ReactNode {
var message = '';
let message = '';
let pic: string[] = [];
const note = this.props.note;
const td = pt.get().ticketDetail;
const createMessage = td.comment.createTicketMessage;
@ -28,15 +31,35 @@ export default class NoteCard extends Component<NoteCardProps, {}> {
break;
case 1:
message = note.content;
pic = note.pic;
break;
case 2:
message = prefix + modifyMessage.get(note.content as StatusStr) || '';
break;
}
const notePicRenderer = (
<View>
<View className='at-row' style={{ marginLeft: '30rpx' }}>
{pic.map((url, idx) => (
<View className='at-col at-col-4' key={idx}>
<Image
style='width: 160rpx; height: 160rpx;'
src={url}
mode='aspectFit'
/>
</View>
))}
</View>
</View>
);
return (
<View className='at-row at-row__align--center'>
<View className='at-col at-col-1 at-col--auto'>
<View className='at-row at-row__align--start'>
<View
className='at-col at-col-1 at-col--auto'
style={{ marginTop: '80rpx' }}
>
<Image
style='width: 70rpx; height: 70rpx; border-radius: 35px;'
src={note.avatar}
@ -55,7 +78,10 @@ export default class NoteCard extends Component<NoteCardProps, {}> {
<View className='at-article__info'>
{note.createdTime.format(timeFormat)}
</View>
<View className='at-article__h3'>{message}</View>
<View className='at-article__h3' style={{ marginBottom: '20rpx' }}>
{message}
</View>
{this.props.showPic ? notePicRenderer : null}
</View>
</View>
);

View File

@ -7,11 +7,13 @@ import pt from '@/plain-text';
interface NoteListProps {
noteList: Array<TicketNote>;
showPic: boolean;
}
export default class NoteList extends Component<NoteListProps, {}> {
props: Readonly<NoteListProps> = {
noteList: [],
showPic: true,
};
render(): ReactNode {
return (
@ -23,7 +25,7 @@ export default class NoteList extends Component<NoteListProps, {}> {
/>
{this.props.noteList.map((note, idx) => (
<View key={idx}>
<NoteCard note={note} />
<NoteCard note={note} showPic={this.props.showPic} />
</View>
))}
</View>

View File

@ -601,6 +601,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
current: true,
notelist: true,
showAllNotes: true,
pic: true,
};
return (

View File

@ -19,6 +19,7 @@ export class TicketNote {
type: 0 | 1 | 2;
content: string;
createdTime: moment.Moment;
pic: string[];
}
export class ShowElements {

View File

@ -56,6 +56,7 @@ export function getTicketInfo(that: DetailFramework, id: number) {
type: 0 | 1 | 2;
content: string;
createdTime: string;
pic: string[];
}) => {
notes.push({
avatar: item.avatar,
@ -64,6 +65,7 @@ export function getTicketInfo(that: DetailFramework, id: number) {
type: item.type,
content: item.content,
createdTime: moment(item.createdTime as string),
pic: item.pic,
});
},
);