李志伟 3 年之前
父節點
當前提交
136058b430

+ 9
- 7
src/hotel/components/shareCard/shareCard.jsx 查看文件

2
 import Popup from '@/components/Popup'
2
 import Popup from '@/components/Popup'
3
 import Taro from '@tarojs/taro'
3
 import Taro from '@tarojs/taro'
4
 import { Input, Button, View, Picker, Label } from '@tarojs/components'
4
 import { Input, Button, View, Picker, Label } from '@tarojs/components'
5
-import {shareRoom} from '@/services/landlord'
5
+import { shareRoom } from '@/services/landlord'
6
 import { useState } from 'react'
6
 import { useState } from 'react'
7
 import './shareCard.less'
7
 import './shareCard.less'
8
 
8
 
9
 
9
 
10
 export default (props) => {
10
 export default (props) => {
11
-  const { showCutover, onClose} = props
11
+  const { showCutover, onClose } = props
12
 
12
 
13
   return (
13
   return (
14
-    <Popup show={showCutover} onClose={onClose}>
15
-      <View className='card'>
16
-      <Label style={{color:'black',fontSize:'45rpx'}}>确认分享给游客</Label>      
17
-      <View><Button  className='cancel' onClick={onClose}>取消</Button><Button openType='share' className='btn'>确认</Button></View>
14
+    <View className='c1'>
15
+      <Popup show={showCutover} onClose={onClose}>
16
+        <View className='card2'>
17
+          <View className='text'>分享到微信</View>
18
+          <View className='share'>去分享<Button openType='share' className='btn'>去分享</Button></View>
19
+        </View>
20
+      </Popup>
18
     </View>
21
     </View>
19
-    </Popup>
20
   )
22
   )
21
 }
23
 }

+ 26
- 23
src/hotel/components/shareCard/shareCard.less 查看文件

1
-.card{
2
-  font-size: 34px;
3
-  padding-top: 40px;
4
-}
5
-.cancel{
6
-  width: 150px;
7
-  height: 70px;
8
-  display: inline-block;
9
-  line-height: 70px;
10
-  border-radius: 12px;
11
-  font-size: 36px;
12
-  margin-top: 15px;
13
-  margin-right: 20px;
14
-}
15
-.btn {
16
-  width: 150px;
17
-  height: 70px;
18
-  background: #1A3B83;
19
-  display: inline-block;
20
-  line-height: 70px;
21
-  border-radius: 12px;
22
-  font-size: 36px;
23
-  color: #fff;
1
+.c1{
2
+  .weui-dialog__bd {
3
+    padding: 0;
4
+    margin: 0;
5
+  }
6
+  .card2{
7
+    text-align: center;
8
+    position: relative;
9
+    .text{
10
+      padding: 30px 0;
11
+      border-bottom: 6px solid #E9E9E9;
12
+      color: #000;
13
+    }
14
+    .share{
15
+      padding: 30px 0;
16
+      color: #618FE7;
17
+    }
18
+    .btn {
19
+      font-size: 36px;
20
+      background:#fff;
21
+      position: absolute;
22
+      width: 100%;
23
+      bottom: 0;
24
+      opacity: 0;
25
+    }
26
+  }
24
 }
27
 }

+ 2
- 0
src/hotel/components/shareRoom/ShareRoom.less 查看文件

42
     margin: 20px 20px 0 0;
42
     margin: 20px 20px 0 0;
43
     width: 236px;
43
     width: 236px;
44
     height: 78px;
44
     height: 78px;
45
+    line-height: 78px;
45
     border: 2px solid #274190;
46
     border: 2px solid #274190;
46
     border-radius: 12px;
47
     border-radius: 12px;
47
   }
48
   }
48
   .btn {
49
   .btn {
49
     width: 236px;
50
     width: 236px;
50
     height: 78px;
51
     height: 78px;
52
+    line-height: 78px;
51
     background: #274291;
53
     background: #274291;
52
     border-radius: 12px;
54
     border-radius: 12px;
53
     display: inline-block;
55
     display: inline-block;

+ 29
- 11
src/hotel/pages/components/Extend/index.jsx 查看文件

3
 import del from '@/assets/icons/landlord/delete.png'
3
 import del from '@/assets/icons/landlord/delete.png'
4
 import Popup from '@/components/Popup'
4
 import Popup from '@/components/Popup'
5
 import { View, Text, Image, Textarea, Label, Button } from '@tarojs/components';
5
 import { View, Text, Image, Textarea, Label, Button } from '@tarojs/components';
6
-import { update,deleteExtend } from '@/services/landlord'
6
+import { update, deleteExtend } from '@/services/landlord'
7
 import './style.less'
7
 import './style.less'
8
 
8
 
9
 export default (props) => {
9
 export default (props) => {
10
-  const { item,setReset } = props
10
+  const { item, setReset } = props
11
   const [eimg, seteImg] = useState(item.content)
11
   const [eimg, seteImg] = useState(item.content)
12
   const handerChange = () => {
12
   const handerChange = () => {
13
     Taro.chooseImage({
13
     Taro.chooseImage({
14
       count: 1,
14
       count: 1,
15
       success: function (res) {
15
       success: function (res) {
16
         seteImg(res.tempFilePaths[0])
16
         seteImg(res.tempFilePaths[0])
17
-        const date={
18
-          content:res.tempFilePaths[0],
19
-          contentType:'image'
17
+        const date = {
18
+          content: res.tempFilePaths[0],
19
+          contentType: 'image'
20
         }
20
         }
21
-        update(item.extId,{...item,...date} )
21
+        update(item.extId, { ...item, ...date })
22
       }
22
       }
23
     })
23
     })
24
   }
24
   }
44
     deleteExtend(item.extId)
44
     deleteExtend(item.extId)
45
     setReset(true)
45
     setReset(true)
46
   }
46
   }
47
-  const handelEdit = () => { 
47
+  //判断是否只有空 空格 回车
48
+  const javaTrim = (str) => {
49
+    for (var i = 0; (str.charAt(i) == ' ') && i < str.length; i++);
50
+    if (i == str.length) return ''; //whole string is space
51
+    var newstr = str.substr(i);
52
+    for (var i = newstr.length - 1; newstr.charAt(i) == ' ' && i >= 0; i--);
53
+    newstr = newstr.substr(0, i + 1);
54
+    return newstr;
55
+  }
56
+  const handelEdit = () => {
48
     var content = document.getElementById('content').value
57
     var content = document.getElementById('content').value
58
+
59
+    content = content.replace(/\n/g, '');
60
+    if (javaTrim(content) == '') {
61
+      Taro.showToast({
62
+        title: '您还没有添加文字哦',
63
+        icon: 'none'
64
+      })
65
+      return;
66
+    }
49
     setContent(content)
67
     setContent(content)
50
-    const date={
68
+    const date = {
51
       content,
69
       content,
52
-      contentType:'text'
70
+      contentType: 'text'
53
     }
71
     }
54
-    update(item.extId,{...item,...date})
72
+    update(item.extId, { ...item, ...date })
55
     onClose()
73
     onClose()
56
   }
74
   }
57
   return (
75
   return (
62
             <View className='rzline' /><Label className='srl mg'>修改文字</Label><View className='rzline' />
80
             <View className='rzline' /><Label className='srl mg'>修改文字</Label><View className='rzline' />
63
           </View>
81
           </View>
64
           <View>
82
           <View>
65
-            <Textarea  className='storezn' value={content} id='content' />
83
+            <Textarea className='storezn' value={content} id='content' />
66
           </View>
84
           </View>
67
           <View>
85
           <View>
68
             <Button className='cancel' onClick={onClose}>取消</Button>
86
             <Button className='cancel' onClick={onClose}>取消</Button>

+ 17
- 12
src/hotel/pages/components/Extend/style.less 查看文件

1
 #det{
1
 #det{
2
   .editword{
2
   .editword{
3
-    padding: 30px;
3
+    padding-top: 60px;
4
     .srl{
4
     .srl{
5
       font-size: 30px;
5
       font-size: 30px;
6
       font-weight: bold;
6
       font-weight: bold;
13
     .rzline{
13
     .rzline{
14
       border-top: 2px #999 dashed;
14
       border-top: 2px #999 dashed;
15
       height: 2px;
15
       height: 2px;
16
-      width: 80px;
16
+      width: 160px;
17
       display: inline-block;
17
       display: inline-block;
18
       margin-bottom: 8px;
18
       margin-bottom: 8px;
19
     } 
19
     } 
20
     .cancel{
20
     .cancel{
21
       color: #274290;
21
       color: #274290;
22
       display: inline-block;
22
       display: inline-block;
23
-      margin: 20px 20px 0 0;
24
-      width: 200px;
23
+      margin-right: 44px;
24
+      width: 240px;      
25
+      font-size: 30px;      
26
+      font-weight: bold;
25
       height: 78px;
27
       height: 78px;
26
       line-height: 78px;
28
       line-height: 78px;
27
       border: 2px solid #274190;
29
       border: 2px solid #274190;
28
       border-radius: 12px;
30
       border-radius: 12px;
31
+      letter-spacing: 3px;
29
     }
32
     }
30
     .btn {
33
     .btn {
31
-      width: 200px;
34
+      letter-spacing: 3px;
35
+      width: 240px;
32
       height: 78px;
36
       height: 78px;
37
+      font-size: 30px;      
33
       line-height: 78px;
38
       line-height: 78px;
34
       background: #274290;
39
       background: #274290;
40
+      font-weight: bold;
35
       border-radius: 12px;
41
       border-radius: 12px;
36
       display: inline-block;
42
       display: inline-block;
37
       color: #fff;
43
       color: #fff;
38
     }  
44
     }  
39
   }
45
   }
40
   .storezn{
46
   .storezn{
41
-    font-size: 28px;    
42
     color: #202020;
47
     color: #202020;
43
     line-height: 54px;
48
     line-height: 54px;
44
-    margin-bottom: 40px;
49
+    margin-bottom: 60px;
45
     text-align: justify;
50
     text-align: justify;
46
   }
51
   }
47
   .weui-slideview__btn__wrp{
52
   .weui-slideview__btn__wrp{
58
     line-height: 44px;
63
     line-height: 44px;
59
   }
64
   }
60
   Textarea{
65
   Textarea{
61
-    height: 200px;
66
+    height: 300px;
62
     width: 100%;
67
     width: 100%;
63
-    padding: 15px;
68
+    padding: 30px;
69
+    background: #F8F8F8;
70
+    border-radius: 8px;
64
     box-sizing: border-box;
71
     box-sizing: border-box;
65
     height: 254px;
72
     height: 254px;
66
-    border: 1px solid #b5b5b5;
67
-    font-size: 24px;
68
-    box-shadow: 0px 4px 24px 0px rgba(0, 0, 0, 0.08);
73
+    font-size: 26px;
69
   }
74
   }
70
 }
75
 }

+ 45
- 12
src/hotel/pages/landlord/addRoom2/addRoom.jsx 查看文件

1
 import withLayout from '@/layouts'
1
 import withLayout from '@/layouts'
2
 import Taro from '@tarojs/taro'
2
 import Taro from '@tarojs/taro'
3
 import CustomNav from '@/components/CustomNav'
3
 import CustomNav from '@/components/CustomNav'
4
-import { View, Input, Button, Label, Textarea } from '@tarojs/components';
4
+import { View, Input, Button, Label, Textarea,Text } from '@tarojs/components';
5
 import { useEffect, useState } from "react"
5
 import { useEffect, useState } from "react"
6
 import { saveRoom, getRoomDetail, updateRoom } from '@/services/landlord'
6
 import { saveRoom, getRoomDetail, updateRoom } from '@/services/landlord'
7
 import { getExtendContent } from "@/services/home";
7
 import { getExtendContent } from "@/services/home";
79
 
79
 
80
   //新增文字
80
   //新增文字
81
   const [showCutover, setShowCutover] = useState(false)
81
   const [showCutover, setShowCutover] = useState(false)
82
-  const [cont,setcont]=useState()
82
+  const [cont, setcont] = useState('')
83
   const onClose = () => {
83
   const onClose = () => {
84
     setShowCutover(false)
84
     setShowCutover(false)
85
-    setReset(true)
86
-    setcont()
85
+  }
86
+  //判断是否只有空 空格 回车
87
+  const javaTrim = (str) => {
88
+    for (var i = 0; (str.charAt(i) == ' ') && i < str.length; i++);
89
+    if (i == str.length) return ''; //whole string is space
90
+    var newstr = str.substr(i);
91
+    for (var i = newstr.length - 1; newstr.charAt(i) == ' ' && i >= 0; i--);
92
+    newstr = newstr.substr(0, i + 1);
93
+    return newstr;
87
   }
94
   }
88
   const handelAdd = () => {
95
   const handelAdd = () => {
89
-    var content = document.getElementById('content').value
90
-    if (content === '') {
96
+    var content = document.getElementById('cont').value
97
+
98
+    content = content.replace(/\n/g, '');
99
+    if (javaTrim(content) == '') {
91
       Taro.showToast({
100
       Taro.showToast({
92
         title: '您还没有添加文字哦',
101
         title: '您还没有添加文字哦',
93
         icon: 'none'
102
         icon: 'none'
100
       content,
109
       content,
101
       contentType: 'text'
110
       contentType: 'text'
102
     }
111
     }
112
+
103
     saveExtend(date)
113
     saveExtend(date)
114
+    setcont('')
104
     onClose()
115
     onClose()
116
+    setReset(!reset)
105
   }
117
   }
106
   const showText = () => {
118
   const showText = () => {
107
     setShowCutover(true)
119
     setShowCutover(true)
120
+    setcont('')
121
+  }
122
+  const addImage = () => {
123
+    Taro.chooseImage({
124
+      count: 1,
125
+      success: function (res) {
126
+        const date = {
127
+          targetId: roomId,
128
+          targetType: 'room',
129
+          content: res.tempFilePaths[0],
130
+          contentType: 'image'
131
+        }
132
+        saveExtend(date)
133
+        setReset(!reset)
134
+      }
135
+    })
108
   }
136
   }
109
   return (
137
   return (
110
     <view className='page-index'>
138
     <view className='page-index'>
120
                   <View className='rzline' /><Label className='srl mg'>新增文字</Label><View className='rzline' />
148
                   <View className='rzline' /><Label className='srl mg'>新增文字</Label><View className='rzline' />
121
                 </View>
149
                 </View>
122
                 <View>
150
                 <View>
123
-                  <Textarea className='storezn' id='content' value={cont} placeholder='请输入准备新增的文字' />
151
+                  <Textarea className='storezn' id='cont' value={cont} placeholder='请输入准备新增的文字' />
124
                 </View>
152
                 </View>
125
                 <View>
153
                 <View>
126
                   <Button className='cancel' onClick={onClose}>取消</Button>
154
                   <Button className='cancel' onClick={onClose}>取消</Button>
127
-                  <Button className='btn' onClick={handelAdd}>确认修改</Button>
155
+                  <Button className='btn' onClick={handelAdd}>确认增加</Button>
128
                 </View>
156
                 </View>
129
               </View>
157
               </View>
130
             </Popup>
158
             </Popup>
169
                     ))}
197
                     ))}
170
                   </mp-cell>
198
                   </mp-cell>
171
               }
199
               }
172
-              <mp-cell extClass='adds'>
173
-                <Button className='add' onClick={showText}>增加文字</Button><Button className='add'>增加图片</Button>
174
-                <Button className='button-OK' onClick={sumbit}>确定</Button>
175
-              </mp-cell>
176
             </mp-cells>
200
             </mp-cells>
177
           </mp-form>
201
           </mp-form>
202
+          <View className='adds' >
203
+            <Text className='zuobian'>增加文字</Text>
204
+            <View className='add' onClick={showText}><Text className='jiahao'>+</Text><Text className='zengjia'>添加</Text></View>
205
+          </View>
206
+          <View className='adds' >
207
+            <Text className='zuobian'>增加图片</Text>
208
+            <View className='add' onClick={addImage}><Text className='jiahao'>+</Text><Text className='zengjia'>添加</Text></View>
209
+          </View>
210
+          <Button className='button-OK' onClick={sumbit}>确定</Button>
178
         </scroll-view>
211
         </scroll-view>
179
       </view>
212
       </view>
180
     </view>
213
     </view>

+ 32
- 12
src/hotel/pages/landlord/addRoom2/addRoom.less 查看文件

11
   }
11
   }
12
     
12
     
13
   .adds{
13
   .adds{
14
-    text-align: center;
14
+    width: 100%;
15
+    background-color: #fff;
16
+    border-radius: 12px;
17
+    font-weight: bold;
18
+    margin-top: 20px;
19
+    padding: 30px;
20
+    position: relative;
21
+    .zuobian{
22
+      text-align: left;
23
+      font-size: 32px;      
24
+    }
15
     .add{
25
     .add{
16
-      display: inline-block;
17
-      width: 35%;
18
-      height: 78px;
19
-      line-height: 78px;
26
+      position: absolute;
27
+      right: 90px;
28
+      height: 60px;
29
+      top: calc(50% - 30px);
30
+      width: 170px;
31
+      border: 2px solid #000;
32
+      color: #202020;
33
+      line-height: 56px;
20
       border-radius: 12px;
34
       border-radius: 12px;
21
       letter-spacing: 5px;
35
       letter-spacing: 5px;
22
-      margin: 0 7%;
23
-      background: #274291;
24
-      color: #fff;
36
+      text-align: center;
37
+      .jiahao{        
38
+        font-size: 48px;
39
+      }
40
+      .zengjia{
41
+        position: relative;
42
+        bottom:  4px;
43
+      }
25
     }
44
     }
26
   }  
45
   }  
27
   .button-OK {
46
   .button-OK {
28
-    width: calc(100% - 60px);
29
-    height: 88px;
47
+    height: 92px;
30
     background: #274291;
48
     background: #274291;
31
-    margin: 10px auto;
49
+    margin: 60px 0 30px 0;
32
     letter-spacing: 5px;
50
     letter-spacing: 5px;
33
-    line-height: 88px;
51
+    line-height: 92px;
34
     border-radius: 12px;
52
     border-radius: 12px;
53
+    font-size: 30px;
54
+    font-weight: bold;
35
     color: #fff;
55
     color: #fff;
36
   }
56
   }
37
 }
57
 }