flat:6.20添加视频板块存档

This commit is contained in:
史典卓
2025-06-20 10:10:46 +08:00
parent b7b43c0b42
commit d97a712fd1
6 changed files with 56 additions and 10 deletions

View File

@@ -7,6 +7,8 @@ import {
import {
msg
} from '@/common/globalFunction.js'
import config from '../config';
const useLocationStore = defineStore("location", () => {
// 定义状态
const longitudeVal = ref(null) // 经度
@@ -25,10 +27,17 @@ const useLocationStore = defineStore("location", () => {
longitude: 120.382665,
latitude: 36.066938
}
longitudeVal.value = resd.longitude
latitudeVal.value = resd.latitude
msg('用户位置获取成功')
resole(resd)
if (config.UsingSimulatedPositioning) { // 使用模拟定位
longitudeVal.value = resd.longitude
latitudeVal.value = resd.latitude
msg('用户位置获取成功')
resole(resd)
} else {
longitudeVal.value = res.longitude
latitudeVal.value = res.latitude
msg('用户位置获取成功')
resole(res)
}
},
fail: function(err) {
// longitudeVal.value = ''
@@ -38,8 +47,8 @@ const useLocationStore = defineStore("location", () => {
longitude: 120.382665,
latitude: 36.066938
}
longitudeVal.value = resd.longitude
latitudeVal.value = resd.latitude
longitudeVal.value = res.longitude
latitudeVal.value = res.latitude
msg('用户位置获取失败,使用模拟定位')
resole(resd)
},

View File

@@ -10,7 +10,7 @@ import {
msg
} from '@/common/globalFunction.js'
import baseDB from './BaseDBStore';
import config from '../config';
class JobRecommendation {
constructor() {
@@ -62,6 +62,30 @@ class JobRecommendation {
}
}
/**
* 计算加权用户行为偏好
* @param {Object} data - 用户行为数据,包括 categories、experience、areas、salary 等
* @param {Object} weights - 每一类行为的权重
* @returns {Object} 加权合并后的结果key 为行为项value 为权重后的分值)
*/
function applyWeightsToUserData(data, weights) {
const result = {}
for (const key in data) {
if (key === 'salary') {
result.salary = weights.salary
} else if (typeof data[key] === 'object') {
result[key] = {}
for (const itemKey in data[key]) {
const rawValue = data[key][itemKey]
result[key][itemKey] = parseFloat((rawValue * weights[key]).toFixed(2))
}
}
}
return result
}
// **🔹 创建推荐系统**
export const jobRecommender = new JobRecommendation();
@@ -121,8 +145,9 @@ export const useRecommedIndexedDBStore = defineStore("indexedDB", () => {
}
function analyzer(jobsData) {
const result = jobAnalyzer.analyze(jobsData)
const sort = jobAnalyzer.printUnifiedResults(result)
const result = jobAnalyzer.analyze(jobsData) // 转换格式化
const result2 = applyWeightsToUserData(result, config.weights) // 添加权重
const sort = jobAnalyzer.printUnifiedResults(result2) // 转换格式化
return {
result,
sort