|
@@ -13,6 +13,7 @@ export default function WuYeXiuGaiBaoXiu () {
|
13
|
13
|
const [DataLock, setDataLock] = useState(false)
|
14
|
14
|
const [DetailInfo, setDetailInfo] = useState(null)
|
15
|
15
|
const [CurrnetId] = useState(Current.router.params.id)
|
|
16
|
+ const [PhotoUrl, setPhotoUrl] = useState(null)
|
16
|
17
|
|
17
|
18
|
useEffect(() => {
|
18
|
19
|
Init()
|
|
@@ -21,6 +22,7 @@ export default function WuYeXiuGaiBaoXiu () {
|
21
|
22
|
const Init = () => {
|
22
|
23
|
request({ ...apis.getGongDanDetail, args: { orgId: user.orgId }, params: { ticketId: CurrnetId } }).then((res) => {
|
23
|
24
|
setDetailInfo(res)
|
|
25
|
+ setPhotoUrl(res.tdImagesList !== null && res.tdImagesList.length > 0 ? res.tdImagesList[0] : null)
|
24
|
26
|
})
|
25
|
27
|
}
|
26
|
28
|
|
|
@@ -53,7 +55,8 @@ export default function WuYeXiuGaiBaoXiu () {
|
53
|
55
|
data: {
|
54
|
56
|
ticketTitle: DetailInfo.ticketTitle,
|
55
|
57
|
ticketContent: DetailInfo.ticketContent,
|
56
|
|
- type: 2
|
|
58
|
+ type: 2,
|
|
59
|
+ imageUrl: PhotoUrl
|
57
|
60
|
}
|
58
|
61
|
}).then((res) => {
|
59
|
62
|
Taro.showToast({ title: '报修修改成功', icon: 'none' })
|
|
@@ -65,6 +68,31 @@ export default function WuYeXiuGaiBaoXiu () {
|
65
|
68
|
})
|
66
|
69
|
}
|
67
|
70
|
|
|
71
|
+ const AddImg = () => { // 添加图片
|
|
72
|
+ Taro.chooseImage({
|
|
73
|
+ count: 1,
|
|
74
|
+ sizeType: ['compressed'],
|
|
75
|
+ sourceType: ['album', 'camera'],
|
|
76
|
+ success: (res) => {
|
|
77
|
+ const tempFilePaths = res.tempFilePaths
|
|
78
|
+ Taro.uploadFile({
|
|
79
|
+ url: apis.uploadImage.url,
|
|
80
|
+ filePath: tempFilePaths[0],
|
|
81
|
+ name: 'file',
|
|
82
|
+ formData: { user: 'upload' },
|
|
83
|
+ header: { 'x-action': 'miniapp', 'authorization': `Bearer ${Taro.getStorageSync('token')}` },
|
|
84
|
+ success: (res) => {
|
|
85
|
+ setPhotoUrl(JSON.parse(res.data).data)
|
|
86
|
+ }
|
|
87
|
+ })
|
|
88
|
+ }
|
|
89
|
+ })
|
|
90
|
+ }
|
|
91
|
+
|
|
92
|
+ const DeleteItem = () => {
|
|
93
|
+ setPhotoUrl(null)
|
|
94
|
+ }
|
|
95
|
+
|
68
|
96
|
return (
|
69
|
97
|
<view className='WuYeXiuGaiBaoXiu'>
|
70
|
98
|
<view className='Form'>
|
|
@@ -72,15 +100,19 @@ export default function WuYeXiuGaiBaoXiu () {
|
72
|
100
|
<Textarea placeholder='描述问题详情,以便我们更好的相处' onInput={DescChange} value={DetailInfo === null ? null : DetailInfo.ticketContent}></Textarea>
|
73
|
101
|
</view>
|
74
|
102
|
<view className='Photo'>
|
75
|
|
- <view className='Add'>
|
|
103
|
+ <view className='Add' onClick={AddImg}>
|
76
|
104
|
<view className='centerLabel'>
|
77
|
105
|
<text className='iconfont iconxiangji'></text>
|
78
|
106
|
<text>添加图片</text>
|
79
|
107
|
</view>
|
80
|
108
|
</view>
|
81
|
|
- <view className='PhotoItem'>
|
82
|
|
- <text className='iconfont iconshanchu'></text>
|
83
|
|
- </view>
|
|
109
|
+ {
|
|
110
|
+ PhotoUrl !== null &&
|
|
111
|
+ <view className='PhotoItem'>
|
|
112
|
+ <text className='iconfont iconshanchu' onClick={DeleteItem}></text>
|
|
113
|
+ <image mode='aspectFit' src={PhotoUrl}></image>
|
|
114
|
+ </view>
|
|
115
|
+ }
|
84
|
116
|
</view>
|
85
|
117
|
<view className='Btn'>
|
86
|
118
|
<text onClick={Send}>确认修改</text>
|