魏超 před 5 roky
rodič
revize
a66bc984fc
2 změnil soubory, kde provedl 166 přidání a 3 odebrání
  1. 1
    1
      src/pages/news/list/NewsList.jsx
  2. 165
    2
      src/pages/news/list/editNewsList.jsx

+ 1
- 1
src/pages/news/list/NewsList.jsx Zobrazit soubor

176
             取消发布
176
             取消发布
177
               <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
177
               <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
178
           </span> :
178
           </span> :
179
-          <span style={{ position: 'absolute', left: '280px', bottom: ' 0.11rem', fontSize: ' 0.11rem', color: '#FF7E48' }} onClick={cancelRelease.bind(this, data.newsId, 0, data.buildingId, data.newsType.newsTypeId)}>
179
+          <span style={{ position: 'absolute', left: '280px', bottom: ' 0.11rem', fontSize: ' 0.11rem', color: '#FF7E48' ,zIndex:'1'}} onClick={cancelRelease.bind(this, data.newsId, 0, data.buildingId, data.newsType.newsTypeId)}>
180
             发布
180
             发布
181
               <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
181
               <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
182
           </span>
182
           </span>

+ 165
- 2
src/pages/news/list/editNewsList.jsx Zobrazit soubor

2
 import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker,message } from 'antd';
2
 import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker,message } from 'antd';
3
 import { FormattedMessage } from 'umi-plugin-react/locale';
3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4
 import styles from '../../style/GoodsList.less';
4
 import styles from '../../style/GoodsList.less';
5
+import apis from '../../../services/apis';
5
 import moment from 'moment';
6
 import moment from 'moment';
6
 import router from 'umi/router';
7
 import router from 'umi/router';
7
 import BuildSelect from '../../../components/SelectButton/BuildSelect'
8
 import BuildSelect from '../../../components/SelectButton/BuildSelect'
9
 import XForm, { FieldTypes } from '../../../components/XForm';
10
 import XForm, { FieldTypes } from '../../../components/XForm';
10
 import Wangedit from '../../../components/Wangedit/Wangedit'
11
 import Wangedit from '../../../components/Wangedit/Wangedit'
11
 import request from '../../../utils/request'
12
 import request from '../../../utils/request'
13
+import PosterBottom from '../../../assets/bottom.png'
14
+import ImageUploader from '../../../components/XForm/ImageUpload';
15
+import logo from '../../../assets/logo.png';
16
+import yinhao from '../../../assets/yinhao.png'
17
+import touxiang from '../../../assets/touxiang.jpg';
18
+import poster1 from '../../../assets/poster1.png';
19
+import poster2 from '../../../assets/poster2.png';
12
 
20
 
13
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
21
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
22
+const { TextArea } = Input;
14
 /**
23
 /**
15
  *
24
  *
16
  *
25
  *
118
   }
127
   }
119
   
128
   
120
   const Poster = (props) => {
129
   const Poster = (props) => {
121
-   return <div>Poster</div>
130
+    const [inputValue, changeInput] = useState('')
131
+    const [textAreaValue, changeTextArea] = useState('')
132
+    const [imgValue, changeImg] = useState('')
133
+    const [posterId, setPosterId] = useState('')
134
+
135
+    if(newsId){
136
+      useEffect(() => {
137
+        request({ ...apis.activity.poster, params: {targetId: newsId,targetType: 'news'} }).then((data) => {
138
+          console.log(data,"2222")
139
+          if(data.length > 0){
140
+            setPosterId(data[0].posterId)
141
+            changeImg(data[0].posterImg)
142
+            changeTextArea(data[0].posterDescription)
143
+            changeInput(data[0].posterTitle)
144
+          }
145
+        }).catch((err) => {
146
+          message.info(err.msg || err.message)
147
+        })
148
+      }, [])
149
+    }
150
+
151
+    const submitPoster  = () => {
152
+       if(newsId){
153
+        if(posterId){
154
+          request({ ...apis.activity.updatePoster, urlData: {id: posterId}, data: {targetId: newsId,targetType: 'news',posterImg: imgValue,posterTitle: inputValue,posterDescription: textAreaValue},}).then((data) => {
155
+            message.info("保存成功")
156
+          }).catch((err) => {
157
+            message.info(err.msg || err.message)
158
+          })
159
+         }else{
160
+          request({ ...apis.activity.addPoster, data: {targetId: newsId,targetType: 'news',posterImg: imgValue,posterTitle: inputValue,posterDescription: textAreaValue},}).then((data) => {
161
+            setPosterId(data.posterId)
162
+            message.info("保存成功")
163
+          }).catch((err) => {
164
+            message.info(err.msg || err.message)
165
+          })
166
+         }
167
+       }else{
168
+        message.warn("请先保存基本信息数据")
169
+       }
170
+    }
171
+
172
+    return <div>
173
+      <div style={{ display: 'flex' }}>
174
+        <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
175
+          <div style={{ width: '375px', height: '785px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
176
+            <img style={{ width: '100%', height: '300px' }} src={imgValue ? imgValue : poster1} alt="" />
177
+            <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
178
+              <img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src={touxiang} alt="" />
179
+              <span style={{ color: '#222', fontWeight: '600', margin: '24px 10px 0 14px', fontSize: '17px' }}>喵喵</span>
180
+              <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您阅读</span>
181
+              <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
182
+            </div>
183
+            <p style={{
184
+              margin: '10px 20px', fontSize: '20px', color: '#222', fontWeight: '600',
185
+              display: '-webkit-box', lineClamp: '3', height: '60px',
186
+              WebkitLineClamp: '2',
187
+              WebkitBoxOrient: 'vertical',
188
+              overflow: 'hidden',
189
+              textOverflow: 'ellipsis'
190
+            }}>{inputValue ? inputValue : '海报标题'}</p>
191
+
192
+            <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
193
+            <p style={{
194
+              margin: '16px 20px 28px 20px', fontSize: '17px', color: '#999',
195
+              display: '-webkit-box', lineClamp: '3', height: '76px',
196
+              WebkitLineClamp: '3',
197
+              WebkitBoxOrient: 'vertical',
198
+              overflow: 'hidden',
199
+              textOverflow: 'ellipsis'
200
+            }}>{textAreaValue ? textAreaValue : '海报描述'}</p>
201
+            <img src={PosterBottom} style={{ width: '100%' }} alt="" />
202
+          </div>
203
+          <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
204
+        </div>
205
+
206
+        <div >
207
+          <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
208
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报图片</p>
209
+            <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
210
+          </div>
211
+          <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
212
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
213
+            <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
214
+          </div>
215
+          <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
216
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
217
+            <TextArea rows={5} value={textAreaValue} onChange={e => changeTextArea(e.target.value)} />
218
+          </div>
219
+
220
+        </div>
221
+      </div>
222
+      <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
223
+      <Button onClick={() => router.go(-1)}>取消</Button>
224
+    </div>
225
+
122
   }
226
   }
123
  
227
  
124
   const Share = (props) => {
228
   const Share = (props) => {
125
-    return <div>Share</div>
229
+    const [inputValue, changeInput] = useState('')
230
+    const [imgValue, changeImg] = useState('')
231
+    const [shareContentId, setShareContentId] = useState('')
232
+    
233
+    if(newsId){
234
+      useEffect(() => {
235
+        request({ ...apis.activity.shareContent, params: {targetId: newsId,targetType: 'news'},}).then((data) => {
236
+          console.log(data,"2222")
237
+          if(data.length > 0){
238
+            setShareContentId(data[0].shareContentId)
239
+            changeImg(data[0].shareContentImg)
240
+            changeInput(data[0].shareContentTitle)
241
+          }
242
+        }).catch((err) => {
243
+          message.info(err.msg || err.message)
244
+        })
245
+      }, [])
246
+    }
247
+
248
+    const submitShare = () => {
249
+      if(newsId){
250
+        if(shareContentId){
251
+          request({ ...apis.activity.updateShareContent, urlData: {id: shareContentId},data: {targetId: newsId,shareContentType: 'news',shareContentImg: imgValue,shareContentTitle: inputValue},}).then((data) => {
252
+            message.info("保存成功")
253
+          }).catch((err) => {
254
+            message.info(err.msg || err.message)
255
+          })
256
+         }else{
257
+          request({ ...apis.activity.addShareContent, data: {targetId: newsId,shareContentType: 'news',shareContentImg: imgValue,shareContentTitle: inputValue},}).then((data) => {
258
+            setShareContentId(data.shareContentId)
259
+            message.info("保存成功")
260
+          }).catch((err) => {
261
+            message.info(err.msg || err.message)
262
+          })
263
+         }
264
+       }else{
265
+        message.warn("请先保存基本信息数据")
266
+       }
267
+    }
268
+
269
+    return <div style={{ padding: '20px' }}>
270
+      <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
271
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板</p>
272
+        <div>
273
+          <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}><img src={logo} style={{ width: '22px', marginRight: '10px' }} />知与行互动</p>
274
+          <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue ? inputValue : '置业V客厅 精准获客平台'}</p>
275
+          <img style={{ width: '200px', height: '140px' }} src={imgValue ? imgValue : poster2} alt="" />
276
+        </div>
277
+      </div>
278
+      <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
279
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
280
+        <Input placeholder="请输入海报标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
281
+      </div>
282
+      <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
283
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图片</p>
284
+        <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
285
+      </div>
286
+      <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
287
+      <Button onClick={() => router.go(-1)}>取消</Button>
288
+    </div>
126
   }
289
   }
127
 
290
 
128
   return (
291
   return (