wangguoyu 4 viikkoa sitten
vanhempi
commit
08be5b7cd9

+ 28 - 0
components/questionsChengji/danxuan.vue

@@ -11,6 +11,16 @@
 			<text class="option-change"  @click="onSelect(index)">{{item.number}}</text>
 			<rich-text :nodes="item.label" class="option-question"></rich-text>
 		</view>
+		
+		<view class="phone-question-answer-box">
+			<view class="phone-line-title">答案解析</view>
+			<view class="btdf-row">本题得分:<text>{{data.score}}</text>分</view>
+			<view class="zqda-row">正确答案:<text>{{data.result}}</text></view>
+			<view class="ndda-row">您的答案:<text>{{data.reply}}</text></view>
+			<view class="dajx-row">答案解析: 
+				<rich-text :nodes="data.answer"></rich-text>
+			</view>
+		</view>
 	</view>
 </template>
 
@@ -39,6 +49,10 @@
 
 	const data = reactive({
 		name: '', //题干数据
+		score: '', 
+		result: '', 
+		reply: '', 
+		answer: '', 
 		contents: [], // 选项数据
 	})
 
@@ -66,13 +80,27 @@
 
 	function formatData(val) {
 		if (val) {
+			console.log('val',val);
 			data.name = val.name;
+			data.answer = val.answer;
+			data.score = val.score;
+			if (val.reply && val.reply.trim() !== '') {
+			data.reply = getLetterByIndex(val.reply) ;
+			} else {
+				reply = '未答'
+			}
+			if (val.result) {
+				data.result =  getLetterByIndex(val.result);
+			} else {
+				result = '无答案'
+			}
 			data.contents = val.content.map((item, index) => {
 				return {
 					label: item,
 					number: getLetterByIndex(index)
 				}
 			})
+			console.log('data.contents',data.contents);
 		}
 	}
 

+ 36 - 0
components/questionsChengji/duoxuan.vue

@@ -10,6 +10,16 @@
 			<text class="option-change" @click="onSelect(index)">{{item.number}}</text>
 			<rich-text :nodes="item.label" class="option-question"></rich-text>
 		</view>
+		
+		<view class="phone-question-answer-box">
+			<view class="phone-line-title">答案解析</view>
+			<view class="btdf-row">本题得分:<text>{{data.score}}</text>分</view>
+			<view class="zqda-row">正确答案:<text>{{data.result}}</text></view>
+			<view class="ndda-row">您的答案:<text>{{data.reply}}</text></view>
+			<view class="dajx-row">答案解析: 
+				<rich-text :nodes="data.answer"></rich-text>
+			</view>
+		</view>
 	</view>
 </template>
 
@@ -39,6 +49,10 @@
 
 	const data = reactive({
 		name: '', //题干数据
+		score: '',
+		result: '', 
+		reply: '', 
+		answer: '', 
 		contents: [], // 选项数据
 	})
 
@@ -63,6 +77,28 @@
 	function formatData(val) {
 		if (val) {
 			data.name = val.name;
+			if (val.reply && val.reply.length) {
+				data.reply = val.reply.map(item => {
+					if (item.trim()) {
+						return getLetterByIndex(item.trim())
+					}
+				}).join(',')
+			} else {
+				reply = '未答'
+			}
+			if (val.result) {
+				data.result = val.result.map(item => {
+					if (item.trim()) {
+						return getLetterByIndex(item.trim())
+					}
+				}).join(',')
+			} else {
+				result = '无答案'
+			}
+			data.answer = val.answer;
+			data.score = val.score;
+			
+			
 			data.contents = val.content.map((item, index) => {
 				return {
 					label: item,

+ 50 - 2
components/questionsChengji/panduan.vue

@@ -16,10 +16,25 @@
 				<view>错误</view>
 			</label>
 		</radio-group>
+		
+		<view class="phone-question-answer-box">
+			<view class="phone-line-title">答案解析</view>
+			<view class="btdf-row">本题得分:<text>{{data.score}}</text>分</view>
+			<view class="zqda-row">正确答案:<text>{{data.result}}</text></view>
+			<view class="ndda-row">您的答案:<text>{{data.reply}}</text></view>
+			<view class="dajx-row">答案解析: 
+				<rich-text :nodes="data.answer"></rich-text>
+			</view>
+		</view>
 	</view>
 </template>
 
 <script setup>
+	import {
+		ref,
+		reactive,
+		watch
+	} from 'vue';
 	const props = defineProps({
 		question: {
 			type: Object,
@@ -29,8 +44,41 @@
 			default: false
 		}
 	})
-
-	function radioChange(e) {
+	const data = reactive({
+		name: '', //题干数据
+		score: '',
+		result: '', 
+		reply: '', 
+		answer: '', 
+	})
+	watch(() => props.question, (val) => formatData(val), {
+		immediate: true
+	})
+	
+	function formatData(val) {
+		
+		console.log('val',val);
+		
+		if (val) {
+			data.name = val.name;
+			if (val.reply === '') {
+				data.reply = '未答'
+			} else if (val.reply == 0) {
+				data.reply = '错误'
+			} else if (val.reply == 1) {
+				data.reply = '正确'
+			}
+			if (val.result == 0) {
+				data.result = '错误'
+			} else if (val.result == 1) {
+				data.result = '正确'
+			}
+			data.answer = val.answer;
+			data.score = val.score;
+		
+		}
+	}
+	function radioChange(e) {                                                                                                                              
 		if (props.showError) {
 			return;
 		}

+ 3 - 0
components/questionsChengji/yuedu.vue

@@ -68,6 +68,9 @@ import cacheManager from '../../utils/cacheManager';
 	const showTishi = ref(false);
 
 	watch(() => props.question, (question) => {
+		
+		
+	
 		const danxuanlist = question.danxuan.forEach(item => item.type = 'danxuan')
 		const duoxuanlist = question.duoxuan.forEach(item => item.type = 'duoxuan')
 		const panduanlist = question.panduan.forEach(item => item.type = 'panduan')

+ 2 - 1
pages/score/kaoshiChengjiInfo.vue

@@ -72,7 +72,7 @@
 		onLoad
 	} from "@dcloudio/uni-app";
 	import * as cjApi from "@/api/chengji.js"
-	import danxuan from "@/components/questionsChengji/yuedu.vue";
+	import danxuan from "@/components/questionsChengji/danxuan.vue";
 	import duoxuan from "@/components/questionsChengji/duoxuan.vue";
 	import tiankong from "@/components/questionsChengji/tiankong.vue";
 	import panduan from "@/components/questionsChengji/panduan.vue";
@@ -376,6 +376,7 @@
 			questionData.value.push(paragraph)
 
 			console.log(questionData.value)
+			console.log(paragraph)
 		}
 	}
 	// 切换阅读小题时更新当前试题解析