Ver código fonte

首页推荐

魏超 5 anos atrás
pai
commit
a9f36e825a
2 arquivos alterados com 75 adições e 64 exclusões
  1. 63
    62
      src/pages/building/list/index.jsx
  2. 12
    2
      src/pages/building/list/style.less

+ 63
- 62
src/pages/building/list/index.jsx Ver arquivo

@@ -96,68 +96,69 @@ function CartBody(props) {
96 96
       },
97 97
     });
98 98
   }
99
-// src={((data.buildingImg && data.buildingImg[0]) || {}).url}background: `url(${item.caseCoverImg})` style={{ background: `url(((data.buildingImg && data.buildingImg[0]) || {}).url)` }}
99
+  // src={((data.buildingImg && data.buildingImg[0]) || {}).url}background: `url(${item.caseCoverImg})` style={{ background: `url(((data.buildingImg && data.buildingImg[0]) || {}).url)` }}
100 100
   const { buildingImg } = data
101 101
   console.log("buildingImg1: ", data.buildingImg)
102 102
   return (
103 103
     <Card
104 104
       hoverable
105 105
       style={{ minWidth: '330px', borderRadius: '12px', margin: '10px', boxShadow: '0px 0px 16px 2px rgba(0,0,0,0.12)' }}
106
-      // cover={}
107
-      // bodyStyle={{ padding: '10px 20px' }}
106
+    // cover={}
107
+    // bodyStyle={{ padding: '10px 20px' }}
108 108
     >
109 109
       {/* 因为 background 方式设置图片背景,如果 图片url 存在空格或者其他特殊字符,导致显示不出来,需要进行 encodeURI(xxx) 转码 */}
110
-    <img className={Styles.cover} style={{ backgroundImage: `url('${encodeURI( ((data.buildingListImg && data.buildingListImg[0]) || {}).url )}')` }}   ></img>
111
-    <div style={{ padding: '10px 20px' }}>
112
-      <p className={Styles.cardText}>
113
-        <span className={Styles.title}>楼盘编号</span>
114
-        <span style={{textOverflow: 'ellipsis',  whiteSpace: 'nowrap',  overflow: 'hidden'}}>:{data.code}</span>
115
-        <AuthButton name="admin.building.update.put" noRight={null}>
116
-          <span className={Styles.ediText} onClick={() => toEdi(data)}>
117
-            编辑
110
+        <span className={Styles.recommderTag}>{data.isMain === 1 ? '首页推荐':''}</span>
111
+        <img className={Styles.cover} style={{ backgroundImage: `url('${encodeURI(((data.buildingListImg && data.buildingListImg[0]) || {}).url)}')` }}   ></img>
112
+      <div style={{ padding: '10px 20px' }}>
113
+        <p className={Styles.cardText}>
114
+          <span className={Styles.title}>楼盘编号</span>
115
+          <span style={{ textOverflow: 'ellipsis', whiteSpace: 'nowrap', overflow: 'hidden' }}>:{data.code}</span>
116
+          <AuthButton name="admin.building.update.put" noRight={null}>
117
+            <span className={Styles.ediText} onClick={() => toEdi(data)}>
118
+              编辑
118 119
                   <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '10px' }} />
119
-          </span>
120
-        </AuthButton>
121
-      </p>
122
-      <p className={Styles.cardText}>
123
-        <span className={Styles.title}>楼盘名称</span>
124
-        <span style={{textOverflow: 'ellipsis',  whiteSpace: 'nowrap',  overflow: 'hidden'}}>:{data.buildingName || data.name}</span>
125
-      </p>
126
-      <p className={Styles.cardItem}>
127
-        <span className={Styles.title}>均价</span>
128
-        <span >
129
-          :约<span style={{ color: '#FF0707', fontSize: '20px' }}> {data.price || '待定'} </span>元/m²
120
+            </span>
121
+          </AuthButton>
122
+        </p>
123
+        <p className={Styles.cardText}>
124
+          <span className={Styles.title}>楼盘名称</span>
125
+          <span style={{ textOverflow: 'ellipsis', whiteSpace: 'nowrap', overflow: 'hidden' }}>:{data.buildingName || data.name}</span>
126
+        </p>
127
+        <p className={Styles.cardItem}>
128
+          <span className={Styles.title}>均价</span>
129
+          <span >
130
+            :约<span style={{ color: '#FF0707', fontSize: '20px' }}> {data.price || '待定'} </span>元/m²
130 131
         </span>
131
-      </p>
132
-      <p className={Styles.cardItem}>
133
-        <span className={Styles.title}>项目地址</span>
134
-        <span className={Styles.address}>:{data.address}</span>
135
-      </p>
136
-      <p className={Styles.cardItem}>
137
-        <span className={Styles.title}>发布状态</span>
138
-        <span >:{data.status === 1 ? '已发布' : '未发布'}</span>
139
-      </p>
140
-      <p className={Styles.cardItem}>
141
-        <span className={Styles.title}>录入时间</span>
142
-        <span >:{moment(data.createDate).format('YYYY-MM-DD HH:mm:ss')}</span>
143
-      </p>
144
-      <p style={{ margin: '15px 0', position: 'relative', fontSize: '0.106rem' }}>
145
-      <AuthButton name="admin.building.update.status.put" noRight={null}>
146
-        <span style={{ color: '#FF4A4A' }} onClick={() => pulicAndUnPulic(data)}>
147
-          {/* 已发布的时候,需要显示取消发布的字样 */}
148
-          {data.status === 1 ? '取消发布' : '发布'}
149
-          <Icon type={data.status === 1 ? 'close-circle' : 'form'} style={{ color: '#C0C4CC', marginLeft: '8px' }} />
150
-        </span>
151
-      </AuthButton>
152
-      <AuthButton name="admin.building.delete.id.delete" noRight={null}>
153
-        <span style={{
154
-          color: '#FF4A4A', position: 'absolute', right: '0',
155
-        }} onClick={() => deleteBuilding(data)}>
156
-          删除
132
+        </p>
133
+        <p className={Styles.cardItem}>
134
+          <span className={Styles.title}>项目地址</span>
135
+          <span className={Styles.address}>:{data.address}</span>
136
+        </p>
137
+        <p className={Styles.cardItem}>
138
+          <span className={Styles.title}>发布状态</span>
139
+          <span >:{data.status === 1 ? '已发布' : '未发布'}</span>
140
+        </p>
141
+        <p className={Styles.cardItem}>
142
+          <span className={Styles.title}>录入时间</span>
143
+          <span >:{moment(data.createDate).format('YYYY-MM-DD HH:mm:ss')}</span>
144
+        </p>
145
+        <p style={{ margin: '15px 0', position: 'relative', fontSize: '0.106rem' }}>
146
+          <AuthButton name="admin.building.update.status.put" noRight={null}>
147
+            <span style={{ color: '#FF4A4A' }} onClick={() => pulicAndUnPulic(data)}>
148
+              {/* 已发布的时候,需要显示取消发布的字样 */}
149
+              {data.status === 1 ? '取消发布' : '发布'}
150
+              <Icon type={data.status === 1 ? 'close-circle' : 'form'} style={{ color: '#C0C4CC', marginLeft: '8px' }} />
151
+            </span>
152
+          </AuthButton>
153
+          <AuthButton name="admin.building.delete.id.delete" noRight={null}>
154
+            <span style={{
155
+              color: '#FF4A4A', position: 'absolute', right: '0',
156
+            }} onClick={() => deleteBuilding(data)}>
157
+              删除
157 158
                 <Icon type="rest" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
158
-        </span>
159
-      </AuthButton>
160
-      </p>
159
+            </span>
160
+          </AuthButton>
161
+        </p>
161 162
       </div>
162 163
     </Card>
163 164
   )
@@ -184,7 +185,7 @@ function body(props) {
184 185
     // 网路请求
185 186
     request({ ...apis.building.getList, params: { ...params } }).then(res => {
186 187
       setDataSource(res)
187
-      console.log("res:",res)
188
+      console.log("res:", res)
188 189
     }).catch(err => {
189 190
       // eslint-disable-next-line no-unused-expressions
190 191
       <Alert
@@ -207,7 +208,7 @@ function body(props) {
207 208
         console.log('提交数据: ', values)
208 209
         const { startDate } = values
209 210
         if (values.startDate !== undefined) {
210
-         
211
+
211 212
           values.startDate = `${moment(startDate).format('YYYY-MM-DDT00:00:00.000')}Z`
212 213
         }
213 214
         getList({ pageNum: 1, pageSize: 9, ...values })
@@ -235,7 +236,7 @@ function body(props) {
235 236
 
236 237
   function toAdd() {
237 238
     // 判断楼盘是否最可以添加
238
-    request({ ...apis.building.verifyMax}).then(res => {
239
+    request({ ...apis.building.verifyMax }).then(res => {
239 240
       router.push({ pathname: '/building/list/add' })
240 241
     }).catch(err => {
241 242
       // eslint-disable-next-line no-unused-expressions
@@ -299,15 +300,15 @@ function body(props) {
299 300
         <Form.Item>
300 301
           {getFieldDecorator('marketStatus')(
301 302
             <Select style={{ width: '180px' }} placeholder="销售状态" onChange={handleSelectChange}>
302
-                <Option value="待定">待定</Option>
303
-                <Option value="在售">在售</Option>
304
-                <Option value="售完">售完</Option>
303
+              <Option value="待定">待定</Option>
304
+              <Option value="在售">在售</Option>
305
+              <Option value="售完">售完</Option>
305 306
             </Select>,
306 307
           )}
307 308
         </Form.Item>
308 309
         <Form.Item>
309 310
           {getFieldDecorator('cityId')(
310
-             <SelectCity />,
311
+            <SelectCity />,
311 312
           )}
312 313
         </Form.Item>
313 314
         <Form.Item>
@@ -319,11 +320,11 @@ function body(props) {
319 320
           )}
320 321
         </Form.Item>
321 322
         <Form.Item>
322
-            <Button type="primary" htmlType="submit">
323
-              搜索
323
+          <Button type="primary" htmlType="submit">
324
+            搜索
324 325
             </Button>
325
-            <Button style={{ marginLeft: 8 }} onClick={handleReset}>
326
-              重置
326
+          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
327
+            重置
327 328
             </Button>
328 329
         </Form.Item>
329 330
       </Form>

+ 12
- 2
src/pages/building/list/style.less Ver arquivo

@@ -20,8 +20,18 @@
20 20
   display: flex;
21 21
   align-items: center;
22 22
   position: relative;
23
-  margin-bottom: 0.08rem;
24
-  
23
+  margin-bottom: 0.08rem; 
24
+}
25
+
26
+.recommderTag{
27
+  position: absolute;
28
+  color: #fff;
29
+  line-height: 0.28rem;
30
+  width: 0.54rem;
31
+  background-color: rgba(0,0,0,0.4);
32
+  text-align: center;
33
+  border-radius: 12px 0 12px 0;
34
+  font-size: 0.09rem;
25 35
 }
26 36
 .cardItem{
27 37
   font-size: 0.106rem;