Files
tra-app/src/components/examination/characters-subject.vue
T
2025-08-21 08:46:43 +08:00

188 lines
3.9 KiB
Vue

<template>
<view class="item">
<view class="top">
<view class="type">
{{ subject_type_text }}
</view>
<view class="score">5</view>
<view class="fl1"></view>
<view class="right">
<view class="mark_and_feedback_div">
<image
:src="markIcon(props.item.mark ? '#0066FF' : '#ABABAB')"
class="img"
@click="mark_click()"
></image>
<image :src="feedbackIcon()" class="img" @click="feedback_click()"></image>
</view>
<!-- <view class="right_text">展开</view>
<uv-icon class="arrow-icon" name="arrow-right"></uv-icon> -->
</view>
</view>
<view class="question_text">
{{ subject_data.qnsContent }}
</view>
<view class="option_div">
<questionVue @changePlay="changePlay" :dataInfo="talkingInfo" :activeVoiceId="questionValue"></questionVue>
</view>
</view>
</template>
<script setup>
import { ref, reactive, onMounted, nextTick, computed, toRaw, watch } from 'vue';
import questionVue from './question.vue';
import radioSubjectItem from './radio-subject-item.vue';
import { markIcon, feedbackIcon } from '@/common/imgSvg';
import { SUBJECT_TYPE } from '@/enum.js';
const questionValue = ref('');
const props = defineProps({
item: {
type: Object,
required: true
},
mode: {
type: String,
required: true
},
activeVoiceId: {
type: String,
required: true
},
voicePathValue: {
type: String,
required: true
}
});
const emit = defineEmits(['subject_click']);
const talkingInfo = ref({
id: '3',
intrctWay: '02',
intrctContent: '中的i id一二三。',
talkingText: '中的i id一二三。',
talkingVoice: ''
});
watch(
() => props.voicePathValue,
(val) => {
if (val) {
talkingInfo.value = {
id: '3',
intrctWay: '02',
intrctContent: '中的i id一二三。',
talkingText: '中的i id一二三。',
talkingVoice: val
};
}
}
);
const feedback_click = () => {
emit('subject_click', 'feedback', props.item);
};
const mark_click = () => {
emit('subject_click', 'mark', props.item);
};
const customStyle = {
borderRadius: '16rpx',
width: '292rpx',
backgroundColor: '#0066FF',
border: '1rpx solid rgb(12, 123, 245)'
};
const subject_data = reactive({
qnsId: '',
qnsContent: '',
qnsTyp: ''
});
Object.assign(subject_data, {
qnsId: props.item.qnsId,
qnsContent: props.item.qnsContent,
qnsTyp: props.item.qnsTyp
});
// 题类型
const subject_type_text = computed(() => SUBJECT_TYPE.find((res) => subject_data.qnsTyp === res.value)?.label || '');
const changePlay = (id) => {
console.log('changePlay');
questionValue.value = id;
// emit('handleEvents', 'changePlay', props.talkingInfo, id)
};
</script>
<style scoped lang="scss">
.mark_and_feedback_div {
display: flex;
height: 100%;
justify-content: end;
align-items: center;
.img {
width: 38rpx;
height: 38rpx;
margin-left: 4rpx;
padding: 4rpx;
}
}
.option_div {
padding-top: 46rpx;
}
.item {
// height: 170rpx;
overflow: hidden;
display: flex;
flex-direction: column;
padding-bottom: 40rpx;
.top {
display: flex;
align-items: center;
.type {
width: 108rpx;
height: 46rpx;
background: #267eff;
border-radius: 8rpx;
font-family: PingFangSC;
font-weight: 500;
font-size: 25rpx;
color: #ffffff;
text-align: center;
line-height: 46rpx;
}
.score {
margin-left: 24rpx;
font-family: ArialMT;
font-size: 30rpx;
color: #333333;
text-align: left;
}
.right {
display: flex;
align-items: center;
.right_text {
font-family: PingFangSC;
font-weight: 600;
font-size: 28rpx;
color: #333;
line-height: 40rpx;
text-align: left;
font-style: normal;
}
}
}
.question_text {
font-family: PingFangSC;
font-weight: 500;
font-size: 30rpx;
color: #333333;
line-height: 48rpx;
text-align: left;
font-style: normal;
margin-top: 20rpx;
}
}
</style>