Pārlūkot izejas kodu

项目海报数据填充

魏熙美 5 gadus atpakaļ
vecāks
revīzija
416341f607
1 mainītis faili ar 21 papildinājumiem un 3 dzēšanām
  1. 21
    3
      src/pages/building/list/add/components/poster.jsx

+ 21
- 3
src/pages/building/list/add/components/poster.jsx Parādīt failu

@@ -13,6 +13,7 @@ import ImageUploader from '../../../../../components/XForm/ImageUpload';
13 13
 import poster1 from '../../../../../assets/poster1.png';
14 14
 import poster2 from '../../../../../assets/poster2.png';
15 15
 import Styles from '../style.less';
16
+import apis from '../../../../../services/apis';
16 17
 
17 18
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
18 19
 const { TextArea } = Input;
@@ -23,6 +24,7 @@ const Poster = props => {
23 24
   const [imgValue, changeImg] = useState('')
24 25
   const [posterId, setPosterId] = useState('')
25 26
 
27
+  const [building, setBuilding] = useState({})
26 28
   const { buildingId } = props.building
27 29
 
28 30
   if (buildingId) {
@@ -43,9 +45,21 @@ const Poster = props => {
43 45
       }).catch(err => {
44 46
         message.info(err.msg || err.message)
45 47
       })
48
+
49
+      getById(buildingId)
46 50
     }, [])
47 51
   }
48 52
 
53
+  // 获取详情信息
54
+  function getById(currentId) {
55
+    const { url, method } = apis.building.buildingGetById
56
+    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(currentId)
57
+
58
+    request({ url: tempUrl, method }).then(res => {
59
+      setBuilding(res)
60
+    })
61
+  }
62
+
49 63
   const submitPoster = () => {
50 64
     if (buildingId) {
51 65
       if (posterId) {
@@ -81,7 +95,11 @@ const Poster = props => {
81 95
         <div style={{ width: '375px', height: '785px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
82 96
           <img style={{ width: '100%', height: '300px' }} src={imgValue || poster1} alt="" />
83 97
 
84
-          <p className={Styles.tagLabel}><span>全朝南</span><span>品牌开发商</span><span>轨交房</span></p>
98
+          <p className={Styles.tagLabel}>
99
+            {
100
+              building.buildingTag && building.buildingTag.map(item => <span>{item.tagName}</span>)
101
+            }
102
+          </p>
85 103
           <p style={{
86 104
             margin: '10px 20px', fontSize: '20px', color: '#222', fontWeight: '600',
87 105
             display: '-webkit-box', lineClamp: '3', height: '36px',lineHeight:'36px',
@@ -89,8 +107,8 @@ const Poster = props => {
89 107
             WebkitBoxOrient: 'vertical',
90 108
             overflow: 'hidden',
91 109
             textOverflow: 'ellipsis',
92
-          }}>{inputValue || '海报标题'}</p>
93
-          <p style={{ color: '#999',padding:' 0 20px' }}>约<span style={{ color: '#fd0d0c', fontSize: '24px',marginLeft:'6px' }}>41505</span><span style={{ color: '#fd0d0c', fontSize: '20px' }}>元/m²</span></p>
110
+          }}>{building.buildingName || '楼盘标题'}</p>
111
+          <p style={{ color: '#999',padding:' 0 20px' }}>约<span style={{ color: '#fd0d0c', fontSize: '24px',marginLeft:'6px' }}>{ building.price }</span><span style={{ color: '#fd0d0c', fontSize: '20px' }}>元/m²</span></p>
94 112
 
95 113
           <img src={yinhao} style={{ width: '30px', marginLeft: '22px' }} alt="" />
96 114
           <p style={{