|
@@ -38,7 +38,6 @@
|
38
|
38
|
<el-input-number v-model="ruleForm.sort" :min="1" :max="10" label="权重值" @change="sortHandleChange"/>
|
39
|
39
|
</el-form-item>
|
40
|
40
|
<el-form-item>
|
41
|
|
- <el-button @click="resetForm('ruleForm','2')">存为草稿</el-button>
|
42
|
41
|
<el-button type="primary" @click="submitForm('ruleForm','1')">发布</el-button>
|
43
|
42
|
</el-form-item>
|
44
|
43
|
</el-form>
|
|
@@ -78,7 +77,6 @@ export default {
|
78
|
77
|
}
|
79
|
78
|
},
|
80
|
79
|
mounted() {
|
81
|
|
- console.log("123")
|
82
|
80
|
this.getById(this.$route.params.id)
|
83
|
81
|
},
|
84
|
82
|
methods: {
|
|
@@ -95,10 +93,11 @@ export default {
|
95
|
93
|
if (valid) {
|
96
|
94
|
if (this.ruleForm.announcementContent.length <= 0 && this.ruleForm.contentImg.length <= 0) {
|
97
|
95
|
this.$message.error('活动内容描述 和 活动配图至少要存在一个!')
|
|
96
|
+ loading.close()
|
98
|
97
|
return
|
99
|
98
|
}
|
100
|
99
|
this.ruleForm.status = status // 发布状态
|
101
|
|
- this.$store.dispatch('AddAnnouncement', this.ruleForm).then((res) => {
|
|
100
|
+ this.$store.dispatch('Updateannouncement', this.ruleForm).then((res) => {
|
102
|
101
|
if (res.code === '0') {
|
103
|
102
|
this.$message({
|
104
|
103
|
message: res.message,
|
|
@@ -119,10 +118,8 @@ export default {
|
119
|
118
|
return false
|
120
|
119
|
}
|
121
|
120
|
})
|
122
|
|
- },
|
123
|
|
- resetForm(formName,status) {
|
124
|
|
- console.log(status)
|
125
|
|
- this.submitForm(formName,status)
|
|
121
|
+ // 关闭加载框
|
|
122
|
+ loading.close()
|
126
|
123
|
},
|
127
|
124
|
handleAvatarSuccess(res, file) { // 轮播图上传回调
|
128
|
125
|
this.ruleForm.announcementCarouselImg = res.data[0]
|
|
@@ -161,34 +158,17 @@ export default {
|
161
|
158
|
console.log(value)
|
162
|
159
|
},
|
163
|
160
|
getById(id) { // 页面初始化后调用此方法根据ID获取活动信息
|
164
|
|
- console.log("id:",id)
|
165
|
161
|
this.ruleForm.id=this.$route.params.id
|
166
|
|
- console.log("123id:",this.ruleForm.id)
|
167
|
162
|
this.$store.dispatch('AnnouncementById', this.ruleForm).then((res) => {
|
168
|
|
- const resData = res.data
|
169
|
|
- this.ruleForm.announcementTitle=resData.tpAnnouncement.announcementTitle// 标题
|
170
|
|
- this.ruleForm.announcementContent=resData.tpAnnouncement.announcementContent// 内容
|
171
|
|
- this.Urlimage=resData.tpAnnouncement.announcementCarouselImg // 轮播图
|
172
|
|
- this.ruleForm.sort=resData.tpAnnouncement.sort// 权重
|
|
163
|
+ const resData = res.data
|
|
164
|
+ this.ruleForm.announcementTitle=resData.tpAnnouncement.announcementTitle// 标题
|
|
165
|
+ this.ruleForm.announcementContent=resData.tpAnnouncement.announcementContent// 内容
|
|
166
|
+ this.Urlimage=resData.tpAnnouncement.announcementCarouselImg // 轮播图
|
|
167
|
+ this.ruleForm.sort=resData.tpAnnouncement.sort// 权重
|
173
|
168
|
//多张图片进行遍历
|
174
|
|
- const imgArr=resData.studentList
|
175
|
|
- console.log("imgArr:",imgArr)
|
176
|
|
- this.ruleForm.contentImg=imgArr// 内容图片
|
177
|
|
- for (let i = 0; i < imgArr.length; i++) {
|
178
|
|
- // this.contentImgList=resData.studentList[i].imageUrl
|
179
|
|
- console.log("imgArr2.:",imgArr)
|
|
169
|
+ for (let i = 0; i < resData.studentList.length; i++) {
|
|
170
|
+ this.contentImgList.push({ url: resData.studentList[i].imageUrl })
|
180
|
171
|
}
|
181
|
|
- // console.log("this.ruleForm.contentImg",imgArr)
|
182
|
|
- // const resData = res.data
|
183
|
|
- // this.imageUrl = resData.info.activityCarouselImg
|
184
|
|
- // this.ruleForm = resData.info
|
185
|
|
-
|
186
|
|
- // const imgArr = resData.contentImg
|
187
|
|
- // this.ruleForm.contentImg = imgArr
|
188
|
|
- //多张图片进行遍历
|
189
|
|
- // for (let i = 0; i < imgArr.length; i++) {
|
190
|
|
- // this.activityContentList.push({ url: imgArr[i] })
|
191
|
|
- // }
|
192
|
172
|
})
|
193
|
173
|
}
|
194
|
174
|
}
|