魏熙美 5 år sedan
förälder
incheckning
e0125301cc
1 ändrade filer med 5 tillägg och 4 borttagningar
  1. 5
    4
      src/pages/building/list/add/components/poster.jsx

+ 5
- 4
src/pages/building/list/add/components/poster.jsx Visa fil

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