Browse Source

海报修改

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

+ 5
- 4
src/pages/building/list/add/components/poster.jsx View File

@@ -24,7 +24,7 @@ const Poster = props => {
24 24
   const [imgValue, changeImg] = useState('')
25 25
   const [posterId, setPosterId] = useState('')
26 26
 
27
-  const [building, setBuilding] = useState({})
27
+  const [building, setBuilding] = useState({ buildingImg: [{ url: '' }] })
28 28
   const { buildingId } = props.building
29 29
 
30 30
   if (buildingId) {
@@ -54,6 +54,7 @@ const Poster = props => {
54 54
  
55 55
     request({ ...apis.building.buildingGetById, urlData: { id: currentId } }).then(res => {
56 56
       setBuilding(res)
57
+      console.log('getById: ', res)
57 58
     })
58 59
   }
59 60
 
@@ -89,7 +90,7 @@ const Poster = props => {
89 90
     <div style={{ display: 'flex' }}>
90 91
       <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
91 92
         <div style={{ width: '375px', height: '785px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
92
-          <img style={{ width: '100%', height: '300px' }} src={imgValue || poster1} alt="" />
93
+          <img style={{ width: '100%', height: '300px' }} src={ imgValue || ( building.buildingImg[0].url || poster1 ) } alt="" />
93 94
 
94 95
           <p className={Styles.tagLabel}>
95 96
             {
@@ -103,7 +104,7 @@ const Poster = props => {
103 104
             WebkitBoxOrient: 'vertical',
104 105
             overflow: 'hidden',
105 106
             textOverflow: 'ellipsis',
106
-          }}>{inputValue || building.buildingName}</p>
107
+          }}>{inputValue || (building.buildingName || '海报标题')}</p>
107 108
           <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>
108 109
 
109 110
           <img src={yinhao} style={{ width: '30px', marginLeft: '22px' }} alt="" />
@@ -122,7 +123,7 @@ const Poster = props => {
122 123
       <div >
123 124
         <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
124 125
           <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报图片</p>
125
-          <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
126
+          <ImageUploader value={ imgValue } onChange={e => changeImg(e)} />
126 127
         </div>
127 128
         <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
128 129
           <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>