Commit ac7eee4a authored by 黄奎's avatar 黄奎

页面修改

parent 18ce8843
......@@ -47,19 +47,14 @@
{{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>
<div class="InpDIV" v-html="item.Content"></div>
</td>
<td style="width:40px;text-align:center;">
<i class="iconfont icon-guanbi Tiku_DelIcon" @click="deleteOpion(0,index)"></i>
</td>
</tr>
<tfoot>
<tr>
<td colspan="3">
<a class="addTiMuList" style="margin-left:13px;" @click="addOption(0)">
<i class="iconfont icon-add"></i>添加更多
</a>
</td>
</tr>
</tfoot>
......@@ -71,19 +66,15 @@
{{item.Name}}
</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>
<div class="InpDIV" v-html="item.Content"></div>
</td>
<td style="width:40px;text-align:center;">
<i class="iconfont icon-guanbi Tiku_DelIcon" @click="deleteOpion(1,index)"></i>
</td>
</tr>
<tfoot>
<tr>
<td colspan="3">
<a class="addTiMuList" style="margin-left:13px;" @click="addOption(1)">
<i class="iconfont icon-add"></i>添加更多
</a>
</td>
</tr>
</tfoot>
......@@ -110,10 +101,6 @@
</div>
</template>
<script>
import {
getOptionList, //获取选择标签【A,B,C,D....】
} from '../../api/question/questionconfig'
import UeEditor from '../editor/UeEditor'
export default {
props: {
questionData: {
......@@ -129,92 +116,15 @@
data() {
return {
data: this.questionData,
config: {
initialFrameWidth: null,
initialFrameHeight: 80,
},
optionTitleList: [],
commonIndex: -1,
commonIndex2: -1
};
},
computed: {
},
created() {
this.initConfig();
},
methods: {
initConfig() {
this.optionTitleList = getOptionList();
},
//删除选项
deleteOpion(index, subIndex) {
this.$q.dialog({
title: '提示信息',
message: '是否确定删除?',
cancel: true,
persistent: true,
ok: "确定",
cancel: "取消",
}).onOk(() => {
//删除第一组是,也删除答案里面的
if (index == 0) {
this.data[2].splice(subIndex, 1);
}
this.data[index].splice(subIndex, 1);
//删除的第二组
if (index == 1) {
var temp1 = this.data[1];
this.data[2].forEach(item => {
var isExists = false;
if (temp1 && temp1.length > 0) {
temp1.forEach(subItem => {
if (subItem.Name == item.Content) {
isExists = true;
}
})
}
if (!isExists) {
item.Content = "";
}
})
}
this.commonIndex = -1;
this.commonIndex2 = -1;
this.calcOptionTitle();
}).onCancel(() => {
});
},
//新增选项
addOption(index) {
if (index == 0) {
this.data[2].push({
Name: "",
Content: "A",
});
}
this.data[index].push({
Name: "",
Content: "",
});
this.calcOptionTitle();
},
//重新计算选择Title[A,B,C,D....]
calcOptionTitle() {
if (this.data && this.data.length > 0) {
this.data.forEach((item, index) => {
item.forEach((subItem, subIndex) => {
if (index == 0 || index == 2) {
subItem.Name = subIndex + 1;
} else if (index == 1) {
subItem.Name = this.optionTitleList[subIndex];
}
})
})
}
},
//返回数据到父组件
returnDataToParent() {
this.getAnswer();
......@@ -234,15 +144,6 @@
this.setOption.Answer = answer;
}
},
//点击切换输入
changeEdit(index) {
this.commonIndex = index;
this.commonIndex2 = -1;
},
changeEdit2(index) {
this.commonIndex2 = index;
this.commonIndex = -1;
}
},
mounted() {},
watch: {
......@@ -254,5 +155,4 @@
},
}
};
</script>
</script>
\ No newline at end of file
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