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

页面修改

parent e5d2cc95
...@@ -20,22 +20,9 @@ ...@@ -20,22 +20,9 @@
{{item.Name}} {{item.Name}}
</td> </td>
<td> <td>
<div class="InpDIV" v-html="item.Content" v-if="commonIndex!=index" @click="changeEdit(index)"></div> <div class="InpDIV" v-html="item.Content"></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>
</td> </td>
</tr> </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>
<table v-if="data&&data.length>0" class="common_TiTable"> <table v-if="data&&data.length>0" class="common_TiTable">
<tr v-for="(item,index) in data[1]"> <tr v-for="(item,index) in data[1]">
...@@ -43,46 +30,24 @@ ...@@ -43,46 +30,24 @@
{{index+1}} {{index+1}}
</td> </td>
<td> <td>
<div class="InpDIV" v-html="item.Content" v-if="commonIndex2!=index" @click="changeEdit2(index)"></div> <div class="InpDIV" v-html="item.Content"></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>
</td> </td>
</tr> </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> </table>
<div class="B-info">答案:</div> <div class="B-info">答案:</div>
<table v-if="data&&data.length>0" style="margin-bottom:20px;"> <table v-if="data&&data.length>0" style="margin-bottom:20px;">
<tr v-for="(item,index) in data[1]"> <tr v-for="(item,index) in data[1]">
<td style="padding:12px 0 0 13px;"> <td>
{{index+1}} {{index+1}}
</td> </td>
<td> <td>
<select v-model="item.Name" class="selectBox" style="margin:10px 0 0 0;outline:none;"> {{item.Name}}
<template v-for="(cItem,cIndex) in data[0]">
<option :key="cIndex" :label="cItem.Name" :value="cItem.Name">
</option>
</template>
</select>
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
</template> </template>
<script> <script>
import {
getOptionList, //获取选择标签【A,B,C,D....】
} from '../../api/question/questionconfig'
import UeEditor from '../editor/UeEditor'
export default { export default {
props: { props: {
questionData: { questionData: {
...@@ -93,95 +58,17 @@ ...@@ -93,95 +58,17 @@
} }
}, },
components: { components: {
UeEditor
}, },
data() { data() {
return { return {
data: this.questionData, data: this.questionData,
config: {
initialFrameWidth: null,
initialFrameHeight: 80,
},
optionTitleList: [],
commonIndex: -1,
commonIndex2: -2
}; };
}, },
created() { created() {
this.initConfig();
}, },
methods: { 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() { returnDataToParent() {
this.$emit('getChild', this.data); this.$emit('getChild', this.data);
...@@ -199,14 +86,6 @@ ...@@ -199,14 +86,6 @@
this.setOption.Answer = answer; this.setOption.Answer = answer;
} }
}, },
changeEdit(index) {
this.commonIndex = index;
this.commonIndex2 = -1;
},
changeEdit2(index) {
this.commonIndex = -1;
this.commonIndex2 = index;
}
}, },
mounted() { mounted() {
...@@ -221,5 +100,4 @@ ...@@ -221,5 +100,4 @@
}, },
} }
}; };
</script> </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