Browse Source

项目海报数据填充

魏熙美 5 years ago
parent
commit
416341f607
1 changed files with 21 additions and 3 deletions
  1. 21
    3
      src/pages/building/list/add/components/poster.jsx

+ 21
- 3
src/pages/building/list/add/components/poster.jsx View File

13
 import poster1 from '../../../../../assets/poster1.png';
13
 import poster1 from '../../../../../assets/poster1.png';
14
 import poster2 from '../../../../../assets/poster2.png';
14
 import poster2 from '../../../../../assets/poster2.png';
15
 import Styles from '../style.less';
15
 import Styles from '../style.less';
16
+import apis from '../../../../../services/apis';
16
 
17
 
17
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
18
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
18
 const { TextArea } = Input;
19
 const { TextArea } = Input;
23
   const [imgValue, changeImg] = useState('')
24
   const [imgValue, changeImg] = useState('')
24
   const [posterId, setPosterId] = useState('')
25
   const [posterId, setPosterId] = useState('')
25
 
26
 
27
+  const [building, setBuilding] = useState({})
26
   const { buildingId } = props.building
28
   const { buildingId } = props.building
27
 
29
 
28
   if (buildingId) {
30
   if (buildingId) {
43
       }).catch(err => {
45
       }).catch(err => {
44
         message.info(err.msg || err.message)
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
   const submitPoster = () => {
63
   const submitPoster = () => {
50
     if (buildingId) {
64
     if (buildingId) {
51
       if (posterId) {
65
       if (posterId) {
81
         <div style={{ width: '375px', height: '785px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
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
           <img style={{ width: '100%', height: '300px' }} src={imgValue || poster1} alt="" />
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
           <p style={{
103
           <p style={{
86
             margin: '10px 20px', fontSize: '20px', color: '#222', fontWeight: '600',
104
             margin: '10px 20px', fontSize: '20px', color: '#222', fontWeight: '600',
87
             display: '-webkit-box', lineClamp: '3', height: '36px',lineHeight:'36px',
105
             display: '-webkit-box', lineClamp: '3', height: '36px',lineHeight:'36px',
89
             WebkitBoxOrient: 'vertical',
107
             WebkitBoxOrient: 'vertical',
90
             overflow: 'hidden',
108
             overflow: 'hidden',
91
             textOverflow: 'ellipsis',
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
           <img src={yinhao} style={{ width: '30px', marginLeft: '22px' }} alt="" />
113
           <img src={yinhao} style={{ width: '30px', marginLeft: '22px' }} alt="" />
96
           <p style={{
114
           <p style={{