李志伟 3 anni fa
parent
commit
4094223e0b

+ 1
- 1
src/pages/index/components/User/index.jsx Vedi File

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

+ 33
- 31
src/pages/index/components/order/index.jsx Vedi File

@@ -52,16 +52,19 @@ export default (props) => {
52 52
   }
53 53
   const handleOk = () => {
54 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,19 +76,23 @@ export default (props) => {
73 76
     //正整数或两位小数
74 77
     if (!isNaN(area)) {
75 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,7 +103,7 @@ export default (props) => {
96 103
       })
97 104
     }
98 105
   }
99
-  useDidShow(() => {
106
+  const getList = () => {
100 107
     getJobList({ pageNum: currentPage }).then(res => {
101 108
       const lst = currentPage === 1 ? res.records || [] : jobList.concat(res.records || [])
102 109
       //长列表加载当下一页没有数据时
@@ -106,17 +113,12 @@ export default (props) => {
106 113
       }
107 114
       setJobList(lst)
108 115
     })
116
+  }
117
+  useDidShow(() => {
118
+    getList();
109 119
   })
110 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 122
   }, [currentPage])
121 123
   useEffect(() => {
122 124
     getBannerList({ position: 'bannerWorker' })

+ 1
- 1
src/pages/userInfo/index.jsx Vedi File

@@ -90,7 +90,7 @@ export default withLayout((props) => {
90 90
         <View className='userCell'>
91 91
           <View>用户名:</View>
92 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 94
           </View>
95 95
         </View>
96 96
         <View className='userCell'>