|
@@ -49,9 +49,18 @@ export default (props) => {
|
49
|
49
|
setJob()
|
50
|
50
|
}
|
51
|
51
|
const handleOk = () => {
|
52
|
|
- console.log('开始作业')
|
53
|
|
- toggleJob(job.jobId, { mode: false }).then(() => {
|
54
|
|
- setShow(false)
|
|
52
|
+ toggleJob(job.jobId, { mode: true }).then(() => {
|
|
53
|
+ //目测有bug
|
|
54
|
+ getJobList({ pageNum: currentPage }).then(res => {
|
|
55
|
+ const lst = currentPage === 1 ? res.records || [] : jobList.concat(res.records || [])
|
|
56
|
+ //长列表加载当下一页没有数据时
|
|
57
|
+ if (res.records.length == 0 && currentPage != 1) {
|
|
58
|
+ setIsMore(true)
|
|
59
|
+ return
|
|
60
|
+ }
|
|
61
|
+ setJobList(lst)
|
|
62
|
+ onClose()
|
|
63
|
+ })
|
55
|
64
|
})
|
56
|
65
|
}
|
57
|
66
|
const handleArea = (e) => {
|
|
@@ -62,8 +71,31 @@ export default (props) => {
|
62
|
71
|
setShowOver(false)
|
63
|
72
|
}
|
64
|
73
|
const handleOverOk = () => {
|
65
|
|
- if (area) {
|
66
|
|
- console.log(666)
|
|
74
|
+ //正整数或两位小数
|
|
75
|
+ const test2 = /^\d+(\.\d{1,2})?$/.test(area)
|
|
76
|
+ if (test2) {
|
|
77
|
+ overJob(job.jobId,{...job,area:area}).then(res=>{
|
|
78
|
+ Taro.showToast({
|
|
79
|
+ title: '恭喜完成作业',
|
|
80
|
+ icon: 'none',
|
|
81
|
+ })
|
|
82
|
+ getJobList({ pageNum: currentPage }).then(res2 => {
|
|
83
|
+ const lst = currentPage === 1 ? res2.records || [] : jobList.concat(res2.records || [])
|
|
84
|
+ //长列表加载当下一页没有数据时
|
|
85
|
+ if (res2.records.length == 0 && currentPage != 1) {
|
|
86
|
+ setIsMore(true)
|
|
87
|
+ return
|
|
88
|
+ }
|
|
89
|
+ setJobList(lst)
|
|
90
|
+ onOverClose()
|
|
91
|
+ })
|
|
92
|
+ })
|
|
93
|
+ }
|
|
94
|
+ else{
|
|
95
|
+ Taro.showToast({
|
|
96
|
+ title: '请输入正确的面积整数或最多两位小数',
|
|
97
|
+ icon: 'none',
|
|
98
|
+ })
|
67
|
99
|
}
|
68
|
100
|
}
|
69
|
101
|
useEffect(() => {
|
|
@@ -154,7 +186,6 @@ export default (props) => {
|
154
|
186
|
</View>
|
155
|
187
|
<Button className='btn' onClick={handleOverOk}>确认</Button>
|
156
|
188
|
</Popup>
|
157
|
|
-
|
158
|
189
|
</ScrollView>
|
159
|
190
|
</View>
|
160
|
191
|
)
|