Commit aadf1bd9 authored by zhengke's avatar zhengke

题了

parent 08570063
......@@ -69,13 +69,13 @@
>
<view
class="chooseNum"
:class="{ myAnswer: item2.myAnswer === item3.Name }"
@click="singerChange(index1, index2, index3)"
:class="{ myAnswer: item3.IsAnswer }"
@click="singerChange(item2,item3)"
>{{ item3.Name }}
</view>
<view
class="chooseName"
@click="singerChange(index1, index2, index3)"
@click="singerChange(item2,item3)"
v-html="item3.Content"
></view>
</view>
......@@ -86,15 +86,13 @@
>
<view
class="chooseNum"
:class="{
myAnswer: item2.myAnswer.find((e) => e == item3.Name),
}"
@click="multipleChange(index1, index2, index3)"
:class="{myAnswer: item3.IsAnswer}"
@click="multipleChange(item3)"
>{{ item3.Name }}
</view>
<view
class="chooseName"
@click="multipleChange(index1, index2, index3)"
@click="multipleChange(item3)"
v-html="item3.Content"
></view>
</view>
......@@ -190,6 +188,11 @@ export default {
data.current = props.startIndex;
data.ExamIndex = props.startIndex;
}
watch(data.data, (newVal, oldVal) => {
if(newVal){
context.emit("answerChange", newVal);
}
});
let methods = {
changeNumToHan,
jumpPage() {
......@@ -234,28 +237,30 @@ export default {
},
//----------------------------------------选题----------------------------------
// 单选or判断
singerChange(index1, index2, index3) {
data.data.DetailsList[index1].QuestionContentObj[index2].myAnswer =
data.data.DetailsList[index1].QuestionContentObj[index2].SubAnwser[
index3
].Name;
singerChange(item2,item3) {
item2.SubAnwser.forEach(x=>{
x.IsAnswer=false;
})
item3.IsAnswer=!item3.IsAnswer
},
// 多选
multipleChange(index1, index2, index3) {
let myAnswer = data.data.DetailsList[index1].QuestionContentObj[index2]
.myAnswer
? data.data.DetailsList[index1].QuestionContentObj[index2].myAnswer
: [];
let res =
data.data.DetailsList[index1].QuestionContentObj[index2].SubAnwser[
index3
].Name;
let find = myAnswer.indexOf(res);
if (find == -1) {
myAnswer.push(res);
} else {
myAnswer.splice(find, 1);
}
multipleChange(item) {
item.IsAnswer=!item.IsAnswer;
this.$forceUpdate();
// let myAnswer = data.data.DetailsList[index1].QuestionContentObj[index2]
// .myAnswer
// ? data.data.DetailsList[index1].QuestionContentObj[index2].myAnswer
// : [];
// let res =
// data.data.DetailsList[index1].QuestionContentObj[index2].SubAnwser[
// index3
// ].Name;
// let find = myAnswer.indexOf(res);
// if (find == -1) {
// myAnswer.push(res);
// } else {
// myAnswer.splice(find, 1);
// }
},
onchange(e) {
data.audioTime = "00:00";
......
......@@ -24,7 +24,7 @@
<swiper-item v-if="sortIndex != 1"></swiper-item>
<swiper-item
v-for="(item1, index1) in data.DetailsList"
:key="item1.id"
:key="index1"
>
<view class="item1">
<view class="flex flex_start_center">
......@@ -35,9 +35,9 @@
<textarea
type="text"
v-model="item1.Answer"
@input="sendData"
class="input textarea"
placeholder="请填写答案"
placeholder-style="textarea-placeholder"
:maxlength="-1"
/>
</view>
......@@ -75,6 +75,7 @@ export default {
props.paperData.DetailsList.forEach((item, index) => {
item.myAnswer = "";
});
let data = reactive({
data: props.paperData,
autoplay: false,
......@@ -98,7 +99,6 @@ export default {
uni.navigateBack();
},
onchange(e) {
context.emit("answerChange", data.data);
data.ExamIndex = e.detail.current;
if (data.ExamIndex === data.data.DetailsList.length + 1) {
console.log("进入");
......@@ -108,6 +108,9 @@ export default {
this.$emit("getBeforeTopic");
}
},
sendData(){
context.emit("answerChange", data.data);
}
};
onMounted(() => {
if (props.isLast) {
......
......@@ -76,6 +76,7 @@
:sortTotal="peaperDetail.Paper.GroupList.length"
@getBeforeTopic="getBeforeTopic()"
@getAfterTopic="getAfterTopic()"
@answerChange="getAnswerChange($event, index)"
v-if="item.QuestionTypeKey === 'listening' && index === changeIndex"
/>
<!-- 填空题 -->
......
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