7 Commits

5 changed files with 171 additions and 61 deletions

View File

@@ -114,15 +114,15 @@ const generateTabbarList = () => {
// 求职者用户(包括未登录状态):显示招聘会
// H5端隐藏招聘会
// #ifndef H5
baseItems.splice(1, 0, {
id: 1,
text: '招聘会',
path: '/pages/careerfair/careerfair',
iconPath: '/static/tabbar/post.png',
selectedIconPath: '/static/tabbar/posted.png',
centerItem: false,
badge: readMsg.badges[1]?.count || 0,
});
// baseItems.splice(1, 0, {
// id: 1,
// text: '招聘会',
// path: '/pages/careerfair/careerfair',
// iconPath: '/static/tabbar/post.png',
// selectedIconPath: '/static/tabbar/posted.png',
// centerItem: false,
// badge: readMsg.badges[1]?.count || 0,
// });
// #endif
}

View File

@@ -1,16 +1,16 @@
export default {
// baseUrl: 'http://39.98.44.136:8080', // 测试
baseUrl: 'http://222.80.110.161:11111/api/ks', // 测试
baseUrl: 'http://222.80.110.161:80/api/ks', // 测试
// baseUrl: 'http://ks.zhaopinzao8dian.com/api/ks', // 测试
// LCBaseUrl:'http://10.110.145.145:9100',//内网端口
// LCBaseUrlInner:'http://10.110.145.145:10100',//招聘、培训、帮扶
// imgBaseUrl:'http://10.110.145.145/images', //图片基础url
// trainVideoImgUrl:'http://10.110.145.145:9100/file/file/minio',
LCBaseUrl:'http://222.80.110.161:11111/prod-api',//内网端口
LCBaseUrlInner:'http://222.80.110.161:11111/prod-psout-api',//招聘、培训、帮扶
imgBaseUrl:'http://222.80.110.161:11111/images', //图片基础url
trainVideoImgUrl:'http://222.80.110.161:11111/prod-api/file/file/minio',
LCBaseUrl:'http://222.80.110.161:80/prod-api',//内网端口
LCBaseUrlInner:'http://222.80.110.161:80/prod-psout-api',//招聘、培训、帮扶
imgBaseUrl:'http://222.80.110.161:80/images', //图片基础url
trainVideoImgUrl:'http://222.80.110.161:80/prod-api/file/file/minio',
// sseAI+
// StreamBaseURl: 'http://39.98.44.136:8000',
StreamBaseURl: 'https://qd.zhaopinzao8dian.com/ai',

View File

@@ -19,37 +19,47 @@ export function useColumnCount(onChange = () => {}) {
// columnCount.value = count < 2 ? 2 : count
// }
// }
const calcColumn = () => {
// 使用新的API替代已废弃的getSystemInfoSync
let width
// #ifdef MP-WEIXIN
const mpSystemInfo = uni.getWindowInfo()
width = mpSystemInfo.windowWidth
// #endif
// #ifndef MP-WEIXIN
const otherSystemInfo = uni.getSystemInfoSync()
width = otherSystemInfo.windowWidth
// #endif
let count = 2
if (width >= 1000) {
count = 5
} else if (width >= 750) {
count = 4
} else if (width >= 500) {
count = 3
} else {
count = 2
}
if (count !== columnCount.value) {
columnCount.value = count
}
// 计算间距count=2 => 1count=5 => 2中间线性插值
const spacing = 2 - (count - 2) * (1 / 3)
// console.log('列数:', count, '间距:', spacing.toFixed(2))
columnSpace.value = spacing
const calcColumn = () => {
// 使用新的API替代已废弃的getSystemInfoSync
let width
// #ifdef MP-WEIXIN
const mpSystemInfo = uni.getWindowInfo()
width = mpSystemInfo.windowWidth
// #endif
// #ifndef MP-WEIXIN
const otherSystemInfo = uni.getSystemInfoSync()
width = otherSystemInfo.windowWidth
// #endif
let count = 2
if (width >= 1000) {
// #ifdef H5
count = 3 // H5端最多显示3列
// #endif
// #ifndef H5
count = 5
// #endif
} else if (width >= 750) {
// #ifdef H5
count = 3 // H5端最多显示3列
// #endif
// #ifndef H5
count = 4
// #endif
} else if (width >= 500) {
count = 3
} else {
count = 2
}
if (count !== columnCount.value) {
columnCount.value = count
}
// 计算间距count=2 => 1count=5 => 2中间线性插值
const spacing = 2 - (count - 2) * (1 / 3)
// console.log('列数:', count, '间距:', spacing.toFixed(2))
columnSpace.value = spacing
}
onMounted(() => {

View File

@@ -9,10 +9,20 @@
<view class="video-detail-container">
<!-- 视频播放组件 -->
<view class="video-wrapper">
<video v-if="videoInfo && videoInfo.cover" id="myVideo" :src="videoInfo.currentUrl" :poster="trainVideoImgUrl+ videoInfo.cover" @seeked="onSeeked"
preload="metadata"
enable-danmu controls style="width: 100%;" @pause="onPause" @timeupdate="onTimeupdate" @ended="onEnded"></video>
<video
v-if="videoInfo && videoInfo.cover && isVideoReady"
id="myVideo"
:src="videoInfo.currentUrl"
:poster="trainVideoImgUrl+ videoInfo.cover"
:initial-time="initialTime"
:autoplay="shouldAutoPlay"
enable-danmu
controls
style="width: 100%;"
@pause="onPause"
@timeupdate="onTimeupdate"
@ended="onEnded">
</video>
</view>
</view>
<view class="video-info" :style="getItemBackgroundStyle('video-bj2.png')">
@@ -134,7 +144,7 @@
</template>
<script setup>
import { inject, reactive,ref, onMounted, onUnmounted, nextTick } from 'vue';
import { inject, reactive,ref, onMounted, onUnmounted, nextTick ,watch} from 'vue';
import { onLoad,onHide,onUnload } from '@dcloudio/uni-app';
const { $api, navTo, navBack } = inject('globalFunction');
import config from "@/config.js"
@@ -148,10 +158,13 @@ const trainVideoImgUrl=config.trainVideoImgUrl
const categories=ref([])
const levalLabels=ref([])
const latestTime = ref(0)
const initialTime = ref(0)
const totalTime=ref(0)
const baseUrl = config.imgBaseUrl
const pageEnterTime = ref(0)
const currentChapter = ref(0)
const isVideoReady = ref(false)
const shouldAutoPlay = ref(false)
const getItemBackgroundStyle = (imageName) => ({
backgroundImage: `url(${baseUrl}/train/${imageName})`,
backgroundSize: '100% 100%', // 覆盖整个容器
@@ -168,18 +181,38 @@ const params = reactive({
videoId: '',
userId: ''
})
// 监听 initialTime 变化,确保设置完成后再渲染
watch(initialTime, (newVal) => {
if (newVal >= 0 && videoInfo.value && videoInfo.value.cover) {
// 延迟渲染,确保初始时间设置生效
nextTick(() => {
isVideoReady.value = true
shouldAutoPlay.value = newVal > 0
})
}
})
// 监听 videoInfo 变化
watch([videoInfo, initialTime], ([newVideoInfo, newInitialTime]) => {
if (newVideoInfo && newVideoInfo.cover && newInitialTime >= 0) {
nextTick(() => {
isVideoReady.value = true
shouldAutoPlay.value = newInitialTime > 0
})
}
}, { deep: true })
onLoad((options) => {
getHeart()
pageEnterTime.value = Date.now() // 记录毫秒时间戳
videoId.value=options.id
getDictionary()
});
onHide(() => {
updateVideoInfo() // 用缓存值,不要调 getCurrentTime
reportPageDuration()
})
// onHide(() => {
// updateVideoInfo() // 用缓存值,不要调 getCurrentTime
// reportPageDuration()
// })
onUnload(() => {
updateVideoInfo()
//updateVideoInfo()
saveCurrentChapterProgress()
reportPageDuration()
})
function getData() {
@@ -197,6 +230,13 @@ function getData() {
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]
if(videoInfo.value.process !=null){
queryModelUserPlay(videoInfo.value.trainClassList[0].classId)
} else {
// 如果没有历史进度,直接准备渲染
initialTime.value = 0
}
updateVideoInfo()
});
}
function getHeart() {
@@ -216,7 +256,6 @@ function getUserInfo(){
$api.myRequest('/system/user/login/user/info', {},'get',10100,header).then((resData) => {
userId.value=resData.info.userId
getData()
updateVideoInfo()
});
}
function getDictionary(){
@@ -245,16 +284,18 @@ function getLevelLabelByValue(value) {
}
function onPause(e){
updateVideoInfo()
saveCurrentChapterProgress()
}
function onEnded(e){
updateVideoInfo()
saveCurrentChapterProgress()
}
function onTimeupdate(e){
latestTime.value = e.detail.currentTime
}
function onSeeked(){
updateVideoInfo()
}
// function onSeeked(){
// updateVideoInfo()
// }
// 更新播放时长
function updateVideoInfo(){
totalTime.value=0
@@ -279,7 +320,7 @@ function updateVideoInfo(){
$api.myRequest("/dashboard/auth/heart", {}, "POST", 10100, header).then((resData) => {
if (resData.code == 200) {
if(videoInfo.value.isCollect===null && videoInfo.value.process ===null){
if(videoInfo.value.isCollect===null && videoInfo.value.process ===null && paramsData.process ==0 ){
$api.myRequest('/train/public/videoUser/add', paramsData,'post',9100,header).then((resData) => {
console.log("视频播放时长更新成功")
});
@@ -313,8 +354,58 @@ function reportPageDuration() {
}
}
function chapterChange(video,index){
saveCurrentChapterProgress()
currentChapter.value=index
videoInfo.value.currentUrl=trainVideoImgUrl+video.url
isVideoReady.value = false
shouldAutoPlay.value = false
queryModelUserPlay(video.classId)
}
const updateUserPlayClassHousr = (classId,hour) => {
let paramsData={
userId:userId.value,
classId:classId,
hour:hour,
dqHour:latestTime.value
}
let header={
'Authorization':uni.getStorageSync('Padmin-Token'),
'Content-Type': "application/x-www-form-urlencoded"
}
$api.myRequest('/train/public/videoUser/updateUserPlayClassHousr', paramsData,'post',9100,header).then((resData) => {
if(resData.code == 200){
console.log("学习时长更新成功")
}
});
}
const queryModelUserPlay = (classId) => {
let queryParams = {
classId: classId,
userId: userId.value,
};
let header = {
Authorization: uni.getStorageSync("Padmin-Token"),
"Content-Type": "application/x-www-form-urlencoded",
};
$api.myRequest("/train/public/videoUser/modelUserPlay", queryParams, "post", 9100, header).then((resData) => {
if(resData.code == 200){
initialTime.value=Number(resData?.data?.dqHour ?? 0)
}else {
initialTime.value = 0
}
}).catch(() => {
initialTime.value = 0
});
}
// 保存当前章节进度
function saveCurrentChapterProgress() {
if (videoInfo.value.trainClassList && videoInfo.value.trainClassList.length > 0) {
const currentVideo = videoInfo.value.trainClassList[currentChapter.value];
if (currentVideo) {
updateUserPlayClassHousr(currentVideo.classId, currentVideo.hour);
}
}
}
onUnmounted(() => {
@@ -495,4 +586,4 @@ onUnmounted(() => {
font-size: 28rpx;
color: #303133;
}
</style>
</style>

View File

@@ -154,6 +154,12 @@
</view>
<view class="service-title">薪酬信息</view>
</view>
<view class="service-item press-button" @click="handleJobFairClick">
<view class="service-icon service-icon-1">
<uni-icons type="shop" size="32" color="#FFFFFF"></uni-icons>
</view>
<view class="service-title">招聘会</view>
</view>
</view>
<!-- #endif -->
</view>
@@ -760,6 +766,9 @@ const handleLiveClick = () => {
const handleSalaryInfoClick = () => {
navTo('/pages/service/salary-info');
};
const handleJobFairClick = () => {
navTo('/pages/careerfair/careerfair');
};
const handleH5SalaryClick = () => {
const salaryUrl = "https://www.mohrss.gov.cn/SYrlzyhshbzb/laodongguanxi_/fwyd/202506/t20250627_544623.html";
window.location.assign(salaryUrl);