This commit is contained in:
2026-03-03 17:32:42 +08:00
parent cc348760a1
commit 153a5611d6

View File

@@ -31,17 +31,22 @@
<view class="title-line"></view> <view class="title-line"></view>
</view> </view>
<view class="info-detail"> <view class="info-detail">
<view class="info-left"> <view class="info-left" style="width: auto;">
<view class="info-item"> <view class="info-item">
<image class="icon-img" :src="baseUrl+'/train/zs.png'" mode=""></image> <image class="icon-img" :src="baseUrl+'/train/zs.png'" mode=""></image>
<view class="info-label"> <view class="info-label">
分类 分类
</view> </view>
<view class="info-value" :data-content="getCategoryLabelByValue(videoInfo.category)"> <view class="info-value" :data-content="getCategoryLabelByValue(videoInfo.category,IndustrialData)">
{{getCategoryLabelByValue(videoInfo.category)}} {{getCategoryLabelByValue(videoInfo.category,IndustrialData)}}/
{{getCategoryLabelByValue(videoInfo.category2,domainData)}}/
{{getCategoryLabelByValue(videoInfo.category3,occupationalData)}}
</view> </view>
</view> </view>
</view> </view>
</view>
<view class="info-detail">
<view class="info-right"> <view class="info-right">
<view class="info-item"> <view class="info-item">
<image class="icon-img" :src="baseUrl+'/train/zs.png'" mode=""></image> <image class="icon-img" :src="baseUrl+'/train/zs.png'" mode=""></image>
@@ -181,6 +186,9 @@ const params = reactive({
videoId: '', videoId: '',
userId: '' userId: ''
}) })
const IndustrialData=ref([])
const domainData=ref([])
const occupationalData=ref([])
// 监听 initialTime 变化,确保设置完成后再渲染 // 监听 initialTime 变化,确保设置完成后再渲染
watch(initialTime, (newVal) => { watch(initialTime, (newVal) => {
if (newVal >= 0 && videoInfo.value && videoInfo.value.cover) { if (newVal >= 0 && videoInfo.value && videoInfo.value.cover) {
@@ -205,6 +213,7 @@ onLoad((options) => {
pageEnterTime.value = Date.now() // 记录毫秒时间戳 pageEnterTime.value = Date.now() // 记录毫秒时间戳
videoId.value=options.id videoId.value=options.id
getDictionary() getDictionary()
getSearchType("-1",1)
}); });
// onHide(() => { // onHide(() => {
// updateVideoInfo() // 用缓存值,不要调 getCurrentTime // updateVideoInfo() // 用缓存值,不要调 getCurrentTime
@@ -227,6 +236,12 @@ function getData() {
} }
$api.myRequest('/train/public/trainVideo/model', params,'post',9100,header).then((resData) => { $api.myRequest('/train/public/trainVideo/model', params,'post',9100,header).then((resData) => {
videoInfo.value=resData.data 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.currentUrl=trainVideoImgUrl+videoInfo.value.trainClassList[0].url
videoInfo.value.percentage=((videoInfo.value.process/(videoInfo.value.hour*60))*100).toFixed(2) videoInfo.value.percentage=((videoInfo.value.process/(videoInfo.value.hour*60))*100).toFixed(2)
videoInfo.value.uploadTime=videoInfo.value.uploadTime.split(' ')[0] videoInfo.value.uploadTime=videoInfo.value.uploadTime.split(' ')[0]
@@ -266,12 +281,34 @@ function getDictionary(){
levalLabels.value=resData.data levalLabels.value=resData.data
}); });
} }
function getCategoryLabelByValue(value) { function getSearchType(code,i){
if (!Array.isArray(categories.value)) { 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) console.warn('categories 不是数组:', categories.value)
return '' return ''
} }
const item = categories.value.find(item => item.dictValue === String(value)) const item = arr.find(item => item.dictValue === String(value))
return item ? item.dictLabel : '暂无分类' return item ? item.dictLabel : '暂无分类'
} }
function getLevelLabelByValue(value) { function getLevelLabelByValue(value) {
@@ -455,7 +492,7 @@ onUnmounted(() => {
} }
.info-detail{ .info-detail{
display: flex; display: flex;
flex-wrap: nowrap; flex-wrap: wrap;
align-items: center; align-items: center;
margin-bottom: 30rpx; margin-bottom: 30rpx;
} }