zlisen преди 4 години
родител
ревизия
3fff8fd153
променени са 6 файла, в които са добавени 71 реда и са изтрити 72 реда
  1. 39
    23
      src/pages/account/index.jsx
  2. 19
    14
      src/pages/imglist/index.jsx
  3. 1
    1
      src/pages/label/index.jsx
  4. 2
    2
      src/pages/mateTag/index.jsx
  5. 5
    29
      src/pages/material/index.jsx
  6. 5
    3
      src/pages/shop/index.jsx

+ 39
- 23
src/pages/account/index.jsx Целия файл

@@ -8,23 +8,27 @@ import Layout from '../../layout/index'
8 8
 import request from '../../util/request'
9 9
 import getQueryValue from '../../util/getQueryValue'
10 10
 import NoData from '@/compents/NoData'
11
-
11
+import InifiniteList from '@/compents/InifiniteList'
12 12
 
13 13
 const account = (props) => {
14 14
 
15 15
   const { id } = getQueryValue()
16 16
   const [list, setList] = useState([])
17
-
17
+  const [page, setPage] = useState({ total: 0, pageNum: 0 })
18 18
 
19 19
   useDidShow(() => {
20 20
     console.log('useDidShow')
21 21
     getShopKepperList({ pageNum: 1, pageSize:10 })
22 22
   })
23 23
 
24
-  function getShopKepperList() {
25
-    request({ url: '/taShopKeeper',params:{shopId:id}, method: 'get', }).then((res)=>{
24
+  function getShopKepperList(params) {
25
+    request({ url: '/taShopKeeper',params:{shopId:id,...params}, method: 'get', }).then((res)=>{
26 26
       const { records, ...page} = res.data.data
27
-      setList(records)
27
+      setList(list.concat(records || []))
28
+      setPage({
29
+        ...page,
30
+        pageNum: page.current
31
+      })
28 32
     })
29 33
   }
30 34
 
@@ -38,7 +42,7 @@ const account = (props) => {
38 42
         if (res.confirm) {
39 43
           console.log('用户点击确定')
40 44
           request({ url: `/taShopKeeper/${keeperId}`, method: 'delete', }).then((res)=>{
41
-            getShopKepperList({ pageNum: 1, pageSize:10 })
45
+            setList(list.filter((x)=>x.keeperId!=keeperId))
42 46
           })
43 47
 
44 48
         } else if (res.cancel) {
@@ -49,28 +53,40 @@ const account = (props) => {
49 53
   }
50 54
 
51 55
 
56
+  const loadMore = () => {
57
+    getShopKepperList({ pageNum: page.pageNum + 1 })
58
+  }
52 59
 
60
+    const renderItem = (index, key) => (
61
+      <View className='account-view' key={key}>
62
+      {/* <Text className='account-view-title'>房源编号:<Text style={{fontSize:"1rem"}}>{item.keeperId}</Text></Text> */}
63
+      <ContainerLayout className='account-view-card'>
64
+        <View className='top' >
65
+          <View>姓名:{list[index].name}</View>
66
+          <View>电话:{list[index].phone}</View>
67
+          {/* <View>微信号:{x.user.name}</View>
68
+          <View>房源数:{x.user.name}</View> */}
69
+        </View>
70
+        <View className='bottom'>
71
+          <Text onClick={() => { Taro.navigateTo({ url: `/pages/account/edit/index?keeperId=${list[index].keeperId}` }) }}>编辑</Text>
72
+          <Text onClick={()=>onDelete(list[index].keeperId)}>删除</Text>
73
+        </View>
74
+      </ContainerLayout>
75
+    </View>
76
+  )
53 77
 
54 78
   return <View className='account'>
55 79
     <Layout>
56 80
       <NoData nodata={!list.length} tips="暂无老板" style={{minHeight: '200px'}}>
57
-        {list.map((item, index) => {
58
-          return <View className='account-view' key={index}>
59
-            {/* <Text className='account-view-title'>房源编号:<Text style={{fontSize:"1rem"}}>{item.keeperId}</Text></Text> */}
60
-            <ContainerLayout className='account-view-card'>
61
-              <View className='top' >
62
-                <View>姓名:{item.name}</View>
63
-                <View>电话:{item.phone}</View>
64
-                {/* <View>微信号:{x.user.name}</View>
65
-                <View>房源数:{x.user.name}</View> */}
66
-              </View>
67
-              <View className='bottom'>
68
-                <Text onClick={() => { Taro.navigateTo({ url: `/pages/account/edit/index?keeperId=${item.keeperId}` }) }}>编辑</Text>
69
-                <Text onClick={()=>onDelete(item.keeperId)}>删除</Text>
70
-              </View>
71
-            </ContainerLayout>
72
-          </View>
73
-        })}
81
+
82
+
83
+      <InifiniteList
84
+        length={list.length}
85
+        total={page.total}
86
+        height={600}
87
+        itemRenderer={renderItem}
88
+        loadMore={loadMore}
89
+      />
74 90
       </NoData>
75 91
     </Layout>
76 92
     {/* onClick={(e)=>(e) */}

+ 19
- 14
src/pages/imglist/index.jsx Целия файл

@@ -33,9 +33,9 @@ const index = (props) => {
33 33
     const [data, setData] = useState({})
34 34
     const [tagList, setTagList] = useState([])
35 35
 
36
-    let [arrList, setArrList] = useState([[]])
36
+    let [arrList, setArrList] = useState({})
37 37
     useDidShow(() => {
38
-        console.log(query)
38
+        // console.log(query)
39 39
         getImageList()
40 40
         getMateTagGroupList()
41 41
     })
@@ -51,7 +51,7 @@ const index = (props) => {
51 51
     const getImageList = () => {
52 52
         request({ url: '/taMetaImageTag', params: { tagIds: query } }).then((res) => {
53 53
             const { records, ...page } = res.data.data
54
-            console.log(groupby(records, item => item.imageId))
54
+            console.log(groupby(records, item => item.imageId),'------')
55 55
             // _.groupBy([6.1, 4.2, 6.3], Math.floor);
56 56
             setList(groupby(records, item => item.imageId))
57 57
 
@@ -170,32 +170,37 @@ const index = (props) => {
170 170
     }
171 171
 
172 172
     const onLabelChange = (e, index) => {
173
-        console.log(e, index, 'onLabelChange')
173
+        let newArrArrList={
174
+            ...arrList,
175
+            [index]: e
176
+        }
177
+        setArrList(newArrArrList)
178
+        let newArr = Object.values(newArrArrList).reduce((pre, cur) => {
174 179
 
175
-        arrList[index] = e
176
-        // const [arrList, setArrList] = useState([[],[],[]])
177
-        setLabelList(arrList.flat())
180
+            return pre.concat(cur)
178 181
 
179
-        console.log(arrList.flat(), 'labelList')
182
+        }, [])
183
+        setLabelList([...newArr])
180 184
     }
181 185
 
182 186
     return <View className='imglist'>
183 187
 
184 188
         
185
-        <NoData nodata={!list.length}>
186
-
187
-
189
+        <NoData nodata={Object.keys(list).length === 0}>
190
+        {console.log(labelState,'-------------------')
191
+}
188 192
         {!labelState&&<View style={{ padding: '0 30px' }}>
193
+           
189 194
             {
190 195
 
191 196
                 Object.keys(list).map((item) => {
192
-                    console.log(list[item], item, 'list[item]11')
193 197
 
194 198
                     return <View className='imglist-card'>
195 199
                         <View className='imglist-card-tags' style={{ display: 'flex' }}>
196 200
                             {/* imageimageimageimage34 */}
197 201
                             {list[item].map((x) => {
198
-                                return <View className='tag' s>{x.tagName}</View>
202
+                                console.log(x.tagName)
203
+                                return <View className='tag' >{x.tagName}</View>
199 204
                             })}
200 205
                         </View>
201 206
                         <Image src={list[item][0].image} style={{ width: '100%' }} onClick={() => { setData(list[item]); setIsOpened(true) }}></Image>
@@ -218,7 +223,7 @@ const index = (props) => {
218 223
                 }
219 224
             </View>
220 225
             {/* <Tab value={['取消','']}  onClick={() => { Taro.navigateTo({ url: `/pages/label/edit/index` }) }} ></Tab> */}
221
-            <Tab pageState='3' value={['取消', '选择']} onClick={[(e) => setPageState('1'), (e) => ontagsClick()]}></Tab>
226
+            <Tab pageState='3' value={['取消', '选择']} onClick={[(e) => setLabelState(false), (e) => ontagsClick()]}></Tab>
222 227
         </View>
223 228
         }
224 229
 

+ 1
- 1
src/pages/label/index.jsx Целия файл

@@ -21,7 +21,7 @@ const house = (props) => {
21 21
 
22 22
 
23 23
   const getMateTagGroupList = () => {
24
-    request({ url: '/taMateTagGroup' }).then((res) => {
24
+    request({ url: '/taMateTagGroup', params:{pageSize:9999}}).then((res) => {
25 25
       const { records, ...page} = res.data.data
26 26
       setList(records)
27 27
     })

+ 2
- 2
src/pages/mateTag/index.jsx Целия файл

@@ -26,7 +26,7 @@ const house = (props) => {
26 26
   // })
27 27
   const getMateTagList = () => {
28 28
     console.log(id,'getMateTagList')
29
-    request({ url: '/taMateTag',params:{groupId:id},method: 'get', }).then((res) => {
29
+    request({ url: '/taMateTag',params:{groupId:id,pageSize:9999},method: 'get', }).then((res) => {
30 30
       const { records, ...page} = res.data.data
31 31
       setList(records)
32 32
     })
@@ -44,7 +44,7 @@ const house = (props) => {
44 44
           console.log('用户点击确定')
45 45
 
46 46
           request({ url: `/taMateTag/${row.tagId}`, method: 'delete', }).then((res)=>{
47
-            getMateTagList({ pageNum: 1, pageSize:10 })
47
+            getMateTagList({ pageNum: 1, pageSize:999 })
48 48
           })
49 49
           // Taro.showModal({
50 50
           //   title: `改标签组有${row.user.number}个标签仍在使用。请先清空标签,再删除标签组`,

+ 5
- 29
src/pages/material/index.jsx Целия файл

@@ -61,15 +61,9 @@ const index = (props) => {
61 61
             return pre.concat(cur)
62 62
 
63 63
         }, [])
64
-        setLabelList(newArr)
65
-        console.log(newArr, 'newArr')
66
-        // console.log(e, index, 'onLabelChange')
64
+        setLabelList([...newArr])
65
+        console.log(newArr, 'newArr11111111')
67 66
 
68
-        // arrList[index] = e
69
-        // // const [arrList, setArrList] = useState([[],[],[]])
70
-        // setLabelList(arrList.flat())
71
-
72
-        // console.log(arrList.flat(), 'labelList')
73 67
     }
74 68
 
75 69
 
@@ -115,29 +109,11 @@ const index = (props) => {
115 109
                 })
116 110
             }
117 111
             </NoData>
118
-
119
-            {/* <View className='inputstyle-view'>
120
-                <Text className='title'>入住人数</Text>
121
-                <Container className='inputstyle-view-card ' style={{ borderRadius: '20rpx', padding: '0 40rpx' }} >
122
-                    <Input placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
123
-                </Container>
124
-            </View>
125
-            <View className='inputstyle-view'>
126
-                <Text className='title'>入住日期</Text>
127
-                <Container className='inputstyle-view-card ' style={{ borderRadius: '20rpx', padding: '0 40rpx' }} >
128
-                    <Input placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
129
-                </Container>
130
-            </View>
131
-
132
-            <View className='inputstyle-view'>
133
-                <Text className='title'>离店日期</Text>
134
-                <Container className='inputstyle-view-card ' style={{ borderRadius: '20rpx', padding: '0 40rpx' }} >
135
-                    <Input placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
136
-                </Container>
137
-            </View> */}
138 112
         </Layout>
139 113
         {/* className='addhousetab' */}
140
-        <Tab pageState='3' value={['取消', '开始查询']} onClick={[(e) => setPageState('2'), (e) => onClick(e)]}></Tab>
114
+        <Tab pageState='3' value={['取消', '开始查询']} onClick={[(e) => Taro.navigateBack({
115
+                delta: 1
116
+            }), (e) => onClick(e)]}></Tab>
141 117
     </View>
142 118
 }
143 119
 

+ 5
- 3
src/pages/shop/index.jsx Целия файл

@@ -28,12 +28,12 @@ const account = (props) => {
28 28
   })
29 29
 
30 30
   function getShopList(params) {
31
-    setLoading(true)
31
+    // setLoading(true)
32 32
     request({ url: "/taShop",params,  method: 'get' })
33 33
       .then((res) => {
34 34
         const { records, ...page} = res.data.data
35 35
 
36
-        setLoading(false)
36
+        // setLoading(false)
37 37
         setPage({
38 38
           ...page,
39 39
           pageNum: page.current
@@ -55,6 +55,7 @@ const account = (props) => {
55 55
          
56 56
           request({ url: `/taShop/${shopId}`,  method: 'delete' })
57 57
           .then((res) => {
58
+            setList(list.filter((x)=>x.shopId!=shopId))
58 59
           })
59 60
 
60 61
 
@@ -66,6 +67,7 @@ const account = (props) => {
66 67
   }
67 68
 
68 69
   const loadMore = () => {
70
+    console.log('----------------')
69 71
     getShopList({ pageNum: page.pageNum + 1 })
70 72
   }
71 73
 
@@ -118,7 +120,7 @@ const account = (props) => {
118 120
       <InifiniteList
119 121
         length={list.length}
120 122
         total={page.total}
121
-        height={500}
123
+        height={600}
122 124
         itemRenderer={renderItem}
123 125
         loadMore={loadMore}
124 126
       />