From 153a5611d69ef50fbdf3f36533579fe78e483eef Mon Sep 17 00:00:00 2001 From: WX0lxh <2062408239@qq.com> Date: Tue, 3 Mar 2026 17:32:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packageB/train/video/videoDetail.vue | 51 ++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/packageB/train/video/videoDetail.vue b/packageB/train/video/videoDetail.vue index 85b6b9a..d7ba2f1 100644 --- a/packageB/train/video/videoDetail.vue +++ b/packageB/train/video/videoDetail.vue @@ -31,17 +31,22 @@ - + 分类: - - {{getCategoryLabelByValue(videoInfo.category)}} + + {{getCategoryLabelByValue(videoInfo.category,IndustrialData)}}/ + {{getCategoryLabelByValue(videoInfo.category2,domainData)}}/ + {{getCategoryLabelByValue(videoInfo.category3,occupationalData)}} + + + @@ -181,6 +186,9 @@ const params = reactive({ videoId: '', userId: '' }) +const IndustrialData=ref([]) +const domainData=ref([]) +const occupationalData=ref([]) // 监听 initialTime 变化,确保设置完成后再渲染 watch(initialTime, (newVal) => { if (newVal >= 0 && videoInfo.value && videoInfo.value.cover) { @@ -205,6 +213,7 @@ onLoad((options) => { pageEnterTime.value = Date.now() // 记录毫秒时间戳 videoId.value=options.id getDictionary() + getSearchType("-1",1) }); // onHide(() => { // updateVideoInfo() // 用缓存值,不要调 getCurrentTime @@ -227,6 +236,12 @@ function getData() { } $api.myRequest('/train/public/trainVideo/model', params,'post',9100,header).then((resData) => { videoInfo.value=resData.data + if(resData.data.category){ + getSearchType(resData.data.category,2) + } + if(resData.data.category2){ + getSearchType(resData.data.category2,3) + } videoInfo.value.currentUrl=trainVideoImgUrl+videoInfo.value.trainClassList[0].url videoInfo.value.percentage=((videoInfo.value.process/(videoInfo.value.hour*60))*100).toFixed(2) videoInfo.value.uploadTime=videoInfo.value.uploadTime.split(' ')[0] @@ -266,12 +281,34 @@ function getDictionary(){ levalLabels.value=resData.data }); } -function getCategoryLabelByValue(value) { - if (!Array.isArray(categories.value)) { +function getSearchType(code,i){ + let header = { + 'Authorization': uni.getStorageSync('token')||'', + 'Content-Type': "application/x-www-form-urlencoded" + }; + $api.myRequest('/system/public/dict/data/getByParentValue', { + dictType: "video_level", + dictParentValue: code, + childFlag: "1", + },'post',9100,header).then((resData) => { + if(resData.code==200){ + if(i==1){ + IndustrialData.value=resData.data; + }else if(i==2){ + domainData.value=resData.data; + }else if(i==3){ + occupationalData.value=resData.data; + } + } + }); + +} +function getCategoryLabelByValue(value,arr) { + if (!Array.isArray(arr)) { console.warn('categories 不是数组:', categories.value) return '' } - const item = categories.value.find(item => item.dictValue === String(value)) + const item = arr.find(item => item.dictValue === String(value)) return item ? item.dictLabel : '暂无分类' } function getLevelLabelByValue(value) { @@ -455,7 +492,7 @@ onUnmounted(() => { } .info-detail{ display: flex; - flex-wrap: nowrap; + flex-wrap: wrap; align-items: center; margin-bottom: 30rpx; }