代码调整
This commit is contained in:
parent
ad5c4b78d4
commit
fb0b52aa60
@ -4,6 +4,7 @@
|
||||
<div v-for="(el,i) in optionList" :key="i" class="option__item">
|
||||
<div> 选项-{{ $asc2chart(65+i) }} </div>
|
||||
<item-rich v-model="el.content" :remove="remove" @modify="doModify(el)" @remove="doRemove(i)" />
|
||||
<span v-if="!el.content" class="error">选项不能为空</span>
|
||||
</div>
|
||||
<el-button v-if="add" class="item__button" type="primary" size="mini" icon="el-icon-plus" @click="doAppend" />
|
||||
</template>
|
||||
@ -57,6 +58,19 @@ export default {
|
||||
.option {
|
||||
&__item {
|
||||
margin-bottom: 10px;
|
||||
position: relative;
|
||||
.error {
|
||||
color: #F56C6C;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
padding-top: 4px;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
.item__button {
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -67,9 +67,19 @@ export default {
|
||||
tagsChange(list) {
|
||||
this.tagsArr = list;
|
||||
},
|
||||
hasNullOption() { // 有空选项
|
||||
const s = this.formModel.optionList.find(item => {
|
||||
return item.content == '';
|
||||
});
|
||||
return s;
|
||||
},
|
||||
create() {
|
||||
this.$refs.info.validate().then(valid => {
|
||||
if (valid) {
|
||||
if (this.hasNullOption()) {
|
||||
this.$message.warning('选项不能为空!');
|
||||
return;
|
||||
}
|
||||
// this.formModel.companyId = parseInt(this.companyId);
|
||||
this.formModel.tags = this.tagsArr.join(',');
|
||||
createQuestion(this.formModel).then(resp => {
|
||||
|
@ -83,8 +83,18 @@ export default {
|
||||
doModify(node) {
|
||||
this.$refs.rich.doShow(node);
|
||||
},
|
||||
hasNullOption() { // 有空选项
|
||||
const s = this.formModel.optionList.find(item => {
|
||||
return item.content == '';
|
||||
});
|
||||
return s;
|
||||
},
|
||||
update() {
|
||||
this.$refs.info.validate().then(valid => {
|
||||
if (this.hasNullOption()) {
|
||||
this.$message.warning('选项不能为空!');
|
||||
return;
|
||||
}
|
||||
if (this.$route.query.draft && valid) {
|
||||
this.$store.state.race.preTheoryData[this.questionId] = this.formModel;
|
||||
this.doBack();
|
||||
|
Loading…
Reference in New Issue
Block a user