|
|
@@ -84,7 +84,7 @@
|
|
|
</el-form>
|
|
|
</div>
|
|
|
</el-card>
|
|
|
- <el-card class="box-card">
|
|
|
+ <el-card class="box-card" v-if="activeItems.length > 0">
|
|
|
<div slot="header" class="clearfix">
|
|
|
<span>报名信息</span>
|
|
|
</div>
|
|
|
@@ -113,10 +113,14 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="input-container" v-else>
|
|
|
+ <div class="input-container" v-else-if="item.type == 3">
|
|
|
<div class="label"><span v-if="item.isRequire">*</span>{{item.question}}</div>
|
|
|
<el-input type="text" v-model="item.inputValue" :maxlength="item.answer[0].option_limit" :disabled="formType!=0" :placeholder="`请输入${item.question}`"></el-input>
|
|
|
</div>
|
|
|
+ <div class="input-container" v-else>
|
|
|
+ <div class="label"><span v-if="item.isRequire">*</span>{{item.question}}</div><br/>
|
|
|
+ <ImageUpload :fileList="item.inputValue" :limit="1" :isEdit="formType==0" :fileType="['image','video']"/>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</el-card>
|
|
|
<el-card class="box-card" v-if="formType != 0">
|
|
|
@@ -170,7 +174,7 @@
|
|
|
import { getDetail, add, follow, getActiveList, getActiveDetail } from "@/api/activityOrder";
|
|
|
export default {
|
|
|
components: {ImageUpload},
|
|
|
- props: ['id','title','formType'],
|
|
|
+ props: ['id','title','formType','activeId'],
|
|
|
data() {
|
|
|
return {
|
|
|
dataList: [],
|
|
|
@@ -219,6 +223,10 @@
|
|
|
if(this.id){
|
|
|
this.getDetail()
|
|
|
}
|
|
|
+ if(this.activeId){
|
|
|
+ this.formData.active = {id: this.activeId}
|
|
|
+ this.getActiveDetail(this.activeId)
|
|
|
+ }
|
|
|
this.getActiveList()
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -237,28 +245,35 @@
|
|
|
})
|
|
|
},
|
|
|
getActiveList(){
|
|
|
- getActiveList({}).then(res => {
|
|
|
+ getActiveList({pageNum: 1,pageSize: -1,status: 1}).then(res => {
|
|
|
this.activeList = res.data.records
|
|
|
})
|
|
|
},
|
|
|
getActiveDetail(id,items){
|
|
|
getActiveDetail({id}).then(res => {
|
|
|
- res.data.promotionQuestionnaireItems.forEach(item=>{
|
|
|
+ this.formData.activeDate = [res.data.startTime,res.data.endTime]
|
|
|
+ res.data.promotionQuestionnaireItems.forEach((item,index)=>{
|
|
|
item.answer = JSON.parse(item.answer)
|
|
|
if(items){
|
|
|
- items.forEach(it=>{
|
|
|
- item.answer.forEach(it1 => {
|
|
|
- JSON.parse(it.answer).forEach(it2 => {
|
|
|
- if(it1.option_value == it2.option_value && it2.active){
|
|
|
- it1.active = true;
|
|
|
- }else{
|
|
|
- it.active = false;
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
+ item.answer.forEach((it,ind) => {
|
|
|
+ let data = JSON.parse(items[index].answer)
|
|
|
+ if(data[ind]?.active){
|
|
|
+ it.active = true;
|
|
|
+ }else{
|
|
|
+ it.active = false;
|
|
|
+ }
|
|
|
+ if(items[index].type == 3){
|
|
|
+ item.inputValue = data[ind]?.option_value
|
|
|
+ }else if(item.type == 4 || item.type == 5){
|
|
|
+ item.inputValue = [{url: data[ind]?.option_value}]
|
|
|
+ }
|
|
|
})
|
|
|
}else{
|
|
|
- item.inputValue = '';
|
|
|
+ if(item.type == 4 || item.type == 5){
|
|
|
+ item.inputValue = []
|
|
|
+ }else{
|
|
|
+ item.inputValue = '';
|
|
|
+ }
|
|
|
item.answer.forEach(it => {
|
|
|
it.active = false;
|
|
|
})
|
|
|
@@ -294,6 +309,10 @@
|
|
|
if(this.activeItems[i].type == 3 && !this.activeItems[i].inputValue) {
|
|
|
return this.$message.warning(`请输入${this.activeItems[i].question}`)
|
|
|
}
|
|
|
+ // 图片视频
|
|
|
+ if((this.activeItems[i].type == 4 || this.activeItems[i].type == 5) && this.activeItems[i].inputValue.length==0) {
|
|
|
+ return this.$message.warning(`请上传${this.activeItems[i].question}`)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
// 生成题目提交信息
|
|
|
@@ -301,17 +320,23 @@
|
|
|
let activeItems = JSON.parse(JSON.stringify(this.activeItems));
|
|
|
for(let index = 0; index < activeItems.length; index++) {
|
|
|
// 单选题多选题
|
|
|
- if ((activeItems[index].type == 1 || activeItems[index].type == 2) && activeItems[index].answer.some(o => o.active)) {
|
|
|
+ if ((activeItems[index].type == 1 || activeItems[index].type == 2)) {
|
|
|
activeItems[index].answer = activeItems[index].answer.filter(o => o.active);
|
|
|
activeItems[index].answer = JSON.stringify(activeItems[index].answer);
|
|
|
items.push(activeItems[index]);
|
|
|
}
|
|
|
// 填写题
|
|
|
- if (activeItems[index].type == 3 && activeItems[index].inputValue) {
|
|
|
+ if (activeItems[index].type == 3) {
|
|
|
activeItems[index].answer[0].option_value = activeItems[index].inputValue;
|
|
|
activeItems[index].answer = JSON.stringify(activeItems[index].answer);
|
|
|
items.push(activeItems[index]);
|
|
|
}
|
|
|
+ // 图片视频
|
|
|
+ if (activeItems[index].type == 4 || activeItems[index].type == 5) {
|
|
|
+ activeItems[index].answer[0].option_value = activeItems[index].inputValue.length>0?activeItems[index].inputValue[0].url:'';
|
|
|
+ activeItems[index].answer = JSON.stringify(activeItems[index].answer);
|
|
|
+ items.push(activeItems[index]);
|
|
|
+ }
|
|
|
}
|
|
|
add({
|
|
|
promotionQuestionnaireId: this.formData.promotionActivityId,
|