From d97a712fd1bdd1939b894e856c4cd43bde0bc498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B2=E5=85=B8=E5=8D=93?= Date: Fri, 20 Jun 2025 10:10:46 +0800 Subject: [PATCH] =?UTF-8?q?flat:6.20=E6=B7=BB=E5=8A=A0=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=9D=BF=E5=9D=97=E5=AD=98=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.js | 13 +++++++++++- pages/index/index.vue | 1 + static/.DS_Store | Bin 10244 -> 10244 bytes stores/useLocationStore.js | 21 +++++++++++++------ stores/useRecommedIndexedDBStore.js | 31 +++++++++++++++++++++++++--- unpackage/dist/build/.DS_Store | Bin 6148 -> 6148 bytes 6 files changed, 56 insertions(+), 10 deletions(-) diff --git a/config.js b/config.js index f2e5545..8a8914b 100644 --- a/config.js +++ b/config.js @@ -14,6 +14,8 @@ export default { DBversion: 2, // 只使用本地缓寸的数据 OnlyUseCachedDB: true, + // 使用模拟定位 + UsingSimulatedPositioning: false, // 应用信息 appInfo: { // 应用名称 @@ -39,7 +41,9 @@ export default { } ] }, + // AI -> 上传文件数量 allowedFileNumber: 2, + // AI -> 上传文件类型 allowedFileTypes: [ "text/plain", // .txt "text/markdown", // .md @@ -52,5 +56,12 @@ export default { "text/csv", // .csv "application/vnd.ms-excel", // .xls "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" // .xlsx - ] + ], + // 首页询问 -> 推荐权重 + weights: { + categories: 1, //岗位 + experience: 0.3, //经验 + salary: 0.5, // 薪资 + areas: 0.5 // 区域 + } } \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index 1055c89..41028ef 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -392,6 +392,7 @@ function getJobList(type = 'add') { current: pageState.page, pageSize: pageState.pageSize, ...pageState.search, + // ...conditionSearch.value, }; $api.createRequest('/app/job/list', params).then((resData) => { diff --git a/static/.DS_Store b/static/.DS_Store index 2edb0f4224cc3a69e5206506b41076f85f87cc96..b31050dd31fed067efb88901812bc3c5ccbd5f73 100644 GIT binary patch delta 287 zcmZn(XbIThFT%KEa)5|3hp3pisDz}H#N=v`JJJ!E$@zJ~nN_Lr0{q1p`Q@HKZa`6L zS!QbaJSd5ct@>gNE%}EkV*(Ww|Z)R5rU>zu@{9yzD(2P4U delta 314 zcmZn(XbIThFT!|ua)5|3hnTp8sHBvn%;aj3JJRt2{KXmh<(|p;c>zVKWtpkv5t%@C zaAsBNAY%|?2xBN?JYxbx4HF}TW{`!_P>L~gGlv)_6T5+>j)Iwi`Q$&s_M5{cma=bV NR|sGo1Wx { // 定义状态 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) }, diff --git a/stores/useRecommedIndexedDBStore.js b/stores/useRecommedIndexedDBStore.js index 96e732b..3f74d19 100644 --- a/stores/useRecommedIndexedDBStore.js +++ b/stores/useRecommedIndexedDBStore.js @@ -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 diff --git a/unpackage/dist/build/.DS_Store b/unpackage/dist/build/.DS_Store index 8614cffd888d7e99e7f058d853f2df28ac76a4d8..3aa820108dedb27ea199d6f5393d221cb2c905cc 100644 GIT binary patch delta 75 zcmV-R0JQ&vFoZCW7XgQnaTbv-ApruBP&<<_6av9b39lMfUv0RXc>6vG3NfCM#=6|MjP delta 57 zcmZoMXfc=|&e%4wP;8=}A|vC(0Ba!8qq*^#A^XG!iksOv1UMMmHeUSBJeglamz9x$ Mf#JYrTam-e01KrNmH+?%