张延森 před 4 roky
rodič
revize
7b6b8386a3

+ 10
- 0
config/index.js Zobrazit soubor

1
+const path = require('path')
2
+
1
 const config = {
3
 const config = {
2
   projectName: 'shigongliserverh5',
4
   projectName: 'shigongliserverh5',
3
   date: '2020-12-19',
5
   date: '2020-12-19',
59
         }
61
         }
60
       }
62
       }
61
     }
63
     }
64
+  },
65
+  alias: {
66
+    '@/assets': path.resolve(__dirname, '..', 'src/assets'),
67
+    '@/compents': path.resolve(__dirname, '..', 'src/compents'),
68
+    '@/layout': path.resolve(__dirname, '..', 'src/layout'),
69
+    '@/store': path.resolve(__dirname, '..', 'src/store'),
70
+    '@/reducers': path.resolve(__dirname, '..', 'src/reducers'),
71
+    '@/util': path.resolve(__dirname, '..', 'src/util')
62
   }
72
   }
63
 }
73
 }
64
 
74
 

+ 5
- 4
package.json Zobrazit soubor

45
     "lodash.groupby": "^4.6.0",
45
     "lodash.groupby": "^4.6.0",
46
     "react": "^16.10.0",
46
     "react": "^16.10.0",
47
     "react-dom": "^16.10.0",
47
     "react-dom": "^16.10.0",
48
+    "react-list": "^0.8.16",
48
     "react-redux": "^7.2.2",
49
     "react-redux": "^7.2.2",
49
     "redux": "^4.0.5",
50
     "redux": "^4.0.5",
50
     "taro-ui": "^3.0.0-alpha.7"
51
     "taro-ui": "^3.0.0-alpha.7"
53
     "@babel/core": "^7.8.0",
54
     "@babel/core": "^7.8.0",
54
     "@tarojs/mini-runner": "3.0.13",
55
     "@tarojs/mini-runner": "3.0.13",
55
     "@tarojs/webpack-runner": "3.0.13",
56
     "@tarojs/webpack-runner": "3.0.13",
57
+    "@types/react": "^16.0.0",
56
     "@types/webpack-env": "^1.13.6",
58
     "@types/webpack-env": "^1.13.6",
57
     "babel-preset-taro": "3.0.13",
59
     "babel-preset-taro": "3.0.13",
58
     "eslint": "^6.8.0",
60
     "eslint": "^6.8.0",
59
     "eslint-config-taro": "3.0.13",
61
     "eslint-config-taro": "3.0.13",
60
-    "stylelint": "9.3.0",
61
-    "@types/react": "^16.0.0",
62
-    "eslint-plugin-react": "^7.8.2",
63
     "eslint-plugin-import": "^2.12.0",
62
     "eslint-plugin-import": "^2.12.0",
64
-    "eslint-plugin-react-hooks": "^1.6.1"
63
+    "eslint-plugin-react": "^7.8.2",
64
+    "eslint-plugin-react-hooks": "^1.6.1",
65
+    "stylelint": "9.3.0"
65
   }
66
   }
66
 }
67
 }

+ 39
- 0
src/compents/InifiniteList/index.jsx Zobrazit soubor

1
+import React, { useEffect, useRef, useState } from 'react'
2
+import ReactList from 'react-list'
3
+import './index.scss'
4
+
5
+export default props => {
6
+  const ref = useRef()
7
+
8
+  const handleScroll = () => {
9
+    const done = props.length >= props.total
10
+
11
+    if (!done) {
12
+      const [, last] = ref.current.getVisibleRange()
13
+      // 如果未展示的数据少于3条就请求数据
14
+      if (props.length - last < 3) {
15
+        props.loadMore()
16
+      }
17
+    }
18
+  }
19
+
20
+  const NoData = (
21
+    <div className="no-data">
22
+      {props.nodata || '暂无数据'}
23
+    </div>
24
+  )
25
+
26
+  return (
27
+    <div className="inifinite-list-wrapper" style={{maxHeight: props.height}} onScroll={handleScroll}>
28
+      {
29
+        !props.length ? NoData :
30
+        <ReactList
31
+          ref={ref}
32
+          type="uniform"
33
+          length={props.length}
34
+          itemRenderer={props.itemRenderer}
35
+        />
36
+      }
37
+    </div>
38
+  )
39
+}

+ 18
- 0
src/compents/InifiniteList/index.scss Zobrazit soubor

1
+.inifinite-list-wrapper {
2
+  &::-webkit-scrollbar {
3
+    display: none;
4
+  }
5
+
6
+  scrollbar-width: none; /* firefox */
7
+  -ms-overflow-style: none; /* IE 10+ */
8
+  overflow-x: hidden;
9
+  overflow-y: auto;
10
+
11
+  .no-data {
12
+    text-align: center;
13
+    font-size: 1.2em;
14
+    color: #aaa;
15
+    position: relative;
16
+    top: 20%;
17
+  }
18
+}

+ 12
- 0
src/compents/NoData/index.jsx Zobrazit soubor

1
+import React, { useEffect, useState } from 'react'
2
+import './index.scss'
3
+
4
+export default props => {
5
+  return (
6
+    <div className={`no-data-wrapper ${props.className}`} style={props.style}>
7
+      {
8
+        props.nodata ? <div className="no-data-view">{props.tips || '暂无数据'}</div> : props.children
9
+      }
10
+    </div>
11
+  )
12
+}

+ 17
- 0
src/compents/NoData/index.scss Zobrazit soubor

1
+.no-data-wrapper {
2
+  position: relative;
3
+  height: 100%;
4
+  min-height: 200px;
5
+
6
+  .no-data-view {
7
+    width: 100%;
8
+    text-align: center;
9
+    font-size: 0.8em;
10
+    color: #aaa;
11
+    position: absolute;
12
+    left: 0;
13
+    top: 50%;
14
+    transform: translateY(-50%);
15
+    line-height: 2em;
16
+  }
17
+}

+ 2
- 2
src/compents/tags/index.jsx Zobrazit soubor

34
     return <View className='tags'>
34
     return <View className='tags'>
35
         <View className='at-row at-row--wrap' style={{ marginTop: '10rpx' }}>
35
         <View className='at-row at-row--wrap' style={{ marginTop: '10rpx' }}>
36
             {
36
             {
37
-                list.map((item) => {
38
-                    return <View className='at-col at-col-4 ' >
37
+                list.map((item, index) => {
38
+                    return <View className='at-col at-col-4 ' key={index}>
39
                         <View className={`tags-btn tags-btn${keyList.find(x => x.tagId === item.tagId) ? '-on' : ''}`} onClick={() => onClick(item)} >{item.name}</View>
39
                         <View className={`tags-btn tags-btn${keyList.find(x => x.tagId === item.tagId) ? '-on' : ''}`} onClick={() => onClick(item)} >{item.name}</View>
40
                     </View>
40
                     </View>
41
                 })
41
                 })

+ 1
- 1
src/compents/tags/index.scss Zobrazit soubor

4
 
4
 
5
   &-btn {
5
   &-btn {
6
     background-color: #ffffff;
6
     background-color: #ffffff;
7
-    color: #acacac;
7
+    color: #666;
8
     margin: 10px;
8
     margin: 10px;
9
     font-size: 22px;
9
     font-size: 22px;
10
     height: 50px;
10
     height: 50px;

+ 20
- 19
src/pages/account/index.jsx Zobrazit soubor

7
 import Layout from '../../layout/index'
7
 import Layout from '../../layout/index'
8
 import request from '../../util/request'
8
 import request from '../../util/request'
9
 import getQueryValue from '../../util/getQueryValue'
9
 import getQueryValue from '../../util/getQueryValue'
10
+import NoData from '@/compents/NoData'
10
 
11
 
11
 
12
 
12
 const account = (props) => {
13
 const account = (props) => {
52
 
53
 
53
   return <View className='account'>
54
   return <View className='account'>
54
     <Layout>
55
     <Layout>
55
-      {list.map((item, index) => {
56
-        return <View className='account-view'>
57
-          {/* <Text className='account-view-title'>房源编号:<Text style={{fontSize:"1rem"}}>{item.keeperId}</Text></Text> */}
58
-          <ContainerLayout className='account-view-card'>
59
-            <View className='top' >
60
-              <View>姓名:{item.name}</View>
61
-              <View>电话:{item.phone}</View>
62
-              {/* <View>微信号:{x.user.name}</View>
63
-              <View>房源数:{x.user.name}</View> */}
64
-            </View>
65
-            <View className='bottom'>
66
-              <Text onClick={() => { Taro.navigateTo({ url: `/pages/account/edit/index?keeperId=${item.keeperId}` }) }}>编辑</Text>
67
-              <Text onClick={()=>onDelete(item.keeperId)}>删除</Text>
68
-            </View>
69
-          </ContainerLayout>
70
-
71
-        </View>
72
-
73
-      })}
56
+      <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
+        })}
74
+      </NoData>
74
     </Layout>
75
     </Layout>
75
     {/* onClick={(e)=>(e) */}
76
     {/* onClick={(e)=>(e) */}
76
     <Tab value={['+新增名宿老板账号']} color='#ffffff' onClick={() => { Taro.navigateTo({ url: `/pages/account/edit/index?id=${id}` }) }} ></Tab>
77
     <Tab value={['+新增名宿老板账号']} color='#ffffff' onClick={() => { Taro.navigateTo({ url: `/pages/account/edit/index?id=${id}` }) }} ></Tab>

+ 1
- 1
src/pages/adminUser/index.jsx Zobrazit soubor

79
 
79
 
80
     <View className='page-container'>
80
     <View className='page-container'>
81
       {menuList.map((row) => {
81
       {menuList.map((row) => {
82
-        return <ContainerLayout className='adminuser-menu' onClick={() => onClick(row)}>
82
+        return <ContainerLayout key={row.url} className='adminuser-menu' onClick={() => onClick(row)}>
83
           <Text>{row.title}</Text>
83
           <Text>{row.title}</Text>
84
           <View className='adminuser-menu-img' >
84
           <View className='adminuser-menu-img' >
85
             <Image className='image' src={row.icon}></Image>
85
             <Image className='image' src={row.icon}></Image>

+ 5
- 1
src/pages/imglist/index.jsx Zobrazit soubor

13
 import getQueryValue from '../../util/getQueryValue';
13
 import getQueryValue from '../../util/getQueryValue';
14
 import request, { uploadFiles } from '../../util/request';
14
 import request, { uploadFiles } from '../../util/request';
15
 import groupby from 'lodash.groupby';
15
 import groupby from 'lodash.groupby';
16
+import NoData from '@/compents/NoData'
16
 
17
 
17
 // Page({
18
 // Page({
18
 //     data: {
19
 //     data: {
164
 
165
 
165
     return <View className='imglist'>
166
     return <View className='imglist'>
166
 
167
 
167
-
168
+        
169
+        <NoData nodata={!list.length}>
168
 
170
 
169
 
171
 
170
         {!labelState&&<View style={{ padding: '0 30px' }}>
172
         {!labelState&&<View style={{ padding: '0 30px' }}>
204
         </View>
206
         </View>
205
         }
207
         }
206
 
208
 
209
+        </NoData>
210
+
207
         <AtFloatLayout isOpened={isOpened} onClose={() => handleClose()} style={{ zIndex: '1000' }}>
211
         <AtFloatLayout isOpened={isOpened} onClose={() => handleClose()} style={{ zIndex: '1000' }}>
208
             <View className='floatmodel' >
212
             <View className='floatmodel' >
209
                 <View onClick={() => updateLabel()}>更改标签</View>
213
                 <View onClick={() => updateLabel()}>更改标签</View>

+ 1
- 41
src/pages/index/index.jsx Zobrazit soubor

6
 import './index.scss'
6
 import './index.scss'
7
 
7
 
8
 const index = (props) => {
8
 const index = (props) => {
9
-
10
-
11
-
12
-  const [userRole, setUserRole] = useState('1')
13
-  const [pageState, SetPageState] = useState('1')
14
-  const [list, setList] = useState([])
15
-  useEffect(() => {
16
-
17
-    
18
-    setList([
19
-      {
20
-        name: 'zhou',
21
-        phone: '177'
22
-      },
23
-      {
24
-        name: 'zhou',
25
-        phone: '177'
26
-      },
27
-      {
28
-        name: 'zhou',
29
-        phone: '177'
30
-      }
31
-    ])
32
-  }, [])
33
-
34
-
35
-  const onTabClick = (e) => {
36
-    console.log(e, '111')
37
-    setUserRole(e)
38
-  }
39
-
40
-  const onRegisterChange = (e) => {
41
-    console.log(e, '111')
42
-  }
43
-
44
-
45
-
46
- 
47
   return <View className='index'>
9
   return <View className='index'>
48
-{/* 432 */}
49
-      <AdminUser></AdminUser>  
50
-     
10
+      <AdminUser></AdminUser>
51
   </View>
11
   </View>
52
 }
12
 }
53
 
13
 

+ 4
- 1
src/pages/mateTag/index.jsx Zobrazit soubor

7
 import Layout from '../../layout/index'
7
 import Layout from '../../layout/index'
8
 import request from '../../util/request'
8
 import request from '../../util/request'
9
 import getQueryValue from '../../util/getQueryValue'
9
 import getQueryValue from '../../util/getQueryValue'
10
+import NoData from '@/compents/NoData'
10
 
11
 
11
 const house = (props) => {
12
 const house = (props) => {
12
 
13
 
25
   // })
26
   // })
26
   const getMateTagList = () => {
27
   const getMateTagList = () => {
27
     console.log(id,'getMateTagList')
28
     console.log(id,'getMateTagList')
28
-    request({ url: '/api/mp/taMateTag',params:{groupId:id},method: 'get', }).then((res) => {
29
+    request({ url: '/taMateTag',params:{groupId:id},method: 'get', }).then((res) => {
29
       const { records, ...page} = res.data.data
30
       const { records, ...page} = res.data.data
30
       setList(records)
31
       setList(records)
31
     })
32
     })
73
 
74
 
74
   return <View className='account'>
75
   return <View className='account'>
75
     <Layout>
76
     <Layout>
77
+      <NoData nodata={!list.length} tips="暂无标签">
76
       {list.map((x, index) => {
78
       {list.map((x, index) => {
77
         return <View className='account-view'>
79
         return <View className='account-view'>
78
   
80
   
90
         </View>
92
         </View>
91
 
93
 
92
       })}
94
       })}
95
+      </NoData>
93
     </Layout>
96
     </Layout>
94
     {/* onClick={(e)=>(e) */}
97
     {/* onClick={(e)=>(e) */}
95
     <Tab value={['+新增标签']} color='#ffffff' onClick={() => { Taro.navigateTo({ url: `/pages/mateTag/edit/index?id=${id}` }) }} ></Tab>
98
     <Tab value={['+新增标签']} color='#ffffff' onClick={() => { Taro.navigateTo({ url: `/pages/mateTag/edit/index?id=${id}` }) }} ></Tab>

+ 4
- 1
src/pages/material/index.jsx Zobrazit soubor

9
 import locationicon from '../../assets/locationicon.png'
9
 import locationicon from '../../assets/locationicon.png'
10
 import Tags from '../../compents/tags/index'
10
 import Tags from '../../compents/tags/index'
11
 import request from '../../util/request'
11
 import request from '../../util/request'
12
+import NoData from '@/compents/NoData'
12
 import './index.scss'
13
 import './index.scss'
13
 
14
 
14
 // Page({
15
 // Page({
90
 
91
 
91
 
92
 
92
         <Layout>
93
         <Layout>
94
+            <NoData nodata={!list.length}>
93
             {
95
             {
94
                 list.map((item,index) => {
96
                 list.map((item,index) => {
95
-                    return <View className='material-card'>
97
+                    return <View className='material-card' key={index}>
96
                         <Text>{item.name}</Text>
98
                         <Text>{item.name}</Text>
97
                         <Tags list={item.taMateTagList} onChange={(e) => onLabelChange(e, index)} > </Tags>
99
                         <Tags list={item.taMateTagList} onChange={(e) => onLabelChange(e, index)} > </Tags>
98
                     </View>
100
                     </View>
99
                 })
101
                 })
100
             }
102
             }
103
+            </NoData>
101
 
104
 
102
             {/* <View className='inputstyle-view'>
105
             {/* <View className='inputstyle-view'>
103
                 <Text className='title'>入住人数</Text>
106
                 <Text className='title'>入住人数</Text>

+ 3
- 2
src/pages/material/index.scss Zobrazit soubor

2
   padding-top: 30rpx;
2
   padding-top: 30rpx;
3
   &-card {
3
   &-card {
4
     text-align: center;
4
     text-align: center;
5
-color: #7b7b7b;
6
-margin-top: 30px;
5
+    // color: #7b7b7b;
6
+    color: '#666';
7
+    margin-top: 30px;
7
 
8
 
8
   }
9
   }
9
 
10
 

+ 29
- 47
src/pages/shop/index.jsx Zobrazit soubor

2
 import Taro, { useDidShow } from '@tarojs/taro'
2
 import Taro, { useDidShow } from '@tarojs/taro'
3
 import './index.scss'
3
 import './index.scss'
4
 import { View, Text, Input, Image } from '@tarojs/components'
4
 import { View, Text, Input, Image } from '@tarojs/components'
5
-import VirtualList from '@tarojs/components/virtual-list'
6
 import ContainerLayout from '../../compents/container/index'
5
 import ContainerLayout from '../../compents/container/index'
7
 import Tab from '../../compents/tab/index'
6
 import Tab from '../../compents/tab/index'
8
 import Layout from '../../layout/index'
7
 import Layout from '../../layout/index'
9
 import request from '../../util/request'
8
 import request from '../../util/request'
10
-
11
-
12
-// const Row = React.memo(({ id, index, style, data }) => {
13
-//   console.log({ id, index, style, data },'444')
14
-//   return (
15
-//     <View className='account-view' id={index}>
16
-//       {/* <Text className='account-view-title'>店铺编号:{index}</Text> */}
17
-//       <ContainerLayout className='account-view-card'>
18
-//         <View className='top' >
19
-//           <View>店铺名称:{data[index]?.name||''}</View>
20
-//           {/* <View>电话:{x.user.name}</View>
21
-//         <View>微信号:{x.user.name}</View>
22
-//         <View>房源数:{x.user.name}</View> */}
23
-//         </View>
24
-//         <View className='bottom'>
25
-//           <Text onClick={() => { Taro.navigateTo({ url: `/pages/account/edit/index?=${data.shopId}` }) }}>编辑</Text>
26
-//           <Text >删除</Text>
27
-//         </View>
28
-//       </ContainerLayout>
29
-
30
-//     </View>
31
-//   );
32
-// })
9
+import InifiniteList from '@/compents/InifiniteList'
33
 
10
 
34
 const account = (props) => {
11
 const account = (props) => {
35
 
12
 
88
     })
65
     })
89
   }
66
   }
90
 
67
 
91
-  // const listReachBottom = () => {
92
-  //   getShopList({ pageNum: page.pageNum + 1 })
93
-  // }
68
+  const loadMore = () => {
69
+    getShopList({ pageNum: page.pageNum + 1 })
70
+  }
71
+
72
+  const renderItem = (index, key) => (
73
+    <View className='account-view' key={key}>
74
+      {/* <Text className='account-view-title'>店铺编号:{index}</Text> */}
75
+      <ContainerLayout className='account-view-card'>
76
+        <View className='top' >
77
+          <View>店铺名称:{list[index].name||''}</View>
78
+          {/* <View>电话:{x.user.name}</View>
79
+        <View>微信号:{x.user.name}</View>
80
+        <View>房源数:{x.user.name}</View> */}
81
+        </View>
82
+        <View className='bottom'>
83
+          <Text onClick={() => { Taro.navigateTo({ url: `/pages/account/index?id=${list[index].shopId}` }) }}>店主</Text>
84
+          <Text onClick={()=>onDelete(list[index].shopId)}>删除</Text>
85
+        </View>
86
+      </ContainerLayout>  
87
+    </View>
88
+  )
94
   
89
   
95
 
90
 
96
   return <View className='account'>
91
   return <View className='account'>
120
         {Row}
115
         {Row}
121
       </VirtualList> */}
116
       </VirtualList> */}
122
 
117
 
123
-      {
124
-        list.map((item)=>{
125
-        return  <View className='account-view' >
126
-          {/* <Text className='account-view-title'>店铺编号:{index}</Text> */}
127
-          <ContainerLayout className='account-view-card'>
128
-            <View className='top' >
129
-              <View>店铺名称:{item.name||''}</View>
130
-              {/* <View>电话:{x.user.name}</View>
131
-            <View>微信号:{x.user.name}</View>
132
-            <View>房源数:{x.user.name}</View> */}
133
-            </View>
134
-            <View className='bottom'>
135
-              <Text onClick={() => { Taro.navigateTo({ url: `/pages/account/index?id=${item.shopId}` }) }}>详情</Text>
136
-              <Text onClick={()=>onDelete(item.shopId)}>删除</Text>
137
-            </View>
138
-          </ContainerLayout>
139
-    
140
-        </View>
141
-        })
142
-      }
118
+      <InifiniteList
119
+        length={list.length}
120
+        total={page.total}
121
+        height={500}
122
+        itemRenderer={renderItem}
123
+        loadMore={loadMore}
124
+      />
143
 
125
 
144
     </Layout>
126
     </Layout>
145
     {/* onClick={(e)=>(e) */}
127
     {/* onClick={(e)=>(e) */}

+ 13993
- 0
yarn.lock
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor