Browse Source

Merge branch 'master' of http://git.ycjcjy.com/shigongli/client-miniapp

张延森 4 years ago
parent
commit
b0d5d96b5d

+ 1
- 1
src/layout/index.jsx View File

@@ -6,7 +6,7 @@ const Layout = ({ children }) => {
6 6
         <View className='page-container' >
7 7
             {children}
8 8
         </View>
9
-        <View style={{height:'10rpx'}}></View>
9
+        {/* <View style={{height:'10rpx'}}></View> */}
10 10
     </ScrollView>
11 11
 }
12 12
 

+ 112
- 82
src/pages/customer/register/index.jsx View File

@@ -1,129 +1,159 @@
1
-import React, { useEffect, useState } from 'react'
2
-import './register.scss'
3
-import { View, Text, Input } from '@tarojs/components'
4
-import ContainerLayout from '../../../compents/container/index'
1
+import React, { useEffect, useState } from "react";
2
+import Taro from "@tarojs/taro";
3
+import "./register.scss";
4
+import { View, Text, Input } from "@tarojs/components";
5
+import ContainerLayout from "../../../compents/container/index";
5 6
 // import { AtInput } from 'taro-ui'
6
-import Tab from '../../../compents/tab'
7
-import Layout from '../../../layout'
8
-import request from '@/util/request'
9
-
7
+import Tab from "../../../compents/tab";
8
+import Layout from "../../../layout";
9
+import request from "@/util/request";
10 10
 
11 11
 const InputGroup = props => {
12
-  const [name, setName] = useState(props.dataSource.name)
13
-  const [phone, setPhone] = useState(props.dataSource.phone)
12
+  const [name, setName] = useState(props.dataSource.name);
13
+  const [phone, setPhone] = useState(props.dataSource.phone);
14 14
 
15 15
   useEffect(() => {
16 16
     if (name !== props.dataSource.name) {
17
-      setName(props.dataSource.name)
17
+      setName(props.dataSource.name);
18 18
     }
19
-  }, [props.dataSource.name])
20
-  
19
+  }, [props.dataSource.name]);
20
+
21 21
   useEffect(() => {
22 22
     if (phone !== props.dataSource.phone) {
23
-      setPhone(props.dataSource.phone)
23
+      setPhone(props.dataSource.phone);
24 24
     }
25
-  }, [props.dataSource.phone])
25
+  }, [props.dataSource.phone]);
26 26
 
27 27
   const handeNameChange = e => {
28
-    const v = e.detail.value
29
-    setName(v)
28
+    const v = e.detail.value;
29
+    setName(v);
30 30
     if (props.onChange) {
31 31
       props.onChange({
32 32
         name: v,
33 33
         phone
34
-      })
34
+      });
35 35
     }
36
-    return v
37
-  }
38
-  
36
+    return v;
37
+  };
38
+
39 39
   const handePhoneChange = e => {
40
-    const v = e.detail.value
41
-    setPhone(v)
40
+    const v = e.detail.value;
41
+    setPhone(v);
42 42
     if (props.onChange) {
43 43
       props.onChange({
44 44
         name,
45 45
         phone: v
46
-      })
46
+      });
47 47
     }
48
-    return v
49
-  }
48
+    return v;
49
+  };
50 50
 
51 51
   const handleFocues = (_, e) => {
52
-    e.stopPropagation()
53
-    e.preventDefault()
54
-  }
52
+    e.stopPropagation();
53
+    e.preventDefault();
54
+  };
55 55
 
56 56
   return (
57
-    <View className='register-user'>
58
-      <Text>入住人{props.index+1}</Text>
59
-      <ContainerLayout className='register-user-from'>
60
-        {console.log(name,phone,'name,phone')}
61
-        <Input name="name" className='register-user-from-input' value={name} onInput={handeNameChange} placeholder='姓名' type='text' />
62
-        <Input name="phone" className='register-user-from-input' value={phone} onInput={handePhoneChange} placeholder='电话' type='text' />
57
+    <View className="register-user">
58
+      <Text>入住人{props.index + 1}</Text>
59
+      <ContainerLayout className="register-user-from">
60
+        <Input
61
+          name="name"
62
+          className="register-user-from-input"
63
+          value={name}
64
+          onInput={handeNameChange}
65
+          placeholder="姓名"
66
+          type="text"
67
+        />
68
+        <View
69
+          style={{ height: "2rpx", border: 1, background: "#f4f4f4" }}
70
+        ></View>
71
+        <Input
72
+          name="phone"
73
+          className="register-user-from-input"
74
+          value={phone}
75
+          onInput={handePhoneChange}
76
+          placeholder="电话"
77
+          type="text"
78
+        />
63 79
       </ContainerLayout>
64 80
     </View>
65
-  )
66
-}
67
-
68
-const register = (props) => {
81
+  );
82
+};
69 83
 
70
-  let [list, setList] = useState([])
84
+const register = props => {
85
+  let [list, setList] = useState([]);
71 86
   useEffect(() => {
72 87
     if (props.dataSource) {
73
-      const {personNum} = props.dataSource.houseSetting || {}
88
+      const { personNum } = props.dataSource.houseSetting || {};
74 89
 
75
-      setList(new Array(personNum || 0).fill('*').map(x => ({name: undefined, phone: undefined})))
90
+      setList(
91
+        new Array(personNum || 0)
92
+          .fill("*")
93
+          .map(x => ({ name: undefined, phone: undefined }))
94
+      );
76 95
     }
77
-  }, [props.dataSource])
96
+  }, [props.dataSource]);
78 97
 
79 98
   const onClick = () => {
80
-    const hasNull = list.filter(x => !x.name || !x.phone)[0]
99
+    const hasNull = list.filter(x => !x.name || !x.phone)[0];
81 100
     if (hasNull) {
82 101
       Taro.showModal({
83
-        title: '请将信息填写完成',
102
+        title: "请将信息填写完成",
84 103
         showCancel: false,
85 104
         success: () => {}
86
-      })
105
+      });
87 106
 
88
-      return
107
+      return;
89 108
     }
90 109
 
91 110
     const data = {
92 111
       orderId: props.dataSource.orderId,
93 112
       houseId: props.dataSource.houseSetting.houseId,
94
-      personList: list,
95
-    }
96
-
97
-    request({ url: '/taHousePerson', method: 'POST', data }).then(res => {
98
-      if (props.onFinished) {
99
-        props.onFinished(res)
100
-      }
101
-    }).catch(err => {
102
-      console.error(err)
103
-      const message = err.message || err.errMsg || err
104
-      Taro.showToast({
105
-        title: message,
106
-        icon: 'none',
107
-        duration: 3000
113
+      personList: list
114
+    };
115
+
116
+    request({ url: "/taHousePerson", method: "POST", data })
117
+      .then(res => {
118
+        if (props.onFinished) {
119
+          props.onFinished(res);
120
+        }
108 121
       })
109
-    })
110
-  }
111
-
112
-  const onChangeList = index => value =>  { 
113
-    list[index] = value
114
-    setList([...list])
115
-  }
116
-
117
-  return <View className='register' >
118
-    <Layout>
119
-      {list.map((x, index) => {
120
-        let inx = index
121
-        return <InputGroup key={inx} index={index} dataSource={x} onChange={onChangeList(inx)} />
122
-      })}
123
-    </Layout>
124
-
125
-    <Tab value={['开启旅程']} onClick={(e) => onClick(e)}></Tab>
126
-  </View>
127
-}
128
-
129
-export default register
122
+      .catch(err => {
123
+        console.error(err);
124
+        const message = err.message || err.errMsg || err;
125
+        Taro.showToast({
126
+          title: message,
127
+          icon: "none",
128
+          duration: 3000
129
+        });
130
+      });
131
+  };
132
+
133
+  const onChangeList = index => value => {
134
+    list[index] = value;
135
+    setList([...list]);
136
+  };
137
+
138
+  return (
139
+    <View className="register">
140
+      <Layout>
141
+        {list.map((x, index) => {
142
+          let inx = index;
143
+          return (
144
+            <InputGroup
145
+              key={inx}
146
+              index={index}
147
+              dataSource={x}
148
+              onChange={onChangeList(inx)}
149
+            />
150
+          );
151
+        })}
152
+      </Layout>
153
+
154
+      <Tab value={["开启旅程"]} onClick={e => onClick(e)}></Tab>
155
+    </View>
156
+  );
157
+};
158
+
159
+export default register;

+ 4
- 4
src/pages/customer/register/register.scss View File

@@ -27,11 +27,11 @@
27 27
                 // height: 60px;
28 28
                 border-radius: 20px;
29 29
                 font-size: 24px;
30
-                border-bottom: none;
30
+                // border-bottom: none;
31 31
 
32
-                &::after{
33
-                    border:none
34
-                }
32
+                // &::after{
33
+                //     border:none
34
+                // }
35 35
               }
36 36
             .at-input__title{
37 37
                 text-align: center;

+ 231
- 165
src/pages/guide/index.jsx View File

@@ -1,170 +1,236 @@
1
-import React, { useEffect, useState } from 'react'
2
-import Taro, { useDidShow } from '@tarojs/taro'
3
-import { View, Text, Image } from '@tarojs/components'
4
-import ContainerLayout from '../../compents/container/index'
5
-import icon from '../../assets/icon.png'
6
-import './index.scss'
7
-import userRloe from '../../util/userRole'
8
-import { useSelector } from 'react-redux'
9
-import request,{uploadFiles } from '@/util/request'
10
-import uploadicon from '../../assets/uploadicon.png'
11
-const guide = (props) => {
12
-
13
-    const user = useSelector(state => state.user)
14
-    // const guide = useSelector(state => state.guide)
15
-
16
-
17
-
18
-
19
-    const { value, houseId, ...prop } = props
20
-    const [state, setState] = useState(1)
21
-
22
-    const [imgurl, setImgurl] = useState('')
23
-    // const [detail, setDetail] = useState({})
24
-    const detail = props.dataSource || {}
25
-
26
-    // useDidShow(() => {
27
-    //     if (houseId) {
28
-    //         getDetail()
29
-    //     }
30
-    // })
31
-
32
-    // useEffect(() => {
33
-    //     console.log(houseId, 'params33')
34
-    //     if (houseId) {
35
-    //         getDetail()
36
-    //     }
37
-
38
-    // }, [])
39
-    // const getDetail = () => {
40
-    //     request({ url: `/taHouse/${houseId}` }).then((res) => {
41
-    //         setDetail(res.data.data)
42
-
43
-    //         wx.setNavigationBarTitle({
44
-    //             title: res.data.data.title
45
-    //         })
46
-    //     })
47
-    // }
48
-
49
-    const onOpenLocation = (lngLat) => {
50
-        const [latitude, longitude] = lngLat.split(',')
51
-        console.log(lngLat, latitude, longitude)
52
-        wx.openLocation({
53
-            latitude: Number(latitude),
54
-            longitude: Number(longitude),
55
-            scale: 18,
56
-            fail: (err) => {
57
-                console.log(err)
58
-            }
59
-        })
1
+import React, { useEffect, useState } from "react";
2
+import Taro, { useDidShow } from "@tarojs/taro";
3
+import { View, Text, Image } from "@tarojs/components";
4
+import ContainerLayout from "../../compents/container/index";
5
+import icon from "../../assets/icon.png";
6
+import "./index.scss";
7
+import userRloe from "../../util/userRole";
8
+import { useSelector } from "react-redux";
9
+import request, { uploadFiles } from "@/util/request";
10
+import uploadicon from "../../assets/uploadicon.png";
11
+const guide = props => {
12
+  const user = useSelector(state => state.user);
13
+  // const guide = useSelector(state => state.guide)
14
+
15
+  const { value, houseId, ...prop } = props;
16
+  const [state, setState] = useState(1);
17
+
18
+  const [imgurl, setImgurl] = useState("");
19
+  // const [detail, setDetail] = useState({})
20
+  const detail = props.dataSource || {};
21
+
22
+  // useDidShow(() => {
23
+  //     if (houseId) {
24
+  //         getDetail()
25
+  //     }
26
+  // })
27
+
28
+  // useEffect(() => {
29
+  //     console.log(houseId, 'params33')
30
+  //     if (houseId) {
31
+  //         getDetail()
32
+  //     }
33
+
34
+  // }, [])
35
+  // const getDetail = () => {
36
+  //     request({ url: `/taHouse/${houseId}` }).then((res) => {
37
+  //         setDetail(res.data.data)
38
+
39
+  //         wx.setNavigationBarTitle({
40
+  //             title: res.data.data.title
41
+  //         })
42
+  //     })
43
+  // }
44
+
45
+  const onOpenLocation = lngLat => {
46
+    const [latitude, longitude] = lngLat.split(",");
47
+    console.log(lngLat, latitude, longitude);
48
+    wx.openLocation({
49
+      latitude: Number(latitude),
50
+      longitude: Number(longitude),
51
+      scale: 18,
52
+      fail: err => {
53
+        console.log(err);
54
+      }
55
+    });
56
+  };
57
+
58
+  const onToMap = type => {
59
+    if (user.role == userRloe.customer) return;
60
+    switch (type) {
61
+      case "address":
62
+        Taro.navigateTo({
63
+          url: `/pages/map/index?houseId=${houseId}&type=${type}`
64
+        });
65
+        break;
66
+      case "park":
67
+        Taro.navigateTo({
68
+          url: `/pages/map/index?houseId=${houseId}&type=${type}`
69
+        });
70
+        break;
71
+      case "wifi":
72
+        Taro.navigateTo({ url: `/pages/wifi/index?houseId=${houseId}` });
73
+        break;
74
+      case "image": {
75
+        if (user.role == userRloe.customer) return;
76
+        wx.chooseImage({
77
+          count: 1,
78
+          sizeType: ["original", "compressed"],
79
+          sourceType: ["album"],
80
+          success: res => {
81
+            // tempFilePath可以作为img标签的src属性显示图片
82
+            const tempFilePaths = res.tempFilePaths;
83
+
84
+            uploadFiles(tempFilePaths)
85
+              .then(res => {
86
+                console.log(res, "uploadFiles");
87
+                // setImgUrl(res[0])
88
+                setImgurl(res[0]);
89
+                request({
90
+                  url: `/taHouse/${houseId}`,
91
+                  method: "put",
92
+                  data: { ...detail, desc: res[0] }
93
+                }).then(res => {});
94
+              })
95
+              .catch(e => {
96
+                console.log(e, "err");
97
+              });
98
+
99
+            // setImgurl(tempFilePaths[0])
100
+          }
101
+          // success: (res) => {
102
+          //     // tempFilePath可以作为img标签的src属性显示图片
103
+
104
+          //     console.log(res)
105
+          //     const tempFilePaths = res.tempFilePaths
106
+          //     setImgurl(tempFilePaths[0])
107
+
108
+          // }
109
+        });
110
+        break;
111
+      }
60 112
     }
61
-
62
-    const onToMap = (type) => {
63
-        if (user.role == userRloe.customer) return
64
-        switch (type) {
65
-            case 'address': Taro.navigateTo({ url: `/pages/map/index?houseId=${houseId}&type=${type}` }); break;
66
-            case 'park': Taro.navigateTo({ url: `/pages/map/index?houseId=${houseId}&type=${type}` }); break;
67
-            case 'wifi': Taro.navigateTo({ url: `/pages/wifi/index?houseId=${houseId}` }); break;
68
-            case 'image': {
69
-                if (user.role == userRloe.customer) return
70
-                wx.chooseImage({
71
-                    count: 1,
72
-                    sizeType: ['original', 'compressed'],
73
-                    sourceType: ['album',],
74
-                    success: (res) => {
75
-                                // tempFilePath可以作为img标签的src属性显示图片
76
-                                const tempFilePaths = res.tempFilePaths
77
-
78
-                        uploadFiles(tempFilePaths).then((res) => {
79
-                            console.log(res, 'uploadFiles')
80
-                            // setImgUrl(res[0])
81
-                            setImgurl(res[0])
82
-                            request({ url: `/taHouse/${houseId}`, method: 'put', data: { ...detail, desc:res[0] } }).then((res) => {
83
-                                
84
-                            })
85
-                        }).catch((e) => {
86
-                            console.log(e, 'err')
87
-                        })
88
-
89
-                        // setImgurl(tempFilePaths[0])
90
-                    }
91
-                    // success: (res) => {
92
-                    //     // tempFilePath可以作为img标签的src属性显示图片
93
-
94
-                    //     console.log(res)
95
-                    //     const tempFilePaths = res.tempFilePaths
96
-                    //     setImgurl(tempFilePaths[0])
97
-
98
-
99
-                        
100
-                    // }
101
-                }); break;
102
-            }
103
-        }
104
-        // Taro.navigateTo({ url: `/pages/map/index?type=${type}` })
105
-    }
106
-     const [addressName,addressDetail] = (detail.address||'').split('____')
107
-     const [parkingName,parkingDetail] = (detail.parking||'').split('____')
108
-    return <View className='guide'>
109
-        {!!houseId&&<View>
110
-            <View className='guide-view'>
111
-                <Text className='guide-view-info'>房屋位置</Text>
112
-                <ContainerLayout className='guide-view-layout' style={{ display: 'flex', justifyContent: 'space-between' }} onClick={() => onToMap('address')}>
113
-                    <View  >
114
-                        <View className='guide-view-layout-text1' >{addressName}</View>
115
-                        <View className='guide-view-layout-text2'>{addressDetail}</View>
116
-                    </View>
117
-                    {user.role == userRloe.customer && <View style={{ float: 'right' }} onClick={() => onOpenLocation(detail.lngLat)}>
118
-                        <Image className='icon' src={icon} />
119
-                        <View className='icontext' >去这里</View>
120
-                    </View>}
121
-                </ContainerLayout>
122
-            </View>
123
-            <View className='guide-view'>
124
-                <Text className='guide-view-info'>停车位置</Text>
125
-                <ContainerLayout className='guide-view-layout' style={{ display: 'flex', justifyContent: 'space-between' }} onClick={() => onToMap('park')}>
126
-                    <View  >
127
-                        <View className='guide-view-layout-text1' >{parkingName}</View>
128
-                        <View className='guide-view-layout-text2'>{parkingDetail}</View>
129
-                    </View>
130
-                    {user.role == userRloe.customer && <View style={{ float: 'right' }} onClick={() => onOpenLocation(detail.parkLngLat)}>
131
-                        <Image className='icon' src={icon} />
132
-                        <View className='icontext'>去这里</View>
133
-                    </View>}
134
-                </ContainerLayout>
135
-            </View>
136
-            <View className='guide-view'>
137
-                <Text className='guide-view-info'>wifi信息</Text>
138
-                <ContainerLayout className='guide-view-layout guide-view-wifi' onClick={() => onToMap('wifi')}>
139
-                    <View>
140
-                        <Text>名称:</Text><Text>{detail.wifiName}</Text>
141
-                    </View>
142
-                    <View>
143
-                        <Text>密码:</Text><Text>{detail.wifiPassword}</Text>
144
-                    </View>
145
-                </ContainerLayout>
146
-            </View>
147
-            <View className='guide-view'>
148
-                <Text className='guide-view-info'>其他指引</Text>
149
-                {/* <ContainerLayout className='guide-view-layout guide-view-img'> */}
150
-                {(detail.desc || imgurl) && <Image className='guide-view-img' mode='widthFix' onClick={() => onToMap('image')} src={imgurl || detail.desc}></Image>}
151
-                {!detail.desc && !imgurl && <View style={{ padding: "300rpx" }} >
152
-
153
-                    <Image className='guide-view-img' mode='widthFix' onClick={() => onToMap('image')} src={uploadicon}></Image>
113
+    // Taro.navigateTo({ url: `/pages/map/index?type=${type}` })
114
+  };
115
+  //  const [addressName,addressDetail] = (detail.address||'').split('____')
116
+  //  const [parkingName,parkingDetail] = (detail.parking||'').split('____')
117
+  return (
118
+    <View className="guide">
119
+      {!!houseId && (
120
+        <View>
121
+          <View className="guide-view">
122
+            <Text className="guide-view-info">房屋位置</Text>
123
+            <ContainerLayout
124
+              className="guide-view-layout"
125
+              style={{ display: "flex", justifyContent: "space-between" }}
126
+              onClick={() => onToMap("address")}
127
+            >
128
+              <View>
129
+                <View className="guide-view-layout-text1">
130
+                  {detail.shortAddress}
154 131
                 </View>
155
-                }
156
-            </View>
157
-        </View>}
158
-        {
159
-            !houseId && <View className='recommend-noorder' style={{ marginTop: 'calc(40vh)',textAlign:'center' }}>
160
-                <Text>哎呀</Text>
161
-                <Text>暂时没发现您的入住订单呢~</Text>
162
-
163
-
164
-            </View>
165
-        }
166
-
132
+                <View className="guide-view-layout-text2">
133
+                  {detail.address}
134
+                </View>
135
+              </View>
136
+              {user.role == userRloe.customer && (
137
+                <View
138
+                  style={{
139
+                    float: "right",
140
+                    display: "flex",
141
+                    justifyContent: "center",
142
+                    flexDirection: "column"
143
+                  }}
144
+                  onClick={() => onOpenLocation(detail.lngLat)}
145
+                >
146
+                  <Image className="icon" src={icon} />
147
+                  <View className="icontext">去这里</View>
148
+                </View>
149
+              )}
150
+            </ContainerLayout>
151
+          </View>
152
+          <View className="guide-view">
153
+            <Text className="guide-view-info">停车位置</Text>
154
+            <ContainerLayout
155
+              className="guide-view-layout"
156
+              style={{ display: "flex", justifyContent: "space-between" }}
157
+              onClick={() => onToMap("park")}
158
+            >
159
+              <View>
160
+                <View className="guide-view-layout-text1">
161
+                  {detail.shortParking}
162
+                </View>
163
+                <View className="guide-view-layout-text2">
164
+                  {detail.parking}
165
+                </View>
166
+              </View>
167
+              {user.role == userRloe.customer && (
168
+                <View
169
+                  style={{
170
+                    float: "right",
171
+                    display: "flex",
172
+                    justifyContent: "center",
173
+                    flexDirection: "column"
174
+                  }}
175
+                  onClick={() => onOpenLocation(detail.parkLngLat)}
176
+                >
177
+                  <Image className="icon" src={icon} />
178
+                  <View className="icontext">去这里</View>
179
+                </View>
180
+              )}
181
+            </ContainerLayout>
182
+          </View>
183
+          <View className="guide-view">
184
+            <Text className="guide-view-info">wifi信息</Text>
185
+            <ContainerLayout
186
+              className="guide-view-layout guide-view-wifi"
187
+              onClick={() => onToMap("wifi")}
188
+            >
189
+              <View>
190
+                <Text>名称:</Text>
191
+                <Text>{detail.wifiName}</Text>
192
+              </View>
193
+              <View>
194
+                <Text>密码:</Text>
195
+                <Text>{detail.wifiPassword}</Text>
196
+              </View>
197
+            </ContainerLayout>
198
+          </View>
199
+          <View className="guide-view">
200
+            <Text className="guide-view-info">其他指引</Text>
201
+            {/* <ContainerLayout className='guide-view-layout guide-view-img'> */}
202
+            {(detail.desc || imgurl) && (
203
+              <Image
204
+                className="guide-view-img"
205
+                mode="widthFix"
206
+                onClick={() => onToMap("image")}
207
+                src={imgurl || detail.desc}
208
+              ></Image>
209
+            )}
210
+            {!detail.desc && !imgurl && (
211
+              <View style={{ padding: "300rpx" }}>
212
+                <Image
213
+                  className="guide-view-img"
214
+                  mode="widthFix"
215
+                  onClick={() => onToMap("image")}
216
+                  src={uploadicon}
217
+                ></Image>
218
+              </View>
219
+            )}
220
+          </View>
221
+        </View>
222
+      )}
223
+      {!houseId && (
224
+        <View
225
+          className="recommend-noorder"
226
+          style={{ marginTop: "calc(40vh)", textAlign: "center" }}
227
+        >
228
+          <Text>哎呀</Text>
229
+          <Text>暂时没发现您的入住订单呢~</Text>
230
+        </View>
231
+      )}
167 232
     </View>
233
+  );
168 234
 };
169 235
 
170
-export default guide
236
+export default guide;

+ 17
- 6
src/pages/house/addnewhouse/index.jsx View File

@@ -47,11 +47,22 @@ const index = (props) => {
47 47
     }
48 48
     const formSubmit = (e) => {
49 49
         // console.log(e.detail, 'formSubmit')
50
+
51
+
52
+        if(!e.detail.value?.title){
53
+            wx.showToast({
54
+                title: '请完善房源信息',
55
+                icon: 'none',
56
+                duration: 2000
57
+              })
58
+            return
59
+        }
60
+
50 61
         const value = e.detail.value
51 62
         const data = {
52 63
             ...value,
53
-            address: `${value.address}____${value.addressdetail}`,
54
-            parking: `${value.parking}____${value.parkingdetail}`,
64
+            // address: `${value.address}____${value.addressdetail}`,
65
+            // parking: `${value.parking}____${value.parkingdetail}`,
55 66
             lngLat: `${address.latitude},${address.longitude}`,
56 67
             parkLngLat: `${address.latitude},${address.longitude}`,
57 68
             
@@ -121,7 +132,7 @@ const index = (props) => {
121 132
                     <Text className='title'>位置信息</Text>
122 133
                     <View style={{ display: 'flex' }}>
123 134
                         <Container className='inputstyle-view-card' style={{ width: '100%', borderRadius: '20rpx', padding: '0 40rpx' }}>
124
-                            <Input name='address' value={address.name} disabled placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
135
+                            <Input name='shortAddress' value={address.name} disabled placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
125 136
 
126 137
                         </Container>
127 138
                         <Container className='map-view-icon' onClick={() => onChooseLocation('address')}>
@@ -133,14 +144,14 @@ const index = (props) => {
133 144
                 <View className='inputstyle-view'>
134 145
                     <Text className='title'>具体地址</Text>
135 146
                     <Container className='inputstyle-view-card ' style={{ borderRadius: '20rpx', padding: '0 40rpx' }} >
136
-                        <Input name='addressdetail' value={address.address} placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
147
+                        <Input name='address' value={address.address} placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
137 148
                     </Container>
138 149
                 </View>
139 150
                 <View className='inputstyle-view'>
140 151
                     <Text className='title'>停车场地址</Text>
141 152
                     <View style={{ display: 'flex' }}>
142 153
                         <Container className='inputstyle-view-card' style={{ width: '100%', borderRadius: '20rpx', padding: '0 40rpx' }}>
143
-                            <Input name='parking' value={parking.name} disabled placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
154
+                            <Input name='shortParking' value={parking.name} disabled placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
144 155
 
145 156
                         </Container>
146 157
                         <Container className='map-view-icon' onClick={() => onChooseLocation('parking')}>
@@ -152,7 +163,7 @@ const index = (props) => {
152 163
                 <View className='inputstyle-view'>
153 164
                     <Text className='title'>具体地址</Text>
154 165
                     <Container className='inputstyle-view-card ' style={{ borderRadius: '20rpx', padding: '0 40rpx' }} >
155
-                        <Input name='parkingdetail' value={parking.address} placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
166
+                        <Input name='parking' value={parking.address} placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
156 167
                     </Container>
157 168
                 </View>
158 169
                 <View className='inputstyle-view'>

+ 119
- 73
src/pages/house/list/index.jsx View File

@@ -1,113 +1,128 @@
1
-import React, { useEffect, useMemo, useState, forwardRef, useImperativeHandle } from 'react'
2
-import Taro, { useDidShow } from '@tarojs/taro'
3
-import './index.scss'
4
-import { View, Text, Input, Image } from '@tarojs/components'
5
-import ContainerLayout from '../../../compents/container/index'
6
-import radio from '../../../assets/radio.png'
7
-import request from '@/util/request'
8
-import RecycleList from '@/compents/RecycleList'
9
-
1
+import React, {
2
+  useEffect,
3
+  useMemo,
4
+  useState,
5
+  forwardRef,
6
+  useImperativeHandle
7
+} from "react";
8
+import Taro, { useDidShow } from "@tarojs/taro";
9
+import "./index.scss";
10
+import { View, Text, Input, Image } from "@tarojs/components";
11
+import ContainerLayout from "../../../compents/container/index";
12
+import radio from "../../../assets/radio.png";
13
+import request from "@/util/request";
14
+import RecycleList from "@/compents/RecycleList";
10 15
 
11 16
 let house = (props, ref) => {
12
-
13
-  const [list, setList] = useState([])
14
-  const [radioHouse, setRadioHouse] = useState()
15
-  const [width, setWidth] = useState()
16
-  const [height, setHeight] = useState()
17
-  const [queryParams, setQueryParams] = useState({pageNum: 1, pageSize: 10})
18
-  const [total, setTotal] = useState(0)
17
+  const [list, setList] = useState([]);
18
+  const [radioHouse, setRadioHouse] = useState();
19
+  const [width, setWidth] = useState();
20
+  const [height, setHeight] = useState();
21
+  const [queryParams, setQueryParams] = useState({ pageNum: 1, pageSize: 10 });
22
+  const [total, setTotal] = useState(0);
19 23
 
20 24
   useImperativeHandle(ref, () => ({
21 25
     // changeVal 就是暴露给父组件的方法
22 26
     getRefHouseList: () => {
23
-      getHouseList()
27
+      getHouseList();
24 28
     }
25 29
   }));
26 30
 
27
-  const radioHouseState = useMemo(() => props.radioHouseState, [props.radioHouseState])
31
+  const radioHouseState = useMemo(() => props.radioHouseState, [
32
+    props.radioHouseState
33
+  ]);
28 34
 
29 35
   wx.setNavigationBarTitle({
30
-    title: '民宿房源管理'
31
-  })
32
-
36
+    title: "民宿房源管理"
37
+  });
33 38
 
34 39
   const getHouseList = () => {
35 40
     request({
36
-      url: '/taHouse',
41
+      url: "/taHouse",
37 42
       params: queryParams
38
-    }).then((res) => {
39
-      const { records, ...page } = res.data.data
43
+    }).then(res => {
44
+      const { records, ...page } = res.data.data;
40 45
 
41 46
       if (page.current !== 1) {
42
-        setList(list.concat(records))
47
+        setList(list.concat(records));
43 48
       } else {
44
-        setList(records)
49
+        setList(records);
45 50
       }
46
-      setTotal(page.total)
47
-    })
48
-  }
51
+      setTotal(page.total);
52
+    });
53
+  };
49 54
 
50 55
   const handleScrollBottom = e => {
51 56
     setQueryParams({
52 57
       ...queryParams,
53 58
       pageNum: queryParams.pageNum + 1
54
-    })
55
-  }
59
+    });
60
+  };
56 61
 
57
-  const onShare = (x) => {
58
-    Taro.navigateTo({ url: `/pages/share/index?houseId=${x.houseId}` })
59
-  }
62
+  const onShare = x => {
63
+    Taro.navigateTo({ url: `/pages/share/index?houseId=${x.houseId}` });
64
+  };
60 65
 
61 66
   useEffect(() => {
62
-
63
-    getHouseList()
67
+    
64 68
 
65 69
     Taro.nextTick(() => {
66
-
67 70
       Taro.createSelectorQuery()
68
-        .selectAll('.houselist')
71
+        .selectAll(".houselist")
69 72
         .boundingClientRect(res => {
70 73
           if (res) {
71
-            setWidth(res[0].width)
74
+            setWidth(res[0].width);
72 75
             // setHeight(res[0].height)
73 76
           }
74
-        }).exec()
75
-        
77
+        })
78
+        .exec();
79
+
76 80
       Taro.createSelectorQuery()
77
-        .selectAll('.tab')
81
+        .selectAll(".tab")
78 82
         .boundingClientRect(res => {
79
-          let found = false
83
+          let found = false;
80 84
           if (res) {
81 85
             for (let item of res) {
82 86
               if (item.height) {
83
-                found = true
84
-                setHeight(Taro.getSystemInfoSync().safeArea.height - item.height - 50)
85
-                break
87
+                found = true;
88
+                setHeight(
89
+                  Taro.getSystemInfoSync().safeArea.height - item.height - 50
90
+                );
91
+                break;
86 92
               }
87 93
             }
88 94
           }
89 95
 
90 96
           if (!found) {
91
-            setHeight(500)
97
+            setHeight(500);
92 98
           }
93
-        }).exec()
94
-    })
95
-
96
-  }, [])
99
+        })
100
+        .exec();
101
+    });
102
+  }, []);
103
+
104
+  useDidShow(() => {
105
+    if (queryParams.pageNum == 1) {
106
+      getHouseList();
107
+    } else {
108
+      setQueryParams({
109
+        ...queryParams,
110
+        pageNum: 1
111
+      });
112
+    }
113
+  });
97 114
 
98 115
   useEffect(() => {
99
-    getHouseList()
100
-  }, [queryParams])
116
+    getHouseList();
117
+  }, [queryParams]);
101 118
 
102 119
   // useDidShow(() => {
103 120
   //   setQueryParams({ ...queryParams })
104 121
   // })
105 122
 
106 123
   return (
107
-    <View className='houselist'>
108
-       {
109
-        (!list || !list.length) && < View className='nodata'> 暂无数据</View>
110
-      }
124
+    <View className="houselist">
125
+      {(!list || !list.length) && <View className="nodata"> 暂无数据</View>}
111 126
       <RecycleList
112 127
         height={height}
113 128
         width={width}
@@ -116,26 +131,57 @@ let house = (props, ref) => {
116 131
         dataKey="houseId"
117 132
         onScrollToLower={handleScrollBottom}
118 133
         renderItem={x => (
119
-          <View className='houselist-view'>
134
+          <View className="houselist-view">
120 135
             {/* <Text className='houselist-view-title'>房源编号:{x.houseId}</Text> */}
121
-            <ContainerLayout className='houselist-view-card'>
122
-              {radioHouseState && <View className='houselist-view-card-radio' onClick={() => { props.onChange(x), setRadioHouse(x) }}>
123
-                {radioHouse?.houseId == x?.houseId && <Image src={radio} style={{ width: '30rpx', height: '20rpx' }}></Image>}
124
-              </View>}
125
-              <View className='top' onClick={() => { if (!radioHouseState) Taro.navigateTo({ url: `/pages/house/index?houseId=${x.houseId}` }) }}>{x.title}</View>
126
-              <View className='bottom'>
127
-                <Text onClick={() => { if (!radioHouseState) Taro.navigateTo({ url: `/pages/house/household/index?houseId=${x.houseId}` }) }}>查看入住人</Text>
128
-                <Text onClick={()=>onShare(x)}>分享链接</Text>
136
+            <ContainerLayout className="houselist-view-card">
137
+              {radioHouseState && (
138
+                <View
139
+                  className="houselist-view-card-radio"
140
+                  onClick={() => {
141
+                    props.onChange(x), setRadioHouse(x);
142
+                  }}
143
+                >
144
+                  {radioHouse?.houseId == x?.houseId && (
145
+                    <Image
146
+                      src={radio}
147
+                      style={{ width: "30rpx", height: "20rpx" }}
148
+                    ></Image>
149
+                  )}
150
+                </View>
151
+              )}
152
+              <View
153
+                className="top"
154
+                onClick={() => {
155
+                  if (!radioHouseState)
156
+                    Taro.navigateTo({
157
+                      url: `/pages/house/index?houseId=${x.houseId}`
158
+                    });
159
+                }}
160
+              >
161
+                {x.title}
162
+              </View>
163
+              <View className="bottom">
164
+                <View
165
+                  className="bottom-btn"
166
+                  onClick={() => {
167
+                    if (!radioHouseState)
168
+                      Taro.navigateTo({
169
+                        url: `/pages/house/household/index?houseId=${x.houseId}`
170
+                      });
171
+                  }}
172
+                >
173
+                  查看入住人
174
+                </View>
175
+                <View className="bottom-btn" onClick={() => onShare(x)}>
176
+                  分享链接
177
+                </View>
129 178
               </View>
130 179
             </ContainerLayout>
131 180
           </View>        
132 181
         )}
133 182
       />
134
-
135
-     
136 183
     </View>
137
-  )
138
-  
139
-}
140
-house = forwardRef(house)
141
-export default house
184
+  );
185
+};
186
+house = forwardRef(house);
187
+export default house;

+ 7
- 7
src/pages/house/list/index.scss View File

@@ -1,5 +1,4 @@
1 1
 .houselist {
2
-
3 2
   &-view {
4 3
     // app padding: 41.3px
5 4
     width: calc(100vw - 82.6px);
@@ -11,7 +10,6 @@
11 10
       font-size: 30px;
12 11
       font-weight: 500;
13 12
       margin-left: 40px;
14
-
15 13
     }
16 14
 
17 15
     &-card {
@@ -23,8 +21,8 @@
23 21
       position: relative;
24 22
 
25 23
       &-radio {
26
-          width: 40px;
27
-          height: 40px;
24
+        width: 40px;
25
+        height: 40px;
28 26
         background-color: #274291;
29 27
         text-align: center;
30 28
         line-height: 40px;
@@ -44,10 +42,12 @@
44 42
       .bottom {
45 43
         display: flex;
46 44
         justify-content: space-around;
47
-        padding: 20px
45
+        padding: 20px;
46
+        &-btn {
47
+          width: 50%;
48
+          text-align: center;
49
+        }
48 50
       }
49
-
50
-
51 51
     }
52 52
   }
53 53
 }

+ 3
- 3
src/pages/landlord/index.jsx View File

@@ -105,9 +105,9 @@ const index = (props) => {
105 105
 
106 106
     <AtFloatLayout isOpened={isOpened} onClose={() => handleClose()} style={{ zIndex: '1000' }}>
107 107
       <View className='floatmodel' >
108
-        <View style={{width:"50%" ,textAlign:'center'}} onClick={() => Taro.navigateTo({ url: '/pages/house/addnewhouse/index' })}>新增房源</View>
109
-        <View style={{width:"50%" ,textAlign:'center'}}  onClick={() => { setIsOpened(false); setRadioHouseState(true) }}>复制房源</View>
110
-        <View style={{width:"50%" ,textAlign:'center', color: '#d2d2d2' }} onClick={() => setIsOpened(false)}>取消</View>
108
+        <View style={{width:"100%" ,textAlign:'center'}} onClick={() => {setIsOpened(false);Taro.navigateTo({ url: '/pages/house/addnewhouse/index' })}}>新增房源</View>
109
+        <View style={{width:"100%" ,textAlign:'center'}}  onClick={() => { setIsOpened(false); setRadioHouseState(true) }}>复制房源</View>
110
+        <View style={{width:"100%" ,textAlign:'center', color: '#d2d2d2' }} onClick={() => setIsOpened(false)}>取消</View>
111 111
       </View>
112 112
 
113 113
     </AtFloatLayout>

+ 29
- 18
src/pages/map/index.jsx View File

@@ -19,14 +19,14 @@ const index = (props) => {
19 19
     const [pageState, setPageState] = useState('1')
20 20
     const [address, setAddress] = useState({})
21 21
 
22
-    // 在onInput详细地址时有bug,不能放在adderss里,所有加了个value
22
+//     // 在onInput详细地址时有bug,不能放在adderss里,所有加了个value
23 23
     const [value,setValue] = useState('')
24
-    // const [lngLat, setLngLat] = useState('')
25
-console.log(address,'setAddress')
24
+//     // const [lngLat, setLngLat] = useState('')
25
+// console.log(address,'setAddress')
26 26
     useDidShow(() => {
27 27
 
28 28
     })
29
-
29
+    // shotAddress,  shotParking
30 30
     useEffect(() => {
31 31
         
32 32
         if (houseId) {
@@ -37,25 +37,30 @@ console.log(address,'setAddress')
37 37
     const getDetail = () => {
38 38
         request({ url: `/taHouse/${houseId}` }).then((res) => {
39 39
             console.log(res.data.data,type, 'getDetail')
40
+            const [ longitude,latitude] = (res.data.data.lngLat||'').split('____')
40 41
             if (type == "address") {
41
-                const [addressName,addressDetail] = (res.data.data.address||'').split('____')
42
+                
42 43
                 setAddress({
43
-                    name:addressName,
44
-                    address:addressDetail,
45
-                    lngLat:res.data.data.lngLat
44
+                    // name:addressName,
45
+                    address:res.data.data.address,
46
+                    shortAddress:res.data.data.shortAddress,
47
+                    longitude,
48
+                    latitude
46 49
                 })
47 50
 
48
-                setValue(addressDetail)
51
+                setValue(res.data.data.address)
49 52
                 // setAddress(res.data.data.address)
50 53
                 // setLngLat(res.data.data.lngLat)
51 54
             }else if (type == 'park'){
52
-                const [addressName,addressDetail] = (res.data.data.parking||'').split('____')
55
+                // const [addressName,addressDetail] = (res.data.data.parking||'').split('____')
53 56
                 setAddress({
54
-                    name:addressName,
55
-                    address:addressDetail,
56
-                    lngLat:res.data.data.parkLngLat
57
+                    // name:addressName,
58
+                    address:res.data.data.parking,
59
+                    shortAddress:res.data.data.shortParking,
60
+                    longitude,
61
+                    latitude
57 62
                 })
58
-                setValue(addressDetail)
63
+                setValue(res.data.data.parking)
59 64
                 // address(res.data.data)
60 65
                 // setAddress(res.data.data.parking)
61 66
                 // setLngLat(res.data.data.parkLngLat)
@@ -70,12 +75,15 @@ console.log(address,'setAddress')
70 75
         let data = {}
71 76
         if (type == 'address') {
72 77
             data = {
73
-                address: `${address.name}____${value}`,
78
+                address: value,
79
+                shortAddress:address.name,
80
+       
74 81
                 lngLat:`${address.latitude},${address.longitude}`
75 82
             }
76 83
         } else if (type == 'park') {
77 84
             data = {
78
-                parking: `${address.name}____${value}`,
85
+                parking: value,
86
+                shortParking:address.name,
79 87
                 parkLngLat:`${address.latitude},${address.longitude}`
80 88
             }
81 89
         }
@@ -94,7 +102,10 @@ console.log(address,'setAddress')
94 102
             success: (res) => {
95 103
                 console.log(res)
96 104
 
97
-                setAddress(res)
105
+                setAddress({
106
+                    ...res,
107
+                    shortAddress:res.name
108
+                })
98 109
                 setValue(res.address)
99 110
             },
100 111
             fail: (err) => {
@@ -115,7 +126,7 @@ console.log(address,'setAddress')
115 126
                 <Text className='title'>位置信息</Text>
116 127
                 <View style={{ display: 'flex' }}>
117 128
                     <Container className='map-view-card' style={{ width: '100%' }}>
118
-                        {address.address&&<Input value={address.name} disabled placeholderClass='placeholderinput' className='input' type='text' placeholder='' />}
129
+                    {address.shortAddress&& <Input value={address.shortAddress} disabled placeholderClass='placeholderinput' className='input' type='text' placeholder='' />}
119 130
 
120 131
                     </Container>
121 132
                     <Container className='map-view-icon' onClick={() => onChooseLocation()}>

+ 2
- 2
src/pages/wifi/index.jsx View File

@@ -88,7 +88,7 @@ const index = (props) => {
88 88
             <View className='map-view'>
89 89
                 <Text className='title'>WiFi名称</Text>
90 90
                 <Container className='map-view-card'>
91
-                <Input value={wifiName} onInput={(e)=>setWifiName(e.detail.value)}  placeholderClass='placeholderinput' className='input' type='text' placeholder='小区/写字楼/大厦等' />
91
+                <Input value={wifiName} onInput={(e)=>setWifiName(e.detail.value)}  placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
92 92
                 </Container>
93 93
             </View>
94 94
          
@@ -96,7 +96,7 @@ const index = (props) => {
96 96
             <View className='map-view'>
97 97
                 <Text className='title'>密码</Text>
98 98
                 <Container className='map-view-card'>
99
-                <Input value={wifiPassword} onInput={(e)=>setWifiPassword(e.detail.value)} placeholderClass='placeholderinput' className='input' type='text' placeholder='小区/写字楼/大厦等' />
99
+                <Input value={wifiPassword} onInput={(e)=>setWifiPassword(e.detail.value)} placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
100 100
                 </Container>
101 101
             </View>
102 102
         </Layout>