李志伟 преди 3 години
родител
ревизия
136058b430

+ 9
- 7
src/hotel/components/shareCard/shareCard.jsx Целия файл

@@ -2,20 +2,22 @@ import React from 'react'
2 2
 import Popup from '@/components/Popup'
3 3
 import Taro from '@tarojs/taro'
4 4
 import { Input, Button, View, Picker, Label } from '@tarojs/components'
5
-import {shareRoom} from '@/services/landlord'
5
+import { shareRoom } from '@/services/landlord'
6 6
 import { useState } from 'react'
7 7
 import './shareCard.less'
8 8
 
9 9
 
10 10
 export default (props) => {
11
-  const { showCutover, onClose} = props
11
+  const { showCutover, onClose } = props
12 12
 
13 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 21
     </View>
19
-    </Popup>
20 22
   )
21 23
 }

+ 26
- 23
src/hotel/components/shareCard/shareCard.less Целия файл

@@ -1,24 +1,27 @@
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,12 +42,14 @@
42 42
     margin: 20px 20px 0 0;
43 43
     width: 236px;
44 44
     height: 78px;
45
+    line-height: 78px;
45 46
     border: 2px solid #274190;
46 47
     border-radius: 12px;
47 48
   }
48 49
   .btn {
49 50
     width: 236px;
50 51
     height: 78px;
52
+    line-height: 78px;
51 53
     background: #274291;
52 54
     border-radius: 12px;
53 55
     display: inline-block;

+ 29
- 11
src/hotel/pages/components/Extend/index.jsx Целия файл

@@ -3,22 +3,22 @@ import Taro from '@tarojs/taro';
3 3
 import del from '@/assets/icons/landlord/delete.png'
4 4
 import Popup from '@/components/Popup'
5 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 7
 import './style.less'
8 8
 
9 9
 export default (props) => {
10
-  const { item,setReset } = props
10
+  const { item, setReset } = props
11 11
   const [eimg, seteImg] = useState(item.content)
12 12
   const handerChange = () => {
13 13
     Taro.chooseImage({
14 14
       count: 1,
15 15
       success: function (res) {
16 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,14 +44,32 @@ export default (props) => {
44 44
     deleteExtend(item.extId)
45 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 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 67
     setContent(content)
50
-    const date={
68
+    const date = {
51 69
       content,
52
-      contentType:'text'
70
+      contentType: 'text'
53 71
     }
54
-    update(item.extId,{...item,...date})
72
+    update(item.extId, { ...item, ...date })
55 73
     onClose()
56 74
   }
57 75
   return (
@@ -62,7 +80,7 @@ export default (props) => {
62 80
             <View className='rzline' /><Label className='srl mg'>修改文字</Label><View className='rzline' />
63 81
           </View>
64 82
           <View>
65
-            <Textarea  className='storezn' value={content} id='content' />
83
+            <Textarea className='storezn' value={content} id='content' />
66 84
           </View>
67 85
           <View>
68 86
             <Button className='cancel' onClick={onClose}>取消</Button>

+ 17
- 12
src/hotel/pages/components/Extend/style.less Целия файл

@@ -1,6 +1,6 @@
1 1
 #det{
2 2
   .editword{
3
-    padding: 30px;
3
+    padding-top: 60px;
4 4
     .srl{
5 5
       font-size: 30px;
6 6
       font-weight: bold;
@@ -13,35 +13,40 @@
13 13
     .rzline{
14 14
       border-top: 2px #999 dashed;
15 15
       height: 2px;
16
-      width: 80px;
16
+      width: 160px;
17 17
       display: inline-block;
18 18
       margin-bottom: 8px;
19 19
     } 
20 20
     .cancel{
21 21
       color: #274290;
22 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 27
       height: 78px;
26 28
       line-height: 78px;
27 29
       border: 2px solid #274190;
28 30
       border-radius: 12px;
31
+      letter-spacing: 3px;
29 32
     }
30 33
     .btn {
31
-      width: 200px;
34
+      letter-spacing: 3px;
35
+      width: 240px;
32 36
       height: 78px;
37
+      font-size: 30px;      
33 38
       line-height: 78px;
34 39
       background: #274290;
40
+      font-weight: bold;
35 41
       border-radius: 12px;
36 42
       display: inline-block;
37 43
       color: #fff;
38 44
     }  
39 45
   }
40 46
   .storezn{
41
-    font-size: 28px;    
42 47
     color: #202020;
43 48
     line-height: 54px;
44
-    margin-bottom: 40px;
49
+    margin-bottom: 60px;
45 50
     text-align: justify;
46 51
   }
47 52
   .weui-slideview__btn__wrp{
@@ -58,13 +63,13 @@
58 63
     line-height: 44px;
59 64
   }
60 65
   Textarea{
61
-    height: 200px;
66
+    height: 300px;
62 67
     width: 100%;
63
-    padding: 15px;
68
+    padding: 30px;
69
+    background: #F8F8F8;
70
+    border-radius: 8px;
64 71
     box-sizing: border-box;
65 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,7 +1,7 @@
1 1
 import withLayout from '@/layouts'
2 2
 import Taro from '@tarojs/taro'
3 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 5
 import { useEffect, useState } from "react"
6 6
 import { saveRoom, getRoomDetail, updateRoom } from '@/services/landlord'
7 7
 import { getExtendContent } from "@/services/home";
@@ -79,15 +79,24 @@ export default withLayout((props) => {
79 79
 
80 80
   //新增文字
81 81
   const [showCutover, setShowCutover] = useState(false)
82
-  const [cont,setcont]=useState()
82
+  const [cont, setcont] = useState('')
83 83
   const onClose = () => {
84 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 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 100
       Taro.showToast({
92 101
         title: '您还没有添加文字哦',
93 102
         icon: 'none'
@@ -100,11 +109,30 @@ export default withLayout((props) => {
100 109
       content,
101 110
       contentType: 'text'
102 111
     }
112
+
103 113
     saveExtend(date)
114
+    setcont('')
104 115
     onClose()
116
+    setReset(!reset)
105 117
   }
106 118
   const showText = () => {
107 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 137
   return (
110 138
     <view className='page-index'>
@@ -120,11 +148,11 @@ export default withLayout((props) => {
120 148
                   <View className='rzline' /><Label className='srl mg'>新增文字</Label><View className='rzline' />
121 149
                 </View>
122 150
                 <View>
123
-                  <Textarea className='storezn' id='content' value={cont} placeholder='请输入准备新增的文字' />
151
+                  <Textarea className='storezn' id='cont' value={cont} placeholder='请输入准备新增的文字' />
124 152
                 </View>
125 153
                 <View>
126 154
                   <Button className='cancel' onClick={onClose}>取消</Button>
127
-                  <Button className='btn' onClick={handelAdd}>确认修改</Button>
155
+                  <Button className='btn' onClick={handelAdd}>确认增加</Button>
128 156
                 </View>
129 157
               </View>
130 158
             </Popup>
@@ -169,12 +197,17 @@ export default withLayout((props) => {
169 197
                     ))}
170 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 200
             </mp-cells>
177 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 211
         </scroll-view>
179 212
       </view>
180 213
     </view>

+ 32
- 12
src/hotel/pages/landlord/addRoom2/addRoom.less Целия файл

@@ -11,27 +11,47 @@
11 11
   }
12 12
     
13 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 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 34
       border-radius: 12px;
21 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 46
   .button-OK {
28
-    width: calc(100% - 60px);
29
-    height: 88px;
47
+    height: 92px;
30 48
     background: #274291;
31
-    margin: 10px auto;
49
+    margin: 60px 0 30px 0;
32 50
     letter-spacing: 5px;
33
-    line-height: 88px;
51
+    line-height: 92px;
34 52
     border-radius: 12px;
53
+    font-size: 30px;
54
+    font-weight: bold;
35 55
     color: #fff;
36 56
   }
37 57
 }