add pic display in ticketnote

This commit is contained in:
Dawn_Ocean
2024-04-08 14:56:51 +08:00
parent c487187451
commit ab52ffe7ae
7 changed files with 42 additions and 9 deletions
@@ -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>
)
+30 -4
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>
);
+3 -1
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>