add pic uploader in ticketnote

mgy
Dawn_Ocean 2024-04-08 18:48:09 +08:00
parent 097f6832e3
commit 51407930bb
2 changed files with 33 additions and 2 deletions

View File

@ -1,9 +1,10 @@
import { ExpandItem } from '@/components/ExpandItem/ExpandItem';
import pt from '@/plain-text'; import pt from '@/plain-text';
import { submitComment } from '@/service/submitComment'; import { submitComment } from '@/service/submitComment';
import { View } from '@tarojs/components'; import { View } from '@tarojs/components';
import Taro from '@tarojs/taro'; import Taro from '@tarojs/taro';
import { Component, ReactNode } from 'react'; import { Component, ReactNode } from 'react';
import { AtButton, AtForm, AtTextarea } from 'taro-ui'; import { AtButton, AtForm, AtImagePicker, AtTextarea } from 'taro-ui';
const submitInterval = 5000; const submitInterval = 5000;
@ -12,6 +13,7 @@ export class Comment extends Component {
isLoading: false, isLoading: false,
isDisable: false, isDisable: false,
comment: '', comment: '',
files: [],
}; };
props = { props = {
@ -27,6 +29,13 @@ export class Comment extends Component {
return comment; return comment;
} }
handlePicChange(files: string[]) {
this.setState({
files: files,
});
return files;
}
onCommentSubmit() { onCommentSubmit() {
this.setState({ this.setState({
isDisable: true, isDisable: true,
@ -62,7 +71,19 @@ export class Comment extends Component {
height='400rpx' height='400rpx'
placeholder={pt.get().ticketDetail.comment.placeholder} placeholder={pt.get().ticketDetail.comment.placeholder}
/> />
<View style={{ height: '40rpx' }}></View> <ExpandItem
title={pt.get().ticketDetail.comment.uploadPic.title}
content={
<View>
<AtImagePicker
showAddBtn={this.state.files.length !== 3}
count={3}
files={this.state.files}
onChange={this.handlePicChange.bind(this)}
/>
</View>
}
/>
<AtButton <AtButton
loading={this.state.isLoading} loading={this.state.isLoading}
disabled={this.state.isDisable} disabled={this.state.isDisable}
@ -71,6 +92,7 @@ export class Comment extends Component {
> >
{pt.get().button.buttonText.submit} {pt.get().button.buttonText.submit}
</AtButton> </AtButton>
<View style={{ marginBottom: '20rpx' }}></View>
</AtForm> </AtForm>
) : ( ) : (
<View></View> <View></View>

View File

@ -35,6 +35,9 @@ export interface TicketDetailText {
placeholder: string; placeholder: string;
createTicketMessage: string; createTicketMessage: string;
statusModifyPrefix: string; statusModifyPrefix: string;
uploadPic: {
title: string;
};
}; };
status: { status: {
title: string; title: string;
@ -79,6 +82,9 @@ export const ticketDetailZhCn: TicketDetailText = {
placeholder: '可以在这里交流机器情况、维修进度、提出问题~', placeholder: '可以在这里交流机器情况、维修进度、提出问题~',
createTicketMessage: '创建了维修', createTicketMessage: '创建了维修',
statusModifyPrefix: '将维修状态改为:', statusModifyPrefix: '将维修状态改为:',
uploadPic: {
title: '上传说明图片处',
},
}, },
reminder: { reminder: {
title: '注意事项!', title: '注意事项!',
@ -132,6 +138,9 @@ export const ticketDetailEnUs: TicketDetailText = {
'You can exchange information the device, the progress of repairs, and ask questions here.', 'You can exchange information the device, the progress of repairs, and ask questions here.',
createTicketMessage: 'Created ticket', createTicketMessage: 'Created ticket',
statusModifyPrefix: 'Modified repair status to: ', statusModifyPrefix: 'Modified repair status to: ',
uploadPic: {
title: 'Upload description images',
},
}, },
reminder: { reminder: {
title: 'Reminder', title: 'Reminder',