Commit aadf1bd9 authored by zhengke's avatar zhengke

题了

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