|
@@ -1,14 +1,316 @@
|
1
|
1
|
<template>
|
2
|
|
- <div></div>
|
|
2
|
+ <div class="edit-form-main">
|
|
3
|
+ <div class="form-title">
|
|
4
|
+ <img class="icon" src="@/assets/img/sa_7.png" />
|
|
5
|
+ <span>活动编辑</span>
|
|
6
|
+ </div>
|
|
7
|
+ <div class="form-content">
|
|
8
|
+ <div class="module-panel">
|
|
9
|
+ <p class="module-title">
|
|
10
|
+ <img src="@/assets/img/sa_13.png" />
|
|
11
|
+ 基本信息
|
|
12
|
+ </p>
|
|
13
|
+ <div class="module-item">
|
|
14
|
+ <label class="item-title">主图</label>
|
|
15
|
+ <div class="poster-photo-panel">
|
|
16
|
+ <el-input v-model="poster_photo_file_name" :readonly="true" class="input"></el-input>
|
|
17
|
+ <el-upload
|
|
18
|
+ action="https://upload.qiniup.com"
|
|
19
|
+ :data="{ token: qntoken, key: poster_photo_file_key }"
|
|
20
|
+ :show-file-list="false"
|
|
21
|
+ :on-error="posterPhotoUploadFail"
|
|
22
|
+ :on-success="posterPhotoUploadSuccess"
|
|
23
|
+ :before-upload="beforePosterPhotoUpload"
|
|
24
|
+ >
|
|
25
|
+ <el-button type="primary" style="margin-left: 10px;" v-loading="uploading_poster_photo">上传图片</el-button>
|
|
26
|
+ </el-upload>
|
|
27
|
+ </div>
|
|
28
|
+ </div>
|
|
29
|
+ <div class="poster-photo-hint">图片建议尺寸828*430,大小不超过3M</div>
|
|
30
|
+ <div class="module-item">
|
|
31
|
+ <label class="item-title">标题</label>
|
|
32
|
+ <el-input v-model="activity.title" class="item-input"></el-input>
|
|
33
|
+ </div>
|
|
34
|
+ <div class="module-item">
|
|
35
|
+ <label class="item-title">名称</label>
|
|
36
|
+ <el-input v-model="activity.subtitle" class="item-input"></el-input>
|
|
37
|
+ </div>
|
|
38
|
+ <div class="module-item">
|
|
39
|
+ <label class="item-title">商户简称</label>
|
|
40
|
+ <el-input v-model="$store.getters.xt_user.org.org_name" class="item-input" readonly></el-input>
|
|
41
|
+ </div>
|
|
42
|
+ <div class="module-item">
|
|
43
|
+ <label class="item-title">报名时间</label>
|
|
44
|
+ <el-date-picker v-model="sign_up_deadline" :picker-options="pickerOptions" value-format="timestamp" type="datetime" format="yyyy-MM-dd HH:mm" class="item-input"></el-date-picker>
|
|
45
|
+ </div>
|
|
46
|
+ <div class="module-item">
|
|
47
|
+ <label class="item-title">活动时间</label>
|
|
48
|
+ <el-date-picker v-model="activity_time" :picker-options="pickerOptions" value-format="timestamp" type="datetime" format="yyyy-MM-dd HH:mm" class="item-input"></el-date-picker>
|
|
49
|
+ </div>
|
|
50
|
+ <div class="module-item">
|
|
51
|
+ <label class="item-title">活动地址</label>
|
|
52
|
+ <el-input v-model="activity.address" class="item-input"></el-input>
|
|
53
|
+ </div>
|
|
54
|
+ <div class="module-item">
|
|
55
|
+ <label class="item-title">限定人数</label>
|
|
56
|
+ <el-input v-model="limit_num" class="item-input" :maxlength="9" @keyup.native="limit_num=limit_num.replace(/\D/g,'')" @afterpaste.native="limit_num=limit_num.replace(/\D/g,'')"></el-input>
|
|
57
|
+ <span class="limit-text">不填写默认为无限制</span>
|
|
58
|
+ </div>
|
|
59
|
+ <div class="module-item">
|
|
60
|
+ <label class="item-title">联系方式</label>
|
|
61
|
+ <el-input v-model="activity.phone_number" class="item-input"></el-input>
|
|
62
|
+ </div>
|
|
63
|
+ </div>
|
|
64
|
+
|
|
65
|
+ <div class="module-panel" style="margin-top: 30px;">
|
|
66
|
+ <p class="module-title">
|
|
67
|
+ <img src="@/assets/img/sa_13.png" />
|
|
68
|
+ 报名须知
|
|
69
|
+ </p>
|
|
70
|
+ <div class="module-item">
|
|
71
|
+ <label class="item-title">报名须知</label>
|
|
72
|
+ <el-input v-model="activity.sign_up_notice" class="item-input" type="textarea" :rows="4" resize="none"></el-input>
|
|
73
|
+ </div>
|
|
74
|
+ </div>
|
|
75
|
+
|
|
76
|
+ <div class="module-panel" style="margin-top: 30px;">
|
|
77
|
+ <p class="module-title">
|
|
78
|
+ <img src="@/assets/img/sa_13.png" />
|
|
79
|
+ 详细说明
|
|
80
|
+ </p>
|
|
81
|
+ <div class="module-item">
|
|
82
|
+ <label class="item-title">标题</label>
|
|
83
|
+ <el-input v-model="paragraph.title" class="item-input"></el-input>
|
|
84
|
+ </div>
|
|
85
|
+ <div class="module-item">
|
|
86
|
+ <label class="item-title">详情</label>
|
|
87
|
+ <div class="item-input">
|
|
88
|
+ <keep-alive>
|
|
89
|
+ <neditor ref="neditor" id="editor" :r_content="paragraph_init_content" @content_changed="paragraphContentChanged"></neditor>
|
|
90
|
+ </keep-alive>
|
|
91
|
+ </div>
|
|
92
|
+ </div>
|
|
93
|
+ </div>
|
|
94
|
+
|
|
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>
|
|
99
|
+ </div>
|
|
100
|
+ </div>
|
|
101
|
+ </div>
|
3
|
102
|
</template>
|
4
|
103
|
|
5
|
104
|
<script>
|
|
105
|
+import Neditor from '@/components/Neditor'
|
|
106
|
+import { getToken } from "@/api/qiniu"
|
|
107
|
+import { getFileExtension } from "@/utils/tools"
|
|
108
|
+
|
6
|
109
|
export default {
|
7
|
110
|
name: "EditActivityEditForm",
|
|
111
|
+ components: {
|
|
112
|
+ Neditor,
|
|
113
|
+ },
|
|
114
|
+ props: {
|
|
115
|
+ activity: {
|
|
116
|
+ type: Object,
|
|
117
|
+ required: true,
|
|
118
|
+ },
|
|
119
|
+ paragraph: {
|
|
120
|
+ type: Object,
|
|
121
|
+ required: true,
|
|
122
|
+ },
|
|
123
|
+ },
|
|
124
|
+ data() {
|
|
125
|
+ return {
|
|
126
|
+ uploading_poster_photo: false,
|
|
127
|
+ qntoken: "",
|
|
128
|
+ poster_photo_file_key: "",
|
|
129
|
+ poster_photo_file_name: "",
|
|
130
|
+
|
|
131
|
+ limit_num: "",
|
|
132
|
+ activity_time: 0,
|
|
133
|
+ sign_up_deadline: 0,
|
|
134
|
+ paragraph_init_content: "",
|
|
135
|
+
|
|
136
|
+ pickerOptions: {
|
|
137
|
+ disabledDate: (time) => {
|
|
138
|
+ return time.getTime() < Date.now() - 8.64e7
|
|
139
|
+ }
|
|
140
|
+ }
|
|
141
|
+ }
|
|
142
|
+ },
|
|
143
|
+ created() {
|
|
144
|
+ this.activity_time = (new Date()).getTime()
|
|
145
|
+ this.sign_up_deadline = (new Date()).getTime()
|
|
146
|
+ },
|
|
147
|
+ watch: {
|
|
148
|
+ limit_num: function(new_val) {
|
|
149
|
+ if (/^[1-9]+[0-9]*]*$/.test(new_val)) {
|
|
150
|
+ this.activity.limit_num = parseInt(new_val)
|
|
151
|
+ } else {
|
|
152
|
+ this.activity.limit_num = 0
|
|
153
|
+ }
|
|
154
|
+ },
|
|
155
|
+ activity_time: function(new_val) {
|
|
156
|
+ this.activity.start_time = new_val
|
|
157
|
+ },
|
|
158
|
+ sign_up_deadline: function(new_val) {
|
|
159
|
+ this.activity.sign_up_deadline = new_val
|
|
160
|
+ },
|
|
161
|
+ },
|
|
162
|
+ methods: {
|
|
163
|
+ initParagraphContent: function(content) {
|
|
164
|
+ this.paragraph_init_content = this.paragraph.content
|
|
165
|
+ },
|
|
166
|
+ paragraphContentChanged: function(content) {
|
|
167
|
+ this.paragraph.content = content
|
|
168
|
+ },
|
|
169
|
+
|
|
170
|
+ posterPhotoUploadFail: function(err, file, fileList) {
|
|
171
|
+ this.uploading_poster_photo = false
|
|
172
|
+ this.$message.error(err)
|
|
173
|
+ },
|
|
174
|
+ posterPhotoUploadSuccess: function(res, file) {
|
|
175
|
+ console.log(res)
|
|
176
|
+ console.log(file)
|
|
177
|
+ this.poster_photo_file_name = file.name
|
|
178
|
+ this.uploading_poster_photo = false
|
|
179
|
+ this.activity.poster_photo = "https://images.shengws.com/" + res.url
|
|
180
|
+ },
|
|
181
|
+ beforePosterPhotoUpload: function(file) {
|
|
182
|
+ console.log(file)
|
|
183
|
+ var is_image = file.type.indexOf("image") > -1
|
|
184
|
+ var mb = file.size / 1024 / 1024
|
|
185
|
+
|
|
186
|
+ if (!is_image) {
|
|
187
|
+ this.$message.error("请上传图片")
|
|
188
|
+ return false
|
|
189
|
+ }
|
|
190
|
+ if (mb > 3) {
|
|
191
|
+ this.$message.error("上传主图大小不能超过3MB")
|
|
192
|
+ return false
|
|
193
|
+ }
|
|
194
|
+
|
|
195
|
+ var rand = Math.floor(Math.random() * 1000000000)
|
|
196
|
+ var date = new Date()
|
|
197
|
+ var ext = getFileExtension(file.name)
|
|
198
|
+ var key = "" + date.getFullYear() + (date.getMonth() + 1) + date.getDate() + "_activity_" + rand + "." + ext
|
|
199
|
+
|
|
200
|
+ this.uploading_poster_photo = true
|
|
201
|
+
|
|
202
|
+ return new Promise((resolve, reject) => {
|
|
203
|
+ getToken().then(rs => {
|
|
204
|
+ var token = rs.data.data.uptoken
|
|
205
|
+ this.qntoken = token
|
|
206
|
+ this.poster_photo_file_key = key
|
|
207
|
+ resolve(true)
|
|
208
|
+ }).catch(err => {
|
|
209
|
+ this.uploading_poster_photo = false
|
|
210
|
+ reject(false)
|
|
211
|
+ })
|
|
212
|
+ })
|
|
213
|
+ },
|
|
214
|
+ },
|
8
|
215
|
}
|
9
|
216
|
</script>
|
10
|
217
|
|
11
|
218
|
<style lang="scss" scoped>
|
|
219
|
+.edit-form-main {
|
|
220
|
+ .form-title {
|
|
221
|
+ width: 100%;
|
|
222
|
+ height: 60px;
|
|
223
|
+ padding: 20px 0 20px 30px;
|
|
224
|
+ border-bottom: 1px #dee2e5 solid;
|
|
225
|
+
|
|
226
|
+ .icon {
|
|
227
|
+ margin-top: -4px;
|
|
228
|
+ vertical-align: middle;
|
|
229
|
+ }
|
|
230
|
+
|
|
231
|
+ span {
|
|
232
|
+ font-size: 18px;
|
|
233
|
+ font-weight: 500;
|
|
234
|
+ color: #485b6d;
|
|
235
|
+ margin-left: 10px;
|
|
236
|
+ }
|
|
237
|
+ }
|
12
|
238
|
|
|
239
|
+ .form-content {
|
|
240
|
+ width: 100%;
|
|
241
|
+ padding: 14px 30px 14px 30px;
|
|
242
|
+
|
|
243
|
+ .module-panel {
|
|
244
|
+ // padding: 0 30px;
|
|
245
|
+
|
|
246
|
+ .module-title {
|
|
247
|
+ font-size: 18px;
|
|
248
|
+ color: #a8b3ba;
|
|
249
|
+
|
|
250
|
+ img {
|
|
251
|
+ float: left;
|
|
252
|
+ display: block;
|
|
253
|
+ padding: 2px 19px 0 0;
|
|
254
|
+ }
|
|
255
|
+ }
|
|
256
|
+
|
|
257
|
+ .module-item {
|
|
258
|
+ margin-top: 20px;
|
|
259
|
+ display: flex;
|
|
260
|
+ // padding: 0 30px;
|
|
261
|
+
|
|
262
|
+ .item-title {
|
|
263
|
+ width: 115px;
|
|
264
|
+ height: 40px;
|
|
265
|
+ line-height: 40px;
|
|
266
|
+ color: #485b6d;
|
|
267
|
+ font-size: 13px;
|
|
268
|
+ // font-weight: 100;
|
|
269
|
+ text-align: right;
|
|
270
|
+ padding-right: 22px;
|
|
271
|
+ float: left;
|
|
272
|
+ }
|
|
273
|
+
|
|
274
|
+ .item-input {
|
|
275
|
+ flex: 1;
|
|
276
|
+ color: #485b6d;
|
|
277
|
+ }
|
|
278
|
+
|
|
279
|
+ .limit-text {
|
|
280
|
+ line-height: 40px;
|
|
281
|
+ color: #a8b3ba;
|
|
282
|
+ font-size: 13px;
|
|
283
|
+ // font-weight: 100;
|
|
284
|
+ text-align: left;
|
|
285
|
+ padding-left: 10px;
|
|
286
|
+ }
|
|
287
|
+
|
|
288
|
+ .poster-photo-panel {
|
|
289
|
+ display: flex;
|
|
290
|
+ flex: 1;
|
|
291
|
+ align-items: center;
|
|
292
|
+
|
|
293
|
+ .input {
|
|
294
|
+ flex: 1;
|
|
295
|
+ color: #485b6d;
|
|
296
|
+ cursor: pointer;
|
|
297
|
+ }
|
|
298
|
+ }
|
|
299
|
+ }
|
|
300
|
+
|
|
301
|
+ .poster-photo-hint {
|
|
302
|
+ font-size: 12px;
|
|
303
|
+ line-height: 16px;
|
|
304
|
+ color: #a8b3ba;
|
|
305
|
+ margin-left: 115px;
|
|
306
|
+ }
|
|
307
|
+ }
|
|
308
|
+
|
|
309
|
+ .submit-button-panel {
|
|
310
|
+ padding: 0 0 0 115px;
|
|
311
|
+ margin-top: 30px;
|
|
312
|
+ }
|
|
313
|
+ }
|
|
314
|
+}
|
13
|
315
|
</style>
|
14
|
316
|
|