Commit ac7eee4a authored by 黄奎's avatar 黄奎

页面修改

parent 18ce8843
...@@ -47,19 +47,14 @@ ...@@ -47,19 +47,14 @@
{{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>
<td style="width:40px;text-align:center;"> <td style="width:40px;text-align:center;">
<i class="iconfont icon-guanbi Tiku_DelIcon" @click="deleteOpion(0,index)"></i>
</td> </td>
</tr> </tr>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="3"> <td colspan="3">
<a class="addTiMuList" style="margin-left:13px;" @click="addOption(0)">
<i class="iconfont icon-add"></i>添加更多
</a>
</td> </td>
</tr> </tr>
</tfoot> </tfoot>
...@@ -71,19 +66,15 @@ ...@@ -71,19 +66,15 @@
{{item.Name}} {{item.Name}}
</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>
<td style="width:40px;text-align:center;"> <td style="width:40px;text-align:center;">
<i class="iconfont icon-guanbi Tiku_DelIcon" @click="deleteOpion(1,index)"></i>
</td> </td>
</tr> </tr>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="3"> <td colspan="3">
<a class="addTiMuList" style="margin-left:13px;" @click="addOption(1)">
<i class="iconfont icon-add"></i>添加更多
</a>
</td> </td>
</tr> </tr>
</tfoot> </tfoot>
...@@ -110,10 +101,6 @@ ...@@ -110,10 +101,6 @@
</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: {
...@@ -129,92 +116,15 @@ ...@@ -129,92 +116,15 @@
data() { data() {
return { return {
data: this.questionData, data: this.questionData,
config: {
initialFrameWidth: null,
initialFrameHeight: 80,
},
optionTitleList: [],
commonIndex: -1,
commonIndex2: -1
}; };
}, },
computed: { computed: {
}, },
created() { created() {
this.initConfig();
}, },
methods: { 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() { returnDataToParent() {
this.getAnswer(); this.getAnswer();
...@@ -234,15 +144,6 @@ ...@@ -234,15 +144,6 @@
this.setOption.Answer = answer; this.setOption.Answer = answer;
} }
}, },
//点击切换输入
changeEdit(index) {
this.commonIndex = index;
this.commonIndex2 = -1;
},
changeEdit2(index) {
this.commonIndex2 = index;
this.commonIndex = -1;
}
}, },
mounted() {}, mounted() {},
watch: { watch: {
...@@ -254,5 +155,4 @@ ...@@ -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