|
@@ -11,7 +11,7 @@
|
11
|
11
|
基本信息
|
12
|
12
|
</p>
|
13
|
13
|
<div class="module-item">
|
14
|
|
- <label class="item-title">主图</label>
|
|
14
|
+ <label class="item-title">海报</label>
|
15
|
15
|
<div class="poster-photo-panel">
|
16
|
16
|
<el-input v-model="poster_photo_file_name" :readonly="true" class="input"></el-input>
|
17
|
17
|
<el-upload
|
|
@@ -22,7 +22,7 @@
|
22
|
22
|
:on-success="posterPhotoUploadSuccess"
|
23
|
23
|
:before-upload="beforePosterPhotoUpload"
|
24
|
24
|
>
|
25
|
|
- <el-button type="primary" style="margin-left: 10px;" v-loading="uploading_poster_photo">上传图片</el-button>
|
|
25
|
+ <el-button type="primary" style="margin-left: 10px;" :loading="uploading_poster_photo">上传图片</el-button>
|
26
|
26
|
</el-upload>
|
27
|
27
|
</div>
|
28
|
28
|
</div>
|
|
@@ -93,9 +93,9 @@
|
93
|
93
|
</div>
|
94
|
94
|
|
95
|
95
|
<div class="submit-button-panel">
|
96
|
|
- <el-button style="padding: 10px 30px;" type="primary">发 布</el-button>
|
97
|
|
- <el-button style="color: #409eff; border-color: #409eff; padding: 10px 30px;">保存草稿</el-button>
|
98
|
|
- <el-button style="color: #409eff; border-color: #409eff; padding: 10px 30px;">预 览</el-button>
|
|
96
|
+ <el-button style="padding: 10px 30px;" type="primary" @click="publishAction" :loading="publishing_activity" :disabled="saving_activity || saving_before_preview_activity">发 布</el-button>
|
|
97
|
+ <el-button style="color: #409eff; border-color: #409eff; padding: 10px 30px;" @click="saveAction" :loading="saving_activity" :disabled="publishing_activity || saving_before_preview_activity">保存草稿</el-button>
|
|
98
|
+ <el-button style="color: #409eff; border-color: #409eff; padding: 10px 30px;" :loading="saving_before_preview_activity" :disabled="publishing_activity || saving_activity">预 览</el-button>
|
99
|
99
|
</div>
|
100
|
100
|
</div>
|
101
|
101
|
</div>
|
|
@@ -105,6 +105,8 @@
|
105
|
105
|
import Neditor from '@/components/Neditor'
|
106
|
106
|
import { getToken } from "@/api/qiniu"
|
107
|
107
|
import { getFileExtension } from "@/utils/tools"
|
|
108
|
+import { parseTime } from "@/utils"
|
|
109
|
+import { submitActivity } from "@/api/activity/activity"
|
108
|
110
|
|
109
|
111
|
export default {
|
110
|
112
|
name: "EditActivityEditForm",
|
|
@@ -123,6 +125,10 @@ export default {
|
123
|
125
|
},
|
124
|
126
|
data() {
|
125
|
127
|
return {
|
|
128
|
+ saving_activity: false,
|
|
129
|
+ publishing_activity: false,
|
|
130
|
+ saving_before_preview_activity: false,
|
|
131
|
+
|
126
|
132
|
uploading_poster_photo: false,
|
127
|
133
|
qntoken: "",
|
128
|
134
|
poster_photo_file_key: "",
|
|
@@ -153,10 +159,10 @@ export default {
|
153
|
159
|
}
|
154
|
160
|
},
|
155
|
161
|
activity_time: function(new_val) {
|
156
|
|
- this.activity.start_time = new_val
|
|
162
|
+ this.activity.start_time = parseInt(new_val / 1000)
|
157
|
163
|
},
|
158
|
164
|
sign_up_deadline: function(new_val) {
|
159
|
|
- this.activity.sign_up_deadline = new_val
|
|
165
|
+ this.activity.sign_up_deadline = parseInt(new_val / 1000)
|
160
|
166
|
},
|
161
|
167
|
},
|
162
|
168
|
methods: {
|
|
@@ -213,6 +219,98 @@ export default {
|
213
|
219
|
})
|
214
|
220
|
})
|
215
|
221
|
},
|
|
222
|
+
|
|
223
|
+ saveAction: function() {
|
|
224
|
+ this.saving_activity = true
|
|
225
|
+ this.submitActivity(false)
|
|
226
|
+ },
|
|
227
|
+ publishAction: function() {
|
|
228
|
+ this.publishing_activity = true
|
|
229
|
+ this.submitActivity(true, function() {
|
|
230
|
+ // 前往活动详情页
|
|
231
|
+ })
|
|
232
|
+ },
|
|
233
|
+ previewAction: function() {
|
|
234
|
+ this.saving_before_preview_activity = true
|
|
235
|
+ this.submitActivity(false, function() {
|
|
236
|
+ // 前往活动预览页
|
|
237
|
+ })
|
|
238
|
+ },
|
|
239
|
+ submitActivity: function(is_publish, successCallBack) {
|
|
240
|
+ this.validActivityInfo().then(() => {
|
|
241
|
+ var activity = {
|
|
242
|
+ id: this.activity.id,
|
|
243
|
+ poster_photo: this.activity.poster_photo,
|
|
244
|
+ title: this.activity.title,
|
|
245
|
+ subtitle: this.activity.subtitle,
|
|
246
|
+ address: this.activity.address,
|
|
247
|
+ limit_num: this.activity.limit_num,
|
|
248
|
+ sign_up_deadline: parseTime(this.activity.sign_up_deadline, "{y}-{m}-{d} {h}:{i}"),
|
|
249
|
+ start_time: parseTime(this.activity.start_time, "{y}-{m}-{d} {h}:{i}"),
|
|
250
|
+ phone_number: this.activity.phone_number,
|
|
251
|
+ sign_up_notice: this.activity.sign_up_notice,
|
|
252
|
+
|
|
253
|
+ paragraph: {
|
|
254
|
+ title: this.paragraph.title,
|
|
255
|
+ content: this.paragraph.content,
|
|
256
|
+ }
|
|
257
|
+ }
|
|
258
|
+ submitActivity(is_publish, activity).then(rs => {
|
|
259
|
+ var resp = rs.data
|
|
260
|
+ if (resp.state == 1) {
|
|
261
|
+ this.activity.id = resp.data.activity_id
|
|
262
|
+ } else {
|
|
263
|
+ this.$message.error(resp.msg)
|
|
264
|
+ }
|
|
265
|
+
|
|
266
|
+ if (successCallBack != null || successCallBack != undefined) {
|
|
267
|
+ successCallBack()
|
|
268
|
+ }
|
|
269
|
+
|
|
270
|
+ this.saving_activity = false
|
|
271
|
+ this.publishing_activity = false
|
|
272
|
+ this.saving_before_preview_activity = false
|
|
273
|
+
|
|
274
|
+ }).catch(err => {
|
|
275
|
+ this.$message.error(err)
|
|
276
|
+ this.saving_activity = false
|
|
277
|
+ this.publishing_activity = false
|
|
278
|
+ this.saving_before_preview_activity = false
|
|
279
|
+ })
|
|
280
|
+
|
|
281
|
+ }).catch(err => {
|
|
282
|
+ this.$message.error(err)
|
|
283
|
+ this.saving_activity = false
|
|
284
|
+ this.publishing_activity = false
|
|
285
|
+ this.saving_before_preview_activity = false
|
|
286
|
+ })
|
|
287
|
+
|
|
288
|
+ },
|
|
289
|
+ validActivityInfo: function() {
|
|
290
|
+ return new Promise((resolve, reject) => {
|
|
291
|
+ if (this.activity.poster_photo.length == 0) {
|
|
292
|
+ reject("海报不能为空")
|
|
293
|
+ } else if (this.activity.title.length == 0) {
|
|
294
|
+ reject("标题不能为空")
|
|
295
|
+ } else if (this.activity.subtitle.length == 0) {
|
|
296
|
+ reject("副标题不能为空")
|
|
297
|
+ } else if (this.activity.address.length == 0) {
|
|
298
|
+ reject("活动地址不能为空")
|
|
299
|
+ } else if (this.activity.sign_up_deadline == 0) {
|
|
300
|
+ reject("活动报名时间不能为空")
|
|
301
|
+ } else if (this.activity.start == 0) {
|
|
302
|
+ reject("活动时间不能为空")
|
|
303
|
+ } else {
|
|
304
|
+ if (this.activity.phone_number.length > 0) {
|
|
305
|
+ if (/^1\d{10}$/.test(this.activity.phone_number) == false && /^(0\d{2,3}-?\d{7,8}$)/.test(this.activity.phone_number) == false) {
|
|
306
|
+ reject("联系方式格式错误")
|
|
307
|
+ return
|
|
308
|
+ }
|
|
309
|
+ }
|
|
310
|
+ }
|
|
311
|
+ resolve()
|
|
312
|
+ })
|
|
313
|
+ },
|
216
|
314
|
},
|
217
|
315
|
}
|
218
|
316
|
</script>
|