Commit 430c1ef5 authored by zhengke's avatar zhengke

修改

parent e3c3f71d
......@@ -21,8 +21,8 @@
<view class="num" v-html="item1.Title"></view>
</view>
<view v-for="(item2, index2) in item1.QuestionContentObj" :key="index2" style="border-bottom:1px solid #d1d1d1;">
<view v-for="(item3,index3) in item2.OptionList" :key="index3" class="flex item2 flex_start_center" @click="getAnswer(item3)">
<view class="chooseNum" :class="{'IsAnswer':item3.IsAnswer}">{{ item3.Name }}
<view v-for="(item3,index3) in item2.OptionList" :key="index3" class="flex item2 flex_start_center" @click="getAnswer(item2.OptionList,item3)">
<view class="chooseNum" :class="{'myAnswer':item3.IsAnswer}">{{ item3.Name }}
</view>
<view class="chooseName" v-html="item3.Content"></view>
</view>
......@@ -88,8 +88,12 @@
}
},
//点击
getAnswer(item){
console.log(item,'item');
getAnswer(allItem,item){
allItem.forEach(x=>{
x.IsAnswer=false;
})
item.IsAnswer = !item.IsAnswer;
this.$forceUpdate();
}
};
onMounted(() => {
......
......@@ -17,13 +17,30 @@
<swiper-item v-for="(item1, index1) in data.DetailsList" :key="item1.id">
<view class="item1">
<view class="flex flex_start_center">
<view>{{ index1 + 1 }}</view>
<view class="num" v-html="item1.Title"></view>
</view>
<view class="chooseName">
<textarea type="text" v-model="item1.myAnswer" class="input textarea" placeholder="请填写答案"
placeholder-style="textarea-placeholder" :maxlength="-1" />
<template v-if="item1.QuestionContentObj[1]&& item1.QuestionContentObj[1].length>0">
<view class="num">(1)</view>
<view class="num">-({{item1.QuestionContentObj[1].length}})题共用备选答案:</view>
</template>
</view>
<template v-if="item1.QuestionContentObj[0]&&item1.QuestionContentObj[0].length>0">
<view v-for="(item2, index2) in item1.QuestionContentObj[0]" :key="index2">
<view class="flex item2 flex_start_center">
<view class="num">{{item2.Name}}</view>
<view style="margin-left:5px;" class="chooseName" v-html="item2.Content"></view>
</view>
</view>
</template>
<template v-if="item1.QuestionContentObj[1]&&item1.QuestionContentObj[1].length>0">
<view v-for="(item3, index3) in item1.QuestionContentObj[1]" :key="index3">
<view class="flex item2 flex_start_center">
<view>{{index3+1}}</view>
<view v-html="item3.Content"></view>
</view>
<van-button type="primary" @click="alertMenu(item3)">弹出菜单</van-button>
{{item3.isShow}}
<van-action-sheet :value="item3.isShow" :actions="item1.QuestionContentObj[0]" @select="onSelect"/>
</view>
</template>
</view>
</swiper-item>
<swiper-item v-if="sortIndex != sortTotal"></swiper-item>
......@@ -56,9 +73,12 @@
},
setup(props, context) {
let {ctx} = getCurrentInstance();
props.paperData.DetailsList.forEach((item, index) => {
item.myAnswer = "";
});
if(props.paperData.DetailsList&&props.paperData.DetailsList.length>0){
props.paperData.DetailsList[0].QuestionContentObj[1].forEach((item, index) => {
item.isShow=false;
});
}
console.log(props.paperData,'paperData');
let data = reactive({
data: props.paperData,
autoplay: false,
......@@ -87,7 +107,20 @@
if (e.detail.current == 0) {
this.$emit('getBeforeTopic');
}
}
},
alertMenu(item){
item.isShow=true;
this.$forceUpdate();
console.log(item,'item');
},
onSelect(item){
console.log(item);
// this.show = false;
// this.$toast({
// message:item.name,
// duration:500
// })
},
};
onMounted(() => {
if (props.isLast) {
......
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