李志伟 il y a 3 ans
Parent
révision
4094223e0b

+ 1
- 1
src/pages/index/components/User/index.jsx Voir le fichier

46
   }
46
   }
47
   return (
47
   return (
48
     <ScrollView scrollY style={{ height: '100%' }}>
48
     <ScrollView scrollY style={{ height: '100%' }}>
49
-      <View className='personTip'>该账号归{person.nickName}pc用户名所属</View>
49
+      <View className='personTip'>该账号归{person.userName}所属</View>
50
       <View className='userHead' onClick={handleAccount}>
50
       <View className='userHead' onClick={handleAccount}>
51
         <Image src={userBgi} className='userBgi' />
51
         <Image src={userBgi} className='userBgi' />
52
         <View className='headcontent' >
52
         <View className='headcontent' >

+ 33
- 31
src/pages/index/components/order/index.jsx Voir le fichier

52
   }
52
   }
53
   const handleOk = () => {
53
   const handleOk = () => {
54
     toggleJob(job.jobId, { mode: true }).then(() => {
54
     toggleJob(job.jobId, { mode: true }).then(() => {
55
-      //目测有bug
56
-      getJobList({ pageNum: currentPage }).then(res => {
57
-        const lst = currentPage === 1 ? res.records || [] : jobList.concat(res.records || [])
58
-        //长列表加载当下一页没有数据时
59
-        if (res.records.length == 0 && currentPage != 1) {
60
-          setIsMore(true)
61
-          return
55
+      const list = [...jobList];
56
+      list.forEach(item => {
57
+        if (item.jobId == job.jobId) {
58
+          item.status = 1
62
         }
59
         }
63
-        setJobList(lst)
64
-        onClose()
60
+      })
61
+      setJobList(list);
62
+      onClose()
63
+    }).catch(e=>{
64
+      console.log(e.message);
65
+      Taro.showToast({
66
+        title: '系统错误,请刷新小程序重试',
67
+        icon: 'none',
65
       })
68
       })
66
     })
69
     })
67
   }
70
   }
73
     //正整数或两位小数
76
     //正整数或两位小数
74
     if (!isNaN(area)) {
77
     if (!isNaN(area)) {
75
       overJob(job.jobId, { ...job, area: area }).then(() => {
78
       overJob(job.jobId, { ...job, area: area }).then(() => {
76
-        getJobList({ pageNum: currentPage }).then(res2 => {
77
-          const lst = currentPage === 1 ? res2.records || [] : jobList.concat(res2.records || [])
78
-          //长列表加载当下一页没有数据时
79
-          if (res2.records.length == 0 && currentPage != 1) {
80
-            setIsMore(true)
81
-            return
79
+        Taro.showToast({
80
+          title: '恭喜完成作业',
81
+          icon: 'none',
82
+        })
83
+        const list = [...jobList];
84
+        list.forEach(item => {
85
+          if (item.jobId == job.jobId) {
86
+            item.status = 3
82
           }
87
           }
83
-          setJobList(lst);
84
-          Taro.showToast({
85
-            title: '恭喜完成作业',
86
-            icon: 'none',
87
-          })
88
-          onOverClose()
88
+        })
89
+        setJobList(list);
90
+        onOverClose()
91
+      }).catch(e=>{
92
+        console.log(e.message);
93
+        Taro.showToast({
94
+          title: '系统错误,请刷新小程序重试',
95
+          icon: 'none',
89
         })
96
         })
90
       })
97
       })
91
     }
98
     }
96
       })
103
       })
97
     }
104
     }
98
   }
105
   }
99
-  useDidShow(() => {
106
+  const getList = () => {
100
     getJobList({ pageNum: currentPage }).then(res => {
107
     getJobList({ pageNum: currentPage }).then(res => {
101
       const lst = currentPage === 1 ? res.records || [] : jobList.concat(res.records || [])
108
       const lst = currentPage === 1 ? res.records || [] : jobList.concat(res.records || [])
102
       //长列表加载当下一页没有数据时
109
       //长列表加载当下一页没有数据时
106
       }
113
       }
107
       setJobList(lst)
114
       setJobList(lst)
108
     })
115
     })
116
+  }
117
+  useDidShow(() => {
118
+    getList();
109
   })
119
   })
110
   useEffect(() => {
120
   useEffect(() => {
111
-    getJobList({ pageNum: currentPage }).then(res => {
112
-      const lst = currentPage === 1 ? res.records || [] : jobList.concat(res.records || [])
113
-      //长列表加载当下一页没有数据时
114
-      if (res.records.length == 0 && currentPage != 1) {
115
-        setIsMore(true)
116
-        return
117
-      }
118
-      setJobList(lst)
119
-    })
121
+    getList();
120
   }, [currentPage])
122
   }, [currentPage])
121
   useEffect(() => {
123
   useEffect(() => {
122
     getBannerList({ position: 'bannerWorker' })
124
     getBannerList({ position: 'bannerWorker' })

+ 1
- 1
src/pages/userInfo/index.jsx Voir le fichier

90
         <View className='userCell'>
90
         <View className='userCell'>
91
           <View>用户名:</View>
91
           <View>用户名:</View>
92
           <View style={{ display: 'flex', opacity: 0.5, alignItems: 'center', height: '54px' }}>
92
           <View style={{ display: 'flex', opacity: 0.5, alignItems: 'center', height: '54px' }}>
93
-            <Input type='text' value='pc端用户名' disabled className='userName' />
93
+            <Input type='text' value={person.userName} disabled className='userName' />
94
           </View>
94
           </View>
95
         </View>
95
         </View>
96
         <View className='userCell'>
96
         <View className='userCell'>