zlisen 4 years ago
parent
commit
84bc458cbd

+ 1
- 0
src/app.config.js View File

4
     'pages/house/index',
4
     'pages/house/index',
5
     'pages/map/index',
5
     'pages/map/index',
6
     'pages/wifi/index',
6
     'pages/wifi/index',
7
+    'pages/housename/index',
7
     'pages/share/index',
8
     'pages/share/index',
8
     'pages/house/addnewhouse/index',
9
     'pages/house/addnewhouse/index',
9
     'pages/house/household/index',
10
     'pages/house/household/index',

+ 80
- 0
src/compents/navcustom/index.jsx View File

1
+import Taro from "@tarojs/taro";
2
+import React, { useEffect, useMemo, useState } from "react";
3
+import { View, Image, Text } from "@tarojs/components";
4
+import usericon from "../../assets/usericon.png";
5
+
6
+const NavCustom = props => {
7
+  const { houseInfo={} } = props;
8
+  const {taShop={}} =houseInfo
9
+  const [navStyle, setNavStyle] = useState({});
10
+
11
+  useEffect(() => {
12
+    console.log(Taro.getMenuButtonBoundingClientRect(), "-------");
13
+    setNavStyle(Taro.getMenuButtonBoundingClientRect());
14
+  }, []);
15
+  return (
16
+    <View
17
+      style={{
18
+        height: navStyle.bottom + 10,
19
+        width: "100%",
20
+        display: "flex",
21
+        background: "#fff"
22
+      }}
23
+    >
24
+      {houseInfo && (
25
+        <View
26
+          style={{
27
+            width: navStyle.left,
28
+            display: "flex",
29
+            background: "#fff",
30
+            paddingLeft: 10,
31
+            paddingBottom: 10,
32
+            margin: 0,
33
+            alignItems: "flex-end"
34
+          }}
35
+        >
36
+          <View
37
+            style={{
38
+              width: navStyle.right - navStyle.left,
39
+              height: 40,
40
+              borderRadius: 20,
41
+           
42
+            }}
43
+          >
44
+            {taShop.logo && (
45
+              <Image
46
+                className="guide-view-img"
47
+                // mode="widthFix"
48
+                style={{
49
+                  width: 40,
50
+                  height: 40,
51
+                  borderRadius: 20,
52
+                  margin:0,
53
+                  background: "#000"
54
+                }}
55
+                src={taShop.logo}
56
+              ></Image>
57
+            )}
58
+          </View>
59
+
60
+          <View
61
+            style={{
62
+              textAlign: "center",
63
+              width: navStyle.left - 50,
64
+              marginTop: navStyle.top,
65
+            //   height: navStyle.height,
66
+            //   lineHeight: `${navStyle.height}px`
67
+            }}
68
+          >
69
+           <view>{taShop.name||'十公里周边指南'}</view>
70
+           {/* <view style={{fontSize:'24rpx',color:'#7b7b7b'}}>{houseInfo.title}</view> */}
71
+              
72
+              
73
+           {/* <Text></Text>  */}
74
+          </View>
75
+        </View>
76
+      )}
77
+    </View>
78
+  );
79
+};
80
+export default NavCustom;

+ 7
- 2
src/layout/index.jsx View File

1
 import React from 'react';
1
 import React from 'react';
2
+import Taro from '@tarojs/taro'
2
 import { View, ScrollView } from '@tarojs/components'
3
 import { View, ScrollView } from '@tarojs/components'
3
 
4
 
4
-const Layout = ({ children }) => {
5
-    return <ScrollView className='scrol' scrollY  >
5
+const Layout = ({ children,type }) => {
6
+
7
+  const navStyle =  Taro.getMenuButtonBoundingClientRect()
8
+
9
+console.log(`calc(100vh - 42.5px - ${navStyle.bottom}px -10px)`,'`calc(100vh - 42.5px - ${navStyle.bottom}px -10px)`')
10
+    return <ScrollView className='scrol' scrollY  style={type=='custom'?{height:`calc(100vh - 42.5px - ${navStyle.bottom}px - 10px)`}:undefined} >
6
         <View className='page-container' >
11
         <View className='page-container' >
7
             {children}
12
             {children}
8
         </View>
13
         </View>

+ 10
- 3
src/pages/customer/index.js View File

1
 import React, { useEffect, useMemo, useState } from 'react'
1
 import React, { useEffect, useMemo, useState } from 'react'
2
+import Taro from '@tarojs/taro'
2
 import { useSelector } from 'react-redux'
3
 import { useSelector } from 'react-redux'
3
-import { View, ScrollView } from '@tarojs/components'
4
+import { View, Image,Text } from '@tarojs/components'
4
 import  Layout from '../../layout/index'
5
 import  Layout from '../../layout/index'
5
 import Tab from '../../compents/tab/index'
6
 import Tab from '../../compents/tab/index'
6
 import Register from './register/index'
7
 import Register from './register/index'
7
 import Guide from '../guide/index'
8
 import Guide from '../guide/index'
8
 import Recommend from '../recommend/index'
9
 import Recommend from '../recommend/index'
9
-// import HouseLIst from '../house/list'
10
+import NavCustom from '../../compents/navcustom'
10
 
11
 
11
 import './index.scss'
12
 import './index.scss'
12
 import request from '../../util/request'
13
 import request from '../../util/request'
14
+import usericon from '../../assets/usericon.png'
13
 
15
 
14
 const index = (props) => {
16
 const index = (props) => {
15
   const {houseId,orderId} = props
17
   const {houseId,orderId} = props
22
   const [surroundList, setSurroundList] = useState()
24
   const [surroundList, setSurroundList] = useState()
23
   const [regUnFinished, setRegUnFinished] = useState(true)
25
   const [regUnFinished, setRegUnFinished] = useState(true)
24
 
26
 
27
+
25
   const handleRegisterFinished = () => {
28
   const handleRegisterFinished = () => {
26
     setRegUnFinished(false)
29
     setRegUnFinished(false)
27
   }
30
   }
64
  
67
  
65
   return (
68
   return (
66
     <View className='index' >
69
     <View className='index' >
70
+
71
+<NavCustom houseInfo={houseInfo}></NavCustom>
67
       {pageState=='1'&&<Register oderId={orderId} dataSource={orderInfo} onFinished={handleRegisterFinished}></Register>}
72
       {pageState=='1'&&<Register oderId={orderId} dataSource={orderInfo} onFinished={handleRegisterFinished}></Register>}
68
 
73
 
69
-      {pageState!='1'&&<Layout>
74
+      {pageState!='1'&&<Layout type='custom'>
75
+
70
         {pageState=='2'&&<Guide houseId={houseId} dataSource={houseInfo}></Guide>  }
76
         {pageState=='2'&&<Guide houseId={houseId} dataSource={houseInfo}></Guide>  }
71
         {pageState=='3'&&<Recommend houseId={houseId} dataSource={surroundList}></Recommend>  }
77
         {pageState=='3'&&<Recommend houseId={houseId} dataSource={surroundList}></Recommend>  }
72
       </Layout>}
78
       </Layout>}
73
     {/* !!houseId&& */}
79
     {/* !!houseId&& */}
74
       {pageState!='1' && (
80
       {pageState!='1' && (
75
         <Tab
81
         <Tab
82
+        styleType='tab'
76
           value={['入住指引','房东推荐']}
83
           value={['入住指引','房东推荐']}
77
           pageState={pageState}
84
           pageState={pageState}
78
           onClick={[(e) => setPageState('2'),(e) => setPageState('3')]} />
85
           onClick={[(e) => setPageState('2'),(e) => setPageState('3')]} />

+ 16
- 0
src/pages/guide/index.jsx View File

71
       case "wifi":
71
       case "wifi":
72
         Taro.navigateTo({ url: `/pages/wifi/index?houseId=${houseId}` });
72
         Taro.navigateTo({ url: `/pages/wifi/index?houseId=${houseId}` });
73
         break;
73
         break;
74
+
75
+      case "housename":
76
+        Taro.navigateTo({ url: `/pages/housename/index?houseId=${houseId}` });
77
+        break;
78
+
74
       case "image": {
79
       case "image": {
75
         if (user.role == userRloe.customer) return;
80
         if (user.role == userRloe.customer) return;
76
         wx.chooseImage({
81
         wx.chooseImage({
118
     <View className="guide">
123
     <View className="guide">
119
       {!!houseId && (
124
       {!!houseId && (
120
         <View>
125
         <View>
126
+          <View className="guide-view">
127
+            <Text className="guide-view-info">房屋名称</Text>
128
+            <ContainerLayout
129
+              className="guide-view-layout guide-view-wifi"
130
+              onClick={() => onToMap("housename")}
131
+            >
132
+              <View className="guide-view-layout-text1" style={{ margin: 0 }}>
133
+                {detail.title}
134
+              </View>
135
+            </ContainerLayout>
136
+          </View>
121
           <View className="guide-view">
137
           <View className="guide-view">
122
             <Text className="guide-view-info">房屋位置</Text>
138
             <Text className="guide-view-info">房屋位置</Text>
123
             <ContainerLayout
139
             <ContainerLayout

+ 6
- 16
src/pages/house/household/index.jsx View File

33
     })
33
     })
34
   }
34
   }
35
 
35
 
36
-  // {
37
-
38
-  //   Object.keys(list).map((item) => {
39
-  //       console.log(list[item], item, 'list[item]11')
40
-
41
-  //       return <View className='imglist-card'>
42
-  //           <View className='imglist-card-tags' style={{ display: 'flex' }}>
43
-  //               {/* imageimageimageimage34 */}
44
-  //               {list[item].map((x) => {
45
-  //                   return <View className='tag' s>{x.tagName}</View>
46
-  //               })}
47
-  //           </View>
48
-  //           <Image src={list[item][0].image} style={{ width: '100%' }} onClick={() => { setData(list[item]); setIsOpened(true) }}></Image>
49
-  //       </View>
50
-  //   })
51
-  // }
36
+const getDate =(value)=>{ 
37
+  const [date,time] = value.split('T')
38
+  console.log(time,'time')
39
+return `${date} ${time.split(':')[0]}:${time.split(':')[1]}`
40
+}
52
   return <View className='household'>
41
   return <View className='household'>
53
 
42
 
54
     <Layout>
43
     <Layout>
63
               {list[item].map((x) => {
52
               {list[item].map((x) => {
64
                 return <view>{x.name}: {x.phone}</view>  
53
                 return <view>{x.name}: {x.phone}</view>  
65
               })}
54
               })}
55
+              {`入住时间:${getDate(list[item][0].createDate)}`}
66
               {list[item].length == 0 && '暂无入住人信息'}
56
               {list[item].length == 0 && '暂无入住人信息'}
67
 
57
 
68
             </ContainerLayout>
58
             </ContainerLayout>

+ 2
- 1
src/pages/house/index.config.js View File

1
 export default {
1
 export default {
2
-    // navigationStyle: "custom"
2
+    
3
     navigationBarTitleText: '',
3
     navigationBarTitleText: '',
4
+    navigationStyle: "custom"
4
   }
5
   }
5
   
6
   

+ 3
- 5
src/pages/house/index.jsx View File

7
 import Guide from '../guide/index'
7
 import Guide from '../guide/index'
8
 import Recommend from '../recommend/index'
8
 import Recommend from '../recommend/index'
9
 import roleList from '../../util/userRole'
9
 import roleList from '../../util/userRole'
10
-
11
-// import HouseLIst from '../house/list'
12
-
10
+import NavCustom from '../../compents/navcustom'
13
 import './index.scss'
11
 import './index.scss'
14
 import request from '../../util/request'
12
 import request from '../../util/request'
15
 
13
 
74
 
72
 
75
 
73
 
76
         <View >
74
         <View >
77
-
78
-            <Layout>
75
+        <NavCustom houseInfo={dataSource}></NavCustom>
76
+            <Layout type='custom'>
79
                 {pageState == '2' && <Guide houseId={houseId} dataSource={dataSource}></Guide>}
77
                 {pageState == '2' && <Guide houseId={houseId} dataSource={dataSource}></Guide>}
80
                 {pageState == '3' && <Recommend houseId={houseId} dataSource={imgSource}></Recommend>}
78
                 {pageState == '3' && <Recommend houseId={houseId} dataSource={imgSource}></Recommend>}
81
             </Layout>
79
             </Layout>

+ 4
- 2
src/pages/house/list/index.jsx View File

60
   };
60
   };
61
 
61
 
62
   const onShare = x => {
62
   const onShare = x => {
63
-    Taro.navigateTo({ url: `/pages/share/index?houseId=${x.houseId}` });
63
+    Taro.navigateTo({ url: `/pages/share/index?houseId=${x.houseId}&&title=${x.title}` });
64
   };
64
   };
65
 
65
 
66
   useEffect(() => {
66
   useEffect(() => {
119
   // useDidShow(() => {
119
   // useDidShow(() => {
120
   //   setQueryParams({ ...queryParams })
120
   //   setQueryParams({ ...queryParams })
121
   // })
121
   // })
122
-
122
+ 
123
   return (
123
   return (
124
     <View className="houselist">
124
     <View className="houselist">
125
+     
126
+
125
       {(!list || !list.length) && <View className="nodata"> 暂无数据</View>}
127
       {(!list || !list.length) && <View className="nodata"> 暂无数据</View>}
126
       <RecycleList
128
       <RecycleList
127
         height={height}
129
         height={height}

+ 4
- 0
src/pages/housename/index.config.js View File

1
+export default {
2
+ 
3
+    navigationBarTitleText: '修改wifi',
4
+  }

+ 106
- 0
src/pages/housename/index.jsx View File

1
+import React, { useEffect, useMemo, useState } from 'react'
2
+import Taro,{useRouter } from "@tarojs/taro";
3
+import { useSelector } from 'react-redux'
4
+import { View, Input, Text, Image } from '@tarojs/components'
5
+import Layout from '../../layout/index'
6
+import Tab from '../../compents/tab/index'
7
+import Container from '../../compents/container/index'
8
+import locationicon from '../../assets/locationicon.png'
9
+import request from '../../util/request'
10
+import './index.scss'
11
+
12
+const index = (props) => {
13
+    const router = useRouter()
14
+
15
+    const { houseId } = router.params
16
+    const page = useSelector(state => state.page)
17
+
18
+    const user = useSelector(state => state.user)
19
+
20
+    const [userRole, setUserRole] = useState('1')
21
+    const [pageState, setPageState] = useState('1')
22
+    const [list, setList] = useState([])
23
+    const [title,setTitle] = useState('')
24
+
25
+   useEffect(() => {
26
+        
27
+        if (houseId) {
28
+            getDetail()
29
+        }
30
+
31
+    }, [])
32
+    const getDetail = () => {
33
+        request({ url: `/taHouse/${houseId}` }).then((res) => {
34
+        
35
+            setTitle(res.data.data.title)
36
+        })
37
+    }
38
+
39
+
40
+    const onTabClick = (e) => {
41
+        console.log(e, '111')
42
+        setUserRole(e)
43
+    }
44
+
45
+    const onRegisterChange = (e) => {
46
+        console.log(e, '111')
47
+    }
48
+    const onSave = () => {
49
+        console.log(333)
50
+        const data= {
51
+            title
52
+        }
53
+
54
+        request({ url: `/taHouse/${houseId}`, method: 'put', data: { ...data, houseId } }).then((res) => {
55
+            Taro.navigateBack({
56
+                delta: 1
57
+            })
58
+        })
59
+        
60
+        // Taro.showModal({
61
+        //     title: '修改成功',
62
+        //     content: '点击确认按钮,返回上级菜单',
63
+        //     showCancel:false,
64
+        //     success: function (res) {
65
+        //       if (res.confirm) {
66
+        //         console.log('用户点击确定')
67
+
68
+        //         Taro.navigateBack({
69
+        //             delta: 1
70
+        //           })
71
+        //       } else if (res.cancel) {
72
+        //         console.log('用户点击取消')
73
+        //       }
74
+        //     }
75
+        //   })
76
+    }
77
+
78
+
79
+    return <View className='map'>
80
+
81
+
82
+
83
+
84
+        <Layout>
85
+            <View className='map-view'>
86
+                <Text className='title'>房屋名称</Text>
87
+                <Container className='map-view-card'>
88
+                <Input value={title} onInput={(e)=>setTitle(e.detail.value)}  placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
89
+                </Container>
90
+            </View>
91
+         
92
+
93
+          
94
+        </Layout>
95
+         <Tab className='addhousetab' pageState='3' value={['取消', '保存修改']} onClick={[(e) =>Taro.navigateBack({
96
+                delta: 1
97
+            }), () => onSave()]}></Tab>
98
+
99
+
100
+
101
+
102
+
103
+    </View>
104
+}
105
+
106
+export default index

+ 50
- 0
src/pages/housename/index.scss View File

1
+.map {
2
+  // padding:13.33px;
3
+  &-view {
4
+    margin: 50px 0 0;
5
+
6
+    &-card {
7
+      // height: 106px;
8
+      // line-height: 106px;
9
+      padding: 0 40px;
10
+      // color:#181818;
11
+      font-size: 24px;
12
+      // font-weight: 600;
13
+      margin-top: 26.67px;
14
+      border-radius: 30px;
15
+      border-radius: 20px;
16
+      .input{
17
+        font-size: 28px;
18
+        padding:30px 0;
19
+        line-height: 106px;
20
+        // color: red;
21
+      }
22
+      .placeholderinput{
23
+        // line-height: 106px;
24
+        color: #d2d2d2;
25
+        font-size: 28px;
26
+      }
27
+    }
28
+    &-icon {
29
+      margin-left: 40px;
30
+      // padding: 20px 30px;
31
+      // color:#181818;
32
+      width: 150px;
33
+      height: 106.67px;
34
+      // font-size: 36px;
35
+      // // font-weight: 600;
36
+      margin-top: 26.67px;
37
+      border-radius: 20px;
38
+      background-color: #274291;
39
+      padding: 0;
40
+      text-align: center;
41
+      line-height:120.67px;
42
+      .icon {
43
+        
44
+        // width: 100%;
45
+      }
46
+    }
47
+    // style={{width:'48.4rpx',height:'48.4rpx'}}
48
+  }
49
+
50
+}

+ 1
- 1
src/pages/index/index.config.js View File

1
 export default {
1
 export default {
2
   // navigationBarTitleText: '首页',
2
   // navigationBarTitleText: '首页',
3
-  
3
+  "navigationStyle": "custom"
4
 }
4
 }

+ 5
- 4
src/pages/landlord/index.jsx View File

11
 import { AtFloatLayout } from "taro-ui"
11
 import { AtFloatLayout } from "taro-ui"
12
 import request from '@/util/request'
12
 import request from '@/util/request'
13
 import './index.scss'
13
 import './index.scss'
14
-
14
+import NavCustom from '../../compents/navcustom'
15
 const index = (props) => {
15
 const index = (props) => {
16
 
16
 
17
 
17
 
86
     }
86
     }
87
 
87
 
88
   }
88
   }
89
-
89
+  const navStyle =  Taro.getMenuButtonBoundingClientRect()
90
 
90
 
91
   return <View className='index'>
91
   return <View className='index'>
92
 
92
 
93
 
93
 
94
     <View>
94
     <View>
95
-
96
-      <Layout>
95
+  
96
+  {pageState == '1' &&<NavCustom houseInfo={{title:'民宿房源管理'}}></NavCustom>}
97
+      <Layout type='custom'>
97
         {pageState == '1' && <HouseLIst ref={childRef} radioHouseState={radioHouseState} onChange={(e) => setRadioHouseData(e)}></HouseLIst>}
98
         {pageState == '1' && <HouseLIst ref={childRef} radioHouseState={radioHouseState} onChange={(e) => setRadioHouseData(e)}></HouseLIst>}
98
       </Layout>
99
       </Layout>
99
       {!isOpened && <Tab className='addhousetab' value={['+添加房源']} onClick={(e) => setIsOpened(true)}></Tab>}
100
       {!isOpened && <Tab className='addhousetab' value={['+添加房源']} onClick={(e) => setIsOpened(true)}></Tab>}

+ 1
- 1
src/pages/recommend/index.jsx View File

20
       className="recommend-view-card"
20
       className="recommend-view-card"
21
       style={
21
       style={
22
 
22
 
23
-          { height: !isopen?'330rpx':undefined, overflow: "hidden"}
23
+          { height: !isopen?'333rpx':undefined, overflow: "hidden"}
24
          
24
          
25
       }
25
       }
26
     >
26
     >

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

19
 
19
 
20
 const Index = () => {
20
 const Index = () => {
21
     const router = useRouter()
21
     const router = useRouter()
22
-    const { houseId } = router.params
22
+    const { houseId,title } = router.params
23
     const [personNum, setPersonNum] = useState()
23
     const [personNum, setPersonNum] = useState()
24
     const [startTime, setStartTime] = useState('')
24
     const [startTime, setStartTime] = useState('')
25
     const [endTime, setEndTime] = useState('')
25
     const [endTime, setEndTime] = useState('')
63
                 return request({ url: `/taHouse/${houseId}/share` }).then(res => {
63
                 return request({ url: `/taHouse/${houseId}/share` }).then(res => {
64
 
64
 
65
                     const share = {
65
                     const share = {
66
-                        title: '分享到微信',
66
+                        title: `欢迎来到${title}`,
67
                         imageUrl: (res.data.data || {}).image,
67
                         imageUrl: (res.data.data || {}).image,
68
                         path: `/pages/index/index?houseId=${houseId}&personNum=${personNum}&startTime=${startTime}&endTime=${endTime}&orderId=${orderId}`
68
                         path: `/pages/index/index?houseId=${houseId}&personNum=${personNum}&startTime=${startTime}&endTime=${endTime}&orderId=${orderId}`
69
                     }
69
                     }