This commit is contained in:
杨航
2025-09-08 09:24:11 +08:00
parent 846b9a2238
commit 4572d6856c
3 changed files with 1192 additions and 1234 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ VITE_APP_BASE_H5_API_Url = 'http://25.18.122.65:7001'
# 任东 # 任东
# VITE_APP_BASE_H5_API_Url_TRAAPP = 'http://25.64.16.130:9601' # VITE_APP_BASE_H5_API_Url_TRAAPP = 'http://25.64.16.130:9601'
# VITE_APP_BASE_H5_API_Url_TRASTUDY = 'http://25.64.16.130:9602' VITE_APP_BASE_H5_API_Url_TRASTUDY = 'http://25.64.16.130:9602'
# VITE_APP_BASE_H5_API_Url_TRAEXAM = 'http://25.64.16.140:9604' # VITE_APP_BASE_H5_API_Url_TRAEXAM = 'http://25.64.16.140:9604'
# 张建成 # 张建成
+279 -271
View File
@@ -1,299 +1,307 @@
<template> <template>
<view class="answer-content" v-if="props.isLoading"> <view class="answer-content" v-if="props.isLoading">
<view class="talking-cont"> <view class="talking-cont">
<CommonLoading color="#06f" /> <CommonLoading color="#06f" />
</view> </view>
</view>
</view> <view class="answer-content" v-else>
<view class="answer-content" v-else> <view class="talking-cont">
<view class="talking-cont"> <MarkdownPreview :mdString="mdText" />
<MarkdownPreview :mdString="mdText" /> </view>
</view> <view class="talking-link">
<view class="talking-link"> <view :class="['link-cont', activeNames.indexOf(1) >= 0 ? 'is-active' : '']" v-if="fileList.length > 0">
<view :class="['link-cont', activeNames.indexOf(1) >= 0 ? 'is-active' : '']" v-if="fileList.length > 0"> <view class="link-info" @click="changeActive(1)">
<view class="link-info" @click="changeActive(1)"> <view class="info-text"> 引用知识库{{ fileList.length }}篇相关资料 </view>
<view class="info-text"> </view>
引用知识库{{fileList.length}}篇相关资料 <view class="link-items">
</view> <view class="link-item" v-for="(item, index) in fileList" @click.stop="previewFile(item)">{{ index + 1 }}. {{ item.docName }}</view>
</view> </view>
<view class="link-items"> </view>
<view class="link-item" v-for="(item, index) in fileList" @click.stop="previewFile(item)">{{index+1}}. {{item.docName}}</view> <view v-else-if="!props.isAnswering" class="link-cont-desc">本次回答参考资料来源于网络</view>
</view> <view :class="['link-cont', activeNames.indexOf(2) >= 0 ? 'is-active' : '']" v-if="crsList.length > 0">
</view> <view class="link-info" @click="changeActive(2)">
<view v-else-if="!props.isAnswering" class="link-cont-desc">本次回答参考资料来源于网络</view> <view class="info-text"> 发现{{ crsList.length }}个关联课程 </view>
<view :class="['link-cont', activeNames.indexOf(2) >= 0 ? 'is-active' : '']" v-if="crsList.length > 0"> </view>
<view class="link-info" @click="changeActive(2)"> <view class="link-items">
<view class="info-text"> <view class="link-item" v-for="(item, index) in crsList" @click.stop="previewCrs(item)">{{ index + 1 }}. {{ item.crsName }}</view>
发现{{crsList.length}}个关联课程 </view>
</view> </view>
</view> </view>
<view class="link-items"> <view class="btns-cont" v-if="!props.isLoading">
<view class="link-item" v-for="(item, index) in crsList" @click.stop="previewCrs(item)">{{index+1}}. {{item.crsName}}</view> <view class="replay-btn" @click="reAnswer" v-if="!props.dataInfo.isHistory">
</view> <image class="icon" src="@/static/images/dialog/answer-restart1.png" style="width: 100%; height: 100%"></image>
</view> </view>
</view> <view class="replay-btn" @click="stopAnswer" v-if="props.isAnswering && props.isLast">
<view class="btns-cont" v-if="!props.isLoading"> <image class="icon" src="@/static/images/dialog/answer-stop1.png" style="width: 100%; height: 100%"></image>
<view class="replay-btn" @click="reAnswer"> </view>
<image class="icon" src="@/static/images/dialog/answer-restart1.png" style="width: 100%;height: 100%;"></image> <view class="replay-btn" @click="zanAnswer">
</view> <image class="icon" v-if="props.dataInfo.likeStat !== 'Y'" src="@/static/images/dialog/answer-zan1.png" style="width: 100%; height: 100%"></image>
<view class="replay-btn" @click="stopAnswer" v-if="props.isAnswering && props.isLast"> <image class="icon" v-else src="@/static/images/dialog/answer-yizan1.png" style="width: 100%; height: 100%"></image>
<image class="icon" src="@/static/images/dialog/answer-stop1.png" style="width: 100%;height: 100%;"></image> </view>
</view> <view class="play-btn" @click="feedbackAnswer">
<view class="replay-btn" @click="zanAnswer"> <image class="icon" v-if="props.dataInfo.downvoteStat !== 'Y'" src="@/static/images/dialog/answer-fankui1.png" style="width: 100%; height: 100%"></image>
<image class="icon" v-if="props.dataInfo.likeStat !== 'Y'" src="@/static/images/dialog/answer-zan1.png" style="width: 100%;height: 100%;"></image> <image class="icon" v-else src="@/static/images/dialog/answer-yifankui1.png" style="width: 100%; height: 100%"></image>
<image class="icon" v-else src="@/static/images/dialog/answer-yizan1.png" style="width: 100%;height: 100%;"></image> </view>
</view> </view>
<view class="play-btn" @click="feedbackAnswer"> </view>
<image class="icon" v-if="props.dataInfo.downvoteStat !== 'Y'" src="@/static/images/dialog/answer-fankui1.png" style="width: 100%;height: 100%;"></image>
<image class="icon" v-else src="@/static/images/dialog/answer-yifankui1.png" style="width: 100%;height: 100%;"></image>
</view>
</view>
</view>
</template> </template>
<script setup> <script setup>
import { import { onMounted, computed, ref, watch } from 'vue'
onMounted, import MarkdownPreview from '@/components/markdown-preview/markdown-preview.vue'
computed, import common from '@/common/common'
ref,
watch
} from 'vue'
import MarkdownPreview from '@/components/markdown-preview/markdown-preview.vue';
import common from '@/common/common';
const emit = defineEmits(['handleEvents']) const emit = defineEmits(['handleEvents'])
const props = defineProps({ const props = defineProps({
dataInfo: { dataInfo: {
default: () => ({}), default: () => ({}),
type: Object type: Object
}, },
isLoading: { isLoading: {
default: false, default: false,
type: Boolean type: Boolean
}, },
isAnswering: { isAnswering: {
default: false, default: false,
type: Boolean type: Boolean
}, },
isLast: { isLast: {
default: false, default: false,
type: Boolean type: Boolean
}, }
}) })
watch(() => props.dataInfo, () => {}, { watch(
deep: true, () => props.dataInfo,
immediate: true () => {},
}) {
watch(() => props.isLoading, () => {}, { deep: true,
deep: true, immediate: true
immediate: true }
}) )
const mdText = computed(() => props.dataInfo?.talkingText) watch(
const fileList = computed(() => props.dataInfo?.talkingFiles || []) () => props.isLoading,
const crsList = computed(()=> props.dataInfo?.talkingCrsList || []) () => {},
const activeNames = ref([1, 2]) {
deep: true,
immediate: true
}
)
const mdText = computed(() => {
//#ifndef APP-PLUS
// h5 假数据
let _text = (props.dataInfo?.talkingText|| '').replace(/\\n/g, `\n`);
return _text
// #endif
//#ifdef APP-PLUS
return (props.dataInfo?.talkingText|| '')
// #endif
})
const fileList = computed(() => props.dataInfo?.talkingFiles || [])
const crsList = computed(() => props.dataInfo?.talkingCrsList || [])
const activeNames = ref([1, 2])
const changeActive = (val) => { const changeActive = val => {
if (activeNames.value.indexOf(val) >= 0) { if (activeNames.value.indexOf(val) >= 0) {
activeNames.value = activeNames.value.filter(t => t !== val) activeNames.value = activeNames.value.filter(t => t !== val)
} else { } else {
activeNames.value.push(val) activeNames.value.push(val)
} }
} }
const reAnswer = () => { const reAnswer = () => {
emit('handleEvents', 'reAnswer') emit('handleEvents', 'reAnswer')
} }
const stopAnswer = () => { const stopAnswer = () => {
emit('handleEvents', 'stop') emit('handleEvents', 'stop')
} }
const zanAnswer = () => { const zanAnswer = () => {
emit('handleEvents', 'great') emit('handleEvents', 'great')
} }
const feedbackAnswer = ()=>{ const feedbackAnswer = () => {
emit('handleEvents', 'feedback') emit('handleEvents', 'feedback')
} }
const previewFile = (item) => { const previewFile = item => {
emit('handleEvents', 'preview', item) emit('handleEvents', 'preview', item)
} }
const previewCrs = (item) => { const previewCrs = item => {
common.navigateTo('/pages/courseDetail/index?crsId=' + item.crsId) common.navigateTo('/pages/courseDetail/index?crsId=' + item.crsId)
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.answer-content { .answer-content {
background-color: #f5f5f5; background-color: #f5f5f5;
padding: 20rpx; padding: 20rpx;
border-radius: 15rpx; border-radius: 15rpx;
padding-bottom: 10rpx; padding-bottom: 10rpx;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
float: left; float: left;
width: 100%; width: 100%;
min-height: 80rpx; min-height: 80rpx;
.talking-cont { .talking-cont {
padding-bottom: 20rpx; padding-bottom: 20rpx;
} }
.btns-cont { .btns-cont {
overflow: hidden; overflow: hidden;
border-top: 3rpx solid #eee; border-top: 3rpx solid #eee;
padding-bottom: 10rpx; padding-bottom: 10rpx;
.replay-btn { .replay-btn {
float: left; float: left;
width: 46rpx; width: 46rpx;
height: 46rpx; height: 46rpx;
overflow: hidden; overflow: hidden;
margin-right: 20rpx; margin-right: 20rpx;
margin-top: 20rpx; margin-top: 20rpx;
} }
.play-btn { .play-btn {
float: left; float: left;
width: 46rpx; width: 46rpx;
height: 46rpx; height: 46rpx;
overflow: hidden; overflow: hidden;
margin-right: 20rpx; margin-right: 20rpx;
margin-top: 20rpx; margin-top: 20rpx;
} }
.next-learn-btn { .next-learn-btn {
float: left; float: left;
padding: 0 60rpx 0 20rpx; padding: 0 60rpx 0 20rpx;
height: 62rpx; height: 62rpx;
line-height: 62rpx; line-height: 62rpx;
font-size: 30rpx; font-size: 30rpx;
background-color: #06f; background-color: #06f;
color: #fff; color: #fff;
border-radius: 8rpx; border-radius: 8rpx;
margin-top: 16rpx; margin-top: 16rpx;
margin-right: 16rpx; margin-right: 16rpx;
position: relative; position: relative;
&.replay-study-btn { &.replay-study-btn {
float: right; float: right;
} }
&.restart { &.restart {
background-color: #eaf2ff; background-color: #eaf2ff;
color: #06f; color: #06f;
} }
.icon-iamge { .icon-iamge {
width: 25rpx; width: 25rpx;
height: 25rpx; height: 25rpx;
position: absolute; position: absolute;
right: 20rpx; right: 20rpx;
top: 50%; top: 50%;
margin-top: -12rpx; margin-top: -12rpx;
} }
} }
.replay-learn-btn { .replay-learn-btn {
float: left; float: left;
padding: 0 60rpx 0 20rpx; padding: 0 60rpx 0 20rpx;
height: 62rpx; height: 62rpx;
line-height: 62rpx; line-height: 62rpx;
font-size: 30rpx; font-size: 30rpx;
color: #06f; color: #06f;
background-color: #eaf2ff; background-color: #eaf2ff;
border-radius: 8rpx; border-radius: 8rpx;
margin-top: 16rpx; margin-top: 16rpx;
margin-right: 16rpx; margin-right: 16rpx;
position: relative; position: relative;
.icon-iamge { .icon-iamge {
width: 25rpx; width: 25rpx;
height: 25rpx; height: 25rpx;
position: absolute; position: absolute;
right: 20rpx; right: 20rpx;
top: 50%; top: 50%;
margin-top: -12rpx; margin-top: -12rpx;
} }
} }
.next-btn { .next-btn {
float: right; float: right;
padding: 0 60rpx 0 20rpx; padding: 0 60rpx 0 20rpx;
height: 62rpx; height: 62rpx;
line-height: 62rpx; line-height: 62rpx;
font-size: 30rpx; font-size: 30rpx;
background-color: #06f; background-color: #06f;
color: #fff; color: #fff;
border-radius: 8rpx; border-radius: 8rpx;
margin-top: 16rpx; margin-top: 16rpx;
position: relative; position: relative;
.icon-iamge { .icon-iamge {
width: 25rpx; width: 25rpx;
height: 25rpx; height: 25rpx;
position: absolute; position: absolute;
right: 20rpx; right: 20rpx;
top: 50%; top: 50%;
margin-top: -12rpx; margin-top: -12rpx;
} }
} }
} }
.link-cont-desc{ .link-cont-desc {
margin-bottom: 12rpx; margin-bottom: 12rpx;
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
} }
.link-cont { .link-cont {
margin-bottom: 12rpx; margin-bottom: 12rpx;
font-size: 28rpx; font-size: 28rpx;
.link-info { .link-info {
height: 50rpx; height: 50rpx;
line-height: 50rpx; line-height: 50rpx;
overflow: hidden; overflow: hidden;
margin-bottom: 12rpx; margin-bottom: 12rpx;
.info-text { .info-text {
float: left; float: left;
padding-right: 20rpx; padding-right: 20rpx;
} }
&::after { &::after {
transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out;
content: ''; content: '';
display: block; display: block;
float: left; float: left;
position: relative; position: relative;
top: 12rpx; top: 12rpx;
width: 12rpx; width: 12rpx;
height: 12rpx; height: 12rpx;
border-right: 4rpx solid #333; border-right: 4rpx solid #333;
border-bottom: 4rpx solid #333; border-bottom: 4rpx solid #333;
transform: rotate(135deg); transform: rotate(135deg);
} }
} }
&.is-active { &.is-active {
.link-info { .link-info {
&::after { &::after {
top: 18rpx; top: 18rpx;
transform: rotate(45deg); transform: rotate(45deg);
} }
} }
.link-items { .link-items {
max-height: 600rpx; max-height: 600rpx;
} }
} }
.link-items { .link-items {
max-height: 0rpx; max-height: 0rpx;
overflow: hidden; overflow: hidden;
transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out;
.link-item { .link-item {
line-height: 48rpx; line-height: 48rpx;
color: #06f; color: #06f;
} }
} }
} }
} }
</style> </style>
+912 -962
View File
File diff suppressed because it is too large Load Diff