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": "清灰换硅脂", "content": "清灰换硅脂",
"createdTime": "2024-03-07T20:30:15.780486", "createdTime": "2024-03-07T20:30:15.780486",
"pic": [ "pic": [
"https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png", "https://storage.360buyimg.com/mtd/home/111543234387022.jpg",
"https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png", "https://storage.360buyimg.com/mtd/home/221543234387016.jpg",
"https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png" "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'] ? ( notelist: this.props.isInfoShow['notelist'] ? (
this.props.isInfoShow['showAllNotes'] ? ( this.props.isInfoShow['showAllNotes'] ? (
<View style={{ padding: '20rpx' }}> <View style={{ padding: '20rpx' }}>
<NoteList noteList={this.state.notes} /> <NoteList noteList={this.state.notes} showPic />
</View> </View>
) : ( ) : (
<View style={{ padding: '20rpx' }}> <View style={{ padding: '20rpx' }}>
<NoteList <NoteList
noteList={[this.state.notes[this.state.notes.length - 1]]} noteList={[this.state.notes[this.state.notes.length - 1]]}
showPic={false}
/> />
</View> </View>
) )

View File

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

View File

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

View File

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

View File

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

View File

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