Commit 4d92dbb8 authored by 黄奎's avatar 黄奎

页面修改

parent e5d2cc95
......@@ -20,22 +20,9 @@
{{item.Name}}
</td>
<td>
<div class="InpDIV" v-html="item.Content" v-if="commonIndex!=index" @click="changeEdit(index)"></div>
<UeEditor v-model="item.Content" :config="config" v-else></UeEditor>
</td>
<td style="width:40px;text-align:center;">
<i v-if="index>0" class="iconfont icon-guanbi Tiku_DelIcon" @click="deleteOpion(index)"></i>
<div class="InpDIV" v-html="item.Content"></div>
</td>
</tr>
<tfoot>
<tr>
<td colspan="3">
<a class="addTiMuList" style="margin-left:13px;" @click="addOption()">
<i class="iconfont icon-add"></i>添加选项
</a>
</td>
</tr>
</tfoot>
</table>
<table v-if="data&&data.length>0" class="common_TiTable">
<tr v-for="(item,index) in data[1]">
......@@ -43,46 +30,24 @@
{{index+1}}
</td>
<td>
<div class="InpDIV" v-html="item.Content" v-if="commonIndex2!=index" @click="changeEdit2(index)"></div>
<UeEditor v-model="item.Content" :config="config" v-else></UeEditor>
</td>
<td style="width:40px;text-align:center;">
<i v-if="index>0" class="iconfont icon-guanbi Tiku_DelIcon" @click="deleteQuestion(index)"></i>
<div class="InpDIV" v-html="item.Content"></div>
</td>
</tr>
<tfoot>
<tr>
<td colspan="3">
<a class="addTiMuList" style="margin-left:13px;" @click="addQuestion()">
<i class="iconfont icon-add"></i>添加题干
</a>
</td>
</tr>
</tfoot>
</table>
<div class="B-info">答案:</div>
<table v-if="data&&data.length>0" style="margin-bottom:20px;">
<tr v-for="(item,index) in data[1]">
<td style="padding:12px 0 0 13px;">
<td>
{{index+1}}
</td>
<td>
<select v-model="item.Name" class="selectBox" style="margin:10px 0 0 0;outline:none;">
<template v-for="(cItem,cIndex) in data[0]">
<option :key="cIndex" :label="cItem.Name" :value="cItem.Name">
</option>
</template>
</select>
{{item.Name}}
</td>
</tr>
</table>
</div>
</template>
<script>
import {
getOptionList, //获取选择标签【A,B,C,D....】
} from '../../api/question/questionconfig'
import UeEditor from '../editor/UeEditor'
export default {
props: {
questionData: {
......@@ -93,95 +58,17 @@
}
},
components: {
UeEditor
},
data() {
return {
data: this.questionData,
config: {
initialFrameWidth: null,
initialFrameHeight: 80,
},
optionTitleList: [],
commonIndex: -1,
commonIndex2: -2
};
},
created() {
this.initConfig();
},
methods: {
initConfig() {
this.optionTitleList = getOptionList();
},
//删除选项
deleteOpion(index) {
this.$q.dialog({
title: '提示信息',
message: '是否确定删除?',
cancel: true,
persistent: true,
ok: "确定",
cancel: "取消",
}).onOk(() => {
this.data[0].splice(index, 1);
this.commonIndex = -1;
this.calcOptionTitle();
}).onCancel(() => {
});
},
//新增选项
addOption() {
if (this.data.length < 26) {
this.data[0].push({
Name: "",
Content: "",
});
this.calcOptionTitle();
} else {
this.$q.notify({
type: 'warning',
position: 'center',
timeout: 1500,
message: `最多只能添加26个选项`
})
return
}
},
//删除题干
deleteQuestion(index) {
this.$q.dialog({
title: '提示信息',
message: '是否确定删除?',
cancel: true,
persistent: true,
ok: "确定",
cancel: "取消",
}).onOk(() => {
this.data[1].splice(index, 1);
this.commonIndex2 = -1;
this.calcOptionTitle();
}).onCancel(() => {
});
},
//添加题干
addQuestion() {
this.data[1].push({
Name: "",
Content: "",
});
this.calcOptionTitle();
},
//重新计算选择Title[A,B,C,D....]
calcOptionTitle() {
if (this.data && this.data.length > 0) {
this.data[0].forEach((item, index) => {
item.Name = this.optionTitleList[index];
})
}
},
//返回数据到父组件
returnDataToParent() {
this.$emit('getChild', this.data);
......@@ -199,14 +86,6 @@
this.setOption.Answer = answer;
}
},
changeEdit(index) {
this.commonIndex = index;
this.commonIndex2 = -1;
},
changeEdit2(index) {
this.commonIndex = -1;
this.commonIndex2 = index;
}
},
mounted() {
......@@ -221,5 +100,4 @@
},
}
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment