This commit is contained in:
史典卓
2025-03-28 15:19:42 +08:00
parent ad4eb162a5
commit 0216f6053a
396 changed files with 18278 additions and 9899 deletions

BIN
.DS_Store vendored

Binary file not shown.

34
App.vue
View File

@@ -1,20 +1,29 @@
<script setup>
import useUserStore from './stores/useUserStore';
import { reactive, inject } from 'vue';
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app';
const userStore = useUserStore();
onLaunch(() => {
console.log('App Launch');
let openId = uni.getStorageSync('openId') || ''; // 同步获取 缓存信息
import useUserStore from './stores/useUserStore';
import useDictStore from './stores/useDictStore';
const { $api, navTo } = inject('globalFunction');
onLaunch((options) => {
useDictStore().getDictData();
uni.onTabBarMidButtonTap(() => {
console.log(123);
uni.navigateTo({
url: '/pages/login/login',
url: '/pages/chat/chat',
});
});
if (openId) {
console.log('有openid');
let token = uni.getStorageSync('token') || ''; // 同步获取 缓存信息
if (token) {
useUserStore()
.loginSetToken(token)
.then(() => {
$api.msg('登录成功');
});
} else {
console.log('没有openid');
uni.redirectTo({
url: '/pages/login/login',
});
}
});
onShow(() => {
@@ -28,4 +37,9 @@ onHide(() => {
<style>
/*每个页面公共css */
@import '@/common/common.css';
/* 修改pages tabbar样式 H5有效 */
.uni-tabbar .uni-tabbar__item:nth-child(4) .uni-tabbar__bd .uni-tabbar__icon {
height: 100% !important;
width: 80rpx !important;
}
</style>

292
common/IndexedDBHelper.js Normal file
View File

@@ -0,0 +1,292 @@
class IndexedDBHelper {
constructor(dbName, version = 1) {
this.dbName = dbName;
this.version = version;
this.db = null;
}
/**
* 初始化数据库(打开/创建)
* @param {Array} stores [{ name: "storeName", keyPath: "id", indexes: [{ name: "indexName", key: "keyPath", unique: false }] }]
* @returns {Promise}
*/
openDB(stores = []) {
return new Promise((resolve, reject) => {
const request = indexedDB.open(this.dbName, this.version);
request.onupgradeneeded = (event) => {
this.db = event.target.result;
stores.forEach(store => {
if (!this.db.objectStoreNames.contains(store.name)) {
const objectStore = this.db.createObjectStore(store.name, {
keyPath: store.keyPath,
autoIncrement: store.autoIncrement || false
});
if (store.indexes) {
store.indexes.forEach(index => {
objectStore.createIndex(index.name, index.key, {
unique: index.unique
});
});
}
}
});
};
request.onsuccess = (event) => {
this.db = event.target.result;
console.log("✅ IndexedDB 连接成功");
resolve(this.db);
};
request.onerror = (event) => {
reject(`IndexedDB Error: ${event.target.error}`);
};
});
}
// 通用查询方法,按指定字段查询
async queryByField(storeName, fieldName, value) {
return new Promise(async (resolve, reject) => {
try {
if (!this.db) {
await this.openDB();
}
const transaction = this.db.transaction(storeName, 'readonly');
const store = transaction.objectStore(storeName);
if (!store.indexNames.contains(fieldName)) {
return reject(`索引 ${fieldName} 不存在`);
}
const index = store.index(fieldName);
const request = index.getAll(value);
request.onsuccess = (event) => {
resolve(event.target.result);
};
request.onerror = (event) => {
reject('查询失败: ' + event.target.error);
};
} catch (error) {
reject('查询错误: ' + error);
}
});
}
/**
* 添加数据(支持单条或批量)
* @param {string} storeName - 存储空间名称
* @param {Object|Array} data - 要添加的数据(单条对象或数组)
* @returns {Promise<number|Array<number>>} - 返回添加数据的ID单条返回数字批量返回数组
*/
add(storeName, data) {
return new Promise((resolve, reject) => {
const transaction = this.db.transaction([storeName], "readwrite");
const store = transaction.objectStore(storeName);
// 统一处理为数组格式
const items = Array.isArray(data) ? data : [data];
const results = [];
// 监听每个添加操作的成功事件
items.forEach((item, index) => {
const request = store.add(item);
request.onsuccess = (event) => {
results[index] = event.target.result; // 保存生成的ID
};
request.onerror = (event) => {
transaction.abort(); // 遇到错误时中止事务
reject(`${index + 1} 条数据添加失败: ${event.target.error}`);
};
});
// 监听事务完成事件
transaction.oncomplete = () => {
// 单条数据返回单个ID批量返回数组
resolve(items.length === 1 ? results[0] : results);
};
// 统一错误处理
transaction.onerror = (event) => {
reject(`添加失败: ${event.target.error}`);
};
});
}
/**
* 读取数据(根据主键)
* @param {string} storeName
* @param {any} key
* @returns {Promise}
*/
get(storeName, key) {
return new Promise((resolve, reject) => {
const transaction = this.db.transaction([storeName], "readonly");
const store = transaction.objectStore(storeName);
const request = store.get(key);
request.onsuccess = () => resolve(request.result);
request.onerror = (event) => reject(`Get Error: ${event.target.error}`);
});
}
/**
* 读取所有数据兼容X5内核方案
* @param {string} storeName
* @returns {Promise}
*/
getAll(storeName) {
return new Promise((resolve, reject) => {
const transaction = this.db.transaction([storeName], "readonly");
const store = transaction.objectStore(storeName);
// 兼容性检测优先尝试原生getAll方法
if (typeof store.getAll === 'function') {
const request = store.getAll();
request.onsuccess = () => resolve(request.result);
request.onerror = (e) => reject(`GetAll Error: ${e.target.error}`);
}
// 降级方案:使用游标手动遍历
else {
const results = [];
const request = store.openCursor();
request.onsuccess = (e) => {
const cursor = e.target.result;
if (cursor) {
results.push(cursor.value);
cursor.continue();
} else {
resolve(results);
}
};
request.onerror = (e) => reject(`Cursor Error: ${e.target.error}`);
}
});
}
/**
* 获取表的总记录数
* @param {string} storeName - 表名Object Store 名称)
* @returns {Promise<number>} - 记录总数
*/
async getRecordCount(storeName) {
return new Promise((resolve, reject) => {
const transaction = this.db.transaction([storeName], "readonly");
const store = transaction.objectStore(storeName);
const request = store.count();
request.onsuccess = () => resolve(request.result);
request.onerror = (event) => reject(`❌ Count Error: ${event.target.error}`);
});
}
/**
* 更新数据
* @param {string} storeName
* @param {Object} data
* @returns {Promise}
*/
update(storeName, data) {
return new Promise((resolve, reject) => {
const transaction = this.db.transaction([storeName], "readwrite");
const store = transaction.objectStore(storeName);
const request = store.put(data);
request.onsuccess = () => resolve("Data updated successfully");
request.onerror = (event) => reject(`Update Error: ${event.target.error}`);
});
}
/**
* 删除数据(根据主键)
* @param {string} storeName
* @param {any} key
* @returns {Promise}
*/
delete(storeName, key) {
return new Promise((resolve, reject) => {
const transaction = this.db.transaction([storeName], "readwrite");
const store = transaction.objectStore(storeName);
const request = store.delete(key);
request.onsuccess = () => resolve("Data deleted successfully");
request.onerror = (event) => reject(`Delete Error: ${event.target.error}`);
});
}
/**
* 通过索引查询数据
* @param {string} storeName
* @param {string} indexName
* @param {any} value
* @returns {Promise}
*/
getByIndex(storeName, indexName, value) {
return new Promise((resolve, reject) => {
const transaction = this.db.transaction([storeName], "readonly");
const store = transaction.objectStore(storeName);
const index = store.index(indexName);
const request = index.get(value);
request.onsuccess = () => resolve(request.result);
request.onerror = (event) => reject(`Get By Index Error: ${event.target.error}`);
});
}
/**
* 清空表
* @param {string} storeName
* @returns {Promise}
*/
clearStore(storeName) {
return new Promise((resolve, reject) => {
const transaction = this.db.transaction([storeName], "readwrite");
const store = transaction.objectStore(storeName);
const request = store.clear();
request.onsuccess = () => resolve("Store cleared successfully");
request.onerror = (event) => reject(`Clear Store Error: ${event.target.error}`);
});
}
/**
* 删除数据库
* @returns {Promise}
*/
deleteDB(dbNamed = null) {
return new Promise((resolve, reject) => {
const request = indexedDB.deleteDatabase(dbNamed || this.dbName);
request.onsuccess = () => resolve("Database deleted successfully");
request.onerror = (event) => reject(`Delete DB Error: ${event.target.error}`);
});
}
async deleteOldestRecord(storeName) {
return new Promise((resolve, reject) => {
const transaction = this.db.transaction([storeName], "readwrite");
const store = transaction.objectStore(storeName);
const request = store.openCursor(); // 🔹 获取最早的记录(按主键 ID 排序)
request.onsuccess = function(event) {
const cursor = event.target.result;
if (cursor) {
console.log(`🗑️ 删除最早的记录 ID: ${cursor.key}`);
store.delete(cursor.key); // 🔥 删除最小 ID最早记录
resolve();
} else {
resolve(); // 没有记录时跳过
}
};
request.onerror = (event) => reject(`❌ Cursor Error: ${event.target.error}`);
});
}
}
export default IndexedDBHelper

View File

@@ -2,11 +2,20 @@
page {
min-height: calc(100vh - var(--window-top) - var(--status-bar-height) - var(--window-bottom));
font-size: 28rpx;
background-color: #f4f4f4;
background-color: #FFFFFF;
color: #333333;
overflow: hidden;
}
/* 禁止页面回弹 */
/* html,
body,
page {
overscroll-behavior: none;
overflow: hidden;
height: 100%;
} */
image {
width: 100%;
height: 100%;

View File

@@ -1,6 +1,36 @@
import useUserStore from "../stores/useUserStore";
import {
request,
createRequest,
uploadFile
} from "../utils/request";
import streamRequest, {
chatRequest
} from "../utils/streamRequest.js";
const msg = (title, duration = 1500, mask = false, icon = 'none', image) => {
export const CloneDeep = (props) => {
if (typeof props !== 'object' || props === null) {
return props
}
let result
if (props) {
result = []
} else {
result = {}
}
for (let key in props) {
if (props.hasOwnProperty(key)) {
result[key] = CloneDeep(props[key])
}
}
return result
}
export const msg = (title, duration = 1500, mask = false, icon = 'none', image) => {
if (Boolean(title) === false) {
return;
}
@@ -63,14 +93,376 @@ function getdeviceInfo() {
function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time))
}
const cloneDeep = (obj) => {
// 1.1 判断是否是对象
const isObject = (obj) => (typeof obj === 'object' || typeof obj === 'function') && obj !== 'null'
if (!isObject(obj)) {
throw new Error('参数不是对象')
}
// 1.3 如果参数为数组,则复制数组各元素,否则复制对象属性
const newObject = Array.isArray(obj) ? [...obj] : {
...obj
}
// 1.4 迭代
Object.keys(newObject).forEach((key) => {
// 1.5 判断如果遍历到的属性值为对象则继续递归cloneDeep
if (isObject(newObject[key])) {
newObject[key] = cloneDeep(newObject[key])
}
})
return newObject
}
const CopyText = (text) => {
let input = document.createElement('textarea');
input.value = text;
document.body.appendChild(input);
input.select();
let flag = document.execCommand('copy')
if (flag) {
message.success('成功复制到剪贴板')
} else {
message.success('复制失败')
}
document.body.removeChild(input)
}
// 柯里化 降低使用范围,提高适用性
function Exp(regExp) {
return (str) => {
return regExp.test(str)
}
}
const checkingPhoneRegExp = Exp(/^1[3-9]{1}\d{9}/)
// 手机号校验 checkingPhoneRegExp(phone)
const checkingEmailRegExp = Exp(/^[a-z0-9_\.-]+@[a-z0-9_\.-]+[a-z0-9]{2,6}$/i)
// 邮箱校验 checkingEmailRegExp(email)
function throttle(fn, delay = 300) {
let valid = true
let savedArgs = null // 参数存储器
let savedContext = null // 上下文存储器
return function(...args) {
// 保存当前参数和上下文
savedArgs = args
savedContext = this
if (!valid) return false
valid = false
setTimeout(() => {
fn.apply(savedContext, savedArgs)
valid = true
savedArgs = null // 清空存储
savedContext = null
}, delay)
}
}
function debounce(fun, delay) {
return function(args) {
let that = this
let _args = args
clearTimeout(fun.id)
fun.id = setTimeout(function() {
fun.call(that, _args)
}, delay)
}
}
function toRad(degree) {
return degree * Math.PI / 180;
}
function haversine(lat1, lon1, lat2, lon2) {
const R = 6371; // 地球半径,单位为公里
const a1 = toRad(lat1);
const a2 = toRad(lat2);
const b1 = toRad(lat2 - lat1);
const b2 = toRad(lon2 - lon1);
const a = Math.sin(b1 / 2) * Math.sin(b1 / 2) +
Math.cos(a1) * Math.cos(a2) * Math.sin(b2 / 2) * Math.sin(b2 / 2);
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
const distance = R * c; // 计算得到的距离,单位为公里
return distance;
}
export function getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) {
const R = 6371; // 地球平均半径,单位为公里
const dLat = deg2rad(lat2 - lat1);
const dLon = deg2rad(lon2 - lon1);
const a =
Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *
Math.sin(dLon / 2) * Math.sin(dLon / 2);
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
const d = R * c;
return {
km: d,
m: d * 1000
};
}
// 将角度转换为弧度
function deg2rad(deg) {
return deg * (Math.PI / 180);
}
function vacanciesTo(vacancies) {
if (vacancies >= 0) {
return vacancies + "人"
} else {
return '不限人数'
}
}
function salaryGlobal(type = 'min') {
const salay = [2, 5, 10, 15, 20, 25, 30, 50, 80];
const salaymax = [2, 5, 10, 15, 20, 25, 30, 50, 80, 100];
const salarys = salay.map((item, index) => ({
label: item + 'k',
value: item * 1000,
children: CloneDeep(salaymax).splice(index).map((vItem) => ({
label: vItem + 'k',
value: vItem * 1000,
}))
}))
return salarys
}
class CustomSystem {
constructor() {
const systemInfo = uni.getSystemInfoSync();
this.systemInfo = systemInfo
}
}
const customSystem = new CustomSystem()
function setCheckedNodes(nodes, ids) {
// 处理每个第一层节点
nodes.forEach((firstLayer) => {
// 初始化或重置计数器
firstLayer.checkednumber = 0;
// 递归处理子树
const traverse = (node) => {
// 设置当前节点选中状态
const shouldCheck = ids.includes(node.id);
if (shouldCheck) node.checked = true;
// 统计后代节点(排除首层自身)
if (node !== firstLayer && node.checked) {
firstLayer.checkednumber++;
}
// 递归子节点
if (node.children) {
node.children.forEach((child) => traverse(child));
}
};
// 启动当前首层节点的遍历
traverse(firstLayer);
});
}
const formatTotal = (total) => {
if (total < 10) return total.toString(); // 直接返回小于 10 的数
const magnitude = Math.pow(10, Math.floor(Math.log10(total))); // 计算数量级
const roundedTotal = Math.floor(total / magnitude) * magnitude; // 去掉零头
return `${roundedTotal}+`;
};
export function formatDate(isoString) {
const date = new Date(isoString);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要 +1
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
export function insertSortData(data, attribute = 'createTime') {
const sortedData = data.sort((a, b) => new Date(b[attribute]) - new Date(a[attribute])); // 按时间降序排序
const result = [];
let lastDate = '';
let lastTitle = ''
const now = new Date();
const todayStr = now.toISOString().split('T')[0]; // 获取今天的日期字符串
const yesterday = new Date(now.setDate(now.getDate() - 1)).toISOString().split('T')[0]; // 获取昨天的日期字符串
const twoDaysAgo = new Date(now.setDate(now.getDate() - 1)).toISOString().split('T')[0]; // 获取前天的日期字符串
sortedData.forEach(item => {
const itemAttribute = item[attribute].replace('T', ' ')
const itemDate = itemAttribute.split(' ')[0]; // 提取日期部分
let title = itemDate;
if (itemDate === todayStr) {
title = '今天';
} else if (itemDate === yesterday) {
title = '昨天';
} else if (itemDate === twoDaysAgo) {
title = '前天';
}
if (lastDate !== itemDate) {
result.push({
title,
isTitle: true
});
lastDate = itemDate;
lastTitle = title;
}
result.push({
...item,
isTitle: false
});
});
return [result, lastTitle];
}
function getWeeksOfMonth(year, month) {
const firstDay = new Date(year, month - 1, 1); // 当月第一天
const lastDay = new Date(year, month, 0); // 当月最后一天
const weeks = [];
let week = [];
for (let d = new Date(firstDay); d <= lastDay; d.setDate(d.getDate() + 1)) {
// 补充第一周的上个月日期
if (week.length === 0 && d.getDay() !== 1) {
let prevMonday = new Date(d);
prevMonday.setDate(d.getDate() - (d.getDay() === 0 ? 6 : d.getDay() - 1));
while (prevMonday < d) {
week.push({
year: prevMonday.getFullYear(),
month: prevMonday.getMonth() + 1,
day: prevMonday.getDate(),
fullDate: getLocalYYYYMMDD(prevMonday), // 修正
weekday: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"][prevMonday.getDay()],
isCurrent: false // 上个月日期
});
prevMonday.setDate(prevMonday.getDate() + 1);
}
}
// 添加当前月份的日期
week.push({
year: d.getFullYear(),
month: d.getMonth() + 1,
day: d.getDate(),
fullDate: getLocalYYYYMMDD(d), // 修正
weekday: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"][d.getDay()],
isCurrent: true // 当前月的日期
});
// 如果到了月末但当前周未满7天需要补足到周日
if (d.getTime() === lastDay.getTime() && week.length < 7) {
let nextDay = new Date(d);
nextDay.setDate(d.getDate() + 1);
while (week.length < 7) {
week.push({
year: nextDay.getFullYear(),
month: nextDay.getMonth() + 1,
day: nextDay.getDate(),
fullDate: getLocalYYYYMMDD(nextDay), // 修正
weekday: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"][nextDay.getDay()],
isCurrent: false // 下个月日期
});
nextDay.setDate(nextDay.getDate() + 1);
}
}
// 如果本周满了7天或者到了月末
if (week.length === 7 || d.getTime() === lastDay.getTime()) {
weeks.push([...week]); // 存入当前周
week = []; // 清空,准备下一周
}
}
return weeks;
}
// 新增工具函数:将日期格式化为本地 YYYY-MM-DD 字符串
function getLocalYYYYMMDD(date) {
const y = date.getFullYear();
const m = String(date.getMonth() + 1).padStart(2, '0');
const d = String(date.getDate()).padStart(2, '0');
return `${y}-${m}-${d}`;
}
function isFutureDate(dateStr) {
const inputDate = new Date(dateStr);
const today = new Date();
// 只比较年月日,不考虑具体时间
today.setHours(0, 0, 0, 0);
inputDate.setHours(0, 0, 0, 0);
return inputDate > today;
}
function parseQueryParams(url = window.location.href) {
const queryString = url.split('?')[1]?.split('#')[0];
const params = {};
if (!queryString) return params;
queryString.split('&').forEach(param => {
const [key, value] = param.split('=');
if (key) {
params[decodeURIComponent(key)] = decodeURIComponent(value || '');
}
});
return params;
}
export const $api = {
msg,
prePage,
sleep,
request,
createRequest,
streamRequest,
chatRequest,
insertSortData,
uploadFile
}
export default {
'$api': {
msg,
prePage,
sleep
},
$api,
navTo,
getdeviceInfo
cloneDeep,
formatDate,
getdeviceInfo,
checkingPhoneRegExp,
checkingEmailRegExp,
throttle,
debounce,
haversine,
getDistanceFromLatLonInKm,
vacanciesTo,
salaryGlobal,
customSystem,
setCheckedNodes,
formatTotal,
getWeeksOfMonth,
isFutureDate,
parseQueryParams
}

BIN
components/.DS_Store vendored

Binary file not shown.

View File

@@ -0,0 +1,92 @@
<!-- CollapseTransition.vue -->
<template>
<view :style="wrapStyle" class="collapse-wrapper">
<view ref="contentRef" class="content-inner">
<slot />
</view>
</view>
</template>
<script setup>
import { ref, watch, nextTick } from 'vue';
const props = defineProps({
show: Boolean,
duration: {
type: Number,
default: 300,
},
});
const wrapStyle = ref({
height: '0rpx',
opacity: 0,
overflow: 'hidden',
transition: `all ${props.duration}ms ease`,
});
const contentRef = ref(null);
// 获取高度(兼容 H5 + 小程序)
function getContentHeight() {
return new Promise((resolve) => {
const query = uni.createSelectorQuery().in(this ? this : undefined);
query
.select('.content-inner')
.boundingClientRect((data) => {
resolve(data?.height || 0);
})
.exec();
});
}
// 动画执行
async function expand() {
const height = await getContentHeight();
wrapStyle.value = {
height: height + 'px',
opacity: 1,
overflow: 'hidden',
transition: `all ${props.duration}ms ease`,
};
setTimeout(() => {
wrapStyle.value.height = 'auto';
}, props.duration);
}
async function collapse() {
const height = await getContentHeight();
wrapStyle.value = {
height: height + 'px',
opacity: 1,
overflow: 'hidden',
transition: 'none',
};
// 等待下一帧开始收起动画
await nextTick();
requestAnimationFrame(() => {
wrapStyle.value = {
height: '0rpx',
opacity: 0,
overflow: 'hidden',
transition: `all ${props.duration}ms ease`,
};
});
}
watch(
() => props.show,
(val) => {
if (val) expand();
else collapse();
}
);
</script>
<style scoped>
.collapse-wrapper {
width: 100%;
}
</style>

View File

@@ -0,0 +1,45 @@
<template>
<view v-show="internalShow" :style="fadeStyle" class="fade-wrapper">
<slot />
</view>
</template>
<script setup>
import { ref, watch } from 'vue';
const props = defineProps({
show: { type: Boolean, default: false },
duration: { type: Number, default: 300 }, // ms
});
const internalShow = ref(props.show);
const fadeStyle = ref({
opacity: props.show ? 1 : 0,
transition: `opacity ${props.duration}ms ease`,
});
watch(
() => props.show,
(val) => {
if (val) {
internalShow.value = true;
requestAnimationFrame(() => {
fadeStyle.value.opacity = 1;
});
} else {
fadeStyle.value.opacity = 0;
// 动画结束后隐藏 DOM
setTimeout(() => {
internalShow.value = false;
}, props.duration);
}
}
);
</script>
<style scoped>
.fade-wrapper {
width: 100%;
height: 100%;
}
</style>

View File

@@ -0,0 +1,26 @@
<!-- components/NoBouncePage.vue -->
<template>
<view class="no-bounce-page">
<scroll-view scroll-y :show-scrollbar="false" class="scroll-area">
<slot />
</scroll-view>
</view>
</template>
<script setup></script>
<style scoped>
.no-bounce-page {
width: 100vw;
height: 100vh;
overflow: hidden;
overscroll-behavior: none; /* 禁止页面级回弹 */
}
.scroll-area {
height: 100%;
overflow-y: auto;
overscroll-behavior: contain; /* 禁止滚动内容回弹 */
-webkit-overflow-scrolling: touch; /* 保留 iOS 惯性滚动 */
}
</style>

View File

@@ -0,0 +1,17 @@
<template>
<view>{{ salaryText }}</view>
</template>
<script setup>
import { inject, computed } from 'vue';
import useDictStore from '../../stores/useDictStore';
const { minSalary, maxSalary, isMonth } = defineProps(['minSalary', 'maxSalary', 'isMonth']);
const salaryText = computed(() => {
if (!minSalary || !maxSalary) return '面议';
if (isMonth) {
return `${minSalary}-${maxSalary}/月`;
}
return `${minSalary / 1000}k-${maxSalary / 1000}k`;
});
</script>

Binary file not shown.

View File

@@ -0,0 +1,23 @@
<template>
<span style="padding-left: 16rpx">{{ tofixedAndKmM(distance) }}</span>
</template>
<script setup>
import { inject } from 'vue';
const { haversine, getDistanceFromLatLonInKm } = inject('globalFunction');
const { alat, along, blat, blong } = defineProps(['alat', 'along', 'blat', 'blong']);
const distance = getDistanceFromLatLonInKm(alat, along, blat, blong);
function tofixedAndKmM(data) {
const { km, m } = data;
if (!alat && !along) {
return '--km';
}
if (km > 1) {
return km.toFixed(2) + 'km';
} else {
return m.toFixed(2) + 'm';
}
}
</script>
<style></style>

View File

@@ -0,0 +1,134 @@
<template>
<view
v-if="visible"
class="tianditu-popop"
:style="{ height: winHeight + 'px', width: winWidth + 'px', top: winTop + 'px' }"
>
<view v-if="header" class="popup-header" @click="close">
<slot name="header"></slot>
</view>
<view :style="{ minHeight: contentHeight + 'vh' }" class="popup-content fadeInUp animated">
<slot></slot>
</view>
</view>
</template>
<script>
export default {
name: 'custom-popup',
data() {
return {
winWidth: 0,
winHeight: 0,
winTop: 0,
contentHeight: 30,
};
},
props: {
visible: {
type: Boolean,
require: true,
default: false,
},
hide: {
type: Number,
default: 0,
},
header: {
type: Boolean,
default: true,
},
contentH: {
type: Number,
default: 30,
},
},
created() {
var that = this;
if (this.contentH) {
this.contentHeight = this.contentH;
}
uni.getSystemInfo({
success: function (res) {
if (that.hide === 0) {
that.winWidth = res.screenWidth;
that.winHeight = res.screenHeight;
that.winTop = 0;
} else {
that.winWidth = res.windowWidth;
that.winHeight = res.windowHeight;
that.winTop = res.windowTop;
}
},
});
},
methods: {
close(e) {
this.$emit('onClose');
},
},
};
</script>
<style scoped>
.tianditu-popop {
position: fixed;
left: 0;
z-index: 999;
background-color: rgba(0, 0, 0, 0.6);
display: flex;
flex-direction: column;
}
.popup-header {
flex: 1;
}
.popup-content {
background-color: #ffffff;
min-height: 300px;
width: 100%;
/* position: absolute;
bottom: 0;
left: 0; */
}
/*base code*/
.animated {
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.animated.infinite {
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
.animated.hinge {
-webkit-animation-duration: 2s;
animation-duration: 2s;
}
@keyframes fadeInUp {
0% {
opacity: 0;
-webkit-transform: translate3d(0, 100%, 0);
-ms-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
}
100% {
opacity: 1;
-webkit-transform: none;
-ms-transform: none;
transform: none;
}
}
.fadeInUp {
-webkit-animation-name: fadeInUp;
animation-name: fadeInUp;
}
</style>

View File

@@ -0,0 +1,11 @@
<template>
<span>{{ dictLabel(dictType, value) }}</span>
</template>
<script setup>
import useDictStore from '../../stores/useDictStore';
const { dictType, value } = defineProps(['value', 'dictType']);
const { complete, dictLabel } = useDictStore();
</script>
<style></style>

View File

@@ -0,0 +1,11 @@
<template>
<span>{{ industryLabel(dictType, value) }}</span>
</template>
<script setup>
import useDictStore from '../../stores/useDictStore';
const { dictType, value } = defineProps(['value', 'dictType']);
const { complete, industryLabel } = useDictStore();
</script>
<style></style>

View File

@@ -0,0 +1,226 @@
<template>
<view class="expected-station">
<view class="sex-search" v-if="search">
<uni-icons class="iconsearch" type="search" size="20"></uni-icons>
<input class="uni-input searchinput" confirm-type="search" />
</view>
<view class="sex-content">
<scroll-view :show-scrollbar="false" :scroll-y="true" class="sex-content-left">
<view
v-for="item in copyTree"
:key="item.id"
class="left-list-btn"
:class="{ 'left-list-btned': item.id === leftValue.id }"
@click="changeStationLog(item)"
>
{{ item.label }}
<view class="positionNum" v-show="item.checkednumber">
{{ item.checkednumber }}
</view>
</view>
</scroll-view>
<scroll-view :show-scrollbar="false" :scroll-y="true" class="sex-content-right">
<view v-for="item in rightValue" :key="item.id">
<view class="secondary-title">{{ item.label }}</view>
<view class="grid-sex">
<view
v-for="item in item.children"
:key="item.id"
:class="{ 'sex-right-btned': item.checked }"
class="sex-right-btn"
@click="addItem(item)"
>
{{ item.label }}
</view>
<!-- <view class="sex-right-btn sex-right-btned" @click="addItem()">客户经理</view>
<view class="sex-right-btn" @click="addItem()">客户经理</view> -->
</view>
</view>
</scroll-view>
</view>
</view>
</template>
<script>
export default {
name: 'expected-station',
data() {
return {
leftValue: {},
rightValue: [],
stationCateLog: 0,
copyTree: [],
};
},
props: {
station: {
type: Array,
default: [],
},
search: {
type: Boolean,
default: true,
},
max: {
type: Number,
default: 5,
},
},
created() {
this.copyTree = this.station;
if (this.copyTree.length) {
this.leftValue = this.copyTree[0];
this.rightValue = this.copyTree[0].children;
}
},
watch: {
station(newVal) {
this.copyTree = this.station;
if (this.copyTree.length) {
this.leftValue = this.copyTree[0];
this.rightValue = this.copyTree[0].children;
}
},
},
methods: {
changeStationLog(item) {
this.leftValue = item;
this.rightValue = item.children;
},
addItem(item) {
let titiles = [];
let count = 0;
// 先统计已选中的职位数量
for (const firstLayer of this.copyTree) {
for (const secondLayer of firstLayer.children) {
for (const thirdLayer of secondLayer.children) {
if (thirdLayer.checked) {
count++;
}
}
}
}
for (const firstLayer of this.copyTree) {
firstLayer.checkednumber = 0; // 初始化当前层级的 checked 计数
for (const secondLayer of firstLayer.children) {
for (const thirdLayer of secondLayer.children) {
// **如果是当前点击的职位**
if (thirdLayer.id === item.id) {
if (!thirdLayer.checked && count >= 5) {
// 如果已经选了 5 个,并且点击的是未选中的职位,则禁止选择
uni.showToast({
title: `最多选择5个职位`,
icon: 'none',
});
continue; // 跳过后续逻辑,继续循环
}
// 切换选中状态
thirdLayer.checked = !thirdLayer.checked;
}
// 统计被选中的第三层节点
if (thirdLayer.checked) {
titiles.push(`${thirdLayer.id}`);
firstLayer.checkednumber++; // 累加计数器
}
}
}
}
titiles = titiles.join(',');
this.$emit('onChange', titiles);
},
},
};
</script>
<style lang="stylus" scoped>
.secondary-title{
font-weight: bold;
padding: 40rpx 0 10rpx 30rpx;
}
.expected-station{
width: 100%;
overflow: hidden;
display: flex;
flex-direction: column;
}
.sex-search
width: calc(100% - 28rpx - 28rpx);
padding: 10rpx 28rpx;
display: grid;
// grid-template-columns: 50rpx auto;
position: relative;
.iconsearch
position: absolute;
left: 40rpx;
top: 20rpx;
.searchinput
border-radius: 10rpx;
background: #FFFFFF;
padding: 10rpx 0 10rpx 58rpx;
.sex-content
background: #FFFFFF;
border-radius: 20rpx;
width: 100%;
margin-top: 20rpx;
display: flex;
border-bottom: 2px solid #D9D9D9;
overflow: hidden;
height: 100%
.sex-content-left
width: 250rpx;
.left-list-btn
padding: 0 40rpx 0 24rpx;
display: grid;
place-items: center;
height: 100rpx;
text-align: center;
color: #606060;
font-size: 28rpx;
position: relative
.positionNum
position: absolute
right: 0
top: 50%;
transform: translate(0, -50%)
color: #FFFFFF
background: #4778EC
border-radius: 50%
width: 36rpx;
height: 36rpx;
.left-list-btned
color: #4778EC;
position: relative;
.left-list-btned::after
position: absolute;
left: 20rpx;
content: '';
width: 7rpx;
height: 38rpx;
background: #4778EC;
border-radius: 0rpx 0rpx 0rpx 0rpx;
.sex-content-right
border-left: 2px solid #D9D9D9;
flex: 1;
.grid-sex
display: grid;
grid-template-columns: 50% 50%;
place-items: center;
padding: 0 0 40rpx 0;
.sex-right-btn
width: 211rpx;
height: 84rpx;
font-size: 32rpx;
line-height: 41rpx;
text-align: center;
display: grid;
place-items: center;
background: #D9D9D9;
border-radius: 20rpx;
margin-top:30rpx;
color: #606060;
.sex-right-btned
color: #FFFFFF;
background: #4778EC;
</style>

View File

@@ -0,0 +1,27 @@
<template>
<view>
<picker range-key="text" @change="changeLatestHotestStatus" :value="rangeVal" :range="rangeOptions">
<view class="uni-input">{{ rangeOptions[rangeVal].text }}</view>
</picker>
</view>
</template>
<script setup>
import { reactive, inject, watch, ref, onMounted, getCurrentInstance } from 'vue';
const rangeVal = ref(0);
const emit = defineEmits(['confirm', 'close']);
const rangeOptions = ref([
{ value: 0, text: '推荐' },
{ value: 1, text: '最热' },
{ value: 2, text: '最新发布' },
]);
function changeLatestHotestStatus(e) {
const id = e.detail.value;
rangeVal.value = id;
const obj = rangeOptions.value.filter((item) => item.value === id)[0];
emit('confirm', obj);
}
</script>
<style lang="stylus"></style>

View File

@@ -0,0 +1,51 @@
<template>
<view class="more">
<uni-load-more iconType="circle" :status="status" />
</view>
</template>
<script>
export default {
name: 'loadmore',
data() {
return {
status: 'more',
statusTypes: [
{
value: 'more',
text: '加载前',
checked: true,
},
{
value: 'loading',
text: '加载中',
checked: false,
},
{
value: 'noMore',
text: '没有更多',
checked: false,
},
],
contentText: {
contentdown: '查看更多',
contentrefresh: '加载中',
contentnomore: '没有更多',
},
};
},
methods: {
change(state) {
this.status = state;
},
clickLoadMore(e) {
uni.showToast({
icon: 'none',
title: '当前状态:' + e.detail.status,
});
},
},
};
</script>
<style></style>

View File

@@ -0,0 +1,17 @@
<template>
<view>{{ matchingText }}</view>
</template>
<script setup>
import { inject, computed } from 'vue';
const { job } = defineProps(['job']);
const { similarityJobs, throttle } = inject('globalFunction');
const matchingText = computed(() => {
if (!job) return '';
const matching = similarityJobs.calculationMatchingDegree(job);
return matching ? '匹配度 ' + matching.overallMatch : '';
});
</script>
<style></style>

View File

@@ -0,0 +1,178 @@
<template>
<view class="markdown-body">
<rich-text class="markdownRich" id="markdown-content" :nodes="renderedHtml" @itemclick="handleItemClick" />
</view>
</template>
<script setup>
import { computed } from 'vue';
import { parseMarkdown, codeDataList } from '@/utils/markdownParser';
const props = defineProps({
content: {
type: String,
default: '',
},
});
const renderedHtml = computed(() => parseMarkdown(props.content));
const handleItemClick = (e) => {
let { attrs } = e.detail.node;
let { 'data-copy-index': codeDataIndex, class: className, href } = attrs;
if (href) {
window.open(href);
return;
}
if (className == 'copy-btn') {
uni.setClipboardData({
data: codeDataList[codeDataIndex],
showToast: false,
success() {
uni.showToast({
title: '复制成功',
icon: 'none',
});
},
});
}
};
</script>
<style lang="scss">
.markdown-body {
h2,
h3,
h4,
h5,
h6 {
// line-height: 1;
}
ul {
// display: block;
padding-inline-start: 40rpx;
li {
margin-bottom: -30rpx;
}
li:nth-child(1) {
margin-top: -40rpx;
}
}
}
.markdown-body {
user-select: text;
-webkit-user-select: text;
white-space: pre-wrap;
}
/* 表格 */
table {
// display: block; /* 让表格可滚动 */
// width: 100%;
// overflow-x: auto;
// white-space: nowrap; /* 防止单元格内容换行 */
border-collapse: collapse;
}
th,
td {
padding: 16rpx;
border: 2rpx solid #ddd;
font-size: 24rpx;
}
th {
background-color: #007bff;
color: white;
font-weight: bold;
}
/* 隔行变色 */
tr:nth-child(even) {
background-color: #f9f9f9;
}
/* 鼠标悬停效果 */
tr:hover {
background-color: #f1f1f1;
transition: 0.3s;
}
/* 代码块 */
pre,
code {
user-select: text;
}
.code-container {
position: relative;
border-radius: 10rpx;
overflow: hidden;
// background: #0d1117;
padding: 8rpx;
color: #c9d1d9;
font-size: 28rpx;
height: fit-content;
margin-top: -140rpx;
margin-bottom: -140rpx;
}
.code-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10rpx 20rpx;
background: #161b22;
color: #888;
font-size: 24rpx;
border-radius: 10rpx 10rpx 0 0;
}
.copy-btn {
background: rgba(255, 255, 255, 0.1);
color: #ddd;
border: none;
padding: 6rpx 16rpx;
font-size: 24rpx;
cursor: pointer;
border-radius: 6rpx;
}
.copy-btn:hover {
background: rgba(255, 255, 255, 0.2);
color: #259939;
text-decoration: underline;
}
pre.hljs {
padding: 0 24rpx;
margin: 0;
border-radius: 0 0 16rpx 16rpx;
background-color: #f8f8f8;
padding: 20rpx;
overflow-x: auto;
font-size: 24rpx;
margin-top: 10rpx;
margin-top: -66rpx;
}
pre code {
margin: 0;
padding: 0;
display: block;
white-space: pre-wrap; /* 允许自动换行 */
word-break: break-word;
}
ol {
list-style: decimal-leading-zero;
padding-left: 60rpx;
}
.line-num {
display: inline-block;
text-align: right;
color: #666;
margin-right: 20rpx;
display: inline-block;
text-align: right;
}
</style>

View File

@@ -0,0 +1,323 @@
<template>
<view v-if="show" class="popup-container">
<view class="popup-content">
<!-- 标题 -->
<view class="title">岗位推荐</view>
<!-- 圆环 -->
<view class="circle-content" :style="{ height: contentHeight * 2 + 'rpx' }">
<!-- 渲染岗位标签 -->
<view class="tabs">
<!-- 动画 -->
<view
class="circle"
:style="{ height: circleDiameter * 2 + 'rpx', width: circleDiameter * 2 + 'rpx' }"
@click="serchforIt"
>
搜一搜
</view>
<view
v-for="(item, index) in jobList"
:key="index"
class="tab"
:style="getLabelStyle(index)"
@click="selectTab(item)"
>
{{ item.name }}
</view>
</view>
</view>
<!-- 关闭按钮 -->
<button class="close-btn" @click="closePopup">完成</button>
</view>
<!-- piker -->
<custom-popup :content-h="100" :visible="state.visible" :header="false">
<view class="popContent">
<view class="s-header">
<view class="heade-lf" @click="state.visible = false">取消</view>
<view class="heade-ri" @click="confimPopup">确认</view>
</view>
<view class="sex-content fl_1">
<expected-station
:search="false"
@onChange="changeJobTitleId"
:station="state.stations"
:max="5"
></expected-station>
</view>
</view>
</custom-popup>
</view>
</template>
<script setup>
import { ref, inject, computed, onMounted, defineProps, defineEmits, reactive } from 'vue';
import useUserStore from '@/stores/useUserStore';
const { $api, navTo, setCheckedNodes } = inject('globalFunction');
const { getUserResume } = useUserStore();
const props = defineProps({
show: Boolean, // 是否显示弹窗
jobList: Array, // 职位列表
});
const contentHeight = ref(373);
const circleDiameter = ref(113);
const screenWidth = ref(375); // 默认值,避免初始化报错
const screenHeight = ref(667);
const centerX = ref(187.5); // 圆心X
const centerY = ref(333.5); // 圆心Y
const radius = ref(120); // 圆半径
const tabPositions = ref([]); // 存储计算好的随机坐标
const emit = defineEmits(['update:show']);
const userInfo = ref({});
const state = reactive({
jobTitleId: '',
stations: [],
visible: false,
});
const closePopup = () => {
emit('update:show', false);
};
const updateScreenSize = () => {
const systemInfo = uni.getSystemInfoSync();
screenWidth.value = systemInfo.windowWidth;
screenHeight.value = systemInfo.windowHeight;
centerX.value = screenWidth.value / 2;
centerY.value = screenHeight.value / 2 - contentHeight.value / 2; // 让圆心稍微上移
};
function serchforIt() {
if (state.stations.length) {
state.visible = true;
return;
}
$api.createRequest('/app/common/jobTitle/treeselect', {}, 'GET').then((resData) => {
if (userInfo.value.jobTitleId) {
const ids = userInfo.value.jobTitleId.split(',').map((id) => Number(id));
setCheckedNodes(resData.data, ids);
}
state.jobTitleId = userInfo.value.jobTitleId;
state.stations = resData.data;
state.visible = true;
});
}
function confimPopup() {
$api.createRequest('/app/user/resume', { jobTitleId: state.jobTitleId }, 'post').then((resData) => {
$api.msg('完成');
state.visible = false;
getUserResume().then(() => {
initload();
});
});
}
function selectTab(item) {
console.log(item);
}
function changeJobTitleId(ids) {
state.jobTitleId = ids;
}
function getLabelStyle(index) {
// 基础半径(根据标签数量动态调整)
const baseRadius = Math.min(Math.max(props.jobList.length * 15, 130), screenWidth.value * 0.4);
// 基础角度间隔
const angleStep = 360 / props.jobList.length;
// 随机扰动参数
const randomRadius = baseRadius + Math.random() * 60 - 50;
const randomAngle = angleStep * index + Math.random() * 20 - 10;
// 极坐标转笛卡尔坐标
const radians = (randomAngle * Math.PI) / 180;
const x = Math.cos(radians) * randomRadius;
const y = Math.sin(radians) * randomRadius;
return {
left: `calc(50% + ${x}px)`,
top: `calc(50% + ${y}px)`,
transform: 'translate(-50%, -50%)',
};
}
onMounted(() => {
userInfo.value = useUserStore().userInfo;
updateScreenSize();
});
</script>
<style scoped>
/* 全屏弹窗 */
.popup-container {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.5);
overflow: hidden;
z-index: 999;
}
/* 弹窗内容 */
.popup-content {
position: relative;
width: 100%;
height: 100%;
background: linear-gradient(to bottom, #007aff, #005bbb);
text-align: center;
flex-direction: column;
display: flex;
justify-content: space-around;
align-items: center;
}
.title {
padding-left: 20rpx;
width: calc(100% - 20rpx);
height: 68rpx;
font-family: Inter, Inter;
font-weight: 400;
font-size: 56rpx;
color: #ffffff;
line-height: 65rpx;
text-align: left;
font-style: normal;
text-transform: none;
}
.circle-content {
width: 731rpx;
height: 747rpx;
position: relative;
}
.circle {
width: 225rpx;
height: 225rpx;
background: linear-gradient(145deg, #13c57c 0%, #8dc5ae 100%);
border-radius: 50%;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
font-weight: 400;
font-size: 35rpx;
color: #ffffff;
text-align: center;
line-height: 225rpx;
}
.circle::before,
.circle::after {
width: 225rpx;
height: 225rpx;
background: linear-gradient(145deg, #13c57c 0%, #8dc5ae 100%);
border-radius: 50%;
position: absolute;
left: 0;
top: 0;
z-index: -1;
content: '';
}
@keyframes larger2 {
0% {
transform: scale(1);
}
100% {
transform: scale(2.5);
opacity: 0;
}
}
.circle::after {
animation: larger1 2s infinite;
}
@keyframes larger1 {
0% {
transform: scale(1);
}
100% {
transform: scale(3.5);
opacity: 0;
}
}
.circle::before {
animation: larger2 2s infinite;
}
/* 岗位标签 */
.tabs {
position: relative;
width: 100%;
height: 100%;
border-radius: 50%;
z-index: 3;
}
.tab {
position: absolute;
white-space: nowrap;
padding: 8rpx 16rpx;
background: #fff;
border-radius: 40rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.15);
transition: all 0.5s ease;
}
/* 关闭按钮 */
.close-btn {
width: 549rpx;
line-height: 85rpx;
height: 85rpx;
background: #2ecc71;
color: #ffffff;
}
/* popup */
.popContent {
padding: 24rpx;
background: #4778ec;
height: calc(100% - 49rpx);
.sex-content {
border-radius: 20rpx;
width: 100%;
margin-top: 20rpx;
margin-bottom: 40rpx;
display: flex;
overflow: hidden;
height: calc(100% - 100rpx);
border: 1px solid #4778ec;
}
.s-header {
display: flex;
justify-content: space-between;
text-align: center;
font-size: 16px;
.heade-lf {
line-height: 30px;
width: 50px;
height: 30px;
border-radius: 4px;
border: 1px solid #666666;
color: #666666;
background: #ffffff;
}
.heade-ri {
line-height: 30px;
width: 50px;
height: 30px;
border-radius: 4px;
border: 1px solid #1b66ff;
background-color: #1b66ff;
color: #ffffff;
}
}
}
</style>

View File

@@ -0,0 +1,261 @@
<template>
<view v-if="show" class="modal-mask">
<view class="modal-container">
<!-- 头部 -->
<view class="modal-header">
<text class="back-btn" @click="handleClose">
<uni-icons type="left" size="24"></uni-icons>
</text>
<text class="modal-title">{{ title }}</text>
<view class="back-btn"></view>
</view>
<!-- 内容区域 -->
<view class="content-wrapper">
<!-- 左侧筛选类别 -->
<scroll-view class="filter-nav" scroll-y>
<view
v-for="(item, index) in filterOptions"
:key="index"
class="nav-item"
:class="{ active: activeTab === item.key }"
@click="scrollTo(item.key)"
>
{{ item.label }}
</view>
</scroll-view>
<!-- 右侧筛选内容 -->
<scroll-view class="filter-content" :scroll-into-view="activeTab" scroll-y>
<template v-for="(item, index) in filterOptions" :key="index">
<view class="content-item">
<view class="item-title" :id="item.key">{{ item.label }}</view>
<checkbox-group class="check-content" @change="(e) => handleSelect(item.key, e)">
<label
v-for="option in item.options"
:key="option.value"
class="checkbox-item"
:class="{ checkedstyle: selectedValues[item.key]?.includes(String(option.value)) }"
>
<checkbox
style="display: none"
:value="String(option.value)"
:checked="selectedValues[item.key]?.includes(String(option.value))"
/>
<text class="option-label">{{ option.label }}</text>
</label>
</checkbox-group>
</view>
</template>
</scroll-view>
</view>
<!-- 底部按钮 -->
<view class="modal-footer">
<button class="footer-btn" type="default" @click="handleClear">清除</button>
<button class="footer-btn" type="primary" @click="handleConfirm">确认</button>
</view>
</view>
</view>
</template>
<script setup>
import { ref, reactive, computed, onBeforeMount } from 'vue';
import useDictStore from '@/stores/useDictStore';
const { getTransformChildren } = useDictStore();
const props = defineProps({
show: Boolean,
title: {
type: String,
default: '筛选',
},
area: {
type: Boolean,
default: true,
},
});
const emit = defineEmits(['confirm', 'close', 'update:show']);
// 当前激活的筛选类别
const activeTab = ref('');
// 存储已选中的值 {key: [selectedValues]}
const selectedValues = reactive({});
const filterOptions = ref([]);
onBeforeMount(() => {
const arr = [
getTransformChildren('education', '学历要求'),
getTransformChildren('experience', '工作经验'),
getTransformChildren('scale', '公司规模'),
];
if (props.area) {
arr.push(getTransformChildren('area', '区域'));
}
filterOptions.value = arr;
activeTab.value = 'education';
});
// 处理选项选择
const handleSelect = (key, e) => {
selectedValues[key] = e.detail.value.map(String);
};
const scrollTo = (key) => {
activeTab.value = key;
};
// 清除所有选择
const handleClear = () => {
Object.keys(selectedValues).forEach((key) => {
selectedValues[key] = [];
});
};
// 确认筛选
function handleConfirm() {
emit('confirm', selectedValues);
handleClose();
}
// 关闭弹窗
const handleClose = () => {
emit('update:show', false);
emit('close');
};
</script>
<style lang="scss" scoped>
.modal-mask {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
}
.modal-container {
width: 100vw;
height: 100vh;
background-color: #fff;
overflow: hidden;
display: flex;
flex-direction: column;
}
.modal-header {
height: 88rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 32rpx;
border-bottom: 1rpx solid #eee;
position: relative;
.back-btn {
font-size: 36rpx;
width: 48rpx;
}
.modal-title {
font-size: 32rpx;
font-weight: 500;
}
}
.content-wrapper {
flex: 1;
display: flex;
overflow: hidden;
}
.filter-nav {
width: 200rpx;
background-color: #f5f5f5;
.nav-item {
height: 100rpx;
padding: 0 20rpx;
line-height: 100rpx;
font-size: 28rpx;
color: #666;
&.active {
background-color: #fff;
color: #007aff;
font-weight: bold;
}
}
}
.filter-content {
flex: 1;
padding: 20rpx;
.content-item {
margin-top: 40rpx;
.item-title {
width: 281rpx;
height: 52rpx;
font-family: Inter, Inter;
font-weight: 400;
font-size: 35rpx;
color: #000000;
line-height: 41rpx;
text-align: left;
font-style: normal;
text-transform: none;
}
}
.content-item:first-child {
margin-top: 0rpx;
}
.check-content {
display: grid;
grid-template-columns: 50% 50%;
place-items: center;
.checkbox-item {
display: flex;
align-items: center;
width: 228rpx;
height: 65rpx;
margin: 20rpx 20rpx 0 0;
text-align: center;
background-color: #d9d9d9;
.option-label {
font-size: 28rpx;
width: 100%;
}
}
.checkedstyle {
background-color: #007aff;
color: #ffffff;
}
}
}
.modal-footer {
height: 100rpx;
display: flex;
border-top: 1rpx solid #eee;
.footer-btn {
flex: 1;
margin: 0;
border-radius: 0;
line-height: 100rpx;
&:first-child {
border-right: 1rpx solid #eee;
}
}
}
</style>

View File

@@ -1,16 +0,0 @@
<template>
<view class="zhuo-tabs"></view>
</template>
<script lang="ts">
export default {
name: 'zhuo-tabs',
data() {
return {};
},
};
</script>
<style lang="stylus">
.zhuo-tabs
</style>

View File

@@ -1,9 +1,16 @@
export default {
baseUrl: '', // 测试
baseUrl: 'http://39.98.44.136:8080', // 测试
// sseAI+
StreamBaseURl: 'http://39.98.44.136:8000',
// 语音转文字
vioceBaseURl: 'ws://39.98.44.136:6006/speech-recognition',
DBversion: 3,
// 应用信息
appInfo: {
// 应用名称
name: "青岛市就业服务",
// AI名称
AIName: '小红',
// 应用版本
version: "1.0.0",
// 应用logo
@@ -20,5 +27,19 @@ export default {
url: ""
}
]
}
},
allowedFileNumber: 2,
allowedFileTypes: [
"text/plain", // .txt
"text/markdown", // .md
"text/html", // .html
"application/msword", // .doc
"application/vnd.openxmlformats-officedocument.wordprocessingml.document", // .docx
"application/pdf", // .pdf
"application/vnd.ms-powerpoint", // .ppt
"application/vnd.openxmlformats-officedocument.presentationml.presentation", // .pptx
"text/csv", // .csv
"application/vnd.ms-excel", // .xls
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" // .xlsx
]
}

475
hook/useRealtimeRecorder.js Normal file
View File

@@ -0,0 +1,475 @@
import {
ref,
onUnmounted
} from 'vue';
export function useAudioRecorder(wsUrl) {
// 状态变量
const isRecording = ref(false);
const isStopping = ref(false);
const isSocketConnected = ref(false);
const recordingDuration = ref(0);
const bufferPressure = ref(0); // 缓冲区压力 (0-100)
const currentInterval = ref(0); // 当前发送间隔
// 音频相关
const audioContext = ref(null);
const mediaStream = ref(null);
const workletNode = ref(null);
// 网络相关
const socket = ref(null);
const audioBuffer = ref([]);
const bufferInterval = ref(null);
// 配置常量
const SAMPLE_RATE = 16000;
const BASE_INTERVAL_MS = 300; // 基础发送间隔
const MIN_INTERVAL_MS = 100; // 最小发送间隔
const MAX_BUFFER_SIZE = 20; // 最大缓冲区块数
const PRESSURE_THRESHOLD = 0.7; // 加快发送的阈值 (70%)
// AudioWorklet处理器代码
const workletProcessorCode = `
class AudioProcessor extends AudioWorkletProcessor {
constructor(options) {
super();
this.sampleRate = options.processorOptions.sampleRate;
this.samplesPerChunk = Math.floor(this.sampleRate * 0.1); // 每100ms的样本数
this.buffer = new Int16Array(this.samplesPerChunk);
this.index = 0;
}
process(inputs) {
const input = inputs[0];
if (input.length > 0) {
const inputChannel = input[0];
for (let i = 0; i < inputChannel.length; i++) {
// 转换为16位PCM
this.buffer[this.index++] = Math.max(-32768, Math.min(32767, inputChannel[i] * 32767));
// 当缓冲区满时发送
if (this.index >= this.samplesPerChunk) {
this.port.postMessage({
audioData: this.buffer.buffer,
timestamp: Date.now()
}, [this.buffer.buffer]);
// 创建新缓冲区
this.buffer = new Int16Array(this.samplesPerChunk);
this.index = 0;
}
}
}
return true;
}
}
registerProcessor('audio-processor', AudioProcessor);
`;
// 初始化WebSocket连接
const initSocket = (wsUrl) => {
return new Promise((resolve, reject) => {
socket.value = new WebSocket(wsUrl);
socket.value.onopen = () => {
isSocketConnected.value = true;
console.log('WebSocket连接已建立');
resolve();
};
socket.value.onerror = (error) => {
console.error('WebSocket连接错误:', error);
reject(error);
};
socket.value.onclose = (event) => {
console.log(`WebSocket连接关闭代码: ${event.code}, 原因: ${event.reason}`);
isSocketConnected.value = false;
console.log('WebSocket连接已关闭');
};
});
};
// 计算动态发送间隔
const calculateDynamicInterval = () => {
const pressureFactor = bufferPressure.value / 100;
// 压力越大,间隔越小(发送越快)
return Math.max(
MIN_INTERVAL_MS,
BASE_INTERVAL_MS - (pressureFactor * (BASE_INTERVAL_MS - MIN_INTERVAL_MS))
);
};
// 发送缓冲的音频数据
const sendBufferedAudio = () => {
if (audioBuffer.value.length === 0 || !socket.value || socket.value.readyState !== WebSocket.OPEN) {
return;
}
try {
// 将缓冲区大小限制为8000字节 (小于8192)
const MAX_CHUNK_SIZE = 8000 / 2; // 16位 = 2字节所以4000个样本
let samplesToSend = [];
let totalSamples = 0;
// 收集不超过限制的样本
while (audioBuffer.value.length > 0 && totalSamples < MAX_CHUNK_SIZE) {
const buffer = audioBuffer.value[0];
const samples = new Int16Array(buffer);
const remainingSpace = MAX_CHUNK_SIZE - totalSamples;
if (samples.length <= remainingSpace) {
samplesToSend.push(samples);
totalSamples += samples.length;
audioBuffer.value.shift();
} else {
// 只取部分样本
samplesToSend.push(samples.slice(0, remainingSpace));
audioBuffer.value[0] = samples.slice(remainingSpace).buffer;
totalSamples = MAX_CHUNK_SIZE;
}
}
// 合并样本并发送
if (totalSamples > 0) {
const combined = new Int16Array(totalSamples);
let offset = 0;
samplesToSend.forEach(chunk => {
combined.set(chunk, offset);
offset += chunk.length;
});
socket.value.send(combined.buffer);
}
} catch (error) {
console.error('发送音频数据时出错:', error);
}
};
// 开始录音
const startRecording = async () => {
if (isRecording.value) return;
try {
// 重置状态
recordingDuration.value = 0;
audioBuffer.value = [];
bufferPressure.value = 0;
currentInterval.value = BASE_INTERVAL_MS;
console.log('正在初始化WebSocket连接...');
// 初始化WebSocket
await initSocket(wsUrl);
console.log('正在获取音频设备权限...');
// 获取音频流
mediaStream.value = await navigator.mediaDevices.getUserMedia({
audio: {
sampleRate: SAMPLE_RATE,
channelCount: 1,
echoCancellation: false,
noiseSuppression: false,
autoGainControl: false
},
video: false
});
console.log('正在初始化音频上下文...');
// 创建音频上下文
audioContext.value = new(window.AudioContext || window.webkitAudioContext)({
sampleRate: SAMPLE_RATE,
latencyHint: 'interactive'
});
// 注册AudioWorklet
const blob = new Blob([workletProcessorCode], {
type: 'application/javascript'
});
const workletUrl = URL.createObjectURL(blob);
await audioContext.value.audioWorklet.addModule(workletUrl);
URL.revokeObjectURL(workletUrl);
// 创建AudioWorkletNode
workletNode.value = new AudioWorkletNode(audioContext.value, 'audio-processor', {
numberOfInputs: 1,
numberOfOutputs: 1,
outputChannelCount: [1],
processorOptions: {
sampleRate: SAMPLE_RATE
}
});
// 处理音频数据
workletNode.value.port.onmessage = (e) => {
if (e.data.audioData instanceof ArrayBuffer) {
audioBuffer.value.push(e.data.audioData);
// 当缓冲区压力超过阈值时立即尝试发送
if (audioBuffer.value.length / MAX_BUFFER_SIZE > PRESSURE_THRESHOLD) {
sendBufferedAudio();
}
}
};
// 连接音频节点
const source = audioContext.value.createMediaStreamSource(mediaStream.value);
source.connect(workletNode.value);
workletNode.value.connect(audioContext.value.destination);
// 启动定时发送
bufferInterval.value = setInterval(sendBufferedAudio, currentInterval.value);
console.log('录音初始化完成,开始录制');
// 更新状态
isRecording.value = true;
console.log(`开始录音,采样率: ${audioContext.value.sampleRate}Hz`);
} catch (error) {
console.error('启动录音失败:', error);
cleanup();
throw error;
}
};
// 停止录音并保存
const stopRecording = async () => {
if (!isRecording.value || isStopping.value) return;
isStopping.value = true;
try {
// 停止定时器
if (bufferInterval.value) {
clearInterval(bufferInterval.value);
bufferInterval.value = null;
}
// 发送剩余音频数据
if (audioBuffer.value.length > 0) {
console.log(`正在发送剩余 ${audioBuffer.value.length} 个音频块...`);
sendBufferedAudio();
}
// 发送结束标记
if (socket.value?.readyState === WebSocket.OPEN) {
console.log('发送结束标记...');
socket.value.send(JSON.stringify({
action: 'end',
duration: recordingDuration.value
}));
// 等待数据发送完成
await new Promise((resolve) => {
if (socket.value.bufferedAmount === 0) {
resolve();
} else {
console.log(`等待 ${socket.value.bufferedAmount} 字节数据发送...`);
const timer = setInterval(() => {
if (socket.value.bufferedAmount === 0) {
clearInterval(timer);
resolve();
}
}, 50);
}
});
// 关闭连接
console.log('正在关闭WebSocket连接...');
socket.value.close();
}
cleanup();
console.log('录音已停止并保存');
} catch (error) {
console.error('停止录音时出错:', error);
throw error;
} finally {
isStopping.value = false;
}
};
// 取消录音
const cancelRecording = async () => {
if (!isRecording.value || isStopping.value) return;
isStopping.value = true;
try {
// 停止定时器
if (bufferInterval.value) {
clearInterval(bufferInterval.value);
bufferInterval.value = null;
}
// 发送取消标记
if (socket.value?.readyState === WebSocket.OPEN) {
console.log('发送结束标记...');
socket.value.send(JSON.stringify({
action: 'cancel'
}));
socket.value.close();
}
console.log('清理资源...');
cleanup();
console.log('录音已成功停止');
console.log('录音已取消');
} catch (error) {
console.error('取消录音时出错:', error);
throw error;
} finally {
isStopping.value = false;
}
};
// 清理资源
const cleanup = () => {
// 清除定时器
if (bufferInterval.value) {
clearInterval(bufferInterval.value);
bufferInterval.value = null;
}
// 关闭音频流
if (mediaStream.value) {
console.log('正在停止媒体流...');
mediaStream.value.getTracks().forEach(track => track.stop());
mediaStream.value = null;
}
// 断开音频节点
if (workletNode.value) {
workletNode.value.disconnect();
workletNode.value.port.onmessage = null;
workletNode.value = null;
}
// 关闭音频上下文
if (audioContext.value) {
if (audioContext.value.state !== 'closed') {
audioContext.value.close().catch(e => {
console.warn('关闭AudioContext时出错:', e);
});
}
audioContext.value = null;
}
// 清空缓冲区
audioBuffer.value = [];
bufferPressure.value = 0;
// 重置状态
isRecording.value = false;
isSocketConnected.value = false;
};
// 组件卸载时自动清理
onUnmounted(() => {
if (isRecording.value) {
cancelRecording();
}
});
return {
isRecording,
isStopping,
isSocketConnected,
recordingDuration,
bufferPressure,
currentInterval,
startRecording,
stopRecording,
cancelRecording
};
}
// import {
// ref
// } from 'vue'
// export function useRealtimeRecorder(wsUrl) {
// const isRecording = ref(false)
// const mediaRecorder = ref(null)
// const socket = ref(null)
// const recognizedText = ref('')
// const startRecording = async () => {
// if (!navigator.mediaDevices?.getUserMedia) {
// uni.showToast({
// title: '当前环境不支持录音',
// icon: 'none'
// })
// return
// }
// recognizedText.value = ''
// const stream = await navigator.mediaDevices.getUserMedia({
// audio: {
// sampleRate: 16000,
// channelCount: 1,
// echoCancellation: false,
// noiseSuppression: false,
// autoGainControl: false
// },
// video: false
// })
// socket.value = new WebSocket(wsUrl)
// socket.value.onopen = () => {
// console.log('[WebSocket] 连接已建立')
// }
// socket.value.onmessage = (event) => {
// recognizedText.value = JSON.parse(event.data).text
// }
// const recorder = new MediaRecorder(stream, {
// mimeType: 'audio/webm;codecs=opus',
// audioBitsPerSecond: 16000,
// })
// recorder.ondataavailable = (e) => {
// if (e.data.size > 0 && socket.value?.readyState === WebSocket.OPEN) {
// socket.value.send(e.data)
// }
// }
// recorder.start(300) // 每 300ms 发送一段数据
// mediaRecorder.value = recorder
// isRecording.value = true
// }
// const stopRecording = () => {
// mediaRecorder.value?.stop()
// mediaRecorder.value = null
// isRecording.value = false
// if (socket.value?.readyState === WebSocket.OPEN) {
// socket.value.send('[end]')
// socket.value.close()
// }
// }
// const cancelRecording = () => {
// mediaRecorder.value?.stop()
// mediaRecorder.value = null
// isRecording.value = false
// recognizedText.value = ''
// if (socket.value?.readyState === WebSocket.OPEN) {
// socket.value.send('[cancel]')
// socket.value.close()
// }
// }
// return {
// isRecording,
// recognizedText,
// startRecording,
// stopRecording,
// cancelRecording
// }
// }

129
hook/useRecorder.js Normal file
View File

@@ -0,0 +1,129 @@
// composables/useRealtimeRecorder.js
import {
ref
} from 'vue'
export function useRealtimeRecorder(wsUrl) {
const isRecording = ref(false)
const recognizedText = ref('')
let audioContext = null
let audioWorkletNode = null
let sourceNode = null
let socket = null
const startRecording = async () => {
const stream = await navigator.mediaDevices.getUserMedia({
audio: true
})
audioContext = new(window.AudioContext || window.webkitAudioContext)()
const processorCode = `
class RecorderProcessor extends AudioWorkletProcessor {
constructor() {
super()
this.buffer = []
this.inputSampleRate = sampleRate
this.targetSampleRate = 16000
}
process(inputs) {
const input = inputs[0][0]
if (!input) return true
this.buffer.push(...input)
const requiredSamples = this.inputSampleRate / 10 // 100ms
if (this.buffer.length >= requiredSamples) {
const resampled = this.downsample(this.buffer, this.inputSampleRate, this.targetSampleRate)
const int16Buffer = this.floatTo16BitPCM(resampled)
this.port.postMessage(int16Buffer)
this.buffer = []
}
return true
}
downsample(buffer, inRate, outRate) {
if (outRate === inRate) return buffer
const ratio = inRate / outRate
const len = Math.floor(buffer.length / ratio)
const result = new Float32Array(len)
for (let i = 0; i < len; i++) {
const start = Math.floor(i * ratio)
const end = Math.floor((i + 1) * ratio)
let sum = 0
for (let j = start; j < end && j < buffer.length; j++) sum += buffer[j]
result[i] = sum / (end - start)
}
return result
}
floatTo16BitPCM(input) {
const output = new Int16Array(input.length)
for (let i = 0; i < input.length; i++) {
const s = Math.max(-1, Math.min(1, input[i]))
output[i] = s < 0 ? s * 0x8000 : s * 0x7FFF
}
return output.buffer
}
}
registerProcessor('recorder-processor', RecorderProcessor)
`
const blob = new Blob([processorCode], {
type: 'application/javascript'
})
const blobUrl = URL.createObjectURL(blob)
await audioContext.audioWorklet.addModule(blobUrl)
socket = new WebSocket(wsUrl)
socket.onmessage = (e) => {
recognizedText.value = e.data
}
sourceNode = audioContext.createMediaStreamSource(stream)
audioWorkletNode = new AudioWorkletNode(audioContext, 'recorder-processor')
audioWorkletNode.port.onmessage = (e) => {
const audioData = e.data
if (socket && socket.readyState === WebSocket.OPEN) {
socket.send(audioData)
}
}
sourceNode.connect(audioWorkletNode)
audioWorkletNode.connect(audioContext.destination)
isRecording.value = true
}
const stopRecording = () => {
sourceNode?.disconnect()
audioWorkletNode?.disconnect()
audioContext?.close()
if (socket?.readyState === WebSocket.OPEN) {
socket.send('[end]')
socket.close()
}
audioContext = null
sourceNode = null
audioWorkletNode = null
socket = null
isRecording.value = false
}
const cancelRecording = () => {
stopRecording()
recognizedText.value = ''
}
return {
isRecording,
recognizedText,
startRecording,
stopRecording,
cancelRecording
}
}

View File

@@ -1,20 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/main.js"></script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
<!-- <script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
<script>
var vConsole = new window.VConsole();
vConsole.destroy();
</script -->
</head>
<body>
<!-- <script src="https://unpkg.com/vconsole/dist/vconsole.min.js"></script>
<script>
var vConsole = new window.VConsole();
</script> -->
<div id="app"><!--app-html--></div>
<script type="module" src="/main.js"></script>
</body>
</html>

BIN
lib/.DS_Store vendored Normal file

Binary file not shown.

9
lib/dompurify@3.2.4es.js Normal file

File diff suppressed because one or more lines are too long

10
lib/highlight/github-dark.min.css vendored Normal file
View File

@@ -0,0 +1,10 @@
pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!
Theme: GitHub Dark
Description: Dark theme as seen on github.com
Author: github.com
Maintainer: @Hirse
Updated: 2021-05-15
Outdated base version: https://github.com/primer/github-syntax-dark
Current colors taken from GitHub's CSS
*/.hljs{color:#c9d1d9;background:#0d1117}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#ff7b72}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#d2a8ff}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#79c0ff}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#a5d6ff}.hljs-built_in,.hljs-symbol{color:#ffa657}.hljs-code,.hljs-comment,.hljs-formula{color:#8b949e}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#7ee787}.hljs-subst{color:#c9d1d9}.hljs-section{color:#1f6feb;font-weight:700}.hljs-bullet{color:#f2cc60}.hljs-emphasis{color:#c9d1d9;font-style:italic}.hljs-strong{color:#c9d1d9;font-weight:700}.hljs-addition{color:#aff5b4;background-color:#033a16}.hljs-deletion{color:#ffdcd7;background-color:#67060c}

5256
lib/highlight/highlight-uni.min.js vendored Normal file

File diff suppressed because one or more lines are too long

352
lib/html-parser.js Normal file
View File

@@ -0,0 +1,352 @@
/*
* HTML5 Parser By Sam Blowes
*
* Designed for HTML5 documents
*
* Original code by John Resig (ejohn.org)
* http://ejohn.org/blog/pure-javascript-html-parser/
* Original code by Erik Arvidsson, Mozilla Public License
* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
*
* ----------------------------------------------------------------------------
* License
* ----------------------------------------------------------------------------
*
* This code is triple licensed using Apache Software License 2.0,
* Mozilla Public License or GNU Public License
*
* ////////////////////////////////////////////////////////////////////////////
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* ////////////////////////////////////////////////////////////////////////////
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Simple HTML Parser.
*
* The Initial Developer of the Original Code is Erik Arvidsson.
* Portions created by Erik Arvidssson are Copyright (C) 2004. All Rights
* Reserved.
*
* ////////////////////////////////////////////////////////////////////////////
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ----------------------------------------------------------------------------
* Usage
* ----------------------------------------------------------------------------
*
* // Use like so:
* HTMLParser(htmlString, {
* start: function(tag, attrs, unary) {},
* end: function(tag) {},
* chars: function(text) {},
* comment: function(text) {}
* });
*
* // or to get an XML string:
* HTMLtoXML(htmlString);
*
* // or to get an XML DOM Document
* HTMLtoDOM(htmlString);
*
* // or to inject into an existing document/DOM node
* HTMLtoDOM(htmlString, document);
* HTMLtoDOM(htmlString, document.body);
*
*/
// Regular Expressions for parsing tags and attributes
var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
var endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/;
var attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; // Empty Elements - HTML 5
var empty = makeMap('area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr'); // Block Elements - HTML 5
// fixed by xxx 将 ins 标签从块级名单中移除
var block = makeMap('a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video'); // Inline Elements - HTML 5
var inline = makeMap('abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var'); // Elements that you can, intentionally, leave open
// (and which close themselves)
var closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'); // Attributes that have their values filled in disabled="disabled"
var fillAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'); // Special Elements (can contain anything)
var special = makeMap('script,style');
function HTMLParser(html, handler) {
var index;
var chars;
var match;
var stack = [];
var last = html;
stack.last = function () {
return this[this.length - 1];
};
while (html) {
chars = true; // Make sure we're not in a script or style element
if (!stack.last() || !special[stack.last()]) {
// Comment
if (html.indexOf('<!--') == 0) {
index = html.indexOf('-->');
if (index >= 0) {
if (handler.comment) {
handler.comment(html.substring(4, index));
}
html = html.substring(index + 3);
chars = false;
} // end tag
} else if (html.indexOf('</') == 0) {
match = html.match(endTag);
if (match) {
html = html.substring(match[0].length);
match[0].replace(endTag, parseEndTag);
chars = false;
} // start tag
} else if (html.indexOf('<') == 0) {
match = html.match(startTag);
if (match) {
html = html.substring(match[0].length);
match[0].replace(startTag, parseStartTag);
chars = false;
}
}
if (chars) {
index = html.indexOf('<');
var text = index < 0 ? html : html.substring(0, index);
html = index < 0 ? '' : html.substring(index);
if (handler.chars) {
handler.chars(text);
}
}
} else {
html = html.replace(new RegExp('([\\s\\S]*?)<\/' + stack.last() + '[^>]*>'), function (all, text) {
text = text.replace(/<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g, '$1$2');
if (handler.chars) {
handler.chars(text);
}
return '';
});
parseEndTag('', stack.last());
}
if (html == last) {
throw 'Parse Error: ' + html;
}
last = html;
} // Clean up any remaining tags
parseEndTag();
function parseStartTag(tag, tagName, rest, unary) {
tagName = tagName.toLowerCase();
if (block[tagName]) {
while (stack.last() && inline[stack.last()]) {
parseEndTag('', stack.last());
}
}
if (closeSelf[tagName] && stack.last() == tagName) {
parseEndTag('', tagName);
}
unary = empty[tagName] || !!unary;
if (!unary) {
stack.push(tagName);
}
if (handler.start) {
var attrs = [];
rest.replace(attr, function (match, name) {
var value = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : fillAttrs[name] ? name : '';
attrs.push({
name: name,
value: value,
escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') // "
});
});
if (handler.start) {
handler.start(tagName, attrs, unary);
}
}
}
function parseEndTag(tag, tagName) {
// If no tag name is provided, clean shop
if (!tagName) {
var pos = 0;
} // Find the closest opened tag of the same type
else {
for (var pos = stack.length - 1; pos >= 0; pos--) {
if (stack[pos] == tagName) {
break;
}
}
}
if (pos >= 0) {
// Close all the open elements, up the stack
for (var i = stack.length - 1; i >= pos; i--) {
if (handler.end) {
handler.end(stack[i]);
}
} // Remove the open elements from the stack
stack.length = pos;
}
}
}
function makeMap(str) {
var obj = {};
var items = str.split(',');
for (var i = 0; i < items.length; i++) {
obj[items[i]] = true;
}
return obj;
}
function removeDOCTYPE(html) {
return html.replace(/<\?xml.*\?>\n/, '').replace(/<!doctype.*>\n/, '').replace(/<!DOCTYPE.*>\n/, '');
}
function parseAttrs(attrs) {
return attrs.reduce(function (pre, attr) {
var value = attr.value;
var name = attr.name;
if (pre[name]) {
pre[name] = pre[name] + " " + value;
} else {
pre[name] = value;
}
return pre;
}, {});
}
function parseHtml(html) {
html = removeDOCTYPE(html);
var stacks = [];
var results = {
node: 'root',
children: []
};
HTMLParser(html, {
start: function start(tag, attrs, unary) {
var node = {
name: tag
};
if (attrs.length !== 0) {
node.attrs = parseAttrs(attrs);
}
if (unary) {
var parent = stacks[0] || results;
if (!parent.children) {
parent.children = [];
}
parent.children.push(node);
} else {
stacks.unshift(node);
}
},
end: function end(tag) {
var node = stacks.shift();
if (node.name !== tag) console.error('invalid state: mismatch end tag');
if (stacks.length === 0) {
results.children.push(node);
} else {
var parent = stacks[0];
if (!parent.children) {
parent.children = [];
}
parent.children.push(node);
}
},
chars: function chars(text) {
var node = {
type: 'text',
text: text
};
if (stacks.length === 0) {
results.children.push(node);
} else {
var parent = stacks[0];
if (!parent.children) {
parent.children = [];
}
parent.children.push(node);
}
},
comment: function comment(text) {
var node = {
node: 'comment',
text: text
};
var parent = stacks[0];
if (!parent.children) {
parent.children = [];
}
parent.children.push(node);
}
});
return results.children;
}
export default parseHtml;

2
lib/markdown-it.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
lib/string-similarity.min.js vendored Normal file
View File

@@ -0,0 +1 @@
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.stringSimilarity=e():t.stringSimilarity=e()}(self,(function(){return t={138:t=>{function e(t,e){if((t=t.replace(/\s+/g,""))===(e=e.replace(/\s+/g,"")))return 1;if(t.length<2||e.length<2)return 0;let r=new Map;for(let e=0;e<t.length-1;e++){const n=t.substring(e,e+2),o=r.has(n)?r.get(n)+1:1;r.set(n,o)}let n=0;for(let t=0;t<e.length-1;t++){const o=e.substring(t,t+2),s=r.has(o)?r.get(o):0;s>0&&(r.set(o,s-1),n++)}return 2*n/(t.length+e.length-2)}t.exports={compareTwoStrings:e,findBestMatch:function(t,r){if(!function(t,e){return"string"==typeof t&&!!Array.isArray(e)&&!!e.length&&!e.find((function(t){return"string"!=typeof t}))}(t,r))throw new Error("Bad arguments: First argument should be a string, second should be an array of strings");const n=[];let o=0;for(let s=0;s<r.length;s++){const i=r[s],f=e(t,i);n.push({target:i,rating:f}),f>n[o].rating&&(o=s)}return{ratings:n,bestMatch:n[o],bestMatchIndex:o}}}}},e={},function r(n){if(e[n])return e[n].exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}(138);var t,e}));

132
lib/uuid-min.js vendored Normal file
View File

@@ -0,0 +1,132 @@
/**
* Minified by jsDelivr using Terser v5.19.2.
* Original file: /npm/uuidjs@5.1.0/dist/uuid.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
/**
* UUID.js - RFC-compliant UUID Generator for JavaScript
*
* @author LiosK
* @version v5.1.0
* @license Apache License 2.0: Copyright (c) 2010-2024 LiosK
* @packageDocumentation
*/
var _a;
export class UUID {
static generate() {
var e = _a._getRandomInt,
t = _a._hexAligner;
return t(e(32), 8) + '-' + t(e(16), 4) + '-' + t(16384 | e(12), 4) + '-' + t(32768 | e(14), 4) + '-' + t(e(48), 12);
}
static _getRandomInt(e) {
if (e < 0 || e > 53) return NaN;
var t = 0 | (1073741824 * Math.random());
return e > 30 ? t + 1073741824 * (0 | (Math.random() * (1 << (e - 30)))) : t >>> (30 - e);
}
static _hexAligner(e, t) {
for (var a = e.toString(16), i = t - a.length, n = '0'; i > 0; i >>>= 1, n += n) 1 & i && (a = n + a);
return a;
}
static useMathRandom() {
_a._getRandomInt = _a._mathPRNG;
}
static genV4() {
var e = _a._getRandomInt;
return new _a(e(32), e(16), 16384 | e(12), 128 | e(6), e(8), e(48));
}
static parse(e) {
var t;
if ((t = /^\s*(urn:uuid:|\{)?([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})(\})?\s*$/i.exec(e))) {
var a = t[1] || '',
i = t[8] || '';
if (a + i === '' || ('{' === a && '}' === i) || ('urn:uuid:' === a.toLowerCase() && '' === i))
return new _a(parseInt(t[2], 16), parseInt(t[3], 16), parseInt(t[4], 16), parseInt(t[5], 16), parseInt(t[6], 16), parseInt(t[7], 16));
}
return null;
}
constructor(e, t, a, i, n, s) {
var r = _a.FIELD_NAMES,
_ = _a.FIELD_SIZES,
h = _a._binAligner,
d = _a._hexAligner;
(this.intFields = new Array(6)), (this.bitFields = new Array(6)), (this.hexFields = new Array(6));
for (var o = 0; o < 6; o++) {
var u = parseInt(arguments[o] || 0);
(this.intFields[o] = this.intFields[r[o]] = u), (this.bitFields[o] = this.bitFields[r[o]] = h(u, _[o])), (this.hexFields[o] = this.hexFields[r[o]] = d(u, _[o] >>> 2));
}
(this.version = (this.intFields.timeHiAndVersion >>> 12) & 15),
(this.bitString = this.bitFields.join('')),
(this.hexNoDelim = this.hexFields.join('')),
(this.hexString = this.hexFields[0] + '-' + this.hexFields[1] + '-' + this.hexFields[2] + '-' + this.hexFields[3] + this.hexFields[4] + '-' + this.hexFields[5]),
(this.urn = 'urn:uuid:' + this.hexString);
}
static _binAligner(e, t) {
for (var a = e.toString(2), i = t - a.length, n = '0'; i > 0; i >>>= 1, n += n) 1 & i && (a = n + a);
return a;
}
toString() {
return this.hexString;
}
equals(e) {
if (!(e instanceof _a)) return !1;
for (var t = 0; t < 6; t++) if (this.intFields[t] !== e.intFields[t]) return !1;
return !0;
}
static genV1() {
null == _a._state && (_a._state = new UUIDState());
var e = new Date().getTime(),
t = _a._state;
e != t.timestamp ? (e < t.timestamp && t.sequence++, (t.timestamp = e), (t.tick = _a._getRandomInt(12))) : t.tick < 9992 ? (t.tick += 1 + _a._getRandomInt(3)) : t.sequence++;
var a = _a._getTimeFieldValues(t.timestamp),
i = a.low + t.tick,
n = (4095 & a.hi) | 4096;
t.sequence &= 16383;
var s = (t.sequence >>> 8) | 128,
r = 255 & t.sequence;
return new _a(i, a.mid, n, s, r, t.node);
}
static resetState() {
_a._state = new UUIDState();
}
static _getTimeFieldValues(e) {
var t = e - Date.UTC(1582, 9, 15),
a = ((t / 4294967296) * 1e4) & 268435455;
return { low: (1e4 * (268435455 & t)) % 4294967296, mid: 65535 & a, hi: a >>> 16, timestamp: t };
}
static genV6() {
null == _a._state && (_a._state = new UUIDState());
var e = new Date().getTime(),
t = _a._state;
e != t.timestamp ? (e < t.timestamp && t.sequence++, (t.timestamp = e), (t.tick = _a._getRandomInt(12))) : t.tick < 9992 ? (t.tick += 1 + _a._getRandomInt(3)) : t.sequence++;
var a = t.timestamp - Date.UTC(1582, 9, 15),
i = Math.floor((a / 268435456) * 1e4) % 4294967296,
n = ((1e4 * (268435455 & a)) & 268435455) + t.tick,
s = n >>> 12,
r = (4095 & n) | 24576;
t.sequence &= 16383;
var _ = (t.sequence >>> 8) | 128,
h = 255 & t.sequence;
return new _a(i, s, r, _, h, t.node);
}
}
(_a = UUID),
(UUID._mathPRNG = _a._getRandomInt),
'undefined' != typeof crypto &&
crypto.getRandomValues &&
(_a._getRandomInt = (e) => {
if (e < 0 || e > 53) return NaN;
var t = new Uint32Array(e > 32 ? 2 : 1);
return crypto.getRandomValues(t), e > 32 ? t[0] + 4294967296 * (t[1] >>> (64 - e)) : t[0] >>> (32 - e);
}),
(UUID.FIELD_NAMES = ['timeLow', 'timeMid', 'timeHiAndVersion', 'clockSeqHiAndReserved', 'clockSeqLow', 'node']),
(UUID.FIELD_SIZES = [32, 16, 16, 8, 8, 48]),
(UUID.NIL = new _a(0, 0, 0, 0, 0, 0)),
(UUID._state = null);
class UUIDState {
constructor() {
var e = UUID._getRandomInt;
(this.timestamp = 0), (this.tick = 0), (this.sequence = e(14)), (this.node = 1099511627776 * (1 | e(8)) + e(40));
}
}
//# sourceMappingURL=/sm/14547599d24239455943f4481cadea00302ff64afee28ff8598a7fb36c36ddc0.map

22
main.js
View File

@@ -1,16 +1,26 @@
import App from './App'
import App from '@/App'
import * as Pinia from 'pinia'
import globalFunction from './common/globalFunction'
import request from './utils/request'
import globalFunction from '@/common/globalFunction'
import '@/lib/string-similarity.min.js'
import similarityJobs from '@/utils/similarity_Job.js';
import NoBouncePage from '@/components/NoBouncePage/NoBouncePage.vue'
import {
createSSRApp
createSSRApp,
} from 'vue'
// 全局组件
export function createApp() {
const app = createSSRApp(App)
app.use(Pinia.createPinia());
app.provide('globalFunction', globalFunction);
app.component('NoBouncePage', NoBouncePage)
app.provide('globalFunction', {
...globalFunction,
similarityJobs
});
app.provide('deviceInfo', globalFunction.getdeviceInfo());
app.use(Pinia.createPinia());
return {
app,
Pinia

View File

@@ -1,7 +1,7 @@
{
"name": "qingdao-employment-service",
"appid": "__UNI__C939371",
"description": "",
"description": "招聘",
"versionName": "1.0.0",
"versionCode": "100",
"transformPx": false,
@@ -77,5 +77,29 @@
"enable": false
},
"vueVersion": "3",
"locale": "zh-Hans"
"locale": "zh-Hans",
"h5": {
"router": {
"base": "/app/",
"mode": "hash"
},
"title": "青岛智慧就业服务",
"optimization": {
"treeShaking": {
"enable": true
}
},
"sdkConfigs": {
"maps": {
"amap": {
"key": "9cfc9370bd8a941951da1cea0308e9e3",
"securityJsCode": "7b16386c7f744c3ca05595965f2b037f",
"serviceHost": ""
}
}
},
"unipush": {
"enable": true
}
}
}

View File

@@ -1,19 +0,0 @@
{
"id": "arc-slider",
"name": "弧形滑动选择器",
"displayName": "弧形滑动选择器",
"version": "3.0.1",
"description": "弧形滑动选择器",
"keywords": [
"弧线",
"选择器",
"滑动",
"滑动选择器"
],
"dcloudext": {
"category": [
"前端组件",
"通用组件"
]
}
}

View File

@@ -0,0 +1,145 @@
<template>
<view class="collection-content">
<view class="one-cards">
<view class="card-box" v-for="(item, index) in pageState.list" :key="index" @click="navToPost(item.jobId)">
<view class="box-row mar_top0">
<view class="row-left">{{ item.jobTitle }}</view>
<view class="row-right">
<Salary-Expectation
:max-salary="item.maxSalary"
:min-salary="item.minSalary"
></Salary-Expectation>
</view>
</view>
<view class="box-row">
<view class="row-left">
<view class="row-tag" v-if="item.educatio">
<dict-Label dictType="education" :value="item.education"></dict-Label>
</view>
<view class="row-tag" v-if="item.experience">
<dict-Label dictType="experience" :value="item.experience"></dict-Label>
</view>
</view>
</view>
<view class="box-row mar_top0">
<view class="row-item mineText">{{ item.postingDate || '发布日期' }}</view>
<view class="row-item mineText">{{ vacanciesTo(item.vacancies) }}</view>
<view class="row-item mineText textblue"><matchingDegree :job="item"></matchingDegree></view>
<view class="row-item">
<!-- <uni-icons type="star" size="28"></uni-icons> -->
<!-- <uni-icons type="star-filled" color="#FFCB47" size="30"></uni-icons> -->
</view>
</view>
<view class="box-row">
<view class="row-left mineText">{{ item.companyName }}</view>
<view class="row-right mineText">
青岛
<dict-Label dictType="area" :value="item.jobLocationAreaCode"></dict-Label>
<!-- 550m -->
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import dictLabel from '@/components/dict-Label/dict-Label.vue';
import { reactive, inject, watch, ref, onMounted } from 'vue';
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
import useUserStore from '@/stores/useUserStore';
const { $api, navTo, vacanciesTo } = inject('globalFunction');
const userStore = useUserStore();
const state = reactive({});
const pageState = reactive({
page: 0,
list: [],
total: 0,
maxPage: 1,
pageSize: 10,
});
onLoad(() => {
console.log('onLoad');
// $api.sleep(2000).then(() => {
// navTo('/pages/login/login');
// });
getJobList();
});
onReachBottom(() => {
getJobList();
});
function navToPost(jobId) {
navTo(`/packageA/pages/post/post?jobId=${btoa(jobId)}`);
}
function getJobList(type = 'add') {
if (type === 'refresh') {
pageState.page = 0;
pageState.maxPage = 1;
}
if (type === 'add' && pageState.page < pageState.maxPage) {
pageState.page += 1;
}
let params = {
current: pageState.page,
pageSize: pageState.pageSize,
};
$api.createRequest('/app/user/apply/job', params).then((resData) => {
const { rows, total } = resData;
if (type === 'add') {
const str = pageState.pageSize * (pageState.page - 1);
const end = pageState.list.length;
const reslist = rows;
pageState.list.splice(str, end, ...reslist);
} else {
pageState.list = rows;
}
// pageState.list = resData.rows;
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
});
}
</script>
<style lang="stylus">
.collection-content
padding: 20rpx 0 20rpx 0;
.one-cards
display: flex;
flex-direction: column;
padding: 0 20rpx;
.card-box
width: calc(100% - 36rpx - 36rpx);
border-radius: 0rpx 0rpx 0rpx 0rpx;
background: #FFFFFF;
border-radius: 17rpx;
padding: 15rpx 36rpx;
margin-top: 24rpx;
.box-row
display: flex;
justify-content: space-between;
margin-top: 8rpx;
align-items: center;
.mineText
font-weight: 400;
font-size: 21rpx;
color: #606060;
.textblue
color: #4778EC;
.row-left
display: flex;
justify-content: space-between;
.row-tag
background: #13C57C;
border-radius: 17rpx 17rpx 17rpx 17rpx;
font-size: 21rpx;
color: #FFFFFF;
line-height: 25rpx;
text-align: center;
padding: 4rpx 8rpx;
margin-right: 23rpx;
.card-box:first-child
margin-top: 6rpx;
</style>

View File

@@ -2,13 +2,16 @@
<view class="container">
<!-- 单位基本信息 -->
<view class="company-header">
<text class="company-name">湖南沃森电器科技有限公司</text>
<text class="company-name">{{ companyInfo.name }}</text>
<view class="company-info">
<view class="location">
<uni-icons type="location-filled" color="#4778EC" size="24"></uni-icons>
青岛 青岛经济技术开发区
青岛 {{ companyInfo.location }}
</view>
<view class="industry" style="display: inline-block">
{{ companyInfo.industry }}
<dict-Label dictType="scale" :value="companyInfo.scale"></dict-Label>
</view>
<text class="industry">制造业 100-299</text>
</view>
</view>
<view class="hr"></view>
@@ -16,73 +19,89 @@
<view class="company-description">
<view class="section-title">单位介绍</view>
<text class="description">
我司在永磁同步电机行业技术优势明显最高载频达24kHZ最高运行频率3000HZ最高运行转速达到180000rpm
{{ companyInfo.description }}
</text>
</view>
<!-- 在招职位 -->
<view class="job-list">
<text class="section-title">在招职位</text>
<view class="job-row" v-for="job in jobs" :key="job.id">
<view
class="job-row"
v-for="job in pageState.list"
:key="job.id"
@click="navTo(`/packageA/pages/post/post?jobId=${job.jobId}`)"
>
<view class="left">
<text class="job-title">{{ job.title }}</text>
<text class="job-title">{{ job.jobTitle }}</text>
<view class="job-tags">
<view class="tag" v-for="tag in job.tags" :key="tag">{{ tag }}</view>
<!-- <view class="tag" v-for="tag in job.tags" :key="tag">{{ tag }}</view> -->
<view class="tag">
<dict-Label dictType="education" :value="job.education"></dict-Label>
</view>
<view class="tag">
<dict-Label dictType="experience" :value="job.experience"></dict-Label>
</view>
<view class="tag">{{ job.vacancies }}</view>
</view>
<text class="location">{{ job.location }}</text>
<text class="location">
青岛
<dict-Label dictType="area" :value="job.jobLocationAreaCode"></dict-Label>
</text>
</view>
<view class="right">
<text class="salary">{{ job.salary }}</text>
<text class="hot" v-if="job.hot">🔥</text>
<text class="salary">{{ job.minSalary }}-{{ job.maxSalary }}/</text>
<text class="hot" v-if="job.isHot">🔥</text>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
jobs: [
{
id: 1,
title: '销售工程师-高级销售经理',
tags: ['本科', '3-5年', '15人', '本科', '3-5年', '15人'],
company: '湖南沃森电气科技有限公司',
location: '青岛 青岛经济技术开发区',
salary: '1万-2万',
hot: true,
},
{
id: 2,
title: '销售工程师-初级销售经理',
tags: ['本科', '3-5年', '15人'],
company: '湖南沃森电气科技有限公司',
location: '青岛 青岛经济技术开发区',
salary: '5千-1万',
hot: true,
},
{
id: 3,
title: '销售助理',
tags: ['大专', '3-5年', '20人'],
company: '湖南沃森电气科技有限公司',
location: '青岛 青岛经济技术开发区',
salary: '5千-8千',
},
{
id: 4,
title: '销售客服',
tags: ['大专', '3-5年', '50人'],
company: '湖南沃森电气科技有限公司',
location: '青岛 青岛经济技术开发区',
salary: '5千-8千',
},
],
};
},
};
<script setup>
import { reactive, inject, watch, ref, onMounted } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import dictLabel from '@/components/dict-Label/dict-Label.vue';
const { $api, navTo } = inject('globalFunction');
const pageState = reactive({
page: 0,
list: [],
total: 0,
maxPage: 1,
pageSize: 10,
});
const companyInfo = ref({});
onLoad((options) => {
console.log(options);
getCompanyInfo(options.companyId);
});
function getCompanyInfo(id) {
$api.createRequest(`/app/company/${id}`).then((resData) => {
companyInfo.value = resData.data;
getJobsList();
});
}
function getJobsList(type = 'add') {
if (type === 'refresh') {
pageState.page = 0;
pageState.maxPage = 1;
}
if (type === 'add' && pageState.page < pageState.maxPage) {
pageState.page += 1;
}
let params = {
current: pageState.page,
pageSize: pageState.pageSize,
};
$api.createRequest(`/app/company/job/${companyInfo.value.companyId}`, params).then((resData) => {
const { rows, total } = resData;
pageState.list = resData.rows;
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
});
}
</script>
<style lang="stylus">

View File

@@ -0,0 +1,434 @@
<template>
<view class="collection-content">
<view class="collection-search">
<view class="search-content">
<input class="uni-input collInput" type="text" @confirm="searchCollection" >
<uni-icons class="iconsearch" color="#616161" type="search" size="20"></uni-icons>
</input>
</view>
<view class="search-date">
<view class="date-7days AllDay" v-if="state.isAll">
<view class="day" v-for="item in weekday" :key="item.weekday">
{{item.weekday}}
</view>
<!-- 日期 -->
<view class="day" v-for="(item, index) in monthDay" :key="index" :class="{active: item.fullDate === currentDay, nothemonth: !item.isCurrent, optional: findBrowseData(item.fullDate)}" @click="selectDay(item)">
{{item.day}}
</view>
<view class="monthSelect">
<uni-icons size="14" class="monthIcon"
:color="state.lastDisable ? '#e8e8e8' : '#333333'" type="left"
@click="changeMonth('lastmonth')"></uni-icons>
{{state.currentMonth}}
<uni-icons size="14" class="monthIcon"
:color="state.nextDisable ? '#e8e8e8' : '#333333'" type="right"
@click="changeMonth('nextmonth')"></uni-icons>
</view>
</view>
<view class="date-7days" v-else>
<view class="day" v-for="item in weekday" :key="item.weekday">
{{item.weekday}}
</view>
<!-- 日期 -->
<view class="day" v-for="(item, index) in weekday" :key="index" :class="{active: item.fullDate === currentDay, optional: findBrowseData(item.fullDate)}" @click="selectDay(item)">
{{item.day}}
</view>
</view>
<view class="downDate">
<uni-icons class="downIcon" v-if="state.isAll" type="up" color="#FFFFFF" size="17" @click="upDateList"></uni-icons>
<uni-icons class="downIcon" v-else type="down" color="#FFFFFF" size="18" @click="downDateList"></uni-icons>
</view>
</view>
</view>
<view class="one-cards">
<view
class="card-box "
v-for="(item, index) in pageState.list"
:key="index"
:class="{'card-transprent': item.isTitle}"
@click="navToPost(item.jobId)"
>
<view class="card-title" v-if="item.isTitle">{{item.title}}</view>
<view v-else>
<view class="box-row mar_top0">
<view class="row-left">{{ item.jobTitle }}</view>
<view class="row-right"><Salary-Expectation
:max-salary="item.maxSalary"
:min-salary="item.minSalary"
></Salary-Expectation></view>
</view>
<view class="box-row">
<view class="row-left">
<view class="row-tag" v-if="item.educatio">
<dict-Label dictType="education" :value="item.education"></dict-Label>
</view>
<view class="row-tag" v-if="item.experience">
<dict-Label dictType="experience" :value="item.experience"></dict-Label>
</view>
</view>
</view>
<view class="box-row mar_top0">
<view class="row-item mineText">{{ item.postingDate || '发布日期' }}</view>
<view class="row-item mineText">{{ vacanciesTo(item.vacancies) }}</view>
<view class="row-item mineText textblue"><matchingDegree :job="item"></matchingDegree></view>
<view class="row-item">
<!-- <uni-icons type="star" size="28"></uni-icons> -->
<!-- <uni-icons type="star-filled" color="#FFCB47" size="30"></uni-icons> -->
</view>
</view>
<view class="box-row">
<view class="row-left mineText">{{ item.companyName }}</view>
<view class="row-right mineText">
青岛
<dict-Label dictType="area" :value="item.jobLocationAreaCode"></dict-Label>
<!-- 550m -->
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import dictLabel from '@/components/dict-Label/dict-Label.vue';
import { reactive, inject, watch, ref, onMounted } from 'vue';
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
import useUserStore from '@/stores/useUserStore';
const { $api, navTo, vacanciesTo, getWeeksOfMonth, isFutureDate } = inject('globalFunction');
const userStore = useUserStore();
const state = reactive({
isAll: false,
fiveMonth: [],
currentMonth: '',
currentMonthNumber: 0,
lastDisable: false,
nextDisable: true,
});
const browseDate = ref('')
const weekday = ref([])
const monthDay = ref([])
const currentDay = ref('')
const pageState = reactive({
page: 0,
list: [],
total: 0,
maxPage: 1,
pageSize: 10,
search: {},
lastDate: ''
});
onLoad(() => {
getBrowseDate()
const five = getLastFiveMonths()
state.fiveMonth = five
state.currentMonth = five[0]
state.nextDisable = true
const today = new Date().toISOString().split('T')[0]
// currentDay.value = new Date().toISOString().split('T')[0]
state.currentMonthNumber = new Date().getMonth() + 1
weekday.value = getWeekFromDate(today)
getJobList('refresh');
});
onReachBottom(() => {
getJobList();
});
function navToPost(jobId) {
navTo(`/packageA/pages/post/post?jobId=${btoa(jobId)}`);
}
function findBrowseData(date) {
const reg = new RegExp(date, 'g')
return reg.test(browseDate.value)
}
function searchCollection(e) {
const value = e.detail.value
pageState.search.jobTitle = value
getJobList('refresh')
}
function selectDay(item) {
if(isFutureDate(item.fullDate) || !findBrowseData(item.fullDate)) {
$api.msg("这一天没有浏览记录")
} else {
pageState.search.startDate = getPreviousDay(item.fullDate)
pageState.search.endDate = item.fullDate
currentDay.value = item.fullDate
getJobList('refresh')
if(item.month !== state.currentMonthNumber) {
const today = new Date(item.fullDate);
monthDay.value = getWeeksOfMonth(today.getFullYear(), today.getMonth() + 1).flat(1);
if(item.month > state.currentMonthNumber) {
changeMonth('nextmonth')
} else {
changeMonth('lastmonth')
}
state.currentMonthNumber = item.month
}
}
}
function changeMonth(type) {
const currentIndex = state.fiveMonth.findIndex((item) => item === state.currentMonth)
switch(type) {
case 'lastmonth':
if(currentIndex === state.fiveMonth.length - 2) state.lastDisable = true
if(currentIndex === state.fiveMonth.length - 1) return
state.currentMonth = state.fiveMonth[currentIndex + 1]
state.nextDisable = false
$api.msg("上一月")
break
case 'nextmonth':
if(currentIndex === 1) state.nextDisable = true
if(currentIndex === 0) return
state.currentMonth = state.fiveMonth[currentIndex - 1]
state.lastDisable = false
$api.msg("下一月")
break
}
const today = new Date(state.currentMonth);
monthDay.value = getWeeksOfMonth(today.getFullYear(), today.getMonth() + 1).flat(1);
}
function downDateList(str) {
const today = new Date();
monthDay.value = getWeeksOfMonth(today.getFullYear(), today.getMonth() + 1).flat(1);
state.isAll = true
}
function getBrowseDate() {
$api.createRequest('/app/user/review/array').then((res) => {
browseDate.value = res.data.join(',')
})
}
function upDateList() {
if(currentDay.value) {
weekday.value = getWeekFromDate(currentDay.value)
}
state.isAll = false
}
function getJobList(type = 'add', loading = true) {
if (type === 'refresh') {
pageState.page = 1;
pageState.maxPage = 1;
}
if (type === 'add' && pageState.page < pageState.maxPage) {
pageState.page += 1;
}
let params = {
current: pageState.page,
pageSize: pageState.pageSize,
...pageState.search
};
$api.createRequest('/app/user/review', params, 'GET', loading).then((resData) => {
const { rows, total } = resData;
if (type === 'add') {
const str = pageState.pageSize * (pageState.page - 1);
const end = pageState.list.length;
const [reslist, lastDate] = $api.insertSortData(rows, 'reviewDate')
if(reslist.length) { // 日期监测是否一致
if (reslist[0].title === pageState.lastDate) {
reslist.shift()
}
}
pageState.list.splice(str, end, ...reslist);
pageState.lastDate = lastDate
} else {
const [reslist, lastDate] = $api.insertSortData(rows, 'reviewDate')
pageState.list = reslist
pageState.lastDate = lastDate
}
// pageState.list = resData.rows;
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
});
}
function getWeekFromDate(dateStr) {
const days = [];
const targetDate = new Date(dateStr);
const currentDay = targetDate.getDay(); // 获取星期几0 表示星期日)
const sundayIndex = currentDay === 0 ? 7 : currentDay; // 让星期日变为 7
// 计算本周的起始和结束日期
for (let i = 1; i <= 7; i++) {
const date = new Date(targetDate);
date.setDate(targetDate.getDate() - (sundayIndex - i)); // 计算日期
days.push({
weekday: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'][i - 1],
fullDate: date.toISOString().split('T')[0], // YYYY-MM-DD 格式
day: date.getDate(),
month: date.getMonth() + 1,
year: date.getFullYear(),
});
}
return days;
}
function getPreviousDay(dateStr) {
const date = new Date(dateStr);
date.setDate(date.getDate() - 1); // 减去一天
// 格式化成 YYYY-MM-DD
return date.toISOString().split('T')[0];
}
function getLastFiveMonths() {
const result = [];
const today = new Date();
for (let i = 0; i < 5; i++) {
const date = new Date(today);
date.setMonth(today.getMonth() - i); // 往前推 i 个月
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 补零
result.push(`${year}-${month}`);
}
return result;
}
</script>
<style lang="stylus">
.card-title
color: #5d5d5d;
font-weight: bold;
font-size: 24rpx
.nothemonth
color: #bfbfbf
.downDate
display: flex
align-items: center
justify-content: center
width: 100%
margin-top: 20rpx
.downIcon
background: #e8e8e8
border-radius: 50%
width: 40rpx
height: 40rpx
.AllDay
position: relative
padding-top: 70rpx
.monthSelect
position: absolute;
top: 0
left: 50%
transform: translate(-50%, 0)
text-align: center;
line-height: 50rpx
display: flex
align-items: center
justify-content: center
font-size: 28rpx
.monthIcon
padding: 0 10rpx
.date-7days
display: grid;
grid-template-columns: repeat(7, 1fr);
text-align: center
margin-top: 10rpx
font-size: 24rpx
grid-gap: 26rpx
.day
position: relative
z-index: 2
.active
color: #FFFFFF
.active::before
position: absolute
content: ''
top: 50%
left: 50%
transform: translate(-50%, -50%)
width: 40rpx
height: 40rpx
background: #4679ef
border-radius: 7rpx
z-index: -1
.optional::after
border 2rpx solid #4679ef
position: absolute
content: ''
top: 50%
left: 50%
border-radius: 10rpx
transform: translate(-50%, -50%)
width: 40rpx
height: 40rpx
z-index: -1
.collection-content
padding: 0 0 20rpx 0;
.collection-search
padding: 10rpx 20rpx;
.search-content
position: relative
.collInput
padding: 6rpx 10rpx 6rpx 50rpx;
background: #e8e8e8
border-radius: 10rpx
.iconsearch
position: absolute
left: 10rpx
top: 50%
transform: translate(0, -50%)
.one-cards
display: flex;
flex-direction: column;
padding: 0 20rpx;
.card-box
width: calc(100% - 36rpx - 36rpx);
border-radius: 0rpx 0rpx 0rpx 0rpx;
background: #FFFFFF;
border-radius: 17rpx;
padding: 15rpx 36rpx;
margin-top: 24rpx;
.box-row
display: flex;
justify-content: space-between;
margin-top: 8rpx;
align-items: center;
.mineText
font-weight: 400;
font-size: 21rpx;
color: #606060;
.textblue
color: #4778EC;
.row-left
display: flex;
justify-content: space-between;
.row-tag
background: #13C57C;
border-radius: 17rpx 17rpx 17rpx 17rpx;
font-size: 21rpx;
color: #FFFFFF;
line-height: 25rpx;
text-align: center;
padding: 4rpx 8rpx;
margin-right: 23rpx;
.card-box:first-child
margin-top: 6rpx;
.card-transprent
background: transparent !important;
.card-transprent:first-child
margin: 0 !important;
padding: 0 !important
</style>

View File

@@ -5,12 +5,18 @@
<!-- 格子布局 -->
<view class="grid-container">
<view class="grid-item blue">
<text class="title">事业单位</text>
<view class="status">已关注 </view>
<view
class="grid-item"
:style="{ backgroundColor: item.backgroudColor }"
v-for="item in list"
:key="item.companyCardId"
>
<text class="title">{{ item.name }}</text>
<view class="status" v-if="item.isCollection" @click="delCollectionCard(item)">已关注 </view>
<view class="status" v-else @click="CollectionCard(item)">特别关注</view>
</view>
<view class="grid-item green">
<!-- <view class="grid-item green">
<text class="title">银行招聘</text>
<view class="status">特别关注</view>
</view>
@@ -23,11 +29,45 @@
<view class="grid-item red">
<text class="title">中国500强</text>
<view class="status">特别关注</view>
</view>
</view> -->
</view>
</view>
</template>
<script setup>
import dictLabel from '@/components/dict-Label/dict-Label.vue';
import { reactive, inject, watch, ref, onMounted } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import useUserStore from '@/stores/useUserStore';
const { $api, navTo } = inject('globalFunction');
const list = ref([]);
onLoad(() => {
getPremiumList();
});
function CollectionCard(item) {
$api.createRequest(`/app/company/card/collection/${item.companyCardId}`, {}, 'PUT').then((resData) => {
getPremiumList();
$api.msg('关注成功');
});
}
function delCollectionCard(item) {
$api.createRequest(`/app/company/card/collection/${item.companyCardId}`, {}, 'DELETE').then((resData) => {
getPremiumList();
$api.msg('取消关注');
});
}
function getPremiumList() {
$api.createRequest('/app/company/card').then((resData) => {
const { rows, total } = resData;
list.value = rows;
});
}
</script>
<style lang="stylus" scoped>
/* 页面整体样式 */
.container

View File

@@ -0,0 +1,141 @@
<template>
<view class="collection-content">
<view class="one-cards">
<view class="card-box" v-for="(item, index) in pageState.list" :key="index" @click="navToPost(item.jobId)">
<view class="box-row mar_top0">
<view class="row-left">{{ item.jobTitle }}</view>
<view class="row-right">
<Salary-Expectation
:max-salary="item.maxSalary"
:min-salary="item.minSalary"
></Salary-Expectation>
</view>
</view>
<view class="box-row">
<view class="row-left">
<view class="row-tag" v-if="item.educatio">
<dict-Label dictType="education" :value="item.education"></dict-Label>
</view>
<view class="row-tag" v-if="item.experience">
<dict-Label dictType="experience" :value="item.experience"></dict-Label>
</view>
</view>
</view>
<view class="box-row mar_top0">
<view class="row-item mineText">{{ item.postingDate || '发布日期' }}</view>
<view class="row-item mineText">{{ vacanciesTo(item.vacancies) }}</view>
<view class="row-item mineText textblue"><matchingDegree :job="item"></matchingDegree></view>
<view class="row-item">
<!-- <uni-icons type="star" size="28"></uni-icons> -->
<!-- <uni-icons type="star-filled" color="#FFCB47" size="30"></uni-icons> -->
</view>
</view>
<view class="box-row">
<view class="row-left mineText">{{ item.companyName }}</view>
<view class="row-right mineText">
青岛
<dict-Label dictType="area" :value="item.jobLocationAreaCode"></dict-Label>
<!-- 550m -->
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import img from '/static/icon/filter.png';
import dictLabel from '@/components/dict-Label/dict-Label.vue';
import { reactive, inject, watch, ref, onMounted } from 'vue';
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
import useUserStore from '@/stores/useUserStore';
const { $api, navTo, vacanciesTo } = inject('globalFunction');
const userStore = useUserStore();
const state = reactive({});
const pageState = reactive({
page: 0,
list: [],
total: 0,
maxPage: 1,
pageSize: 10,
});
onLoad(() => {
getJobList();
});
onReachBottom(() => {
getJobList();
});
function navToPost(jobId) {
navTo(`/packageA/pages/post/post?jobId=${btoa(jobId)}`);
}
function getJobList(type = 'add') {
if (type === 'refresh') {
pageState.page = 0;
pageState.maxPage = 1;
}
if (type === 'add' && pageState.page < pageState.maxPage) {
pageState.page += 1;
}
let params = {
current: pageState.page,
pageSize: pageState.pageSize,
};
$api.createRequest('/app/user/collection/job', params).then((resData) => {
const { rows, total } = resData;
if (type === 'add') {
const str = pageState.pageSize * (pageState.page - 1);
const end = pageState.list.length;
const reslist = rows;
pageState.list.splice(str, end, ...reslist);
} else {
pageState.list = rows;
}
// pageState.list = resData.rows;
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
});
}
</script>
<style lang="stylus">
.collection-content
padding: 20rpx 0 20rpx 0;
.one-cards
display: flex;
flex-direction: column;
padding: 0 20rpx;
.card-box
width: calc(100% - 36rpx - 36rpx);
border-radius: 0rpx 0rpx 0rpx 0rpx;
background: #FFFFFF;
border-radius: 17rpx;
padding: 15rpx 36rpx;
margin-top: 24rpx;
.box-row
display: flex;
justify-content: space-between;
margin-top: 8rpx;
align-items: center;
.mineText
font-weight: 400;
font-size: 21rpx;
color: #606060;
.textblue
color: #4778EC;
.row-left
display: flex;
justify-content: space-between;
.row-tag
background: #13C57C;
border-radius: 17rpx 17rpx 17rpx 17rpx;
font-size: 21rpx;
color: #FFFFFF;
line-height: 25rpx;
text-align: center;
padding: 4rpx 8rpx;
margin-right: 23rpx;
.card-box:first-child
margin-top: 6rpx;
</style>

View File

@@ -5,10 +5,30 @@
<view class="avatar"></view>
<view class="info">
<view class="name-row">
<text class="name">用户姓名</text>
<!-- <view class="edit-icon"></view> -->
<text class="name" v-if="state.disbleName">{{ state.name || '编辑用户名' }}</text>
<input
class="uni-input name"
style="padding-top: 6px"
v-else
v-model="state.name"
placeholder-class="name"
type="text"
placeholder="输入用户名"
/>
<view class="edit-icon">
<image
class="img"
v-if="state.disbleName"
src="../../../static/icon/edit.png"
@click="editName"
></image>
<image v-else class="img" src="../../../static/icon/save.png" @click="completeUserName"></image>
</view>
</view>
<text class="details"> 23</text>
<text class="details">
<dict-Label dictType="sex" :value="userInfo.sex"></dict-Label>
{{ state.age }}
</text>
</view>
</view>
@@ -17,22 +37,67 @@
<view class="info-card">
<view class="card-content">
<text class="label">出生年月</text>
<text class="value">2001/01/01</text>
<!-- <text class="value">2001/01/01</text> -->
<picker
mode="date"
:disabled="state.disbleDate"
:value="state.date"
:start="startDate"
:end="endDate"
@change="bindDateChange"
>
<view class="uni-input">{{ state.date }}</view>
</picker>
<view class="edit-icon">
<image
v-if="state.disbleDate"
class="img"
src="../../../static/icon/edit.png"
@click="editResume"
></image>
<image v-else class="img" src="../../../static/icon/save.png" @click="completeResume"></image>
</view>
</view>
<view class="card-content">
<text class="label">学历</text>
<text class="value">2001/01/01</text>
<!-- <text class="value">
<dict-Label dictType="education" :value="userInfo.education"></dict-Label>
</text> -->
<picker
@change="bindEducationChange"
range-key="label"
:disabled="state.disbleDate"
:value="state.education"
:range="state.educationList"
>
<view class="uni-input">{{ state.educationList[state.education].label }}</view>
</picker>
</view>
<view class="card-content">
<text class="label">政治面貌</text>
<text class="value">2001/01/01</text>
<!-- <text class="value">2001/01/01</text> -->
<picker
@change="bindPoliticalAffiliationChange"
range-key="label"
:disabled="state.disbleDate"
:value="state.politicalAffiliation"
:range="state.affiliationList"
>
<view class="uni-input">{{ state.affiliationList[state.politicalAffiliation].label }}</view>
</picker>
</view>
<view class="card-content">
<view class="card-content" style="padding-bottom: 3px">
<text class="label">联系方式</text>
<text class="value">2001/01/01</text>
</view>
<view class="edit-icon">
<image class="img" src="../../../static/icon/edit.png"></image>
<!-- <text class="value">2001/01/01</text> -->
<input
class="uni-input"
style="padding-top: 6px"
:disabled="state.disbleDate"
v-model="state.phone"
placeholder-class="value"
type="number"
placeholder="输入手机号"
/>
</view>
</view>
</view>
@@ -43,14 +108,11 @@
<view class="card-content">
<text class="label">期望职位</text>
<view class="value">
<view>销售工程师</view>
<view>销售工程师</view>
<view>销售工程师</view>
<view>销售工程师</view>
<view v-for="item in userInfo.jobTitle" :key="item">{{ item }}</view>
</view>
<view class="edit-icon">
<image class="img" @click="editJobs" src="../../../static/icon/edit.png"></image>
</view>
</view>
<view class="edit-icon">
<image class="img" src="../../../static/icon/edit.png"></image>
</view>
</view>
</view>
@@ -60,10 +122,33 @@
<view class="info-card">
<view class="card-content">
<text class="label">期望薪资</text>
<view class="value">8-10k</view>
</view>
<view class="edit-icon">
<image class="img" src="../../../static/icon/edit.png"></image>
<view class="value">
<picker
@change="changeSalary"
@columnchange="changeColumeSalary"
range-key="label"
:disabled="state.disbleSalary"
:value="state.salary"
:range="state.salayList"
mode="multiSelector"
>
<view class="uni-input">{{ state.salaryMin / 1000 }}k-{{ state.salaryMax / 1000 }}k</view>
</picker>
</view>
<view class="edit-icon">
<image
v-if="state.disbleSalary"
class="img"
src="../../../static/icon/edit.png"
@click="salaryExpectation"
></image>
<image
v-else
class="img"
src="../../../static/icon/save.png"
@click="completesalaryExpectation"
></image>
</view>
</view>
</view>
</view>
@@ -73,10 +158,35 @@
<view class="info-card">
<view class="card-content">
<text class="label long">期望工作地</text>
<view class="value">青岛-青岛经济技术开发区</view>
</view>
<view class="edit-icon">
<image class="img" src="../../../static/icon/edit.png"></image>
<view class="value">
<view v-if="state.disaleArea">
青岛 -
<dict-Label dictType="area" :value="Number(state.area)"></dict-Label>
</view>
<view v-else>
<picker
@change="bindAreaChange"
range-key="label"
:disabled="state.disaleArea"
:value="state.area"
:range="state.areaList"
>
<view class="uni-input">
青岛 -
{{ state.areaList[state.area].label }}
</view>
</picker>
</view>
</view>
<view class="edit-icon">
<image
v-if="state.disaleArea"
class="img"
src="../../../static/icon/edit.png"
@click="state.disaleArea = false"
></image>
<image v-else class="img" src="../../../static/icon/save.png" @click="completeArea"></image>
</view>
</view>
</view>
</view>
@@ -88,15 +198,283 @@
上传简历
</button>
</view>
<!-- piker -->
<custom-popup :content-h="100" :visible="state.visible" :header="false">
<view class="popContent">
<view class="s-header">
<view class="heade-lf" @click="state.visible = false">取消</view>
<view class="heade-ri" @click="confimPopup">确认</view>
</view>
<view class="sex-content fl_1">
<expected-station
:search="false"
@onChange="changeJobTitleId"
:station="state.stations"
:max="5"
></expected-station>
</view>
</view>
</custom-popup>
<uni-popup ref="popup" type="dialog">
<uni-popup-dialog
mode="base"
title="确定退出登录吗?"
type="info"
:duration="2000"
:before-close="true"
@confirm="confirm"
@close="close"
></uni-popup-dialog>
</uni-popup>
</view>
</template>
<script>
export default {
data() {
return {};
},
<script setup>
import { reactive, inject, watch, ref, onMounted, computed } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import dictLabel from '@/components/dict-Label/dict-Label.vue';
const { $api, navTo, checkingPhoneRegExp, salaryGlobal, setCheckedNodes } = inject('globalFunction');
import useUserStore from '@/stores/useUserStore';
import useDictStore from '@/stores/useDictStore';
const { getUserResume } = useUserStore();
const { getDictData, oneDictData } = useDictStore();
const userInfo = ref({});
const salay = salaryGlobal();
const state = reactive({
date: getDate(),
education: 0,
politicalAffiliation: 0,
phone: '',
name: '',
jobTitleId: '',
salaryMin: 2000,
salaryMax: 2000,
area: 0,
salary: [0, 0],
disbleDate: true,
disbleName: true,
disbleSalary: true,
disaleArea: true,
visible: false,
educationList: oneDictData('education'),
affiliationList: oneDictData('affiliation'),
areaList: oneDictData('area'),
stations: [],
copyData: {},
salayList: [salay, salay[0].children],
});
const startDate = computed(() => {
return getDate('start');
});
const endDate = computed(() => {
return getDate('end');
});
onShow(() => {
initload();
});
onLoad(() => {
setTimeout(() => {
const { age, birthDate } = useUserStore().userInfo;
const newAge = calculateAge(birthDate);
// 计算年龄是否对等
if (age != newAge) {
console.log(age, newAge);
completeResume();
}
}, 1000);
});
const calculateAge = (birthDate) => {
const birth = new Date(birthDate);
const today = new Date();
let age = today.getFullYear() - birth.getFullYear();
const monthDiff = today.getMonth() - birth.getMonth();
const dayDiff = today.getDate() - birth.getDate();
// 如果生日的月份还没到,或者刚到生日月份但当天还没过,则年龄减 1
if (monthDiff < 0 || (monthDiff === 0 && dayDiff < 0)) {
age--;
}
return age;
};
function initload() {
userInfo.value = useUserStore().userInfo;
state.name = userInfo.value.name;
state.date = userInfo.value.birthDate;
state.age = userInfo.value.age;
state.phone = userInfo.value.phone;
state.salaryMax = userInfo.value.salaryMax;
state.salaryMin = userInfo.value.salaryMin;
state.area = userInfo.value.area;
state.educationList.map((iv, index) => {
if (iv.value === userInfo.value.education) state.education = index;
});
state.affiliationList.map((iv, index) => {
if (iv.value === userInfo.value.politicalAffiliation) state.politicalAffiliation = index;
});
$api.createRequest('/app/common/jobTitle/treeselect', {}, 'GET').then((resData) => {
if (userInfo.value.jobTitleId) {
const ids = userInfo.value.jobTitleId.split(',').map((id) => Number(id));
setCheckedNodes(resData.data, ids);
}
state.jobTitleId = userInfo.value.jobTitleId;
state.stations = resData.data;
});
}
function bindAreaChange(val) {
state.area = val.detail.value;
}
function bindDateChange(val) {
state.date = val.detail.value;
}
function bindEducationChange(val) {
state.education = val.detail.value;
}
function bindPoliticalAffiliationChange(val) {
state.politicalAffiliation = val.detail.value;
}
function completeArea() {
let params = {
area: state.area,
};
$api.createRequest('/app/user/resume', params, 'post').then((resData) => {
$api.msg('完成');
state.disaleArea = true;
getUserResume().then(() => {
initload();
});
});
}
function completesalaryExpectation() {
let params = {
salaryMin: state.salaryMin,
salaryMax: state.salaryMax,
};
$api.createRequest('/app/user/resume', params, 'post').then((resData) => {
$api.msg('完成');
state.disbleSalary = true;
getUserResume().then(() => {
initload();
});
});
}
function completeResume() {
let params = {
birthDate: state.date,
age: calculateAge(state.date),
education: state.educationList[state.education].value,
politicalAffiliation: state.affiliationList[state.politicalAffiliation].value,
phone: state.phone,
};
if (!params.birthDate) {
return $api.msg('请选择出生年月');
}
if (!params.education) {
return $api.msg('请选择学历');
}
if (!params.politicalAffiliation) {
return $api.msg('请选择政治面貌');
}
if (!checkingPhoneRegExp(params.phone)) {
return $api.msg('请输入正确手机号');
}
$api.createRequest('/app/user/resume', params, 'post').then((resData) => {
$api.msg('完成');
state.disbleDate = true;
getUserResume().then(() => {
initload();
});
});
}
function completeUserName() {
if (!state.name) {
return $api.msg('请输入用户名称');
}
$api.createRequest('/app/user/resume', { name: state.name }, 'post').then((resData) => {
$api.msg('完成');
state.disbleName = true;
getUserResume().then(() => {
initload();
});
});
}
function confimPopup() {
$api.createRequest('/app/user/resume', { jobTitleId: state.jobTitleId }, 'post').then((resData) => {
$api.msg('完成');
state.visible = false;
getUserResume().then(() => {
initload();
});
});
}
function editResume() {
state.copyData.date = state.date;
state.copyData.education = state.education;
state.copyData.politicalAffiliation = state.politicalAffiliation;
state.copyData.phone = state.phone;
state.disbleDate = false;
}
function salaryExpectation() {
state.disbleSalary = false;
}
function editName() {
state.name = userInfo.value.name;
state.disbleName = false;
}
function changeJobTitleId(ids) {
state.jobTitleId = ids;
}
function editJobs() {
state.visible = true;
}
function changeColumeSalary(e) {
const { column, value } = e.detail;
if (column === 0) {
state.salary[1] = 0;
state.salayList[1] = salay[value].children;
}
}
function changeSalary(e) {
const [minIndex, maxIndex] = e.detail.value;
const min = state.salayList[0][minIndex];
const max = state.salayList[0][minIndex].children[maxIndex];
state.salaryMin = min.value;
state.salaryMax = max.value;
}
function getDate(type) {
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (type === 'start') {
year = year - 60;
} else if (type === 'end') {
year = year + 2;
}
month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day;
return `${year}-${month}-${day}`;
}
</script>
<style lang="stylus" scoped>
@@ -126,16 +504,21 @@ export default {
.name-row
display flex
align-items center
position relative
.name
font-size 36rpx
font-weight bold
color #fff
.edit-icon
width 30rpx
height 30rpx
background-color #fff
width 40rpx
height 40rpx
border-radius 50%
margin-left 10rpx
position: absolute
right: -60rpx
top: 6rpx
.img
width: 100%
height: 100%
.details
font-size 24rpx
color #dbeafe
@@ -162,6 +545,7 @@ export default {
display flex
line-height: 58rpx
margin-top 16rpx
position: relative
.label
width 160rpx
height: 32rpx
@@ -183,14 +567,15 @@ export default {
margin-top 0
.edit-icon
position: absolute
right: 40rpx
top: 20rpx
right: 10rpx
top: 10rpx
width 40rpx
height 40rpx
.img
width: 100%
height: 100%
.upload-btn
margin-top 20rpx
.btn
@@ -203,4 +588,45 @@ export default {
font-size 28rpx
font-weight bold
border-radius 20rpx
/* popup */
.popContent {
padding: 24rpx;
background: #4778ec;
height: calc(100% - 49rpx);
.sex-content {
border-radius: 20rpx;
width: 100%;
margin-top: 20rpx;
margin-bottom: 40rpx;
display: flex;
overflow: hidden;
height: calc(100% - 100rpx);
border: 1px solid #4778ec;
}
.s-header {
display: flex;
justify-content: space-between;
text-align: center;
font-size: 16px;
.heade-lf {
line-height: 30px;
width: 50px;
height: 30px;
border-radius: 4px;
border: 1px solid #666666;
color: #666666;
background: #ffffff;
}
.heade-ri {
line-height: 30px;
width: 50px;
height: 30px;
border-radius: 4px;
border: 1px solid #1b66ff;
background-color: #1b66ff;
color: #ffffff;
}
}
}
</style>

View File

@@ -1,63 +1,176 @@
<template>
<view class="container">
<view class="job-header">
<view class="job-title">销售工程师-高级销售经理</view>
<view class="job-info">
<text class="salary">1-2/</text>
<text class="views">1024浏览</text>
</view>
<view class="location-info">
<text class="location">📍 青岛 青岛经济技术开发区</text>
<text class="date">2022.1.3</text>
<view class="source">来源 智联招聘</view>
</view>
</view>
<view class="container">
<view class="job-header">
<view class="job-title">{{ jobInfo.jobTitle }}</view>
<view class="job-info">
<text class="salary">{{ jobInfo.minSalary }}-{{ jobInfo.maxSalary }}/</text>
<text class="views">{{ jobInfo.view }}浏览</text>
</view>
<view class="location-info">
<view class="location" style="display: inline-block">
📍 青岛
<dict-Label dictType="area" :value="jobInfo.jobLocationAreaCode"></dict-Label>
</view>
<text class="date">{{ jobInfo.postingDate || '发布日期' }}</text>
<view class="source">来源 智联招聘</view>
</view>
</view>
<view class="job-details">
<text class="details-title">职位详情</text>
<view class="tags">
<view class="tag">本科</view>
<view class="tag">3-5</view>
</view>
<view class="description">
我司在永磁同步电机行业技术优势明显最高载频24kHZ最高运行频率3000HZ最高运行转速180000rpm职责
<br />
1结合公司业务优势深挖行业大客户需求为客户提供针对性的营销解决方案
<br />
2有丰富的项目落地执行经验
<br />
3做好应收款控制与管理
<br />
要求
<br />
1统招本科以上学历电气相关专业
<br />
2有3年以上从事变频器或相关经验者优先
<br />
</view>
</view>
<view class="job-details">
<text class="details-title">职位详情</text>
<view class="tags">
<view class="tag"><dict-Label dictType="education" :value="jobInfo.education"></dict-Label></view>
<view class="tag"><dict-Label dictType="experience" :value="jobInfo.experience"></dict-Label></view>
</view>
<view class="description" :style="{ whiteSpace: 'pre-wrap' }">
{{ jobInfo.description }}
</view>
</view>
<view class="company-info" @click="navTo('/packageA/pages/UnitDetails/UnitDetails')">
<view class="company-name">湖南沃森电气科技有限公司</view>
<view class="company-details">制造业 100-299 单位详情</view>
</view>
<view
class="company-info"
@click="navTo(`/packageA/pages/UnitDetails/UnitDetails?companyId=${jobInfo.company.companyId}`)"
>
<view class="company-name">{{ jobInfo.company?.name }}</view>
<view class="company-details">
<dict-tree-Label
v-if="jobInfo.company?.industry"
dictType="industry"
:value="jobInfo.company?.industry"
></dict-tree-Label>
<span v-if="jobInfo.company?.industry">&nbsp;</span>
<dict-Label dictType="scale" :value="jobInfo.company?.scale"></dict-Label>
单位详情
</view>
<view class="company-map" v-if="jobInfo.latitude && jobInfo.longitude">
<map
style="width: 100%; height: 100%"
:latitude="jobInfo.latitude"
:longitude="jobInfo.longitude"
:markers="mapCovers"
></map>
</view>
</view>
<view class="footer">
<button class="apply-btn">立即申请</button>
<view class="falls-card-matchingrate">
<uni-icons type="star" size="40"></uni-icons>
<!-- <uni-icons type="star-filled" color="#FFCB47" size="40"></uni-icons> -->
</view>
<view class="footer">
<!-- <button class="apply-btn" v-if="!jobInfo.isApply" @click="jobApply">立即申请</button> -->
<button class="apply-btn" @click="jobApply">立即申请</button>
<!-- <button class="apply-btn btned" v-else>已申请</button> -->
<view class="falls-card-matchingrate" @click="jobCollection">
<uni-icons v-if="!jobInfo.isCollection" type="star" size="40"></uni-icons>
<uni-icons v-else type="star-filled" color="#FFCB47" size="40"></uni-icons>
</view>
</view>
</view>
</view>
</template>
<script setup>
import { reactive, inject, watch, ref, onMounted } from 'vue';
const { $api, navTo } = inject('globalFunction');
import point from '@/static/icon/point.png';
import { reactive, inject, watch, ref, onMounted, computed } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import dictLabel from '@/components/dict-Label/dict-Label.vue';
const { $api, navTo, getLenPx, parseQueryParams } = inject('globalFunction');
const jobInfo = ref({});
const state = reactive({});
const mapCovers = ref([]);
const jobIdRef = ref();
onLoad((option) => {
if (option.jobId) {
initLoad(option);
}
});
onShow(() => {
const option = parseQueryParams(); // 兼容微信内置浏览器
if (option.jobId) {
initLoad(option);
}
});
function initLoad(option) {
const jobId = atob(option.jobId);
if (jobId !== jobIdRef.value) {
jobIdRef.value = jobId;
getDetail(jobId);
}
}
function getDetail(jobId) {
$api.createRequest(`/app/job/${jobId}`).then((resData) => {
const { latitude, longitude, companyName } = resData.data;
jobInfo.value = resData.data;
if (latitude && longitude) {
mapCovers.value = [
{
latitude: latitude,
longitude: longitude,
iconPath: point,
label: {
content: companyName,
textAlign: 'center',
padding: 3,
fontSize: 12,
bgColor: '#FFFFFF',
anchorX: getTextWidth(companyName), // X 轴调整,负数向左
borderRadius: 5,
},
width: 34,
},
];
}
});
}
function getTextWidth(text, size = 12) {
const canvas = document.createElement('canvas');
const context = canvas.getContext('2d');
context.font = `${12}px Arial`;
return -(context.measureText(text).width / 2) - 20; // 计算文字中心点
}
// 申请岗位
function jobApply() {
const jobId = jobInfo.value.jobId;
if (jobInfo.value.isApply) {
const jobUrl = jobInfo.value.jobUrl;
return window.open(jobUrl);
} else {
$api.createRequest(`/app/job/apply/${jobId}`, {}, 'GET').then((resData) => {
getDetail(jobId);
$api.msg('申请成功');
const jobUrl = jobInfo.value.jobUrl;
return window.open(jobUrl);
});
}
}
// 取消/收藏岗位
function jobCollection() {
const jobId = jobInfo.value.jobId;
if (jobInfo.value.isCollection) {
$api.createRequest(`/app/job/collection/${jobId}`, {}, 'DELETE').then((resData) => {
getDetail(jobId);
$api.msg('取消收藏成功');
});
} else {
$api.createRequest(`/app/job/collection/${jobId}`, {}, 'POST').then((resData) => {
getDetail(jobId);
$api.msg('收藏成功');
});
}
}
</script>
<style lang="stylus" scoped>
::v-deep .amap-logo {
opacity: 0 !important;
}
::v-deep .amap-copyright {
opacity: 0 !important;
}
.container
display flex
flex-direction column
@@ -117,7 +230,7 @@ const { $api, navTo } = inject('globalFunction');
.company-info
background-color #fff
padding 20rpx 40rpx
margin-bottom 10rpx
margin-bottom 300rpx
.company-name
font-size 28rpx
font-weight bold
@@ -125,6 +238,13 @@ const { $api, navTo } = inject('globalFunction');
.company-details
font-size 24rpx
color #666
.company-map
height: 340rpx
width: 100%
background: #e8e8e8
margin-top: 10rpx
border-radius: 16rpx
overflow: hidden
.footer
position fixed
@@ -143,4 +263,6 @@ const { $api, navTo } = inject('globalFunction');
border-radius 30rpx
font-size 32rpx
margin-right: 30rpx
.btned
background-color #666666
</style>

View File

@@ -3,24 +3,29 @@
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "青岛智慧就业平台",
"navigationStyle": "custom"
}
},
{
"path": "pages/mine/mine",
"style": {
"navigationBarTitleText": "我的",
"navigationStyle": "custom"
}
},
{
"path": "pages/msglog/msglog",
"style": {
"navigationStyle": "custom"
"navigationBarTitleText": "消息",
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
},
{
"path": "pages/careerfair/careerfair",
"style": {
"navigationBarTitleText": "招聘会",
"navigationStyle": "custom"
}
},
@@ -38,46 +43,81 @@
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/chat/chat",
"style": {
"navigationBarTitleText": "AI+",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white",
"enablePullDownRefresh": false,
// #ifdef H5
"navigationStyle": "custom"
//#endif
}
}
],
"subpackages": [{
"root": "packageA",
"pages": [{
"path": "pages/choiceness/choiceness",
"style": {
"navigationBarTitleText": "精选",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
"path": "pages/choiceness/choiceness",
"style": {
"navigationBarTitleText": "精选",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/post/post",
"style": {
"navigationBarTitleText": "职位详情",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/UnitDetails/UnitDetails",
"style": {
"navigationBarTitleText": "单位详情",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/exhibitors/exhibitors",
"style": {
"navigationBarTitleText": "参展单位",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/myResume/myResume",
"style": {
"navigationBarTitleText": "我的简历",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/Intendedposition/Intendedposition",
"style": {
"navigationBarTitleText": "意向岗位",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/collection/collection",
"style": {
"navigationBarTitleText": "我的收藏",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/browseJob/browseJob",
"style": {
"navigationBarTitleText": "我的浏览",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
}
}
}, {
"path": "pages/post/post",
"style": {
"navigationBarTitleText": "职位详情",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/UnitDetails/UnitDetails",
"style": {
"navigationBarTitleText": "单位详情",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/exhibitors/exhibitors",
"style": {
"navigationBarTitleText": "参展单位",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/myResume/myResume",
"style": {
"navigationBarTitleText": "我的简历",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
}
}]
]
}],
"tabBar": {
"color": "#7A7E83",
@@ -91,16 +131,21 @@
},
"list": [{
"pagePath": "pages/index/index",
"iconPath": "static/tabbar/post.png",
"selectedIconPath": "static/tabbar/posted.png",
"iconPath": "static/tabbar/calendar.png",
"selectedIconPath": "static/tabbar/calendared.png",
"text": "职位"
},
{
"pagePath": "pages/careerfair/careerfair",
"iconPath": "static/tabbar/calendar.png",
"selectedIconPath": "static/tabbar/calendared.png",
"iconPath": "static/tabbar/post.png",
"selectedIconPath": "static/tabbar/posted.png",
"text": "招聘会"
},
{
"pagePath": "pages/chat/chat",
"iconPath": "static/tabbar/logo2.png",
"selectedIconPath": "static/tabbar/logo2.png"
},
{
"pagePath": "pages/msglog/msglog",
"iconPath": "static/tabbar/chat4.png",

BIN
pages/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -77,6 +77,7 @@ function getNextMonthDates() {
background: linear-gradient( 180deg, #4778EC 0%, #002979 100%);
display: flex;
flex-direction: column;
position: fixed
.careerfair-AI
height: 42rpx;
font-family: Inter, Inter;

221
pages/chat/chat.vue Normal file
View File

@@ -0,0 +1,221 @@
<template>
<view class="container">
<!-- 抽屉遮罩层 -->
<view v-if="isDrawerOpen" class="overlay" @click="toggleDrawer"></view>
<!-- 抽屉窗口 -->
<view class="drawer" :class="{ open: isDrawerOpen }">
<view class="drawer-content">
<view class="drawer-title">历史对话</view>
<scroll-view scroll-y :show-scrollbar="false" class="chat-scroll">
<view
class="drawer-rows"
@click="changeDialogue(item)"
v-for="(item, index) in tabeList"
:key="item.id"
>
<view
v-if="!item.isTitle"
class="drawer-row-list"
:class="{ 'drawer-row-active': item.sessionId === chatSessionID }"
>
{{ item.title }}
</view>
<view class="drawer-row-title" v-else>
{{ item.title }}
</view>
</view>
</scroll-view>
</view>
</view>
<!-- 主要内容挤压效果 -->
<view class="main-content" :class="{ shift: isDrawerOpen }">
<!-- header -->
<header class="head">
<view class="main-header">
<image src="/static/icon/Hamburger-button.png" @click="toggleDrawer"></image>
<view class="title">青岛市岗位推荐</view>
<image src="/static/icon/Comment-one.png" @click="addNewDialogue"></image>
</view>
</header>
<view class="chatmain-warpper">
<ai-paging ref="paging"></ai-paging>
</view>
</view>
</view>
</template>
<script setup>
import { ref, inject, nextTick } from 'vue';
const { $api, navTo } = inject('globalFunction');
import { onLoad, onShow } from '@dcloudio/uni-app';
import useChatGroupDBStore from '@/stores/userChatGroupStore';
import aiPaging from './components/ai-paging.vue';
import { storeToRefs } from 'pinia';
const { isTyping, tabeList, chatSessionID } = storeToRefs(useChatGroupDBStore());
const isDrawerOpen = ref(false);
const scrollIntoView = ref(false);
import config from '@/config';
const paging = ref(null);
onLoad(() => {
// useChatGroupDBStore().getHistory();
});
onShow(() => {
nextTick(() => {
paging.value?.colseFile();
});
});
const toggleDrawer = () => {
isDrawerOpen.value = !isDrawerOpen.value;
};
const addNewDialogue = () => {
$api.msg('新对话');
useChatGroupDBStore().addNewDialogue();
};
const changeDialogue = (item) => {
if (item.sessionId) {
paging.value?.closeGuess();
useChatGroupDBStore().changeDialogue(item);
toggleDrawer();
nextTick(() => {
paging.value?.scrollToBottom();
});
}
};
</script>
<style lang="stylus" scoped>
/* 页面容器 */
.container {
position: fixed;
width: 100vw;
height: calc(100vh - var(--window-top) - var(--status-bar-height) - var(--window-bottom));
overflow: hidden;
}
/* 遮罩层 */
.overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.4);
z-index: 999;
}
/* 抽屉窗口 */
.drawer {
position: fixed;
top: 0;
left: 0; /* 如果要右侧弹出改为 right: 0; */
width: 500rpx;
height: 100vh;
background: #e7e7e6;
transform: translateX(-100%);
transition: transform 0.3s ease-in-out;
z-index: 1000;
}
/* 抽屉展开 */
.drawer.open {
box-shadow: 4rpx 0 20rpx rgba(0, 0, 0, 0.2);
transform: translateX(0);
}
/* 抽屉内容 */
.drawer-content
height: 100%
.drawer-title
height: calc(88rpx + env(safe-area-inset-top));
line-height: calc(88rpx + env(safe-area-inset-top));
padding: 0 20rpx;
background: rgba(71, 120, 236, 1);
color: #FFFFFF;
font-size: 30rpx
.chat-scroll
height: calc(100% - 88rpx + env(safe-area-inset-top));
.drawer-rows
padding: 0 20rpx;
// border-bottom: 2rpx dashed #e8e8e8
overflow:hidden; //超出的文本隐藏
text-overflow:ellipsis; //溢出用省略号显示
white-space:nowrap; //溢出不换行
.drawer-row-title
color: #5d5d5d;
font-weight: bold;
font-size: 24rpx
line-height: 88rpx
height: 88rpx
margin-top: 16rpx
// border-bottom: 2rpx dashed #5d5d5d
.drawer-row-list
height: 66rpx;
line-height: 66rpx
color: #000000
font-size: 28rpx
overflow: hidden
text-overflow: ellipsis
.drawer-row-active
.drawer-row-list:active
background: #DCDCDB
border-radius: 8rpx
padding: 0 10rpx
/* 主要内容区域 */
.main-content
width: 100%;
height: 100vh;
// background: #f8f8f8;
transition: margin-left 0.3s ease-in-out;
position: relative
background: #FFFFFF
.head
display: block;
box-sizing: border-box;
height: calc(88rpx + env(safe-area-inset-top));
user-select: none;
.main-header
position: fixed;
left: var(--window-left);
right: var(--window-right);
height: calc(88rpx + env(safe-area-inset-top));
padding-top: calc(14rpx + env(safe-area-inset-top));
border: 2rpx solid #F4F4F4;
background: #FFFFFF
z-index: 998;
transition-property: all;
display: flex;
align-items: center;
justify-content: space-between
font-size: 28rpx
color: #000000
padding: 0 30rpx;
font-weight: bold
text-align: center
image
width: 36rpx;
height: 37rpx;
.chatmain-warpper
height: calc(100% - 88rpx - env(safe-area-inset-top));
position: relative;
display: block;
box-sizing: border-box;
width: 100%;
/* 页面被挤压时向右移动 */
.main-content.shift {
margin-left: 500rpx;
}
</style>

View File

@@ -0,0 +1,66 @@
<template>
<view class="wave-container" :style="{ background }">
<view v-for="(bar, index) in bars" :key="index" class="bar" :style="getBarStyle(index)" />
</view>
</template>
<script setup>
import { computed } from 'vue';
const props = defineProps({
background: {
type: String,
default: 'linear-gradient(to right, #377dff, #9a60ff)',
},
});
// 默认参数(不暴露)
const barCount = 20;
const barWidth = 4;
const barHeight = 40;
const barRadius = 2;
const duration = 1200;
const gap = 4;
const bars = computed(() => new Array(barCount).fill(0));
const getBarStyle = (index) => {
const delay = (index * (duration / barCount)) % duration;
return {
width: `${barWidth}rpx`,
height: `${barHeight}rpx`,
background: '#fff',
borderRadius: `${barRadius}rpx`,
animation: `waveAnim ${duration}ms ease-in-out ${delay}ms infinite`,
transformOrigin: 'bottom center',
};
};
</script>
<style scoped>
.wave-container {
display: flex;
justify-content: center;
align-items: center;
padding: 16rpx;
border-radius: 36rpx;
height: calc(102rpx - 40rpx);
gap: 4rpx;
/* background: linear-gradient(90deg, #9e74fd 0%, #256bfa 100%); */
box-shadow: 0rpx 8rpx 40rpx 0rpx rgba(0, 54, 170, 0.15);
}
@keyframes waveAnim {
0%,
100% {
transform: scaleY(0.4);
}
50% {
transform: scaleY(1);
}
}
.bar {
transform-origin: bottom center;
}
</style>

View File

@@ -0,0 +1,783 @@
<template>
<view class="chat-container">
<FadeView :show="!messages.length" :duration="600">
<view class="chat-background">
<image class="backlogo" src="/static/icon/backAI.png"></image>
<view class="back-rowTitle">欢迎使用青岛AI智能求职</view>
<view class="back-rowText">
我可以根据您的简历和求职需求帮你精准匹配青岛市互联网招聘信息对比招聘信息的优缺点提供面试指导等请把你的任务交给我吧~
</view>
<view class="back-rowh3">猜你所想</view>
<view class="back-rowmsg">我希望找青岛的IT行业岗位薪资能否在12000以上</view>
<view class="back-rowmsg">我有三年的工作经验能否推荐一些适合我的青岛的国企 岗位</view>
</view>
</FadeView>
<scroll-view class="chat-list scrollView" :scroll-top="scrollTop" :scroll-y="true" scroll-with-animation>
<FadeView :show="messages.length" :duration="600">
<view class="chat-list list-content">
<view
v-for="(msg, index) in messages"
:key="index"
:id="'msg-' + index"
class="chat-item"
:class="{ self: msg.self }"
>
<text class="message" v-if="msg.self">
<view class="msg-filecontent" v-if="msg.files.length">
<view
class="msg-files"
v-for="(file, vInex) in msg.files"
:key="vInex"
@click="jumpUrl(file)"
>
<image class="msg-file-icon" src="/static/icon/Vector2.png"></image>
<text class="msg-file-text">{{ file.name || '附件' }}</text>
</view>
</view>
{{ msg.displayText }}
</text>
<text class="message" :class="{ messageNull: !msg.displayText }" v-else>
<!-- {{ msg.displayText }} -->
<md-render :content="msg.displayText"></md-render>
<!-- guess -->
<view
class="guess"
v-if="showGuess && !msg.self && messages.length - 1 === index && msg.displayText"
>
<view class="guess-top">
<image class="guess-icon" src="/static/icon/tips2.png" mode=""></image>
猜你所想
</view>
<view class="gulist">
<view
class="guess-list"
@click="sendMessageGuess(item)"
v-for="(item, index) in guessList"
:key="index"
>
{{ item }}
</view>
</view>
</view>
</text>
</view>
<view v-if="isTyping" :class="{ self: true }">
<text class="message msg-loading">
<span class="ai-loading"></span>
</text>
</view>
</view>
</FadeView>
</scroll-view>
<view class="vio_container" :class="status" v-if="status !== 'idle'">
<view class="record-tip">{{ statusText }}</view>
<AudioWave :background="audiowaveStyle" />
</view>
<view class="input-area" v-else>
<view class="areatext">
<input
v-model="textInput"
placeholder-class="inputplaceholder"
class="input"
@confirm="sendMessage"
:disabled="isTyping"
:adjust-position="false"
placeholder="请输入您的职位名称、薪资要求、岗位地址"
v-if="!isVoice"
/>
<view
class="input_vio"
@touchstart="handleTouchStart"
@touchmove="handleTouchMove"
@touchend="handleTouchEnd"
@touchcancel="handleTouchCancel"
type="default"
v-else
>
按住说话
</view>
<!-- upload -->
<view class="btn-box" @click="changeShowFile">
<image
class="send-btn"
:class="{ 'add-file-btn': showfile }"
src="/static/icon/addGroup.png"
></image>
</view>
<!-- sendmessgae Button-->
<view class="btn-box purple" v-if="textInput && !isTyping" @click="sendMessage">
<image class="send-btn" src="/static/icon/send3.png"></image>
</view>
<view class="btn-box" v-else-if="!isTyping && !isVoice" @click="changeVoice">
<image class="send-btn" src="/static/icon/send2x.png"></image>
</view>
<view class="btn-box" v-else-if="!isTyping" @click="changeVoice">
<image class="send-btn" src="/static/icon/send4.png"></image>
</view>
<view class="btn-box" v-else>
<image class="send-btn" src="/static/icon/send2xx.png"></image>
</view>
</view>
<!-- btn -->
<CollapseTransition :show="showfile">
<view class="area-file">
<image class="file-img" @click="uploadCamera" src="/static/icon/carmreupload.png"></image>
<image class="file-img" @click="getUploadFile" src="/static/icon/fileupload.png"></image>
<image class="file-img" @click="uploadCamera('album')" src="/static/icon/imgupload.png"></image>
</view>
</CollapseTransition>
<!-- filelist -->
<view class="area-uploadfiles" v-if="filesList.length">
<scroll-view class="uploadfiles-scroll" scroll-x="true">
<view class="uploadfiles-list">
<view class="file-uploadsend" v-for="(file, index) in filesList" :key="index">
<image
class="file-icon"
@click="jumpUrl(file)"
v-if="isImage(file.type)"
src="/static/icon/image.png"
></image>
<image
class="file-icon"
@click="jumpUrl(file)"
v-if="isFile(file.type)"
src="/static/icon/doc.png"
></image>
<text class="filename-text">{{ file.name }}</text>
<view class="file-del" catchtouchmove="true" @click="delfile(file)">
<uni-icons type="closeempty" color="#4B4B4B" size="10"></uni-icons>
</view>
</view>
</view>
</scroll-view>
</view>
</view>
</view>
</template>
<script setup>
import { ref, inject, nextTick, defineProps, defineEmits, onMounted, toRaw, reactive, computed } from 'vue';
import { storeToRefs } from 'pinia';
import config from '@/config.js';
import useChatGroupDBStore from '@/stores/userChatGroupStore';
const { $api, navTo, throttle } = inject('globalFunction');
const emit = defineEmits(['onConfirm']);
import MdRender from '@/components/md-render/md-render.vue';
const { messages, isTyping, textInput, chatSessionID } = storeToRefs(useChatGroupDBStore());
import CollapseTransition from '@/components/CollapseTransition/CollapseTransition.vue';
import FadeView from '@/components/FadeView/FadeView.vue';
import AudioWave from './AudioWave.vue';
import { useAudioRecorder } from '@/hook/useRealtimeRecorder.js';
const { isRecording, recognizedText, startRecording, stopRecording, cancelRecording } = useAudioRecorder(
config.vioceBaseURl
);
const guessList = ref([]);
const scrollTop = ref(0);
const showGuess = ref(false);
const showfile = ref(false);
const filesList = ref([]);
const bgText = ref(false);
const isVoice = ref(false);
const status = ref('idle'); // idle | recording | cancel
const startY = ref(0);
const cancelThreshold = 100;
let recordingTimer = null;
const state = reactive({
uploadFileTips: '请根据以上附件,帮我推荐岗位。',
});
onMounted(() => {
scrollToBottom();
});
const sendMessage = () => {
const values = textInput.value;
showfile.value = false;
showGuess.value = false;
if (values.trim()) {
// 判断是否有对话ID // 没有则创建对话列表
const callback = () => {
const normalArr = toRaw(filesList.value); // 转换为普通数组
filesList.value = [];
const newMsg = { text: values, self: true, displayText: values, files: normalArr };
useChatGroupDBStore().addMessage(newMsg);
useChatGroupDBStore()
.getStearm(values, normalArr, scrollToBottom)
.then(() => {
console.log(messages);
getGuess();
scrollToBottom();
});
emit('onConfirm', values);
textInput.value = '';
scrollToBottom();
};
// 没有对话列表则创建
if (!chatSessionID.value) {
useChatGroupDBStore()
.addTabel(values)
.then((res) => {
callback();
});
} else {
callback();
}
} else {
if (filesList.value.length) {
$api.msg('上传文件请输入想问的问题描述');
} else {
$api.msg('请输入职位信息或描述');
}
}
};
const sendMessageGuess = (item) => {
showGuess.value = false;
textInput.value = item;
sendMessage(item);
};
const delfile = (file) => {
uni.showModal({
content: '确认删除文件?',
success() {
filesList.value = filesList.value.filter((item) => item.url !== file.url);
if (!filesList.value.length) {
if (textInput.value === state.uploadFileTips) {
textInput.value = '';
}
}
$api.msg('附件删除成功');
},
});
};
const scrollToBottom = throttle(function () {
nextTick(() => {
try {
setTimeout(() => {
const query = uni.createSelectorQuery();
query.select('.scrollView').boundingClientRect();
query.select('.list-content').boundingClientRect();
query.exec((res) => {
const scrollViewHeight = res[0].height;
const scrollContentHeight = res[1].height;
if (scrollContentHeight > scrollViewHeight) {
const scrolldistance = scrollContentHeight - scrollViewHeight;
scrollTop.value = scrolldistance;
}
});
}, 100);
} catch (err) {
console.warn(err);
}
});
}, 500);
function getGuess() {
$api.chatRequest('/guest', { sessionId: chatSessionID.value }, 'POST').then((res) => {
guessList.value = res.data;
showGuess.value = true;
nextTick(() => {
scrollToBottom();
});
});
}
function isImage(fileNmae) {
return new RegExp('image').test(fileNmae);
}
function isFile(fileNmae) {
return new RegExp('custom-doc').test(fileNmae);
}
function jumpUrl(file) {
if (file.url) {
window.open(file.url);
} else {
$api.msg('文件地址丢失');
}
}
function VerifyNumberFiles(num) {
if (filesList.value.length >= config.allowedFileNumber) {
$api.msg(`最大上传文件数量 ${config.allowedFileNumber}`);
return true;
} else {
return false;
}
}
function uploadCamera(type = 'camera') {
if (VerifyNumberFiles()) return;
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: [type], //从相册选择
success: function (res) {
const tempFilePaths = res.tempFilePaths;
const file = res.tempFiles[0];
// 继续上传
$api.uploadFile(tempFilePaths[0], true).then((resData) => {
resData = JSON.parse(resData);
if (isImage(file.type)) {
filesList.value.push({
url: resData.msg,
type: file.type,
name: file.name,
});
textInput.value = state.uploadFileTips;
}
});
},
});
}
function getUploadFile(type = 'camera') {
if (VerifyNumberFiles()) return;
uni.chooseFile({
count: 1,
success: (res) => {
const tempFilePaths = res.tempFilePaths;
const file = res.tempFiles[0];
const allowedTypes = config.allowedFileTypes || [];
if (!allowedTypes.includes(file.type)) {
return $api.msg('仅支持 txt md html word pdf ppt csv excel 格式类型');
}
// 继续上传
$api.uploadFile(tempFilePaths[0], true).then((resData) => {
resData = JSON.parse(resData);
filesList.value.push({
url: resData.msg,
type: 'custom-doc',
name: file.name,
});
textInput.value = state.uploadFileTips;
});
},
});
}
const handleTouchStart = (e) => {
startY.value = e.touches[0].clientY;
status.value = 'recording';
showfile.value = false;
startRecording();
};
const handleTouchMove = (e) => {
const moveY = e.touches[0].clientY;
if (startY.value - moveY > cancelThreshold) {
status.value = 'cancel';
} else {
status.value = 'recording';
}
};
const handleTouchEnd = () => {
if (status.value === 'cancel') {
console.log('取消发送');
cancelRecording();
} else {
stopRecording();
console.log('发送语音');
}
status.value = 'idle';
};
const handleTouchCancel = () => {
stopRecording();
status.value = 'idle';
};
const statusText = computed(() => {
switch (status.value) {
case 'recording':
return '松手发送,上划取消';
case 'cancel':
return '松手取消';
default:
return '按住说话';
}
});
const audiowaveStyle = computed(() => {
return status.value === 'cancel'
? '#f54545'
: status.value === 'recording'
? 'linear-gradient(to right, #377dff, #9a60ff)'
: '#f1f1f1';
});
function closeGuess() {
showGuess.value = false;
}
function changeVoice() {
isVoice.value = !isVoice.value;
}
function changeShowFile() {
showfile.value = !showfile.value;
}
function colseFile() {
showfile.value = false;
}
defineExpose({ scrollToBottom, closeGuess, colseFile });
</script>
<style lang="stylus" scoped>
/* 过渡样式 */
.collapse-enter-active,
.collapse-leave-active {
transition: max-height 0.3s ease, opacity 0.3s ease;
}
.collapse-enter-from,
.collapse-leave-to {
max-height: 0;
opacity: 0;
}
.collapse-enter-to,
.collapse-leave-from {
max-height: 400rpx; /* 根据你内容最大高度设定 */
opacity: 1;
}
.msg-filecontent
display: flex
flex-wrap: wrap
.msg-files
overflow: hidden
margin-right: 10rpx
height: 30rpx
max-width: 201rpx
background: #FFFFFF
border-radius: 10rpx
display: flex
align-items: center
justify-content: flex-start
padding: 10rpx
color: #000000
margin-bottom: 10rpx
.msg-file-icon
width: 29rpx
height: 26rpx
padding-right: 10rpx
.msg-file-text
flex: 1
white-space: nowrap
overflow: hidden
text-overflow: ellipsis
color: rgba(96, 96, 96, 1)
font-size: 24rpx
.msg-files:active
background: #e9e9e9
.guess
border-top: 2rpx solid #8c8c8c
padding: 20rpx 0 10rpx 0
.guess-top
padding: 0 0 10rpx 0
display: flex
align-items: center
color: rgba(255, 173, 71, 1)
font-size: 28rpx
.guess-icon
width: 43rpx
height: 43rpx
.guess-list
border: 2rpx solid #8c8c8c
padding: 6rpx 12rpx
border-radius: 10rpx;
width: fit-content
margin: 0 10rpx 10rpx 0
font-size: 24rpx
color: #8c8c8c
.gulist
display: flex
flex-wrap: wrap
position: relative
image-margin-top = 40rpx
.chat-container
display: flex;
flex-direction: column;
height: calc(100% - var(--window-top) - var(--status-bar-height) - var(--window-bottom));
position: relative
z-index: 1
background: #FFFFFF
.chat-background
position: absolute
padding: 44rpx;
display: flex
flex-direction: column
justify-content: flex-start
align-items: center
.backlogo
width: 313rpx;
height: 190rpx;
.back-rowTitle
width: 100%;
height: 56rpx;
font-weight: bold;
font-size: 40rpx;
color: #333333;
line-height: 47rpx;
margin-top: 40rpx
.back-rowText
margin-top: 28rpx
width: 100%;
height: 144rpx;
font-weight: 400;
font-size: 28rpx;
color: #333333;
border-bottom: 2rpx dashed rgba(0, 0, 0, 0.2);
.back-rowh3
width: 100%;
height: 30rpx;
font-weight: 500;
font-size: 22rpx;
color: #000000;
margin-top: 24rpx
.back-rowmsg
width: 630rpx
margin-top: 20rpx
font-weight: 500;
font-size: 24rpx;
color: #333333;
line-height: 28rpx;
font-size: 24rpx
background: #F6F6F6;
border-radius: 8rpx 8rpx 8rpx 8rpx;
padding: 32rpx 18rpx;
.chat-list {
flex: 1;
overflow-y: auto;
white-space: pre-wrap;
}
.list-content {
padding: 0 44rpx 44rpx 44rpx;
}
.chat-item {
display: flex;
align-items: flex-start;
margin-bottom: 20rpx;
}
.chat-item.self {
justify-content: flex-end;
}
.message {
margin-top: 40rpx
padding: 20rpx 20rpx 0 20rpx;
border-radius: 0 20rpx 20rpx 20rpx;
background: #F6F6F6;
// max-width: 80%;
word-break: break-word;
color: #333333;
user-select: text;
-webkit-user-select: text;
}
.messageNull
background: transparent;
.msg-loading{
background: transparent;
font-size: 24rpx;
color: #8f8d8e;
display: flex;
align-items: flex-end;
justify-content: flex-start;
}
.loaded{
padding-left: 20rpx
}
.chat-item.self .message {
background: linear-gradient( 225deg, #DAE2FE 0%, #E9E3FF 100%);
border-radius: 20rpx 0 20rpx 20rpx;
padding: 20rpx;
}
.input-area {
padding: 32rpx;
position: relative;
background: #FFFFFF;
box-shadow: 0rpx -4rpx 10rpx 0rpx rgba(11,44,112,0.06);
transition: height 2s ease-in-out;
}
.input-area::after
position: absolute
content: ''
top: 0
left: 0
width: 100%
z-index: 1
box-shadow: 0rpx -4rpx 10rpx 0rpx rgba(11,44,112,0.06);
.areatext{
display: flex;
}
.input {
flex: 1;
border-radius: 5rpx;
min-height: 63rpx;
line-height: 63rpx;
padding: 4rpx 24rpx;
position: relative
background: #F5F5F5;
border-radius: 60rpx 60rpx 60rpx 60rpx;
}
.input_vio
flex: 1;
border-radius: 5rpx;
min-height: 63rpx;
line-height: 63rpx;
padding: 4rpx 24rpx;
// position: relative
border-radius: 60rpx 60rpx 60rpx 60rpx;
font-size: 28rpx
color: #333333
background: #F5F5F5;
text-align: center
font-size: 28rpx
font-weight: 500
-webkit-touch-callout:none;
-webkit-user-select:none;
-khtml-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none;
.input_vio:active
background: #e8e8e8
.vio_container
background: transparent
padding: 28rpx
text-align: center
.record-tip
font-weight: 400;
color: #909090;
text-align: center;
padding-bottom: 16rpx
.inputplaceholder {
font-weight: 500;
font-size: 24rpx;
color: #000000;
line-height: 28rpx;
opacity: 0.4
}
.btn-box
margin-left: 12rpx;
width: 70rpx;
height: 70rpx;
border-radius: 50%
background: #F5F5F5;
display: flex
align-items: center
justify-content: center
.send-btn,
.receive-btn
transition: transform 0.5s ease;
width: 38rpx;
height: 38rpx;
.purple
background: linear-gradient( 225deg, #9E74FD 0%, #256BFA 100%);
.add-file-btn{
transform: rotate(45deg)
transition: transform 0.5s ease;
}
.area-file
display: grid
width: 100%
grid-template-columns: repeat(3, 1fr)
grid-gap: 20rpx
padding: 20rpx 0 0 0;
.file-img
height: 179rpx
width: 100%
.area-uploadfiles
position: absolute
top: -100rpx
width: calc(100% - 40rpx)
background: #FFFFFF
left: 0
padding: 10rpx 20rpx
box-shadow: 0rpx -4rpx 10rpx 0rpx rgba(11,44,112,0.06);
.uploadfiles-scroll
height: 100%
.uploadfiles-list
height: 100%
display: flex
flex-wrap: nowrap
.file-uploadsend
display: flex
flex-wrap: nowrap
justify-content: center
align-items: center
margin: 10rpx 18rpx 0 10rpx;
height: 100%
border-radius: 30rpx
font-size: 24rpx
position: relative
width: 218rpx;
height: 80rpx;
border-radius: 12rpx 12rpx 12rpx 12rpx;
border: 2rpx solid #E2E2E2;
.file-del
position: absolute
right: 0
top: 0
z-index: 9
border-radius: 50%
display: flex
align-items: center
justify-content: center
transform: translate(50%, -10rpx)
height: 40rpx
width: 23rpx;
height: 23rpx;
background: #FFFFFF;
border: 2rpx solid #E2E2E2;
.file-del:active
background: #e8e8e8
.filename-text
overflow: hidden
text-overflow: ellipsis
white-space: nowrap
color: #333333
flex: 1
font-weight: 500
max-width: 100%
.file-icon
height: 40rpx
width: 40rpx
margin: 0 18rpx 0 18rpx
@keyframes ai-circle {
0% {
-webkit-transform: rotate(0);
transform: rotate(0);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
.ai-loading
display: inline-flex;
vertical-align: middle;
width: 28rpx;
height: 28rpx;
background: 0 0;
border-radius: 50%;
border: 4rpx solid;
border-color: #e5e5e5 #e5e5e5 #e5e5e5 #8f8d8e;
-webkit-animation: ai-circle 1s linear infinite;
animation: ai-circle 1s linear infinite;
</style>

View File

@@ -1,5 +1,5 @@
<template>
<view class="app-containers">
<view class="app-container">
<view class="index-AI">AI+就业服务程序</view>
<view class="index-option">
<view class="option-left">
@@ -8,126 +8,401 @@
<view class="left-item">职业图谱</view>
</view>
<view class="option-right">
<input class="uni-input right-input" confirm-type="search" />
<uni-icons class="iconsearch" color="#FFFFFF" type="search" size="20"></uni-icons>
<input
class="uni-input right-input"
adjust-position="false"
confirm-type="search"
v-model="inputText"
@confirm="searchJobTitle"
/>
<uni-icons
class="iconsearch"
color="#FFFFFF"
type="search"
size="20"
@click="searchJobTitle"
></uni-icons>
</view>
</view>
<!-- tab -->
<view class="tab-options">
<scroll-view :scroll-x="true" :show-scrollbar="false" class="tab-scroll">
<view class="tab-op-left">
<view class="tab-list" v-for="(item, index) in 4" :key="index">中国万岁</view>
<view
class="tab-list"
:class="{ tabchecked: state.tabIndex === 'all' }"
@click="choosePosition('all')"
>
全部
</view>
<view
class="tab-list"
:class="{ tabchecked: state.tabIndex === index }"
v-for="(item, index) in userInfo.jobTitle"
:key="index"
@click="choosePosition(index)"
>
{{ item }}
</view>
</view>
</scroll-view>
<view class="tab-op-right">
<uni-icons type="plusempty" style="margin-right: 10rpx" size="20"></uni-icons>
<view class="tab-recommend">推荐</view>
<view class="tab-filter">
<view class="tab-number">1000+</view>
<uni-icons type="plusempty" style="margin-right: 10rpx" size="20" @click="editojobs"></uni-icons>
<view class="tab-recommend">
<latestHotestStatus @confirm="handelHostestSearch"></latestHotestStatus>
</view>
<view class="tab-filter" @click="showFilter = true">
<view class="tab-number" v-show="pageState.total">{{ formatTotal(pageState.total) }}</view>
<image class="image" src="/static/icon/filter.png"></image>
</view>
</view>
</view>
<!-- waterfalls -->
<scroll-view :scroll-y="true" class="falls-scroll">
<scroll-view :scroll-y="true" class="falls-scroll" @scrolltolower="scrollBottom">
<view class="falls">
<custom-waterfalls-flow ref="waterfallsFlowRef" :value="state.list">
<template v-slot:default="item">
<view class="item">
<view class="falls-card" @click="navTo('/packageA/pages/post/post')">
<view class="falls-card-title">销售工程师</view>
<view class="falls-card-pay">1-2/</view>
<view class="falls-card-education">本科</view>
<view class="falls-card-experience">3-5</view>
<view class="falls-card-company">德阳人社</view>
<view class="falls-card-company">青岛 青岛经济技术开发区</view>
<custom-waterfalls-flow ref="waterfallsFlowRef" :value="list">
<template v-slot:default="job">
<view class="item" v-if="!job.recommend">
<view class="falls-card" @click="nextDetail(job)">
<view class="falls-card-title">{{ job.jobTitle }}</view>
<view class="falls-card-pay">
<view class="pay-text">
<Salary-Expectation
:max-salary="job.maxSalary"
:min-salary="job.minSalary"
:is-month="true"
></Salary-Expectation>
</view>
<image v-if="job.isHot" class="flame" src="/static/icon/flame.png"></image>
</view>
<view class="falls-card-education" v-if="job.education">
<dict-Label dictType="education" :value="job.education"></dict-Label>
</view>
<view class="falls-card-experience" v-if="job.experience">
<dict-Label dictType="experience" :value="job.experience"></dict-Label>
</view>
<view class="falls-card-company">{{ job.companyName }}</view>
<view class="falls-card-company">
青岛
<dict-Label dictType="area" :value="job.jobLocationAreaCode"></dict-Label>
</view>
<view class="falls-card-pepleNumber">
<view>2024.1.8</view>
<view>8</view>
<view>{{ job.postingDate || '发布日期' }}</view>
<view>{{ vacanciesTo(job.vacancies) }}</view>
</view>
<view class="falls-card-matchingrate">
<view class="">匹配度95%</view>
<view class=""><matchingDegree :job="job"></matchingDegree></view>
<uni-icons type="star" size="30"></uni-icons>
<uni-icons type="star-filled" color="#FFCB47" size="30"></uni-icons>
<!-- <uni-icons type="star-filled" color="#FFCB47" size="30"></uni-icons> -->
</view>
</view>
</view>
<view class="item" v-else>
<view class="recommend-card">
<view class="card-content">
<view class="recommend-card-title">在找{{ job.jobCategory }}工作吗</view>
<view class="recommend-card-tip">{{ job.tip }}</view>
<view class="recommend-card-controll">
<view class="controll-yes" @click="findJob(job)">是的</view>
<view class="controll-no">不是</view>
</view>
</view>
</view>
</view>
</template>
</custom-waterfalls-flow>
<loadmore ref="loadmoreRef"></loadmore>
</view>
</scroll-view>
<screeningJobRequirementsVue
v-model:show="showFilter"
@confirm="handleFilterConfirm"
></screeningJobRequirementsVue>
<!-- 岗位推荐组件 -->
<modify-expected-position-vue v-model:show="showModel" :jobList="jobList" />
</view>
</template>
<script setup>
import img from '/static/icon/filter.png';
import { reactive, inject, watch, ref, onMounted } from 'vue';
import { reactive, inject, watch, ref, onMounted, getCurrentInstance } from 'vue';
import img from '@/static/icon/filter.png';
import dictLabel from '@/components/dict-Label/dict-Label.vue';
const { $api, navTo, vacanciesTo, formatTotal } = inject('globalFunction');
import { onLoad, onShow } from '@dcloudio/uni-app';
import useUserStore from '../../stores/useUserStore';
const { $api, navTo } = inject('globalFunction');
const userStore = useUserStore();
import { storeToRefs } from 'pinia';
import useUserStore from '@/stores/useUserStore';
const { userInfo } = storeToRefs(useUserStore());
import useDictStore from '@/stores/useDictStore';
const { getTransformChildren } = useDictStore();
import screeningJobRequirementsVue from '@/components/screening-job-requirements/screening-job-requirements.vue';
import modifyExpectedPositionVue from '@/components/modifyExpectedPosition/modifyExpectedPosition.vue';
import { useRecommedIndexedDBStore, jobRecommender } from '@/stores/useRecommedIndexedDBStore.js';
const recommedIndexDb = useRecommedIndexedDBStore();
const waterfallsFlowRef = ref(null);
const loadmoreRef = ref(null);
const state = reactive({
title: '123123123房贷首付打的手机家里好玩的很浓厚第卡后sdhiwohdijasnbdhoui1很努力',
list: [
{
image: img,
hide: true,
},
{
image: img,
hide: true,
},
{
image: img,
hide: true,
},
{
image: img,
hide: true,
},
{
image: img,
hide: true,
},
{
image: img,
hide: true,
},
{
image: img,
hide: true,
},
{
image: img,
hide: true,
},
],
tabIndex: 'all',
search: '',
});
onShow(() => {
console.log('onShow');
const list = ref([]);
const pageState = reactive({
page: 0,
total: 0,
maxPage: 2,
pageSize: 10,
search: {
order: 0,
},
});
const inputText = ref('');
const showFilter = ref(false);
const showModel = ref(false);
const jobList = ref([
{ name: '销售顾问', highlight: true },
{ name: '销售管理', highlight: true },
{ name: '销售工程师', highlight: true },
{ name: '算法工程师', highlight: false },
{ name: '生产经理', highlight: false },
{ name: '市场策划', highlight: false },
{ name: '商务服务', highlight: false },
{ name: '客服', highlight: false },
{ name: '创意总监', highlight: false },
]);
onLoad(() => {
console.log('onLoad');
// $api.sleep(2000).then(() => {
// navTo('/pages/login/login');
// });
getJobRecommend('refresh');
});
watch(
() => state.title,
(newValue, oldValue) => {},
{ deep: true }
);
function nextDetail(job) {
// 记录岗位类型,用作数据分析
if (job.jobCategory) {
const recordData = recommedIndexDb.JobParameter(job);
recommedIndexDb.addRecord(recordData);
}
navTo(`/packageA/pages/post/post?jobId=${btoa(job.jobId)}`);
}
function handleModelConfirm(val) {
console.log(val);
}
function findJob(item) {
console.log(item);
}
function handleFilterConfirm(val) {
pageState.search = {
order: pageState.search.order,
};
for (const [key, value] of Object.entries(val)) {
pageState.search[key] = value.join(',');
}
getJobList('refresh');
}
function handelHostestSearch(val) {
pageState.search.order = val.value;
getJobList('refresh');
}
function scrollBottom() {
loadmoreRef.value.change('loading');
if (state.tabIndex === 'all') {
getJobRecommend();
} else {
getJobList();
}
}
function editojobs() {
console.log('jobs');
showModel.value = true;
}
function choosePosition(index) {
state.tabIndex = index;
list.value = [];
if (index === 'all') {
pageState.search = {};
inputText.value = '';
getJobRecommend('refresh');
} else {
// const id = useUserStore().userInfo.jobTitleId.split(',')[index];
pageState.search.jobTitle = useUserStore().userInfo.jobTitle[index];
inputText.value = '';
getJobList('refresh');
}
}
function searchJobTitle() {
state.tabIndex = '-1';
pageState.search = {
jobTitle: inputText.value,
};
getJobList('refresh');
}
function changeRecommend() {}
function changeLatestHotestStatus(e) {}
function getJobRecommend(type = 'add') {
if (type === 'refresh') {
list.value = [];
if (waterfallsFlowRef.value) waterfallsFlowRef.value.refresh();
}
let params = {
pageSize: pageState.pageSize,
sessionId: useUserStore().seesionId,
...pageState.search,
};
let comd = { recommend: true, jobCategory: '', tip: '确认你的兴趣,为您推荐更多合适的岗位' };
$api.createRequest('/app/job/recommend', params).then((resData) => {
const { data, total } = resData;
pageState.total = 0;
if (type === 'add') {
// 记录系统
recommedIndexDb.getRecord().then((res) => {
if (res.length) {
// 数据分析系统
const resultData = recommedIndexDb.analyzer(res);
const { sort, result } = resultData;
// 岗位询问系统
const conditionCounts = Object.fromEntries(
sort.filter((item) => item[1] > 1) // 过滤掉次数为 1 的项
);
jobRecommender.updateConditions(conditionCounts);
const question = jobRecommender.getNextQuestion();
if (question) {
comd.jobCategory = question;
data.unshift(comd);
}
}
const reslist = dataToImg(data);
list.value.push(...reslist);
});
} else {
list.value = dataToImg(data);
}
// 切换状态
if (data.length < pageState.pageSize) {
loadmoreRef.value.change('noMore');
} else {
loadmoreRef.value.change('more');
}
// 当没有岗位刷新sessionId重新啦
if (!data.length) {
useUserStore().initSeesionId();
}
});
}
function getJobList(type = 'add') {
if (type === 'add' && pageState.page < pageState.maxPage) {
pageState.page += 1;
}
if (type === 'refresh') {
list.value = [];
pageState.page = 1;
pageState.maxPage = 2;
waterfallsFlowRef.value.refresh();
}
let params = {
current: pageState.page,
pageSize: pageState.pageSize,
...pageState.search,
};
$api.createRequest('/app/job/list', params).then((resData) => {
const { rows, total } = resData;
if (type === 'add') {
const str = pageState.pageSize * (pageState.page - 1);
const end = list.value.length;
const reslist = dataToImg(rows);
list.value.splice(str, end, ...reslist);
} else {
list.value = dataToImg(rows);
}
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
if (rows.length < pageState.pageSize) {
loadmoreRef.value.change('noMore');
} else {
loadmoreRef.value.change('more');
}
});
}
function dataToImg(data) {
return data.map((item) => ({
...item,
image: img,
hide: true,
}));
}
</script>
<style lang="stylus" scoped>
.app-containers
// 推荐卡片
.recommend-card::before
position: absolute
left: 0
top: 0
content: ''
height: 60rpx
width: 100%
background: linear-gradient(to bottom, #FFAD47, #FFFFFF)
.recommend-card::after
position: absolute
right: -20rpx
top: 40rpx
content: ''
height: 100rpx
width: 200rpx
background: url('@/static/icon/Group1.png') center center no-repeat
background-size: 100rpx 140rpx
.recommend-card
padding: 20rpx
.card-content
position: relative;
z-index: 2;
.recommend-card-title
color: #333333
font-size: 32rpx
.recommend-card-tip
font-size: 24rpx;
color: #606060;
margin-top: 10rpx
.recommend-card-controll
display: flex
align-items: center
justify-content: space-around
margin-top: 40rpx
.controll-yes
border-radius: 39rpx
padding: 0rpx 30rpx
background: rgba(255, 173, 71, 1)
border: 2rpx solid rgba(255, 173, 71, 1)
color: #FFFFFF
.controll-no
border-radius: 39rpx
border: 2rpx solid rgba(255, 173, 71, 1)
padding: 0rpx 30rpx
color: rgba(255, 173, 71, 1)
.controll-yes:active, .controll-no:active
background: #e8e8e8
border: 2rpx solid #e8e8e8
.app-container
width: 100%;
height: calc(100vh - var(--window-top) - var(--status-bar-height) - var(--window-bottom));
background: linear-gradient( 180deg, #4778EC 0%, #002979 100%);
// background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, #fff 100%);
display: flex;
flex-direction: column;
position: fixed
.index-AI
height: 42rpx;
font-family: Inter, Inter;
@@ -204,7 +479,8 @@ watch(
align-items: center;
.tab-recommend
white-space: nowrap;
width: 92rpx;
width: fit-content;
padding: 0 10rpx;
height: 42rpx;
background: #4778EC;
border-radius: 17rpx 17rpx 0rpx 17rpx;
@@ -212,7 +488,7 @@ watch(
color: #FFFFFF;
font-size: 21rpx;
line-height: 42rpx;
margin-right: 12rpx;
margin-right: 14rpx;
.tab-number
font-size: 21rpx;
color: #606060;
@@ -225,54 +501,75 @@ watch(
height: 27rpx;
.falls-scroll
flex: 1;
overflow: hidden
overflow: hidden;
background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, #fff 100%)
.falls
padding: 20rpx 40rpx;
.falls-card
padding: 30rpx;
.falls-card-title
height: 49rpx;
font-size: 42rpx;
color: #606060;
line-height: 49rpx;
text-align: left;
.falls-card-pay
height: 50rpx;
font-size: 35rpx;
color: #002979;
line-height: 50rpx;
text-align: left;
.falls-card-education,.falls-card-experience
width: fit-content;
height: 30rpx;
background: #13C57C;
border-radius: 17rpx 17rpx 17rpx 17rpx;
padding: 0 10rpx;
line-height: 30rpx;
font-weight: 400;
font-size: 21rpx;
color: #FFFFFF;
text-align: center;
margin-top: 14rpx;
.falls-card-company,.falls-card-pepleNumber
margin-top: 14rpx;
font-size: 21rpx;
color: #606060;
line-height: 25rpx;
text-align: left;
.falls-card-pepleNumber
display: flex;
justify-content: space-between;
align-items: center;
.falls-card-matchingrate
margin-top: 10rpx;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 21rpx;
color: #4778EC;
text-align: left;
.item
position: relative;
// background: linear-gradient( 180deg, rgba(19, 197, 124, 0.4) 0%, rgba(255, 255, 255, 0) 30%), rgba(255, 255, 255, 0);
.falls-card
padding: 30rpx;
.falls-card-title
// height: 49rpx;
font-size: 42rpx;
color: #606060;
line-height: 49rpx;
text-align: left;
word-break:break-all
.falls-card-pay
// height: 50rpx;
word-break:break-all
font-size: 34rpx;
color: #002979;
line-height: 50rpx;
text-align: left;
display: flex;
align-items: end;
position: relative
.pay-text
color: #002979;
padding-right: 10rpx
.flame
position: absolute
bottom: 0
right: -10rpx
transform: translate(0, -30%)
width: 24rpx
height: 31rpx
.falls-card-education,.falls-card-experience
width: fit-content;
height: 30rpx;
background: #13C57C;
border-radius: 17rpx 17rpx 17rpx 17rpx;
padding: 0 10rpx;
line-height: 30rpx;
font-weight: 400;
font-size: 21rpx;
color: #FFFFFF;
text-align: center;
margin-top: 14rpx;
.falls-card-company,.falls-card-pepleNumber
margin-top: 14rpx;
font-size: 21rpx;
color: #606060;
line-height: 25rpx;
text-align: left;
.falls-card-pepleNumber
display: flex;
justify-content: space-between;
align-items: center;
.falls-card-matchingrate
margin-top: 10rpx;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 21rpx;
color: #4778EC;
text-align: left;
.logo
width: 100px;
height: 100px;
width: 200rpx;
height: 200rpx;
.tabchecked
color: #4778EC !important
</style>

View File

@@ -9,7 +9,8 @@
<view class="logo-title">就业</view>
</view>
<view class="btns">
<button open-type="getUserInfo" @getuserinfo="getuserinfo" class="wxlogin">微信登录</button>
<button class="wxlogin" @click="loginTest">登录</button>
<!-- <button open-type="getUserInfo" @getuserinfo="getuserinfo" class="wxlogin">登录</button> -->
<view class="wxaddress">青岛市公共就业和人才服务中心</view>
</view>
</template>
@@ -21,15 +22,17 @@
<view class="color_D9D9D9">个人信息仅用于推送优质内容</view>
</view>
<view class="fl_box fl_justmiddle fl_1 fl_alstart">
<view class="tabtwo-sex">
<view class="tabtwo-sex" @click="changeSex(1)">
<image class="sex-img" src="../../static/icon/woman.png"></image>
<view class="mar_top5"></view>
<view class="dot"></view>
<view v-if="fromValue.sex === 1" class="dot doted"></view>
<view v-else class="dot"></view>
</view>
<view class="tabtwo-sex">
<view class="tabtwo-sex" @click="changeSex(0)">
<image class="sex-img" src="../../static/icon/man.png"></image>
<view class="mar_top5"></view>
<view class="dot doted"></view>
<view v-if="fromValue.sex === 0" class="dot doted"></view>
<view v-else class="dot"></view>
</view>
</view>
<view class="nextstep" @tap="nextStep">下一步</view>
@@ -43,10 +46,16 @@
<view class="color_D9D9D9">个人信息仅用于推送优质内容</view>
</view>
<view class="fl_box fl_deri fl_almiddle">
<view class="agebtn agebtned">30岁以下</view>
<view class="agebtn">31-40</view>
<view class="agebtn">41-50</view>
<view class="agebtn">51岁以上</view>
<!-- <view class="agebtn agebtned">30岁以下</view> -->
<view
class="agebtn"
:class="{ agebtned: item.value === fromValue.age }"
v-for="item in state.ageList"
:key="item.value"
@click="changeAge(item.value)"
>
{{ item.label }}
</view>
</view>
<view class="fl_box fl_justmiddle"></view>
<view class="nextstep" @tap="nextStep">下一步</view>
@@ -60,17 +69,15 @@
<view class="color_D9D9D9">个人信息仅用于推送优质内容</view>
</view>
<view class="eduction-content">
<view class="eductionbtn eductionbtned">初中及以下</view>
<view class="eductionbtn">中专/中技</view>
<view class="eductionbtn">高中</view>
<view class="eductionbtn">大专</view>
<view class="eductionbtn">本科</view>
<view class="eductionbtn">硕士</view>
<view class="eductionbtn">博士</view>
<view class="eductionbtn">MBA/EMBA</view>
<view class="eductionbtn">留学-学士</view>
<view class="eductionbtn">留学-硕士</view>
<view class="eductionbtn">留学-博士</view>
<view
class="eductionbtn"
:class="{ eductionbtned: item.value === fromValue.education }"
v-for="item in oneDictData('education')"
@click="changeEducation(item.value)"
:key="item.value"
>
{{ item.label }}
</view>
</view>
<view class="nextstep" @tap="nextStep">下一步</view>
</view>
@@ -83,22 +90,28 @@
<view class="color_D9D9D9">个人信息仅用于推送优质内容</view>
</view>
<view class="salary">
<scroll-view class="salary-content" :show-scrollbar="false" :scroll-y="true">
<view class="salary-content-item">不限</view>
<view class="salary-content-item salary-content-item-selected">2k</view>
<view class="salary-content-item">5k</view>
<view class="salary-content-item">10k</view>
<view class="salary-content-item">15k</view>
</scroll-view>
<view class="center-text"></view>
<scroll-view class="salary-content" :show-scrollbar="false" :scroll-y="true">
<view class="salary-content-item">不限</view>
<view class="salary-content-item salary-content-item-selected">2k</view>
<view class="salary-content-item">5k</view>
<view class="salary-content-item">10k</view>
<view class="salary-content-item">15k</view>
<view class="salary-content-item">15k</view>
</scroll-view>
<picker-view
indicator-style="height: 140rpx;"
:value="state.salayData"
@change="bindChange"
class="picker-view"
>
<picker-view-column>
<view class="item" v-for="(item, index) in state.lfsalay" :key="index">
<view class="item-child" :class="{ 'item-childed': state.salayData[0] === index }">
{{ item }}k
</view>
</view>
</picker-view-column>
<view class="item-center"></view>
<picker-view-column>
<view class="item" v-for="(item, index) in state.risalay" :key="index">
<view class="item-child" :class="{ 'item-childed': state.salayData[2] === index }">
{{ item }}k
</view>
</view>
</picker-view-column>
</picker-view>
</view>
<view class="fl_box fl_justmiddle"></view>
<view class="nextstep" @tap="nextStep">下一步</view>
@@ -112,17 +125,17 @@
<view class="color_D9D9D9">个人信息仅用于推送优质内容</view>
</view>
<view class="eduction-content">
<view class="eductionbtn eductionbtned">市南区</view>
<view class="eductionbtn">市北区</view>
<view class="eductionbtn">李沧区</view>
<view class="eductionbtn">崂山区</view>
<view class="eductionbtn">荒岛区</view>
<view class="eductionbtn">城阳区</view>
<view class="eductionbtn">即墨区</view>
<view class="eductionbtn">胶州市</view>
<view class="eductionbtn">平度市</view>
<view class="eductionbtn">莱西市</view>
<view class="eductionbtn">不限区域</view>
<!-- <view class="eductionbtn eductionbtned">市南区</view> -->
<view
class="eductionbtn"
:class="{ eductionbtned: item.value === fromValue.area }"
v-for="item in oneDictData('area')"
:key="item.value"
@click="changeArea(item.value)"
>
{{ item.label }}
</view>
<!-- <view class="eductionbtn">不限区域</view> -->
</view>
<view class="nextstep" @tap="nextStep">下一步</view>
</view>
@@ -134,37 +147,13 @@
<view class="color_FFFFFF fs_30">您的期望岗位6/6</view>
<view class="color_D9D9D9">个人信息仅用于推送优质内容</view>
</view>
<view class="sex-search">
<uni-icons class="iconsearch" type="search" size="20"></uni-icons>
<input class="uni-input searchinput" confirm-type="search" />
</view>
<view class="sex-content fl_1">
<scroll-view :show-scrollbar="false" :scroll-y="true" class="sex-content-left">
<view
v-for="item in state.station"
:key="item.value"
class="left-list-btn"
:class="{ 'left-list-btned': item.value === state.stationCateLog }"
@click="changeStationLog(item)"
>
{{ item.label }}
</view>
</scroll-view>
<scroll-view :show-scrollbar="false" :scroll-y="true" class="sex-content-right">
<view class="grid-sex">
<view class="sex-right-btn sex-right-btned">客户经理</view>
<view class="sex-right-btn">客户经理</view>
<view class="sex-right-btn">客户经理</view>
<view class="sex-right-btn">客户经理</view>
<view class="sex-right-btn">客户经理</view>
<view class="sex-right-btn">客户经理</view>
<view class="sex-right-btn">客户经理</view>
</view>
</scroll-view>
<expected-station @onChange="changeJobTitleId" :station="state.station"></expected-station>
</view>
<navigator url="/pages/index/index" open-type="reLaunch" hover-class="other-navigator-hover">
<button class="nextstep confirmStep">完成</button>
</navigator>
<button class="nextstep confirmStep" @click="complete">完成</button>
<!-- <navigator url="/pages/index/index" open-type="reLaunch" hover-class="other-navigator-hover">
<button class="nextstep confirmStep" @click="complete">完成</button>
</navigator> -->
</view>
</template>
</tabcontrolVue>
@@ -174,61 +163,125 @@
<script setup>
import tabcontrolVue from './components/tabcontrol.vue';
import { reactive, inject, watch, ref } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import useUserStore from '@/stores/useUserStore';
import useDictStore from '@/stores/useDictStore';
const { statusBarHeight } = inject('deviceInfo');
const { $api, navTo } = inject('globalFunction');
// 初始化
const station = [
{ label: '销售/商务拓展', value: 1 },
{ label: '人事/行政/财务/法务', value: 2 },
{ label: '互联网/通信及硬件', value: 3 },
{ label: '运维/测试', value: 4 },
{ label: '销售/商务拓展', value: 5 },
{ label: '人事/行政/财务/法务', value: 6 },
{ label: '互联网/通信及硬件', value: 7 },
{ label: '运维/测试', value: 8 },
{ label: '销售/商务拓展', value: 9 },
{ label: '人事/行政/财务/法务', value: 10 },
{ label: '互联网/通信及硬件', value: 11 },
{ label: '销售/商务拓展', value: 12 },
{ label: '人事/行政/财务/法务', value: 13 },
{ label: '互联网/通信及硬件', value: 14 },
];
const { loginSetToken, getUserResume } = useUserStore();
const { getDictSelectOption, oneDictData } = useDictStore();
// status
const tabCurrent = ref(0);
const salay = [2, 5, 10, 15, 20, 25, 30, 50, 80, 100];
const state = reactive({
station: station,
station: [],
stationCateLog: 1,
ageList: [],
lfsalay: [2, 5, 10, 15, 20, 25, 30, 50],
risalay: JSON.parse(JSON.stringify(salay)),
salayData: [0, 0, 0],
});
const fromValue = reactive({
sex: 1,
age: '0',
education: '4',
salaryMin: 2000,
salaryMax: 2000,
area: 0,
jobTitleId: '',
});
setTimeout(() => {
console.log('gg');
}, 4000);
const getuserinfo = (e) => {
console.log(e);
};
// 行为
function changeStationLog(item) {
state.stationCateLog = item.value;
onLoad((parmas) => {
getDictSelectOption('age').then((data) => {
state.ageList = data;
});
getTreeselect();
});
// 选择薪资
function bindChange(val) {
state.salayData = val.detail.value;
const copyri = JSON.parse(JSON.stringify(salay));
const [lf, _, ri] = val.detail.value;
state.risalay = copyri.slice(lf, copyri.length);
fromValue.salaryMin = copyri[lf] * 1000;
fromValue.salaryMax = state.risalay[ri] * 1000;
}
function changeSex(sex) {
fromValue.sex = sex;
}
function changeAge(age) {
fromValue.age = age;
}
function changeEducation(education) {
fromValue.education = education;
}
function changeArea(area) {
fromValue.area = area;
}
function changeJobTitleId(jobTitleId) {
fromValue.jobTitleId = jobTitleId;
}
// 行为
// function changeStationLog(item) {
// state.stationCateLog = item.value;
// }
function nextStep() {
tabCurrent.value += 1;
}
function handleScroll(event) {
console.log('滚动条滚动', event.detail.scrollTop);
console.log(Math.round(event.detail.scrollTop / 75));
// this.activeIndex = Math.round(event.detail.scrollTop / 75);
// function handleScroll(event) {
// console.log('滚动条滚动', event.detail.scrollTop);
// console.log(Math.round(event.detail.scrollTop / 75));
// // this.activeIndex = Math.round(event.detail.scrollTop / 75);
// }
// 获取职位
function getTreeselect() {
$api.createRequest('/app/common/jobTitle/treeselect', {}, 'GET').then((resData) => {
state.station = resData.data;
});
}
// 登录
function loginTest() {
const params = {
username: 'test',
password: 'test',
};
$api.createRequest('/app/login', params, 'post').then((resData) => {
$api.msg('模拟帐号密码测试登录成功');
loginSetToken(resData.token).then((resume) => {
if (resume.data.jobTitleId) {
// 设置推荐列表,每次退出登录都需要更新
useUserStore().initSeesionId();
uni.reLaunch({
url: '/pages/index/index',
});
} else {
nextStep();
}
});
});
}
function complete() {
$api.createRequest('/app/user/resume', fromValue, 'post').then((resData) => {
$api.msg('完成');
getUserResume();
uni.reLaunch({
url: '/pages/index/index',
});
});
}
</script>
<style lang="stylus" scoped>
.container
background: linear-gradient(#4778EC, #002979);
width: 100%;
height: calc(100vh - var(--window-top) - var(--status-bar-height) - var(--window-bottom));
position: relative;
position: fixed;
.login-content
position: absolute;
@@ -360,9 +413,53 @@ function handleScroll(event) {
.salary
width: fit-content;
display: grid;
grid-template-columns: 300rpx 40rpx 300rpx;
// grid-gap: 20rpx;
grid-template-columns: 640rpx;
grid-gap: 20rpx;
margin-top: 50rpx;
.picker-view {
width: 100%;
height: 600rpx;
margin-top: 20rpx;
.uni-picker-view-mask{
background: rgba(0,0,0,0);
}
}
.item {
.item-child{
line-height: 90rpx;
font-size: 38rpx;
color: #606060;
text-align: center;
background: #D9D9D9;
border-radius: 20rpx;
margin: 20rpx 10rpx 20rpx 10rpx;
}
.item-childed{
line-height: 105rpx;
margin: 10rpx 5rpx 10rpx 5rpx;
background: #13C57C;
color: #FFFFFF;
}
}
.item-center{
width: 40rpx;
line-height: 600rpx;
width: 51rpx;
height: 47rpx;
font-family: Inter, Inter;
font-weight: 400;
font-size: 28rpx;
color: #FFFFFF;
text-align: center;
font-style: normal;
text-transform: none;
}
.uni-picker-view-indicator:after{
border: 0
}
.uni-picker-view-indicator:before{
border: 0
}
.center-text
color: #FFFFFF;
text-align: center;
@@ -386,71 +483,12 @@ function handleScroll(event) {
padding-left: 0;
padding-right: 0;
background: #4678ec;
.sex-search
width: calc(100% - 28rpx - 28rpx);
padding: 10rpx 28rpx;
display: grid;
// grid-template-columns: 50rpx auto;
position: relative;
.iconsearch
position: absolute;
left: 40rpx;
top: 20rpx;
.searchinput
border-radius: 10rpx;
background: #FFFFFF;
padding: 10rpx 0 10rpx 58rpx;
.sex-content
background: #FFFFFF;
border-radius: 20rpx;
width: 100%;
margin-top: 20rpx;
margin-bottom: 40rpx;
display: flex;
border-bottom: 2px solid #D9D9D9;
overflow: hidden
.sex-content-left
width: 250rpx;
.left-list-btn
padding: 0 24rpx;
display: grid;
place-items: center;
height: 100rpx;
text-align: center;
color: #606060;
font-size: 28rpx;
.left-list-btned
color: #4778EC;
position: relative;
.left-list-btned::after
position: absolute;
left: 20rpx;
content: '';
width: 7rpx;
height: 38rpx;
background: #4778EC;
border-radius: 0rpx 0rpx 0rpx 0rpx;
.sex-content-right
border-left: 2px solid #D9D9D9;
flex: 1;
.grid-sex
display: grid;
grid-template-columns: 50% 50%;
place-items: center;
.sex-right-btn
width: 211rpx;
height: 84rpx;
font-size: 35rpx;
line-height: 41rpx;
text-align: center;
display: grid;
place-items: center;
background: #D9D9D9;
border-radius: 20rpx;
margin-top:30rpx;
color: #606060;
.sex-right-btned
color: #FFFFFF;
background: #4778EC;
overflow: hidden;
height: 100%
</style>

View File

@@ -3,11 +3,15 @@
<view class="mine-AI">AI+就业服务程序</view>
<view class="mine-userinfo">
<view class="userindo-head">
<image class="userindo-head-img" src="/static/icon/flame2.png"></image>
<image class="userindo-head-img" v-if="userInfo.age === '0'" src="/static/icon/boy.png"></image>
<image class="userindo-head-img" v-else src="/static/icon/girl.png"></image>
</view>
<view class="userinfo-ls">
<view class="userinfo-ls-name">用户名</view>
<view class="userinfo-ls-resume">简历完成度80%建议优化</view>
<view class="userinfo-ls-name">{{ userInfo.name || '暂无用户名' }}</view>
<view class="userinfo-ls-resume" v-if="isAbove90(Completion)">
简历完成度 {{ Completion }}建议优化
</view>
<view class="userinfo-ls-resume" v-else>简历完成度 {{ Completion }}</view>
</view>
</view>
<view class="mine-tab">
@@ -15,15 +19,15 @@
<image class="item-img" src="/static/icon/resume.png"></image>
<view class="item-text">我的简历</view>
</view>
<view class="tab-item">
<view class="tab-item" @click="navTo('/packageA/pages/collection/collection')">
<image class="item-img" src="/static/icon/collect.png"></image>
<view class="item-text">我的收藏</view>
</view>
<view class="tab-item">
<view class="tab-item" @click="navTo('/packageA/pages/browseJob/browseJob')">
<image class="item-img" src="/static/icon/browse.png"></image>
<view class="item-text">我的浏览</view>
</view>
<view class="tab-item">
<view class="tab-item" @click="navTo('/packageA/pages/Intendedposition/Intendedposition')">
<image class="item-img" src="/static/icon/quaters.png"></image>
<view class="item-text">意向岗位</view>
</view>
@@ -32,18 +36,50 @@
<view class="mine-options-item">实名认证</view>
<view class="mine-options-item">素质测评</view>
<view class="mine-options-item">AI面试</view>
<view class="mine-options-item">账号与安全</view>
<!-- <view class="mine-options-item">账号与安全</view> -->
<view class="mine-options-item">通知与提醒</view>
<view class="mine-logout">退出登录</view>
<view class="mine-logout" @click="logOut">退出登录</view>
</view>
<uni-popup ref="popup" type="dialog">
<uni-popup-dialog
mode="base"
title="确定退出登录吗?"
type="info"
:duration="2000"
:before-close="true"
@confirm="confirm"
@close="close"
></uni-popup-dialog>
</uni-popup>
</view>
</template>
<script setup>
import { reactive, inject, watch, ref, onMounted } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import useUserStore from '../../stores/useUserStore';
const { $api, navTo } = inject('globalFunction');
import useUserStore from '@/stores/useUserStore';
const userInfo = ref({});
const Completion = ref({});
const popup = ref(null);
onShow(() => {
userInfo.value = useUserStore().userInfo;
Completion.value = useUserStore().Completion;
});
function logOut() {
popup.value.open();
}
function close() {
popup.value.close();
}
function confirm() {
useUserStore().logOut();
}
const isAbove90 = (percent) => parseFloat(percent) < 90;
</script>
<style lang="stylus" scoped>
@@ -122,12 +158,17 @@ const { $api, navTo } = inject('globalFunction');
.tab-item:nth-child(2)>.item-img
width: 51rpx;
height: 45rpx;
margin-top: 6rpx;
margin-bottom: 4rpx;
.tab-item:nth-child(3)>.item-img
width: 62rpx;
height: 41rpx;
margin-top: 6rpx
margin-bottom: 10rpx;
.tab-item:nth-child(4)>.item-img
width: 45rpx;
height: 47rpx;
margin-bottom: 8rpx;
.mine-options
margin: 43rpx 30rpx;
min-height: 155rpx;

View File

@@ -10,7 +10,7 @@
<swiper-item class="list">
<view class="list-card">
<view class="card-img">
<image class="card-img-flame" src="/static/icon/flame2.png"></image>
<image class="card-img-flame" src="/static/icon/recommendday.png"></image>
</view>
<view class="card-info">
<view class="info-title">今日推荐</view>
@@ -22,7 +22,7 @@
<swiper-item class="list">
<view class="list-card">
<view class="card-img">
<image class="card-img-flame" src="/static/icon/flame2.png"></image>
<image class="card-img-flame" src="/static/icon/recommendday.png"></image>
</view>
<view class="card-info">
<view class="info-title">今日推荐</view>
@@ -63,7 +63,6 @@ function seemsg(index) {
background: linear-gradient( 180deg, #4778EC 0%, #002979 100%);
display: flex;
flex-direction: column;
.msg-AI
height: 42rpx;
font-family: Inter, Inter;
@@ -83,7 +82,7 @@ function seemsg(index) {
.actived
font-size: 28rpx;
color: #FFFFFF;
text-shadow: 0px 7px 7px rgba(0,0,0,0.25);
text-shadow: 0rpx 14rpx 14rpx rgba(0,0,0,0.25);
.msg-list
flex: 1;
overflow: hidden;
@@ -111,8 +110,8 @@ function seemsg(index) {
place-items: center;
margin-right: 30rpx;
.card-img-flame
width: 36rpx;
height: 44rpx;
width: 100%;
height: 100%
.card-info
flex: 1;
display: flex;

View File

@@ -1,64 +1,243 @@
<template>
<scroll-view :scroll-y="true" class="nearby-scroll">
<scroll-view :scroll-y="true" class="nearby-scroll" @scrolltolower="scrollBottom">
<view class="two-head">
<view class="head-item active">市北区</view>
<view class="head-item" v-for="(item, index) in 10" :key="index">中山路商圈</view>
<!-- <view class="head-item active">市北区</view> -->
<view
class="head-item"
:class="{ active: state.comId === item.commercialAreaId }"
v-for="(item, index) in state.comlist"
:key="item.commercialAreaId"
@click="clickCommercialArea(item)"
>
{{ item.commercialAreaName }}
</view>
</view>
<view class="nearby-list">
<view class="list-head" @touchmove.stop.prevent>
<view class="tab-options">
<scroll-view :scroll-x="true" :show-scrollbar="false" class="tab-scroll">
<scroll-view :scroll-x="true" :show-scrollbar="false" class="tab-scroll" @touchmove.stop>
<view class="tab-op-left">
<view class="tab-list" v-for="(item, index) in 4" :key="index">中国万岁</view>
<uni-icons type="plusempty" style="margin-right: 10rpx" size="20"></uni-icons>
<view
class="tab-list"
:class="{ tabchecked: state.tabIndex === 'all' }"
@click="choosePosition('all')"
>
全部
</view>
<view
class="tab-list"
:class="{ tabchecked: state.tabIndex === index }"
@click="choosePosition(index)"
v-for="(item, index) in userInfo.jobTitle"
:key="index"
>
{{ item }}
</view>
</view>
</scroll-view>
<view class="tab-op-right">
<view class="tab-recommend">推荐</view>
<view class="tab-filter">
<view class="tab-number">1000+</view>
<uni-icons type="plusempty" style="margin-right: 10rpx" size="20"></uni-icons>
<view class="tab-recommend">
<latestHotestStatus @confirm="handelHostestSearch"></latestHotestStatus>
</view>
<view class="tab-filter" @click="emit('onFilter', 3)">
<view class="tab-number" v-show="pageState.total">{{ formatTotal(pageState.total) }}</view>
<image class="image" src="/static/icon/filter.png"></image>
</view>
</view>
</view>
</view>
<view class="one-cards">
<view class="card-box" v-for="(item, index) in 20" :key="index">
<view class="card-box" v-for="(item, index) in list" :key="item.jobId" @click="navToPost(item.jobId)">
<view class="box-row mar_top0">
<view class="row-left">销售工程师-高级销售经理</view>
<view class="row-right">1-2</view>
<view class="row-left">{{ item.jobTitle }}</view>
<view class="row-right">
<Salary-Expectation
:max-salary="item.maxSalary"
:min-salary="item.minSalary"
></Salary-Expectation>
</view>
</view>
<view class="box-row">
<view class="row-left">
<view class="row-tag">本科</view>
<view class="row-tag">1-5</view>
<view class="row-tag" v-if="item.education">
<dict-Label dictType="education" :value="item.education"></dict-Label>
</view>
<view class="row-tag" v-if="item.experience">
<dict-Label dictType="experience" :value="item.experience"></dict-Label>
</view>
</view>
</view>
<view class="box-row mar_top0">
<view class="row-item mineText">2024.1.8</view>
<view class="row-item mineText">8</view>
<view class="row-item mineText textblue">匹配度93%</view>
<view class="row-item mineText">{{ item.postingDate || '发布日期' }}</view>
<view class="row-item mineText">{{ vacanciesTo(item.vacancies) }}</view>
<view class="row-item mineText textblue"><matchingDegree :job="item"></matchingDegree></view>
<view class="row-item">
<uni-icons type="star" size="28"></uni-icons>
<!-- <uni-icons type="star-filled" color="#FFCB47" size="30"></uni-icons> -->
</view>
</view>
<view class="box-row">
<view class="row-left mineText">湖南沃森电气科技有限公司</view>
<view class="row-right mineText">青岛 青岛经济技术开发区 550m</view>
<view class="row-left mineText">{{ item.companyName }}</view>
<view class="row-right mineText">
青岛
<dict-Label dictType="area" :value="item.jobLocationAreaCode"></dict-Label>
<convert-distance
:alat="item.latitude"
:along="item.longitude"
:blat="latitude()"
:blong="longitude()"
></convert-distance>
</view>
</view>
</view>
</view>
</view>
<loadmore ref="loadmoreRef"></loadmore>
</scroll-view>
</template>
<script setup>
import dictLabel from '@/components/dict-Label/dict-Label.vue';
import { reactive, inject, watch, ref, onMounted } from 'vue';
const state = reactive({});
import { onLoad, onShow } from '@dcloudio/uni-app';
import useDictStore from '@/stores/useDictStore';
import useUserStore from '@/stores/useUserStore';
const { getDictSelectOption, oneDictData } = useDictStore();
const { $api, navTo, vacanciesTo, formatTotal } = inject('globalFunction');
import useLocationStore from '@/stores/useLocationStore';
const { getLocation, longitude, latitude } = useLocationStore();
const emit = defineEmits(['onFilter']);
const state = reactive({
tabIndex: 'all',
comlist: [],
comId: 0,
});
const fromValue = reactive({
area: 0,
areaInfo: {},
});
const loadmoreRef = ref(null);
const userInfo = ref({});
const isLoaded = ref(false);
const pageState = reactive({
page: 0,
total: 0,
maxPage: 2,
pageSize: 10,
search: {
order: 0,
},
});
const list = ref([]);
onShow(() => {
userInfo.value = useUserStore().userInfo;
});
onLoad(() => {
getBusinessDistrict();
});
function navToPost(jobId) {
navTo(`/packageA/pages/post/post?jobId=${btoa(jobId)}`);
}
async function loadData() {
try {
if (isLoaded.value) return;
getJobList('refresh');
isLoaded.value = true;
} catch (err) {
isLoaded.value = false; // 重置状态允许重试
throw err;
}
}
function scrollBottom() {
getJobList();
loadmoreRef.value.change('loading');
}
function choosePosition(index) {
state.tabIndex = index;
if (index === 'all') {
pageState.search.jobTitle = '';
} else {
pageState.search.jobTitle = useUserStore().userInfo.jobTitle[index];
}
getJobList('refresh');
}
function clickCommercialArea(area) {
state.areaInfo = area;
state.comId = area.commercialAreaId;
getJobList('refresh');
}
function getBusinessDistrict() {
$api.createRequest(`/app/common/commercialArea`).then((resData) => {
if (resData.data.length) {
state.comlist = resData.data;
state.areaInfo = resData.data[0];
state.comId = resData.data[0].commercialAreaId;
}
});
}
function getJobList(type = 'add') {
if (type === 'add' && pageState.page < pageState.maxPage) {
pageState.page += 1;
}
if (type === 'refresh') {
pageState.page = 1;
pageState.maxPage = 2;
}
let params = {
longitude: state.areaInfo.longitude,
latitude: state.areaInfo.latitude,
current: pageState.page,
pageSize: pageState.pageSize,
radius: 2,
...pageState.search,
};
$api.createRequest('/app/job/commercialArea', params, 'POST').then((resData) => {
const { rows, total } = resData;
if (type === 'add') {
const str = pageState.pageSize * (pageState.page - 1);
const end = list.value.length;
const reslist = rows;
list.value.splice(str, end, ...reslist);
} else {
list.value = rows;
}
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
if (rows.length < pageState.pageSize) {
loadmoreRef.value.change('noMore');
} else {
loadmoreRef.value.change('more');
}
});
}
function handelHostestSearch(val) {
pageState.search.order = val.value;
getJobList('refresh');
}
function handleFilterConfirm(val) {
pageState.search = {
order: pageState.search.order,
};
for (const [key, value] of Object.entries(val)) {
pageState.search[key] = value.join(',');
}
getJobList('refresh');
}
defineExpose({ loadData, handleFilterConfirm });
</script>
<style lang="stylus" scoped>
.tabchecked
color: #4778EC !important
.nearby-scroll
overflow: hidden;
.two-head
@@ -85,7 +264,7 @@ const state = reactive({});
color: #FFFFFF;
.nearby-list
margin-top: 40rpx;
background: linear-gradient( 180deg, #4778EC 0%, #002979 100%);
// background: linear-gradient( 180deg, #4778EC 0%, #002979 100%);
.list-head
height: 77rpx;
background-color: #FFFFFF;
@@ -123,7 +302,8 @@ const state = reactive({});
align-items: center;
.tab-recommend
white-space: nowrap;
width: 92rpx;
width: fit-content;
padding: 0 10rpx;
height: 42rpx;
background: #4778EC;
border-radius: 17rpx 17rpx 0rpx 17rpx;
@@ -165,6 +345,9 @@ const state = reactive({});
color: #606060;
.textblue
color: #4778EC;
.row-right
min-width: 120rpx
text-align: right
.row-left
display: flex;
justify-content: space-between;

View File

@@ -1,13 +1,15 @@
<template>
<scroll-view :scroll-y="true" class="nearby-scroll">
<scroll-view :scroll-y="true" class="nearby-scroll" @scrolltolower="scrollBottom">
<view class="nearby-map" @touchmove.stop.prevent>
<zhuo-tianditu-MultiPoint-Mapper
ref="tMap"
:showLabel="false"
:showCirle="true"
api-key="e122b0518f43b32dcc256edbae20a5d1"
@onLoad="LoadComplite"
></zhuo-tianditu-MultiPoint-Mapper>
<map
style="width: 100%; height: 300px"
:latitude="latitude()"
:longitude="longitude()"
:markers="mapCovers"
:circles="mapCircles"
:controls="mapControls"
@controltap="handleControl"
></map>
</view>
<view class="nearby-list">
<view class="list-head" @touchmove.stop.prevent>
@@ -32,81 +34,236 @@
></bingProgressComponent>
</view>
<view class="tab-op-right">
<view class="tab-recommend">推荐</view>
<view class="tab-filter">
<view class="tab-number">1000+</view>
<view class="tab-recommend">
<latestHotestStatus @confirm="handelHostestSearch"></latestHotestStatus>
</view>
<view class="tab-filter" @click="emit('onFilter', 0)">
<view class="tab-number" v-show="pageState.total">{{ formatTotal(pageState.total) }}</view>
<image class="image" src="/static/icon/filter.png"></image>
</view>
</view>
</view>
</view>
<view class="one-cards">
<view class="card-box" v-for="(item, index) in 20" :key="index">
<view class="card-box" v-for="(item, index) in list" :key="item.jobId" @click="navToPost(item.jobId)">
<view class="box-row mar_top0">
<view class="row-left">销售工程师-高级销售经理</view>
<view class="row-right">1-2</view>
<view class="row-left">{{ item.jobTitle }}</view>
<view class="row-right">
<Salary-Expectation
:max-salary="item.maxSalary"
:min-salary="item.minSalary"
></Salary-Expectation>
</view>
</view>
<view class="box-row">
<view class="row-left">
<view class="row-tag">本科</view>
<view class="row-tag">1-5</view>
<view class="row-tag" v-if="item.education">
<dict-Label dictType="education" :value="item.education"></dict-Label>
</view>
<view class="row-tag" v-if="item.experience">
<dict-Label dictType="experience" :value="item.experience"></dict-Label>
</view>
</view>
</view>
<view class="box-row mar_top0">
<view class="row-item mineText">2024.1.8</view>
<view class="row-item mineText">8</view>
<view class="row-item mineText textblue">匹配度93%</view>
<view class="row-item mineText">{{ item.postingDate || '发布日期' }}</view>
<view class="row-item mineText">{{ vacanciesTo(item.vacancies) }}</view>
<view class="row-item mineText textblue"><matchingDegree :job="item"></matchingDegree></view>
<view class="row-item">
<uni-icons type="star" size="28"></uni-icons>
<!-- <uni-icons type="star-filled" color="#FFCB47" size="30"></uni-icons> -->
</view>
</view>
<view class="box-row">
<view class="row-left mineText">湖南沃森电气科技有限公司</view>
<view class="row-right mineText">青岛 青岛经济技术开发区 550m</view>
<view class="row-left mineText">{{ item.companyName }}</view>
<view class="row-right mineText">
青岛
<dict-Label dictType="area" :value="item.jobLocationAreaCode"></dict-Label>
<convert-distance
:alat="item.latitude"
:along="item.longitude"
:blat="latitude()"
:blong="longitude()"
></convert-distance>
</view>
</view>
</view>
</view>
</view>
<loadmore ref="loadmoreRef"></loadmore>
</scroll-view>
</template>
<script setup>
import point2 from '@/static/icon/point2.png';
import LocationPng from '@/static/icon/Location.png';
import dictLabel from '@/components/dict-Label/dict-Label.vue';
import useLocationStore from '@/stores/useLocationStore';
import bingProgressComponent from '/components/bing-progress/bing-progress.vue';
import screeningJobRequirementsVue from '@/components/screening-job-requirements/screening-job-requirements.vue';
import { reactive, inject, watch, ref, onMounted, onBeforeUnmount } from 'vue';
const { getLocation, longitude, latitude } = useLocationStore();
import { onLoad, onShow } from '@dcloudio/uni-app';
import { msg } from '../../../common/globalFunction';
const { $api, navTo, debounce, vacanciesTo, customSystem, formatTotal } = inject('globalFunction');
const emit = defineEmits(['onFilter']);
const tMap = ref();
const progress = ref();
const state = reactive({
progressWidth: '150px',
const mapCovers = ref([]);
const mapCircles = ref([]);
const mapControls = ref([
{
id: 1,
position: {
// 控件位置
left: customSystem.systemInfo.screenWidth - 50,
top: 180,
width: 30,
height: 30,
},
iconPath: LocationPng, // 控件图标
},
]);
const loadmoreRef = ref(null);
const pageState = reactive({
page: 0,
total: 100,
maxPage: 2,
pageSize: 10,
search: {
radius: 1,
order: 0,
},
});
const isLoaded = ref(false);
const list = ref([]);
const state = reactive({
progressWidth: '200px',
});
onLoad(() => {});
function navToPost(jobId) {
navTo(`/packageA/pages/post/post?jobId=${btoa(jobId)}`);
}
async function loadData() {
try {
if (isLoaded.value) return;
isLoaded.value = true;
} catch (err) {
isLoaded.value = false; // 重置状态允许重试
throw err;
}
}
function scrollBottom() {
getJobList();
loadmoreRef.value.change('loading');
}
function handleControl(e) {
switch (e.detail.controlId) {
case 1:
getInit();
break;
}
}
onMounted(() => {
const query = uni.createSelectorQuery().in(this);
query
.select('.tab-scroll')
.boundingClientRect((data) => {
state.progressWidth = data.width - 50 + 'px';
})
.exec();
tMap.value.open(104.397894, 31.126855);
$api.msg('使用模拟定位');
getInit();
});
// 初始化
function LoadComplite() {
console.log('天地图加载完成');
const list = [
function getInit() {
getLocation().then((res) => {
mapCovers.value = [
{
latitude: res.latitude,
longitude: res.longitude,
iconPath: point2,
},
];
mapCircles.value = [
{
latitude: res.latitude,
longitude: res.longitude,
radius: 1000,
fillColor: '#00b8002e',
},
];
getJobList('refresh');
});
}
function progressChange(e) {
const range = 1 + e.value;
pageState.search.radius = range;
mapCircles.value = [
{
id: 0,
label: '',
lat: 31.126855,
lon: 104.397894,
latitude: latitude(),
longitude: longitude(),
radius: range * 1000,
fillColor: '#00b8002e',
},
];
tMap.value.addFeature(list);
debounceAjax('refresh');
}
function progressChange(e) {
tMap.value.changeRange(e.value);
let debounceAjax = debounce(getJobList, 500);
function getJobList(type = 'add') {
if (type === 'add' && pageState.page < pageState.maxPage) {
pageState.page += 1;
}
if (type === 'refresh') {
pageState.page = 1;
pageState.maxPage = 2;
}
let params = {
current: pageState.page,
pageSize: pageState.pageSize,
longitude: longitude(),
latitude: latitude(),
...pageState.search,
};
$api.createRequest('/app/job/nearJob', params, 'POST').then((resData) => {
const { rows, total } = resData;
if (type === 'add') {
const str = pageState.pageSize * (pageState.page - 1);
const end = list.value.length;
const reslist = rows;
list.value.splice(str, end, ...reslist);
} else {
list.value = rows;
}
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
if (rows.length < pageState.pageSize) {
loadmoreRef.value.change('noMore');
} else {
loadmoreRef.value.change('more');
}
});
}
function handelHostestSearch(val) {
pageState.search.order = val.value;
getJobList('refresh');
}
function handleFilterConfirm(val) {
pageState.search = {
radius: pageState.search.radius,
order: pageState.search.order,
};
for (const [key, value] of Object.entries(val)) {
pageState.search[key] = value.join(',');
}
getJobList('refresh');
}
defineExpose({ loadData, handleFilterConfirm });
</script>
<style lang="stylus" scoped>
@@ -115,8 +272,9 @@ function progressChange(e) {
.nearby-map
height: 467rpx;
background: #e8e8e8;
overflow: hidden
.nearby-list
background: linear-gradient( 180deg, #4778EC 0%, #002979 100%);
// background: linear-gradient( 180deg, #4778EC 0%, #002979 100%);
.list-head
height: 77rpx;
background-color: #FFFFFF;
@@ -163,7 +321,8 @@ function progressChange(e) {
align-items: center;
.tab-recommend
white-space: nowrap;
width: 92rpx;
width: fit-content;
padding: 0 10rpx;
height: 42rpx;
background: #4778EC;
border-radius: 17rpx 17rpx 0rpx 17rpx;
@@ -186,7 +345,7 @@ function progressChange(e) {
.one-cards
display: flex;
flex-direction: column;
padding: 0 20rpx;
padding: 0 20rpx 20rpx 20rpx;
.card-box
width: calc(100% - 36rpx - 36rpx);
border-radius: 0rpx 0rpx 0rpx 0rpx;
@@ -205,6 +364,9 @@ function progressChange(e) {
color: #606060;
.textblue
color: #4778EC;
.row-right
min-width: 120rpx
text-align: right
.row-left
display: flex;
justify-content: space-between;

View File

@@ -1,20 +1,44 @@
<template>
<scroll-view :scroll-y="true" class="nearby-scroll">
<scroll-view :scroll-y="true" class="nearby-scroll" @scrolltolower="scrollBottom">
<view class="three-head" @touchmove.stop.prevent>
<scroll-view class="scroll-head" :scroll-x="true" :show-scrollbar="false">
<view class="metro">
<view class="metro-one">1号线</view>
<view class="metro-two">王家港-东郭庄</view>
<view class="metro-one">
<picker
class="one-picker"
@change="bindPickerChange"
@cancel="state.downup = true"
@click="state.downup = false"
:value="state.value"
range-key="text"
:range="range"
>
<view class="one-picker">
<view class="uni-input">{{ inputText(state.subwayId) }}</view>
<uni-icons v-if="state.downup" type="down" size="16"></uni-icons>
<uni-icons v-else type="up" size="16"></uni-icons>
</view>
</picker>
</view>
<view class="metro-two">{{ state.subwayStart.stationName }}-{{ state.subwayEnd.stationName }}</view>
<view class="metro-three">
<view class="three-background">
<view class="three-items">
<view class="three-item">
<view class="item-dont dontstart"></view>
<view class="item-text">王家港</view>
</view>
<view class="three-item" v-for="(item, index) in 20" :key="index">
<view class="item-dont"></view>
<view class="item-text">王家港</view>
<view
class="three-item"
v-for="(item, index) in subwayCurrent.subwayStationList"
@click="selectSubwayStation(item, index)"
:key="index"
>
<view
class="item-dont"
:class="{
dontstart: index === 0,
dontend: index === subwayCurrent.subwayStationList.length - 1,
donted: index === state.dont,
}"
></view>
<view class="item-text">{{ item.stationName }}</view>
</view>
</view>
</view>
@@ -25,58 +49,271 @@
<view class="nearby-list">
<view class="list-head" @touchmove.stop.prevent>
<view class="tab-options">
<scroll-view :scroll-x="true" :show-scrollbar="false" class="tab-scroll">
<scroll-view :scroll-x="true" :show-scrollbar="false" class="tab-scroll" @touchmove.stop>
<view class="tab-op-left">
<view class="tab-list" v-for="(item, index) in 4" :key="index">中国万岁</view>
<uni-icons type="plusempty" style="margin-right: 10rpx" size="20"></uni-icons>
<view
class="tab-list"
:class="{ tabchecked: state.tabIndex === 'all' }"
@click="choosePosition('all')"
>
全部
</view>
<view
class="tab-list"
:class="{ tabchecked: state.tabIndex === index }"
v-for="(item, index) in userInfo.jobTitle"
:key="index"
@click="choosePosition(index)"
>
{{ item }}
</view>
</view>
</scroll-view>
<view class="tab-op-right">
<view class="tab-recommend">推荐</view>
<view class="tab-filter">
<view class="tab-number">1000+</view>
<uni-icons type="plusempty" style="margin-right: 10rpx" size="20"></uni-icons>
<view class="tab-recommend">
<latestHotestStatus @confirm="handelHostestSearch"></latestHotestStatus>
</view>
<view class="tab-filter" @click="emit('onFilter', 2)">
<view class="tab-number" v-show="pageState.total">{{ formatTotal(pageState.total) }}</view>
<image class="image" src="/static/icon/filter.png"></image>
</view>
</view>
</view>
</view>
<view class="one-cards">
<view class="card-box" v-for="(item, index) in 20" :key="index">
<view class="card-box" v-for="(item, index) in list" :key="item.jobId" @click="navToPost(item.jobId)">
<view class="box-row mar_top0">
<view class="row-left">销售工程师-高级销售经理</view>
<view class="row-right">1-2</view>
<view class="row-left">{{ item.jobTitle }}</view>
<view class="row-right">
<Salary-Expectation
:max-salary="item.maxSalary"
:min-salary="item.minSalary"
></Salary-Expectation>
</view>
</view>
<view class="box-row">
<view class="row-left">
<view class="row-tag">本科</view>
<view class="row-tag">1-5</view>
<view class="row-tag" v-if="item.education">
<dict-Label dictType="education" :value="item.education"></dict-Label>
</view>
<view class="row-tag" v-if="item.experience">
<dict-Label dictType="experience" :value="item.experience"></dict-Label>
</view>
</view>
</view>
<view class="box-row mar_top0">
<view class="row-item mineText">2024.1.8</view>
<view class="row-item mineText">8</view>
<view class="row-item mineText textblue">匹配度93%</view>
<view class="row-item mineText">{{ item.postingDate || '发布日期' }}</view>
<view class="row-item mineText">{{ vacanciesTo(item.vacancies) }}</view>
<view class="row-item mineText textblue"><matchingDegree :job="item"></matchingDegree></view>
<view class="row-item">
<uni-icons type="star" size="28"></uni-icons>
<!-- <uni-icons type="star-filled" color="#FFCB47" size="30"></uni-icons> -->
</view>
</view>
<view class="box-row">
<view class="row-left mineText">湖南沃森电气科技有限公司</view>
<view class="row-right mineText">青岛 青岛经济技术开发区 550m</view>
<view class="row-left mineText">{{ item.companyName }}</view>
<view class="row-right mineText">
青岛
<dict-Label dictType="area" :value="item.jobLocationAreaCode"></dict-Label>
<convert-distance
:alat="item.latitude"
:along="item.longitude"
:blat="latitude()"
:blong="longitude()"
></convert-distance>
</view>
</view>
</view>
</view>
</view>
<loadmore ref="loadmoreRef"></loadmore>
</scroll-view>
</template>
<script setup>
import dictLabel from '@/components/dict-Label/dict-Label.vue';
import { reactive, inject, watch, ref, onMounted } from 'vue';
const state = reactive({});
import { onLoad, onShow } from '@dcloudio/uni-app';
import useUserStore from '@/stores/useUserStore';
const { $api, navTo, vacanciesTo, formatTotal } = inject('globalFunction');
import useLocationStore from '@/stores/useLocationStore';
const { getLocation, longitude, latitude } = useLocationStore();
const emit = defineEmits(['onFilter']);
// status
const subwayCurrent = ref([]);
const isLoaded = ref(false);
const range = ref([]);
const userInfo = ref({});
const state = reactive({
subwayList: [],
subwayStart: {},
subwayEnd: {},
value: 0,
subwayId: 0,
downup: true,
dont: 0,
dontObj: {},
tabIndex: 'all',
});
const pageState = reactive({
page: 0,
total: 0,
maxPage: 2,
pageSize: 10,
search: {
order: 0,
},
});
const list = ref([]);
const loadmoreRef = ref(null);
onLoad(() => {
getSubway();
});
onShow(() => {
userInfo.value = useUserStore().userInfo;
});
function navToPost(jobId) {
navTo(`/packageA/pages/post/post?jobId=${btoa(jobId)}`);
}
async function loadData() {
try {
if (isLoaded.value) return;
getJobList('refresh');
isLoaded.value = true;
} catch (err) {
isLoaded.value = false; // 重置状态允许重试
throw err;
}
}
function scrollBottom() {
getJobList();
loadmoreRef.value.change('loading');
}
function choosePosition(index) {
state.tabIndex = index;
if (index === 'all') {
pageState.search.jobTitle = '';
} else {
pageState.search.jobTitle = useUserStore().userInfo.jobTitle[index];
}
getJobList('refresh');
}
function selectSubwayStation(point, index) {
console.log(point, index);
state.dont = index;
state.dontObj = point;
getJobList('refresh');
}
function inputText(id) {
if (id) {
const text = range.value.filter((item) => item.value === id)[0].text;
return text;
} else {
return '';
}
}
function bindPickerChange(e) {
const lineId = range.value[e.detail.value];
const value = state.subwayList.filter((iv) => iv.lineId === lineId.value)[0];
subwayCurrent.value = value;
state.value = e.detail.value;
state.subwayId = value.lineId;
const points = value.subwayStationList;
state.downup = true;
if (points.length) {
state.dont = 0;
state.dontObj = points[0];
state.subwayStart = points[0];
state.subwayEnd = points[points.length - 1];
}
}
function getSubway() {
$api.createRequest(`/app/common/subway`).then((resData) => {
state.subwayList = resData.data;
subwayCurrent.value = resData.data[0];
state.subwayId = resData.data[0].lineId;
state.value = 0;
state.dont = 0;
range.value = resData.data.map((iv) => ({ text: iv.lineName, value: iv.lineId }));
const points = resData.data[0].subwayStationList;
if (points.length) {
state.dont = 0;
state.dontObj = points[0];
state.subwayStart = points[0];
state.subwayEnd = points[points.length - 1];
}
});
}
function getJobList(type = 'add') {
if (type === 'add' && pageState.page < pageState.maxPage) {
pageState.page += 1;
}
if (type === 'refresh') {
pageState.page = 1;
pageState.maxPage = 2;
}
let params = {
current: pageState.page,
pageSize: pageState.pageSize,
subwayIds: [state.dontObj.stationId],
latitude: state.dontObj.latitude,
longitude: state.dontObj.longitude,
radius: 2,
...pageState.search,
};
$api.createRequest('/app/job/subway', params, 'POST').then((resData) => {
const { rows, total } = resData;
if (type === 'add') {
const str = pageState.pageSize * (pageState.page - 1);
const end = list.value.length;
const reslist = rows;
list.value.splice(str, end, ...reslist);
} else {
list.value = rows;
}
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
if (rows.length < pageState.pageSize) {
loadmoreRef.value.change('noMore');
} else {
loadmoreRef.value.change('more');
}
});
}
function handelHostestSearch(val) {
pageState.search.order = val.value;
getJobList('refresh');
}
function handleFilterConfirm(val) {
pageState.search = {
order: pageState.search.order,
};
for (const [key, value] of Object.entries(val)) {
pageState.search[key] = value.join(',');
}
getJobList('refresh');
}
defineExpose({ loadData, handleFilterConfirm });
</script>
<style lang="stylus" scoped>
.tabchecked
color: #4778EC !important;
.nearby-scroll
overflow: hidden;
.three-head
@@ -93,6 +330,14 @@ const state = reactive({});
font-size: 28rpx;
color: #000000;
line-height: 33rpx;
width: fit-content;
min-width: 100rpx;
.one-picker
width: 100%
height: 100%
display: flex;
flex-wrap: nowrap;
align-items: center;
.metro-two
font-size: 21rpx;
color: #606060;
@@ -118,6 +363,19 @@ const state = reactive({});
border-radius: 50%;
position: relative;
margin-bottom: 10rpx;
.donted::after
position: absolute;
content: '';
color: #FFFFFF;
font-size: 20rpx;
text-align: center;
left: 0;
top: -5rpx;
width: 27rpx;
height: 27rpx;
line-height: 28rpx;
background: blue !important;
border-radius: 50%;
.dontstart::after
position: absolute;
content: '始';
@@ -129,7 +387,20 @@ const state = reactive({});
width: 27rpx;
height: 27rpx;
line-height: 28rpx;
background: blue;
background: #666666;
border-radius: 50%;
.dontend::after
position: absolute;
content: '终点';
color: #FFFFFF;
font-size: 20rpx;
text-align: center;
left: 0;
top: -5rpx;
width: 27rpx;
height: 27rpx;
line-height: 28rpx;
background: #666666;
border-radius: 50%;
.item-text
width: 23rpx;
@@ -151,14 +422,14 @@ const state = reactive({});
z-index: 1;
.nearby-list
margin-top: 40rpx;
background: linear-gradient( 180deg, #4778EC 0%, #002979 100%);
// background: linear-gradient( 180deg, #4778EC 0%, #002979 100%);
.list-head
height: 77rpx;
background-color: #FFFFFF;
border-radius: 17rpx 17rpx 0rpx 0rpx;
position: relative;
top: -17rpx;
z-index: 9999;
z-index: 2;
.tab-options
display: flex;
align-items: center;
@@ -189,7 +460,8 @@ const state = reactive({});
align-items: center;
.tab-recommend
white-space: nowrap;
width: 92rpx;
width: fit-content;
padding: 0 10rpx;
height: 42rpx;
background: #4778EC;
border-radius: 17rpx 17rpx 0rpx 17rpx;
@@ -231,6 +503,9 @@ const state = reactive({});
color: #606060;
.textblue
color: #4778EC;
.row-right
min-width: 120rpx
text-align: right
.row-left
display: flex;
justify-content: space-between;

View File

@@ -1,72 +1,237 @@
<template>
<scroll-view :scroll-y="true" class="nearby-scroll">
<scroll-view :scroll-y="true" class="nearby-scroll" @scrolltolower="scrollBottom">
<view class="two-head">
<view class="head-item active">市北区</view>
<view class="head-item">市北区</view>
<view class="head-item">市北区</view>
<view class="head-item">市北区</view>
<view class="head-item">市北区</view>
<view class="head-item">市北区</view>
<view class="head-item">市北区</view>
<view class="head-item">市北区</view>
<view class="head-item">市北区</view>
<view class="head-item">市北区</view>
<view
class="head-item"
:class="{ active: item.value === fromValue.area }"
v-for="(item, index) in oneDictData('area')"
:key="item.value"
@click="changeArea(item.value, item)"
>
{{ item.label }}
</view>
<view
class="head-item"
:class="{ active: state.tabBxText === fromValue.area }"
@click="changeArea(state.tabBxText, item)"
>
不限区域
</view>
</view>
<view class="nearby-list">
<view class="list-head" @touchmove.stop.prevent>
<view class="tab-options">
<scroll-view :scroll-x="true" :show-scrollbar="false" class="tab-scroll">
<scroll-view :scroll-x="true" :show-scrollbar="false" class="tab-scroll" @touchmove.stop>
<view class="tab-op-left">
<view class="tab-list" v-for="(item, index) in 4" :key="index">中国万岁</view>
<uni-icons type="plusempty" style="margin-right: 10rpx" size="20"></uni-icons>
<view
class="tab-list"
:class="{ tabchecked: state.tabIndex === 'all' }"
@click="choosePosition('all')"
>
全部
</view>
<view
class="tab-list"
:class="{ tabchecked: state.tabIndex === index }"
@click="choosePosition(index)"
v-for="(item, index) in userInfo.jobTitle"
:key="index"
>
{{ item }}
</view>
</view>
</scroll-view>
<view class="tab-op-right">
<view class="tab-recommend">推荐</view>
<view class="tab-filter">
<view class="tab-number">1000+</view>
<uni-icons type="plusempty" style="margin-right: 10rpx" size="20"></uni-icons>
<view class="tab-recommend">
<latestHotestStatus @confirm="handelHostestSearch"></latestHotestStatus>
</view>
<view class="tab-filter" @click="emit('onFilter', 1)">
<view class="tab-number" v-show="pageState.total">{{ formatTotal(pageState.total) }}</view>
<image class="image" src="/static/icon/filter.png"></image>
</view>
</view>
</view>
</view>
<view class="one-cards">
<view class="card-box" v-for="(item, index) in 20" :key="index">
<view class="card-box" v-for="(item, index) in list" :key="item.jobId" @click="navToPost(item.jobId)">
<view class="box-row mar_top0">
<view class="row-left">销售工程师-高级销售经理</view>
<view class="row-right">1-2</view>
<view class="row-left">{{ item.jobTitle }}</view>
<view class="row-right">
<Salary-Expectation
:max-salary="item.maxSalary"
:min-salary="item.minSalary"
></Salary-Expectation>
</view>
</view>
<view class="box-row">
<view class="row-left">
<view class="row-tag">本科</view>
<view class="row-tag">1-5</view>
<view class="row-tag" v-if="item.education">
<dict-Label dictType="education" :value="item.education"></dict-Label>
</view>
<view class="row-tag" v-if="item.experience">
<dict-Label dictType="experience" :value="item.experience"></dict-Label>
</view>
</view>
</view>
<view class="box-row mar_top0">
<view class="row-item mineText">2024.1.8</view>
<view class="row-item mineText">8</view>
<view class="row-item mineText textblue">匹配度93%</view>
<view class="row-item mineText">{{ item.postingDate || '发布日期' }}</view>
<view class="row-item mineText">{{ vacanciesTo(item.vacancies) }}</view>
<view class="row-item mineText textblue"><matchingDegree :job="item"></matchingDegree></view>
<view class="row-item">
<uni-icons type="star" size="28"></uni-icons>
<!-- <uni-icons type="star-filled" color="#FFCB47" size="30"></uni-icons> -->
</view>
</view>
<view class="box-row">
<view class="row-left mineText">湖南沃森电气科技有限公司</view>
<view class="row-right mineText">青岛 青岛经济技术开发区 550m</view>
<view class="row-left mineText">{{ item.companyName }}</view>
<view class="row-right mineText">
青岛
<dict-Label dictType="area" :value="item.jobLocationAreaCode"></dict-Label>
<convert-distance
:alat="item.latitude"
:along="item.longitude"
:blat="latitude()"
:blong="longitude()"
></convert-distance>
</view>
</view>
</view>
</view>
</view>
<loadmore ref="loadmoreRef"></loadmore>
</scroll-view>
</template>
<script setup>
import dictLabel from '@/components/dict-Label/dict-Label.vue';
import { reactive, inject, watch, ref, onMounted } from 'vue';
const state = reactive({});
import { onLoad, onShow } from '@dcloudio/uni-app';
import useDictStore from '@/stores/useDictStore';
import useUserStore from '@/stores/useUserStore';
import useLocationStore from '@/stores/useLocationStore';
const { getLocation, longitude, latitude } = useLocationStore();
const { getDictSelectOption, oneDictData } = useDictStore();
const { $api, navTo, vacanciesTo, formatTotal } = inject('globalFunction');
const emit = defineEmits(['onFilter']);
const state = reactive({
tabIndex: 'all',
tabBxText: 'buxianquyu',
});
const isLoaded = ref(false);
const fromValue = reactive({
area: 0,
});
const loadmoreRef = ref(null);
const userInfo = ref({});
const pageState = reactive({
page: 0,
total: 0,
maxPage: 2,
pageSize: 10,
search: {
order: 0,
},
});
const list = ref([]);
onShow(() => {
userInfo.value = useUserStore().userInfo;
});
function navToPost(jobId) {
navTo(`/packageA/pages/post/post?jobId=${btoa(jobId)}`);
}
async function loadData() {
try {
if (isLoaded.value) return;
const area = oneDictData('area')[0];
fromValue.area = area.value;
getJobList('refresh');
isLoaded.value = true;
} catch (err) {
isLoaded.value = false; // 重置状态允许重试
throw err;
}
}
function scrollBottom() {
getJobList();
loadmoreRef.value.change('loading');
}
function choosePosition(index) {
state.tabIndex = index;
if (index === 'all') {
pageState.search.jobTitle = '';
} else {
pageState.search.jobTitle = useUserStore().userInfo.jobTitle[index];
}
getJobList('refresh');
}
function changeArea(area, item) {
fromValue.area = area;
getJobList('refresh');
}
function getJobList(type = 'add') {
if (type === 'add' && pageState.page < pageState.maxPage) {
pageState.page += 1;
}
if (type === 'refresh') {
pageState.page = 1;
pageState.maxPage = 2;
}
let params = {
current: pageState.page,
pageSize: pageState.pageSize,
countyIds: [fromValue.area],
...pageState.search,
};
if (fromValue.area === state.tabBxText) {
params.countyIds = [];
}
$api.createRequest('/app/job/countyJob', params, 'POST').then((resData) => {
const { rows, total } = resData;
if (type === 'add') {
const str = pageState.pageSize * (pageState.page - 1);
const end = list.value.length;
const reslist = rows;
list.value.splice(str, end, ...reslist);
} else {
list.value = rows;
}
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
if (rows.length < pageState.pageSize) {
loadmoreRef.value.change('noMore');
} else {
loadmoreRef.value.change('more');
}
});
}
function handelHostestSearch(val) {
pageState.search.order = val.value;
getJobList('refresh');
}
function handleFilterConfirm(val) {
pageState.search = {
order: pageState.search.order,
};
for (const [key, value] of Object.entries(val)) {
pageState.search[key] = value.join(',');
}
getJobList('refresh');
}
defineExpose({ loadData, handleFilterConfirm });
</script>
<style lang="stylus" scoped>
.tabchecked
color: #4778EC !important
.nearby-scroll
overflow: hidden;
.two-head
@@ -93,7 +258,7 @@ const state = reactive({});
color: #FFFFFF;
.nearby-list
margin-top: 40rpx;
background: linear-gradient( 180deg, #4778EC 0%, #002979 100%);
// background: linear-gradient( 180deg, #4778EC 0%, #002979 100%);
.list-head
height: 77rpx;
background-color: #FFFFFF;
@@ -131,7 +296,8 @@ const state = reactive({});
align-items: center;
.tab-recommend
white-space: nowrap;
width: 92rpx;
width: fit-content;
padding: 0 10rpx;
height: 42rpx;
background: #4778EC;
border-radius: 17rpx 17rpx 0rpx 17rpx;
@@ -173,6 +339,9 @@ const state = reactive({});
color: #606060;
.textblue
color: #4778EC;
.row-right
min-width: 120rpx
text-align: right
.row-left
display: flex;
justify-content: space-between;

View File

@@ -8,44 +8,112 @@
</view>
<view class="nearby-content">
<swiper class="swiper" :current="state.current" @change="changeSwiperType">
<swiper-item class="swiper-item" disable-touch>
<oneComponent></oneComponent>
</swiper-item>
<swiper-item class="swiper-item">
<twoComponent></twoComponent>
</swiper-item>
<swiper-item class="swiper-item">
<threeComponent></threeComponent>
</swiper-item>
<swiper-item class="swiper-item">
<fourComponent></fourComponent>
<!-- 动态绑定ref -->
<swiper-item class="swiper-item" v-for="(_, index) in 4" :key="index">
<component
:is="components[index]"
@onFilter="addfileter"
:ref="(el) => handelComponentsRef(el, index)"
/>
</swiper-item>
</swiper>
</view>
<!-- 弹窗 -->
<screeningJobRequirementsVue
:area="false"
v-model:show="showFilter"
@confirm="handleFilterConfirm"
></screeningJobRequirementsVue>
<screeningJobRequirementsVue
:area="false"
v-model:show="showFilter1"
@confirm="handleFilterConfirm"
></screeningJobRequirementsVue>
<screeningJobRequirementsVue
:area="false"
v-model:show="showFilter2"
@confirm="handleFilterConfirm"
></screeningJobRequirementsVue>
<screeningJobRequirementsVue
:area="false"
v-model:show="showFilter3"
@confirm="handleFilterConfirm"
></screeningJobRequirementsVue>
</view>
</template>
<script setup>
import screeningJobRequirementsVue from '@/components/screening-job-requirements/screening-job-requirements.vue';
import oneComponent from './components/one.vue';
import twoComponent from './components/two.vue';
import threeComponent from './components/three.vue';
import fourComponent from './components/four.vue';
import { reactive, inject, watch, ref, onMounted } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
const { $api, debounce, throttle } = inject('globalFunction');
const loadedMap = reactive([false, false, false, false]);
const swiperRefs = [ref(null), ref(null), ref(null), ref(null)];
const components = [oneComponent, twoComponent, threeComponent, fourComponent];
const filterId = ref(0);
const showFilter = ref(false);
const showFilter1 = ref(false);
const showFilter2 = ref(false);
const showFilter3 = ref(false);
const state = reactive({
current: 2,
current: 0,
all: [{}],
});
onLoad(() => {});
// filter education aera scale 。。。。
function handleFilterConfirm(e) {
swiperRefs[filterId.value].value?.handleFilterConfirm(e);
}
function addfileter(val) {
filterId.value = val;
switch (val) {
case 0:
showFilter.value = true;
break;
case 1:
showFilter1.value = true;
break;
case 2:
showFilter2.value = true;
break;
case 3:
showFilter3.value = true;
break;
}
}
onMounted(() => {
handleTabChange(state.current);
});
const handelComponentsRef = (el, index) => {
if (el) {
swiperRefs[index].value = el;
}
};
// 查看消息类型
function changeSwiperType(e) {
const currented = e.detail.current;
state.current = currented;
const index = e.detail.current;
state.current = index;
handleTabChange(index);
}
function changeType(index) {
state.current = index;
handleTabChange(index);
}
function handleTabChange(index) {
if (!loadedMap[index]) {
swiperRefs[index].value?.loadData();
loadedMap[index] = true;
}
}
</script>
@@ -68,7 +136,7 @@ function changeType(index) {
width: calc(100% / 4);
z-index: 9
.actived
width: 169rpx;
// width: 169rpx;
height: 63rpx;
background: #13C57C;
box-shadow: 0rpx 7rpx 7rpx 0rpx rgba(0,0,0,0.25);

49
readme.md Normal file
View File

@@ -0,0 +1,49 @@
# vue3版本
vue2版本已经上线欢迎下载使用。
[https://ext.dcloud.net.cn/plugin?id=13864](https://ext.dcloud.net.cn/plugin?id=13864)
## uniapp markdown渲染解析.md语法及代码高亮
> **组件名uaMarkdown**
> 代码块: `<ua-markdown>`
uaMarkdown组件是基于uniapp+vue3自定义解析markdown语法结构插件、支持代码块高亮编译兼容H5+小程序端+App端。
### 引入方式
本组件符合[easycom](https://uniapp.dcloud.io/collocation/pages?id=easycom)规范,只需将本组件`ua-markdown`放在components目录在页面`template`中即可直接使用。
### 基本用法
**示例**
- 基础用法
```html
const mdvalue = '### uniapp markdwon'
<ua-markdown :source="mdvalue" />
```
- 去掉代码块行号
```html
<ua-markdown :source="xxx" :showLine="false" />
```
### API
### uaMarkdown Props
|属性名|类型|默认值|说明|
|:-:|:-:|:-:|:-:|
|source|String|-| 渲染解析内容 |
|showLine|Boolean|true| 是否显示代码块行号 |
### 💝最后
开发不易,希望各位小伙伴们多多支持下哈~~ ☕️☕️

BIN
static/.DS_Store vendored

Binary file not shown.

BIN
static/icon/.DS_Store vendored Normal file

Binary file not shown.

BIN
static/icon/Comment-one.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 B

BIN
static/icon/Group1.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

BIN
static/icon/Location.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
static/icon/Vector2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
static/icon/addGroup.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B

BIN
static/icon/addGroup1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

BIN
static/icon/backAI.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
static/icon/boy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
static/icon/doc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

BIN
static/icon/fileupload.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
static/icon/girl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
static/icon/image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 916 B

BIN
static/icon/imgupload.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
static/icon/point.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
static/icon/point2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
static/icon/save.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

BIN
static/icon/send2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

BIN
static/icon/send2xx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

BIN
static/icon/send3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

BIN
static/icon/send4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 B

BIN
static/icon/tips2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

BIN
static/tabbar/logo2copy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

BIN
stores/.DS_Store vendored Normal file

Binary file not shown.

64
stores/BaseDBStore.js Normal file
View File

@@ -0,0 +1,64 @@
// BaseStore.js - 基础Store类
import IndexedDBHelper from '@/common/IndexedDBHelper.js'
import useChatGroupDBStore from './userChatGroupStore'
import config from '@/config'
class BaseStore {
db = null
isDBReady = false
dbName = 'BrowsingHistory'
constructor() {
this.checkAndInitDB()
}
checkAndInitDB() {
// 获取本地数据库版本
const localVersion = uni.getStorageSync('indexedDBVersion') || 1
console.log('DBVersion: ', localVersion, config.DBversion)
if (localVersion === config.DBversion) {
this.initDB()
} else {
console.log('清空本地数据库')
this.clearDB().then(() => {
uni.setStorageSync('indexedDBVersion', config.DBversion);
this.initDB();
});
}
}
initDB() {
this.db = new IndexedDBHelper(this.dbName, config.DBversion);
this.db.openDB([{
name: 'record',
keyPath: "id",
autoIncrement: true,
}, {
name: 'messageGroup',
keyPath: "id",
autoIncrement: true,
}, {
name: 'messages',
keyPath: "id",
autoIncrement: true,
indexes: [{
name: 'parentGroupId',
key: 'parentGroupId',
unique: false
}]
}]).then(async () => {
useChatGroupDBStore().init()
this.isDBReady = true
});
}
async clearDB() {
return new Promise((resolve, rejetc) => {
new IndexedDBHelper().deleteDB(this.dbName).then(() => {
resolve()
})
})
}
}
const baseDB = new BaseStore()
export default baseDB

181
stores/useDictStore.js Normal file
View File

@@ -0,0 +1,181 @@
import {
defineStore
} from 'pinia';
import {
reactive,
ref,
} from 'vue'
import {
createRequest
} from "../utils/request";
// 静态树 O(1) 超快查询!!!!!
let IndustryMap = null
// 构建索引
function buildIndex(tree) {
const map = new Map();
function traverse(nodes) {
for (const node of nodes) {
map.set(node.id, node);
if (node.children && node.children.length) {
traverse(node.children);
}
}
}
traverse(tree);
return map;
}
const useDictStore = defineStore("dict", () => {
// 定义状态
const complete = ref(false)
const state = reactive({
education: [],
experience: [],
area: [],
scale: [],
isPublish: [],
sex: [],
affiliation: [],
industry: []
})
// political_affiliation
const getDictData = async (dictType, dictName) => {
try {
if (dictType && dictName) {
return getDictSelectOption(dictType).then((data) => {
state[dictName] = data
return data
})
}
const [education, experience, area, scale, sex, affiliation] = await Promise.all([
getDictSelectOption('education'),
getDictSelectOption('experience'),
getDictSelectOption('area', true),
getDictSelectOption('scale'),
getDictSelectOption('app_sex'),
getDictSelectOption('political_affiliation'),
]);
state.education = education;
state.experience = experience;
state.area = area;
state.scale = scale;
state.sex = sex;
state.affiliation = affiliation;
complete.value = true
getIndustryDict() // 获取行业
} catch (error) {
console.error('Error fetching dictionary data:', error);
}
};
async function getIndustryDict() {
if (state.industry.length) return
const resp = await createRequest(`/app/common/industry/treeselect`);
if (resp.code === 200 && resp.data) {
state.industry = resp.data
IndustryMap = buildIndex(resp.data);
}
return [];
}
function industryLabel(dictType, value) {
switch (dictType) {
case 'industry':
if (!IndustryMap) return
const data = IndustryMap.get(Number(value))?.label || ''
return data
}
return null
}
function dictLabel(dictType, value) {
if (state[dictType]) {
for (let i = 0; i < state[dictType].length; i++) {
let element = state[dictType][i];
if (element.value === value) {
return element.label
}
}
}
return ''
}
function oneDictData(dictType, value) {
if (!value) {
return state[dictType]
}
if (state[dictType]) {
for (let i = 0; i < state[dictType].length; i++) {
let element = state[dictType][i];
if (element.value === value) {
return element
}
}
}
return null
}
function getTransformChildren(dictType, title = '', key = '') {
if (dictType) {
return {
label: title,
key: key || dictType,
options: state[dictType],
}
}
return null
}
async function getDictSelectOption(dictType, isDigital) {
const resp = await createRequest(`/app/common/dict/${dictType}`);
if (resp.code === 200 && resp.data) {
const options = resp.data.map((item) => {
return {
text: item.dictLabel,
label: item.dictLabel,
value: isDigital ? Number(item.dictValue) : item.dictValue,
key: item.dictCode,
listClass: item.listClass,
status: item.listClass,
};
});
return options;
}
return [];
}
async function getDictValueEnum(dictType, isDigital) {
const resp = await createRequest(`/app/common/dict/${dictType}`);
if (resp.code === 200 && resp.data) {
const opts = {};
resp.data.forEach((item) => {
opts[item.dictValue] = {
text: item.dictLabel,
label: item.dictLabel,
value: isDigital ? Number(item.dictValue) : item.dictValue,
key: item.dictCode,
listClass: item.listClass,
status: item.listClass,
};
});
return opts;
} else {
return {};
}
}
// 导入
return {
getDictData,
dictLabel,
oneDictData,
complete,
getDictSelectOption,
getTransformChildren,
industryLabel
}
})
export default useDictStore;

View File

@@ -0,0 +1,69 @@
import {
defineStore
} from 'pinia';
import {
ref
} from 'vue'
import {
msg
} from '@/common/globalFunction.js'
const useLocationStore = defineStore("location", () => {
// 定义状态
const longitudeVal = ref('') // 经度
const latitudeVal = ref('') //纬度
function getLocation() {
return new Promise((resole, reject) => {
uni.getLocation({
type: 'wgs84',
altitude: true,
isHighAccuracy: true,
enableHighAccuracy: true, // 关键参数:启用传感器辅助
timeout: 10000,
success: function(res) {
const resd = {
longitude: 120.382665,
latitude: 36.066938
}
longitudeVal.value = resd.longitude
latitudeVal.value = resd.latitude
msg('用户位置获取成功')
resole(resd)
},
fail: function(err) {
// longitudeVal.value = ''
// latitudeVal.value = ''
// reject(err)
const resd = {
longitude: 120.382665,
latitude: 36.066938
}
longitudeVal.value = resd.longitude
latitudeVal.value = resd.latitude
msg('用户位置获取失败,使用模拟定位')
resole(resd)
},
complete: function(e) {
console.warn('getUserLocation' + JSON.stringify(e))
}
})
})
}
function longitude() {
return longitudeVal.value
}
function latitude() {
return latitudeVal.value
}
// 导入
return {
getLocation,
longitude,
latitude,
}
})
export default useLocationStore;

View File

@@ -0,0 +1,113 @@
import {
defineStore
} from 'pinia';
import {
ref
} from 'vue'
import IndexedDBHelper from '@/common/IndexedDBHelper.js'
import useDictStore from '@/stores/useDictStore';
import jobAnalyzer from '@/utils/jobAnalyzer';
import {
msg
} from '@/common/globalFunction.js'
import baseDB from './BaseDBStore';
class JobRecommendation {
constructor() {
this.conditions = {}; // 存储最新的条件及其出现次数
this.askHistory = new Map(); // 记录每个条件的最后询问时间
this.cooldown = 5 * 60 * 1000; // 冷却时间(单位:毫秒)
}
updateConditions(newConditions) {
this.conditions = newConditions;
}
getCurrentTime() {
return Date.now();
}
/**
* 获取下一个符合条件的推荐问题
* @returns {string|null} 返回推荐的问题,或 null无可询问的
*/
getNextQuestion() {
const now = this.getCurrentTime();
// 按照出现次数降序排序
const sortedConditions = Object.entries(this.conditions)
.sort((a, b) => b[1] - a[1]); // 按出现次数降序排序
for (const [condition, count] of sortedConditions) {
const lastAskedTime = this.askHistory.get(condition);
if (!lastAskedTime || now - lastAskedTime >= this.cooldown) {
this.askHistory.set(condition, now);
return condition;
}
}
return null; // 没有可询问的
}
}
// **🔹 创建推荐系统**
export const jobRecommender = new JobRecommendation();
export const useRecommedIndexedDBStore = defineStore("indexedDB", () => {
const tableName = ref('record')
const total = ref(200) // 记录多少条数据
// 插入数据
async function addRecord(payload) {
const totalRecords = await baseDB.db.getRecordCount(tableName.value);
if (totalRecords >= total.value) {
console.log(`⚠数据超过 ${total.value} 条,删除最早的一条...`);
await baseDB.db.deleteOldestRecord(tableName.value);
}
if (!baseDB.isDBReady) await baseDB.initDB();
return await baseDB.db.add(tableName.value, payload);
}
// 获取所有数据
async function getRecord() {
if (!baseDB.isDBReady) await baseDB.initDB();
return await baseDB.db.getAll(tableName.value);
}
// 格式化浏览数据岗位数据
function JobParameter(job) {
const experIenceLabel = useDictStore().dictLabel('experience', job.experience)
const jobLocationAreaCodeLabel = useDictStore().dictLabel('area', job.jobLocationAreaCode)
return {
jobCategory: job.jobCategory,
jobTitle: job.jobTitle,
minSalary: job.minSalary,
maxSalary: job.maxSalary,
experience: job.experience,
experIenceLabel,
jobLocationAreaCode: job.jobLocationAreaCode,
jobLocationAreaCodeLabel,
createTime: Date.now()
}
}
function analyzer(jobsData) {
const result = jobAnalyzer.analyze(jobsData)
const sort = jobAnalyzer.printUnifiedResults(result)
return {
result,
sort
}
}
return {
addRecord,
getRecord,
JobParameter,
analyzer
};
});

View File

@@ -4,13 +4,51 @@ import {
import {
ref
} from 'vue'
import {
createRequest
} from '../utils/request';
import similarityJobs from '@/utils/similarity_Job.js';
import {
UUID
} from "@/lib/uuid-min.js";
// 简历完成度计算
function getResumeCompletionPercentage(resume) {
const requiredFields = [
'name',
'age',
'sex',
'birthDate',
'education',
'politicalAffiliation',
'phone',
'salaryMin',
'salaryMax',
'area',
'status',
'jobTitleId',
'jobTitle',
];
const totalFields = requiredFields.length;
let filledFields = requiredFields.filter((field) => {
const value = resume[field];
return value !== null && value !== '' && !(Array.isArray(value) && value.length === 0);
}).length;
return ((filledFields / totalFields) * 100).toFixed(0) + '%';
}
const useUserStore = defineStore("user", () => {
// 定义状态
const hasLogin = ref(false)
const openId = ref('')
// const openId = ref('')
const userInfo = ref({});
const token = ref('测试token')
const role = ref({});
const token = ref('')
const resume = ref({})
const Completion = ref('0%')
const seesionId = ref(uni.getStorageSync('seesionId') || '')
const login = (value) => {
hasLogin.value = true;
@@ -24,17 +62,79 @@ const useUserStore = defineStore("user", () => {
}
const logOut = () => {
hasLogin = false;
hasLogin.value = false;
token.value = ''
resume.value = {}
userInfo.value = {}
role.value = {}
uni.clearStorageSync('userInfo')
uni.clearStorageSync('token')
uni.redirectTo({
url: '/pages/login/login',
});
}
const getUserInfo = () => {
return new Promise((reslove, reject) => {
createRequest('/getInfo', {}, 'get').then((userInfo) => {
setUserInfo(userInfo);
reslove(userInfo)
});
})
}
const getUserResume = () => {
return new Promise((reslove, reject) => {
createRequest('/app/user/resume', {}, 'get').then((resume) => {
Completion.value = getResumeCompletionPercentage(resume.data)
similarityJobs.setUserInfo(resume.data)
setUserInfo(resume);
reslove(resume)
});
})
}
const loginSetToken = async (value) => {
token.value = value
uni.setStorageSync('token', value);
// 获取用户信息
return getUserResume()
}
const setUserInfo = (values) => {
userInfo.value = values.data;
// role.value = values.role;
hasLogin.value = true;
}
const tokenlogin = (token) => {
createRequest('/app/login', {
token
}).then((resData) => {
onsole.log(resData)
})
}
const initSeesionId = () => {
const seesionIdVal = UUID.generate()
uni.setStorageSync('seesionId', seesionIdVal);
seesionId.value = seesionIdVal
}
// 导入
return {
hasLogin,
openId,
userInfo,
token,
resume,
login,
logOut
logOut,
loginSetToken,
getUserResume,
initSeesionId,
seesionId,
Completion
}
})

View File

@@ -0,0 +1,291 @@
import {
defineStore
} from 'pinia';
import {
reactive,
ref
} from 'vue'
import IndexedDBHelper from '@/common/IndexedDBHelper.js'
import baseDB from './BaseDBStore';
import {
msg,
CloneDeep,
$api,
formatDate,
insertSortData
} from '../common/globalFunction';
import {
UUID
} from '../lib/uuid-min';
import config from '../config';
const useChatGroupDBStore = defineStore("messageGroup", () => {
const tableName = ref('messageGroup')
const massageName = ref('messages')
const messages = ref([]) // 消息列表
const isTyping = ref(false) // 是否正在输入
const textInput = ref('')
// tabel
const tabeList = ref([])
const chatSessionID = ref('')
const lastDateRef = ref('')
// const groupPages = reactive({
// page: 0,
// total: 0,
// maxPage: 2,
// pageSize: 50,
// })
async function init() {
// 获取所有数据
setTimeout(async () => {
if (!baseDB.isDBReady) await baseDB.initDB();
const result = await baseDB.db.getAll(tableName.value);
// 1、判断是否有数据没数据请求服务器
if (result.length) {
console.warn('本地数据库存在数据')
const list = result.reverse()
const [table, lastData] = insertSortData(list)
tabeList.value = table
const tabelRow = list[0]
chatSessionID.value = tabelRow.sessionId
initMessage(tabelRow.sessionId)
} else {
console.warn('本地数据库存在数据')
getHistory('refresh')
}
}, 1000)
}
async function initMessage(sessionId) {
if (!baseDB.isDBReady) await baseDB.initDB();
chatSessionID.value = sessionId
const list = await baseDB.db.queryByField(massageName.value, 'parentGroupId', sessionId);
if (list.length) {
console.log('本地数据库存在该对话数据', list)
messages.value = list
} else {
console.log('本地数据库不存在该对话数据')
getHistoryRecord('refresh')
}
}
async function addMessage(payload) {
if (!chatSessionID.value) {
return msg('请创建对话')
}
const params = {
...payload,
parentGroupId: chatSessionID.value,
files: payload.files || [],
}
messages.value.push(params);
addMessageIndexdb(params)
}
function toggleTyping(status) {
isTyping.value = status
}
async function addTabel(text) {
if (!baseDB.isDBReady) await baseDB.initDB();
const uuid = UUID.generate() // 对话sessionId
let payload = {
title: text,
createTime: formatDate(Date.now()),
sessionId: uuid
}
const id = await baseDB.db.add(tableName.value, payload);
const list = await baseDB.db.getAll(tableName.value);
chatSessionID.value = uuid
const [result, lastData] = insertSortData(list)
tabeList.value = result
return id
}
async function addMessageIndexdb(payload) {
console.log(payload)
return await baseDB.db.add(massageName.value, payload);
}
async function getStearm(text, fileUrls = [], progress) {
return new Promise((resolve, reject) => {
try {
toggleTyping(true);
const params = {
data: text,
sessionId: chatSessionID.value,
};
if (fileUrls && fileUrls.length) {
params['fileUrl'] = fileUrls.map((item) => item.url)
}
const newMsg = {
text: '', // 存放完整的流式数据
self: false,
displayText: '' // 用于前端逐步显示
};
const index = messages.value.length;
messages.value.push(newMsg); // 先占位
let fullText = ''; // 存储完整的响应内容
function handleUnload() {
newMsg.text = fullText
newMsg.parentGroupId = chatSessionID.value
baseDB.db.add(massageName.value, newMsg);
}
// 添加事件监听
window.addEventListener("unload", handleUnload);
// 实时数据渲染
function onDataReceived(data) {
// const parsedData = safeParseJSON(data);
fullText += data; // 累积完整内容
newMsg.displayText += data; // 逐步更新 UI
messages.value[index] = {
...newMsg
}; // 触发视图更新
progress && progress()
}
// 异常处理
function onError(error) {
console.error('请求异常:', error);
msg('服务响应异常')
reject(error);
}
// 完成处理
function onComplete() {
newMsg.text = fullText; // 保存完整响应
messages.value[index] = {
...newMsg
};
toggleTyping(false);
window.removeEventListener("unload", handleUnload);
handleUnload()
resolve && resolve();
}
$api.streamRequest('/chat', params, onDataReceived,
onError, onComplete)
} catch (err) {
console.log(err);
reject(err);
}
})
}
// 状态控制
function addNewDialogue() {
chatSessionID.value = ''
messages.value = []
}
function changeDialogue(item) {
chatSessionID.value = item.sessionId
initMessage(item.sessionId)
}
// 云端数据
function getHistory() {
$api.chatRequest('/getHistory').then((res) => {
if (!res.data.list.length) return
let tabel = parseHistory(res.data.list)
if (tabel && tabel.length) {
const tabelRow = tabel[0] // 默认第一个
const [result, lastData] = insertSortData(tabel)
// console.log('getHistory insertSortData', result, lastData)
chatSessionID.value = tabelRow.sessionId
tabeList.value = result
getHistoryRecord(false)
baseDB.db.add(tableName.value, tabel);
lastDateRef.value = lastData
}
})
}
function getHistoryRecord(loading = true) {
const params = {
sessionId: chatSessionID.value
}
$api.chatRequest('/detail', params, 'GET', loading).then((res) => {
console.log('detail', res.data)
let list = parseHistoryDetail(res.data.list, chatSessionID.value)
if (list.length) {
messages.value = list
baseDB.db.add(massageName.value, list);
}
console.log('解析后:', list)
}).catch(() => {
msg('请求出现异常,请联系工作人员')
})
}
// 解析器
function parseHistory(list) {
return list.map((item) => ({
title: item.title,
createTime: item.updateTime,
sessionId: item.chatId
}))
}
function parseHistoryDetail(list, sessionId) {
const arr = []
for (let i = 0; i < list.length; i++) {
const element = list[i];
const self = element.obj !== 'AI'
let text = ''
let files = []
for (let j = 0; j < element.value.length; j++) {
const obj = element.value[j];
if (obj.type === 'text') {
text += obj.text.content
}
if (obj.type === 'file') {
files.push(obj.file)
}
}
arr.push({
parentGroupId: sessionId,
displayText: text,
self: self,
text: text,
dataId: element.dataId,
files,
})
}
return arr
}
return {
messages,
isTyping,
textInput,
chatSessionID,
addMessage,
tabeList,
init,
initMessage,
toggleTyping,
addTabel,
addNewDialogue,
changeDialogue,
getStearm,
getHistory,
};
});
function safeParseJSON(data) {
try {
return JSON.parse(data);
} catch {
return null; // 解析失败,返回 null
}
}
export default useChatGroupDBStore

BIN
uni_modules/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,39 @@
## 1.0.82024-03-28
- 修复 在vue2下:style动态绑定导致编译失败的bug
## 1.0.72024-01-20
- 修复 长文本回显超过容器的bug超过容器部分显示省略号
## 1.0.62023-04-12
- 修复 微信小程序点击时会改变背景颜色的 bug
## 1.0.52023-02-03
- 修复 禁用时会显示清空按钮
## 1.0.42023-02-02
- 优化 查询条件短期内多次变更只查询最后一次变更后的结果
- 调整 内部缓存键名调整为 uni-data-select-lastSelectedValue
## 1.0.32023-01-16
- 修复 不关联服务空间报错的问题
## 1.0.22023-01-14
- 新增 属性 `format` 可用于格式化显示选项内容
## 1.0.12022-12-06
- 修复 当where变化时数据不会自动更新的问题
## 0.1.92022-09-05
- 修复 微信小程序下拉框出现后选择会点击到蒙板后面的输入框
## 0.1.82022-08-29
- 修复 点击的位置不准确
## 0.1.72022-08-12
- 新增 支持 disabled 属性
## 0.1.62022-07-06
- 修复 pc端宽度异常的bug
## 0.1.5
- 修复 pc端宽度异常的bug
## 0.1.42022-07-05
- 优化 显示样式
## 0.1.32022-06-02
- 修复 localdata 赋值不生效的 bug
- 新增 支持 uni.scss 修改颜色
- 新增 支持选项禁用(数据选项设置 disabled: true 即禁用)
## 0.1.22022-05-08
- 修复 当 value 为 0 时选择不生效的 bug
## 0.1.12022-05-07
- 新增 记住上次的选项(仅 collection 存在时有效)
## 0.1.02022-04-22
- 初始化

Some files were not shown because too many files have changed in this diff Show More