李志伟 3 vuotta sitten
vanhempi
commit
8f876c2515
1 muutettua tiedostoa jossa 17 lisäystä ja 2 poistoa
  1. 17
    2
      src/hotel/pages/landlord/addRoom/addRoom.jsx

+ 17
- 2
src/hotel/pages/landlord/addRoom/addRoom.jsx Näytä tiedosto

@@ -138,6 +138,21 @@ export default withLayout((props) => {
138 138
       }
139 139
     })
140 140
   }
141
+  const isError = (s) => {
142
+    if (!s) { return true }
143
+    else {
144
+      // 根据,(逗号)进行分割
145
+      let split = s.split(",");
146
+      if (split.length != 2) {
147
+        return true
148
+      } else {
149
+        if (!split[0] || !split[1]) {
150
+          return true
151
+        }
152
+      }
153
+    }
154
+    return false
155
+  }
141 156
   return (
142 157
     <view className='page-index'>
143 158
       <view className="index-navbar">
@@ -170,7 +185,7 @@ export default withLayout((props) => {
170 185
             <mp-cells title='房屋位置'>
171 186
               <mp-cell>
172 187
                 <Input style={{ color: '#000', fontWeight: 'bold', marginBottom: '13px' }} onInput={(e) => setRoomModel({ ...roomModel, address: e.detail.value })} value={roomModel.address} placeholder='请输入房屋位置(必填)' />
173
-                <Label style={{ color: '#666' }} onClick={onRoomMap}>{roomModel.location == '' ? '房间定位(必填)' : roomModel.location}</Label>
188
+                <Label style={{ color: '#666' }} onClick={onRoomMap}>{isError(roomModel.location)? '房间定位(必填)' : roomModel.location}</Label>
174 189
               </mp-cell>
175 190
             </mp-cells>
176 191
             {
@@ -178,7 +193,7 @@ export default withLayout((props) => {
178 193
                 <mp-cells title='停车场位置'>
179 194
                   <mp-cell>
180 195
                     <Input onInput={(e) => setRoomModel({ ...roomModel, parkingAddress: e.detail.value })} value={roomModel.parkingAddress} placeholder='请输入停车场位置' />
181
-                    <Label style={{ color: '#666', lineHeight: '30px' }} onClick={onParkMap}>{roomModel.parkingLocation == '' ? '停车场定位' : roomModel.parkingLocation}</Label>
196
+                    <Label style={{ color: '#666', lineHeight: '30px' }} onClick={onParkMap}>{isError(roomModel.parkingLocation)? '停车场定位' : roomModel.parkingLocation}</Label>
182 197
                   </mp-cell>
183 198
                 </mp-cells> : null
184 199
             }