修改
This commit is contained in:
@@ -31,17 +31,22 @@
|
||||
<view class="title-line"></view>
|
||||
</view>
|
||||
<view class="info-detail">
|
||||
<view class="info-left">
|
||||
<view class="info-left" style="width: auto;">
|
||||
<view class="info-item">
|
||||
<image class="icon-img" :src="baseUrl+'/train/zs.png'" mode=""></image>
|
||||
<view class="info-label">
|
||||
分类:
|
||||
</view>
|
||||
<view class="info-value" :data-content="getCategoryLabelByValue(videoInfo.category)">
|
||||
{{getCategoryLabelByValue(videoInfo.category)}}
|
||||
<view class="info-value" :data-content="getCategoryLabelByValue(videoInfo.category,IndustrialData)">
|
||||
{{getCategoryLabelByValue(videoInfo.category,IndustrialData)}}/
|
||||
{{getCategoryLabelByValue(videoInfo.category2,domainData)}}/
|
||||
{{getCategoryLabelByValue(videoInfo.category3,occupationalData)}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-detail">
|
||||
|
||||
<view class="info-right">
|
||||
<view class="info-item">
|
||||
<image class="icon-img" :src="baseUrl+'/train/zs.png'" mode=""></image>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user