flat: 暂存

This commit is contained in:
Apcallover
2025-12-24 16:33:58 +08:00
17 changed files with 2054 additions and 764 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
export default {
baseUrl: 'https://fw.rc.qingdao.gov.cn/rgpp-api/api', // 内网
// baseUrl: 'https://qd.zhaopinzao8dian.com/api', // 测试
// baseUrl: 'https://fw.rc.qingdao.gov.cn/rgpp-api/api', // 内网
baseUrl: 'https://qd.zhaopinzao8dian.com/api', // 测试
// baseUrl: 'http://192.168.3.29:8081',
// baseUrl: 'http://10.213.6.207:19010/api',
// 语音转文字

View File

@@ -53,15 +53,25 @@ export function useColumnCount(onChange = () => {}) {
onMounted(() => {
columnCount.value = 2
calcColumn()
// if (process.client) {
window.addEventListener('resize', calcColumn)
// }
try {
// if (process.client) {
window.addEventListener('resize', calcColumn)
// }
} catch (error) {
}
})
onUnmounted(() => {
// if (process.client) {
window.removeEventListener('resize', calcColumn)
// }
try {
// if (process.client) {
window.removeEventListener('resize', calcColumn)
// }
} catch (error) {
}
})
// 列数变化时执行回调

View File

@@ -26,9 +26,11 @@ import renderCompanyCollectionRecord from '@/components/renderCompanyCollectionR
import renderJobViewRecord from '@/components/renderJobViewRecord/renderJobViewRecord.vue';
import MyIcons from '@/components/My-icons/my-icons.vue';
import GlobalPopup from '@/components/GlobalPopup/GlobalPopup.vue'
import FileIcon from '@/components/FileIcon/fileIcon.vue'
import FileText from '@/components/FileText/fileText.vue'
// import Tabbar from '@/components/tabbar/midell-box.vue'
// 自动导入 directives 目录下所有指令
console.log(lightAppJssdk)
const directives = import.meta.glob('./directives/*.js', {
eager: true
});
@@ -58,6 +60,8 @@ export function createApp() {
app.component('renderJobViewRecord', renderJobViewRecord) //渲染岗位浏览记录
app.component('MyIcons', MyIcons)
app.component('global-popup', GlobalPopup)
app.component('FileIcon', FileIcon)
app.component('FileText', FileText)
// app.component('tabbar-custom', Tabbar)
for (const path in directives) {

View File

@@ -50,7 +50,7 @@
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "",
"appid" : "wxdbdcc6a10153c99b",
"setting" : {
"urlCheck" : false,
"es6" : true,

View File

@@ -0,0 +1,564 @@
<template>
<uni-popup ref="popup" type="center" borderRadius="12px 12px 0 0" @change="changePopup">
<view class="popup-inner">
<view v-show="!fileCount" class="title">请扫码上传附件</view>
<view v-show="!fileCount" class="img-box">
<!-- 加载状态 -->
<view v-if="loading" class="loading-container">
<uni-load-more status="loading" :icon-size="24" :content-text="loadingText" />
</view>
<canvas canvas-id="qrcode" id="qrcode" />
</view>
<view class="tips" v-if="!loading">
已上传
<span class="num">{{ fileCount }}</span>
个文件
</view>
<view v-show="!fileCount" class="tips" v-if="!loading">请使用手机扫描二维码上传文件</view>
<view v-show="fileCount" class="file-list">
<view v-for="(file, index) in fileList" class="file-item">
<image
class="file-icon"
@click="preViewImage(file)"
v-if="isImage(file.fileSuffix)"
:src="file.fileUrl"
mode="scaleToFill"
></image>
<FileIcon v-else class="file-icon" :type="file.fileSuffix"></FileIcon>
<view class="right">
<view class="file-name">{{ file.originalName }}</view>
<FileText :type="file.fileSuffix"></FileText>
</view>
<view class="remove-btn" @click="delFile(file, index)">×</view>
</view>
</view>
<view v-show="fileCount" class="confirm-btn btn-feel" @click="handleConfirm">确认</view>
<view class="close-btn" @click="close"></view>
</view>
</uni-popup>
</template>
<script setup>
import { ref, inject, onUnmounted, watch, computed } from 'vue';
import uQRCode from '@/static/js/qrcode';
import config from '@/config';
import { onShow, onHide } from '@dcloudio/uni-app';
import { UUID } from '../../../../lib/uuid-min';
const props = defineProps({
sessionId: {
type: [Number, String],
default: '',
},
leaveFileCount: {
type: [Number, String],
default: 2,
},
});
const emit = defineEmits(['onSend', 'onClose']);
const { $api } = inject('globalFunction');
const popup = ref(null);
const loading = ref(false);
const pollingTimer = ref(null);
const isPolling = ref(false);
const isVisible = ref(false);
const uuid = ref(null);
const fileList = ref([]);
const deleting = ref(false);
const fileCount = computed(() => {
return fileList.value.length ?? 0;
});
// 计算加载文本
const loadingText = computed(() => ({
contentdown: '二维码生成中',
contentrefresh: '二维码生成中',
}));
onUnmounted(() => {
stopPolling();
clearResources();
});
function isImage(type) {
if (!type || typeof type !== 'string') return false;
const imageTypes = [
'jpg',
'jpeg',
'png',
'gif',
'bmp',
'webp',
'svg',
'tiff',
'tif',
'ico',
'apng',
'avif',
'heic',
'heif',
'jfif',
];
const lowerType = type.toLowerCase();
return imageTypes.some((item) => lowerType.includes(item));
}
function preViewImage(file) {
if (file.fileUrl) {
uni.previewImage({
urls: [file.fileUrl],
});
} else {
$api.msg('文件地址丢失');
}
}
async function delFile(file, idx) {
deleting.value = true;
try {
await $api.createRequest(`/app/kiosk/remove?sessionId=${uuid.value}&ids=${file.id}`, {}, 'post', true);
} catch (error) {
$api.msg(error);
} finally {
deleting.value = false;
}
fileList.value.splice(idx, 1);
if(fileList.value.length == 0){
open()
}
}
function open() {
uuid.value = UUID.generate();
resetState();
isVisible.value = true;
popup.value.open();
initQrCode();
}
function close() {
isVisible.value = false;
stopPolling();
popup.value.close();
resetState();
}
function changePopup(e) {
if (e.show) {
} else {
stopPolling();
emit('onClose');
}
}
function handleConfirm() {
emit('onSend', fileList.value);
close();
}
// 重置所有状态
function resetState() {
fileList.value = [];
loading.value = false;
stopPolling();
}
async function initQrCode() {
try {
loading.value = true;
// 清除之前的二维码
clearCanvas();
await makeQrcode();
// 二维码生成成功后开始轮询
if (isVisible.value) {
startPolling();
}
} catch (error) {
console.error('生成二维码失败:', error);
uni.showToast({
title: '生成二维码失败,请重试',
icon: 'none',
});
close();
} finally {
loading.value = false;
}
}
function makeQrcode() {
const protocol = window.location.protocol;
const host = window.location.host;
const isLocal = host.includes('localhost') || host.includes('127.0.0.1');
// const pathPrefix = isLocal ? '' : '/rgpp-api/all-in-one';
let pathPrefix = '';
if (host.includes('localhost') || host.includes('127.0.0.1')) {
pathPrefix = '';
} else if (host.includes('qd.zhaopinzao8dian.com')) {
// 外网测试环境
pathPrefix = '/app';
} else if (host.includes('fw.rc.qingdao.gov.cn')) {
// 青岛政务网环境
pathPrefix = '/rgpp-api/all-in-one';
} else {
pathPrefix = '';
}
const htmlPath = `${protocol}//${host}${pathPrefix}/static/upload.html?sessionId=${uuid.value}&uploadApi=${config.baseUrl}/app/kiosk/upload&fileCount=${props.leaveFileCount}`;
// const htmlPath = `${window.location.host}/static/upload.html?sessionId=${uuid.value}&uploadApi=${
// config.baseUrl + '/app/kiosk/upload'
// }`;
// const htmlPath = `${window.location.host}/static/upload.html?sessionId=${props.sessionId}&uploadApi=${
// config.baseUrl + '/app/kiosk/upload'
// }`;
console.log(htmlPath);
console.log('剩余可上传文件数量:', props.leaveFileCount);
return new Promise((resolve, reject) => {
setTimeout(() => {
uQRCode.make({
canvasId: 'qrcode',
text: htmlPath,
size: uni.upx2px(300),
margin: 0,
backgroundColor: '#ffffff',
foregroundColor: '#1677ff',
fileType: 'png',
correctLevel: uQRCode.defaults.correctLevel,
});
resolve();
}, 100);
});
}
// 清除画布
function clearCanvas() {
const ctx = uni.createCanvasContext('qrcode');
ctx.clearRect(0, 0, uni.upx2px(300), uni.upx2px(300));
ctx.draw();
}
function startPolling() {
if (isPolling.value) return;
isPolling.value = true;
console.log('开始轮询');
// 轮询检查上传状态
const poll = async () => {
if (!isPolling.value || !isVisible.value || deleting.value) return;
const { data } = await $api.createRequest('/app/kiosk/list', { sessionId: uuid.value });
// const { data } = await $api.createRequest('/app/kiosk/list',{sessionId:props.sessionId});
if (data && data.length) {
fileList.value = data;
}
if (isPolling.value && isVisible.value) {
pollingTimer.value = setTimeout(poll, 2000); // 每2秒轮询一次
}
};
poll();
}
function stopPolling() {
isPolling.value = false;
if (pollingTimer.value) {
clearTimeout(pollingTimer.value);
pollingTimer.value = null;
}
console.log('停止轮询');
}
function clearResources() {
stopPolling();
clearCanvas();
}
defineExpose({ open, close });
</script>
<style lang="scss" scoped>
.popup-inner {
padding: 40rpx 30rpx 50rpx;
width: 520rpx;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
border-radius: 20rpx;
background: linear-gradient(135deg, #fafafa 0%, #f0f7ff 100%);
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.15);
}
.title {
font-size: 32rpx;
color: #1a1a1a;
margin-bottom: 30rpx;
font-weight: 600;
text-align: center;
position: relative;
padding-bottom: 16rpx;
&::after {
content: '';
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 60rpx;
height: 4rpx;
background: linear-gradient(90deg, #4191fe 0%, #256bfa 100%);
border-radius: 2rpx;
}
}
.img-box {
margin: 0 auto 30rpx;
width: 300rpx;
height: 300rpx;
background: linear-gradient(145deg, #ffffff 0%, #f8faff 100%);
border-radius: 16rpx;
overflow: hidden;
position: relative;
box-shadow: 0 8rpx 32rpx rgba(65, 145, 254, 0.2);
padding: 20rpx;
border: 2rpx solid rgba(65, 145, 254, 0.1);
canvas {
width: 100%;
height: 100%;
border-radius: 8rpx;
transition: all 0.3s ease;
animation: canvasFadeIn 0.5s ease;
}
}
@keyframes canvasFadeIn {
0% {
opacity: 0;
transform: scale(0.95);
}
100% {
opacity: 1;
transform: scale(1);
}
}
@keyframes fadeIn {
0% {
opacity: 0;
transform: translateY(20rpx);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
.file-list {
margin-top: 30rpx;
width: 470rpx;
max-height: 60vh;
overflow-x: hidden;
overflow-y: auto;
padding-right: 10rpx;
.file-item {
width: 100%;
padding: 25rpx;
padding-right: 15rpx;
box-sizing: border-box;
border: 1px solid #bbc5d1;
display: flex;
align-items: center;
animation: fadeIn 0.5s ease;
background: linear-gradient(135deg, #ffffff 0%, #f0f8ff 100%);
border-radius: 16rpx;
margin-bottom: 20rpx;
transition: all 0.3s ease;
position: relative;
overflow: hidden;
&::before {
content: '';
position: absolute;
left: 0;
top: 0;
width: 6rpx;
height: 100%;
background: linear-gradient(180deg, #4191fe 0%, #256bfa 100%);
border-radius: 3rpx 0 0 3rpx;
}
&:hover {
transform: translateY(-2rpx);
box-shadow: 0 8rpx 24rpx rgba(65, 145, 254, 0.15);
}
.file-icon {
width: 80rpx;
height: 80rpx;
margin-right: 20rpx;
border-radius: 12rpx;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
transition: transform 0.3s ease;
&:active {
transform: scale(0.95);
}
}
.right {
flex: 1;
overflow: hidden;
min-width: 0;
.file-name {
font-size: 30rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-weight: 500;
color: #1a1a1a;
margin-bottom: 8rpx;
transition: color 0.3s ease;
}
.file-size {
font-size: 24rpx;
color: #838383;
}
}
.remove-btn {
background: none;
border: none;
color: #ff6b6b;
font-size: 52rpx;
cursor: pointer;
margin-left: 20rpx;
flex-shrink: 0;
width: 60rpx;
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
transition: all 0.3s ease;
margin-top: -15rpx;
&:active {
background-color: rgba(255, 107, 107, 0.1);
transform: scale(0.9);
}
}
}
}
.confirm-btn {
font-weight: 500;
font-size: 32rpx;
color: #ffffff;
text-align: center;
width: 350rpx;
height: 80rpx;
line-height: 80rpx;
background: linear-gradient(135deg, #4191fe 0%, #256bfa 100%);
border-radius: 16rpx;
margin-top: 30rpx;
transition: all 0.3s ease;
box-shadow: 0 8rpx 24rpx rgba(37, 107, 250, 0.3);
position: relative;
overflow: hidden;
&::after {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
transition: left 0.6s ease;
}
&:active {
transform: scale(0.98);
box-shadow: 0 4rpx 16rpx rgba(37, 107, 250, 0.4);
&::after {
left: 100%;
}
}
}
.loading-container {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(145deg, #ffffff 0%, #f8faff 100%);
border-radius: 16rpx;
}
.tips {
font-size: 26rpx;
color: #666;
text-align: center;
line-height: 1.6;
padding: 0 20rpx;
margin-top: 10rpx;
animation: fadeIn 0.5s ease;
.num {
color: #4191fe;
font-size: 28rpx;
font-weight: 600;
margin: 0 8rpx;
position: relative;
}
}
.close-btn {
position: absolute;
right: 20rpx;
top: 20rpx;
width: 56rpx;
height: 56rpx;
border-radius: 50%;
background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
z-index: 10;
&:active {
transform: scale(0.9) rotate(90deg);
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.15);
}
&::before,
&::after {
content: '';
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 24rpx;
height: 2rpx;
background: #5a5a68;
border-radius: 1rpx;
transition: all 0.3s ease;
}
&::before {
transform: translate(-50%, -50%) rotate(45deg);
}
&::after {
transform: translate(-50%, -50%) rotate(-45deg);
}
}
</style>

View File

@@ -127,6 +127,7 @@
<view class="footer-button btn-feel" @click="chooseResume">上传简历</view>
</view>
</template>
<UploadQrcode ref="qrcodeRef" @onSend="handleFileSend" :leaveFileCount="1" ></UploadQrcode>
</AppLayout>
</template>
@@ -137,11 +138,14 @@ import { onLoad, onShow } from '@dcloudio/uni-app';
import { storeToRefs } from 'pinia';
import useUserStore from '@/stores/useUserStore';
import useDictStore from '@/stores/useDictStore';
const { userInfo, isMiniProgram } = storeToRefs(useUserStore());
const { userInfo, isMiniProgram,isMachineEnv } = storeToRefs(useUserStore());
const { getUserResume } = useUserStore();
const { getDictData, oneDictData } = useDictStore();
import { playTextDirectly } from '@/hook/useTTSPlayer-all-in-one';
import config from '@/config.js';
import UploadQrcode from './components/uploadQrcode.vue';
const qrcodeRef = ref(null);
const showNotice = ref(true);
onLoad(() => {
getUserResume();
@@ -152,6 +156,10 @@ function closeNotice() {
}
function chooseResume() {
if(isMachineEnv.value){
qrcodeRef.value?.open()
return
}
uni.chooseImage({
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
@@ -162,9 +170,11 @@ function chooseResume() {
res = JSON.parse(res);
getUserResume();
$api.msg('上传成功');
playTextDirectly('上传成功')
})
.catch((err) => {
$api.msg('上传失败');
playTextDirectly('上传失败')
});
},
fail: (error) => {},
@@ -209,6 +219,23 @@ function uploadResume(tempFilePath, loading) {
});
});
}
const handleFileSend = (rows)=>{
const file = {
url: rows[0].fileUrl,
type: rows[0].fileSuffix,
name: rows[0].originalName,
}
$api.createRequest('/app/oss/uploadToObs', { userId: userInfo.value.userId,url:file.url }, 'POST').then((res) => {
getUserResume();
$api.msg('上传成功');
playTextDirectly('上传失败')
}).catch(()=>{
$api.msg('上传失败');
playTextDirectly('上传失败')
})
}
</script>
<style lang="stylus" scoped>

View File

@@ -273,8 +273,6 @@ import PopupFeeBack from './popupbadFeeback.vue';
import UploadQrcode from './uploadQrcode.vue';
import AudioWave from './AudioWave.vue';
import WaveDisplay from './WaveDisplay.vue';
import FileIcon from './fileIcon.vue';
import FileText from './fileText.vue';
import useScreenStore from '@/stores/useScreenStore'
const screenStore = useScreenStore();
import { useAudioRecorder } from '@/hook/useRealtimeRecorder.js';

View File

@@ -40,8 +40,6 @@
<script setup>
import { ref, inject, onUnmounted, watch, computed } from 'vue';
import FileIcon from './fileIcon.vue';
import FileText from './fileText.vue';
import uQRCode from '@/static/js/qrcode';
import config from '@/config';
import { onShow, onHide } from '@dcloudio/uni-app';

View File

@@ -0,0 +1,395 @@
<template>
<view class="out">
<view v-if="loading" class="loading">
<view class="semicircle-loader"></view>
</view>
<view v-else class="container" id="pixi-box" ref="pixiContainerRef"></view>
</view>
</template>
<script setup>
import { onMounted, onUnmounted, ref, nextTick, watch } from 'vue';
const props = defineProps({
tags: {
type: Array,
default: [],
},
loading: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(['tag-click']);
// DOM Ref
const pixiContainerRef = ref(null);
// PIXI 变量
let app = null;
let tagsContainer = null;
let activeTagInstances = [];
// 配置数据
const tagsConfig = ref([
{ bgColor: 0x0069fe, fontColor: 0xffffff, size: 16, opacity: 1.0, angle: 0, radius: 0 },
{
bgColor: 0x87e2ec,
fontColor: 0xffffff,
size: 14,
opacity: 1,
angle: -Math.PI / 2,
radius: 68,
tailRotation: Math.PI / 2,
},
{
bgColor: 0xffebeb,
tailColor: 0xffe1e1,
fontColor: 0xff6969,
size: 11.5,
opacity: 1,
angle: -Math.PI / 4.2,
radius: 125,
tailRotation: (3 * Math.PI) / 4.5,
},
{
bgColor: 0x21ea85,
fontColor: 0xffffff,
size: 15,
opacity: 1,
angle: -Math.PI / 10,
radius: 130,
tailRotation: (3 * Math.PI) / 4.2,
},
{
bgColor: 0xebf3ff,
tailColor: 0xb9d3ff,
fontColor: 0x1d71ef,
size: 12,
opacity: 1,
angle: Math.PI / 18,
radius: 135,
tailRotation: (3 * Math.PI) / 4.3,
},
{
bgColor: 0xffd4b6,
fontColor: 0xffffff,
size: 14,
opacity: 1,
angle: Math.PI / 4.3,
radius: 100,
tailRotation: -(3 * Math.PI) / 4.5,
},
{
bgColor: 0xff9400,
fontColor: 0xffffff,
size: 14,
opacity: 1,
angle: (2 * Math.PI) / 3,
radius: 92,
tailRotation: -Math.PI / 2.4,
},
{
bgColor: 0xebf3ff,
tailColor: 0xb9d3ff,
fontColor: 0x1d71ef,
size: 10.5,
opacity: 1,
angle: (5.4 * Math.PI) / 6,
radius: 110,
tailRotation: (3 * Math.PI) / 1.79,
},
{
bgColor: 0xff6969,
fontColor: 0xffffff,
size: 14,
opacity: 1,
angle: (6.3 * Math.PI) / 5.8,
radius: 120,
tailRotation: Math.PI / 2.9,
},
{
bgColor: 0xfce9c9,
fontColor: 0xfbc55f,
size: 13,
opacity: 1,
angle: (7.2 * Math.PI) / 5.9,
radius: 120,
tailRotation: Math.PI / 3,
},
]);
watch(
() => props.tags,
(val) => {
if (val && val.length) {
tagsConfig.value.map((tag, index) => {
// console.log(val[index])
tag.name = val[index]?.job_name;
});
setTimeout(() => {
initPixi();
}, 100);
}
},
{ deep: true }
);
onMounted(async () => {
window.addEventListener('resize', handleResize);
});
onUnmounted(() => {
window.removeEventListener('resize', handleResize);
if (app) {
app.destroy(true, { children: true, texture: true, baseTexture: true });
app = null;
}
});
const getContainerDOM = () => {
const refVal = pixiContainerRef.value;
if (!refVal) return document.getElementById('pixi-box');
if (refVal.$el) return refVal.$el;
return refVal;
};
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
const initPixi = () => {
const container = getContainerDOM();
if (!container) return;
const width = container.clientWidth || 300;
const height = container.clientHeight || 300;
if (app) return;
app = new PIXI.Application({
width: width,
height: height,
backgroundAlpha: 0,
backgroundColor: 0xf5f7fa,
antialias: true,
resolution: window.devicePixelRatio || 1,
autoDensity: true,
});
app.view.style.touchAction = 'auto';
container.appendChild(app.view);
tagsContainer = new PIXI.Container();
app.stage.addChild(tagsContainer);
renderScene(width, height);
};
const renderScene = (sw, sh) => {
let ratio = window.innerWidth / 400;
if (ratio < 1) ratio = 1;
tagsContainer.removeChildren();
activeTagInstances = [];
tagsConfig.value.forEach((data, index) => {
const scaledRadius = data.radius * ratio;
let x = sw / 2 + scaledRadius * Math.cos(data.angle);
let y = sh / 2 + scaledRadius * Math.sin(data.angle);
const tag = createTag(data, index, ratio);
tagsContainer.addChild(tag);
const safeW = tag.width / 2 + 10;
const safeH = tag.height / 2 + 10;
// 强制修正 x 和 y使其不超出屏幕
x = clamp(x, safeW, sw - safeW);
y = clamp(y, safeH, sh - safeH);
tag.x = x;
tag.y = y;
// 4. 保存元数据
tag.userData = {
originalX: x,
originalY: y,
angle: data.angle,
radius: scaledRadius,
floatOffset: Math.random() * Math.PI * 2,
floatSpeed: 0.01 + Math.random() * 0.02,
floatRange: 2 * ratio + Math.random() * 2,
safeH: safeH,
};
if (data.radius > 0) {
const tail = createCometTail(
data.tailColor || data.bgColor,
data.tailRotation,
tag.width,
tag.height,
ratio
);
tag.addChildAt(tail, 0);
tag.updateTail = () => tail.updateAnim();
}
activeTagInstances.push(tag);
});
// 动画循环
app.ticker.add(() => {
const screenH = app.screen.height;
activeTagInstances.forEach((tag) => {
const meta = tag.userData;
if (meta) {
// 计算新的浮动位置
meta.floatOffset += meta.floatSpeed;
let nextY = meta.originalY + Math.sin(meta.floatOffset) * meta.floatRange;
// 再次进行边界检查
if (nextY < meta.safeH) nextY = meta.safeH;
if (nextY > screenH - meta.safeH) nextY = screenH - meta.safeH;
tag.y = nextY;
if (tag.updateTail) tag.updateTail();
}
});
});
};
const createTag = (tagData, index, ratio) => {
if (ratio > 1) ratio = ratio * 0.9;
const tagGroup = new PIXI.Container();
tagGroup.eventMode = 'static';
tagGroup.cursor = 'pointer';
tagGroup.on('pointertap', () => emit('tag-click', tagData));
const text = new PIXI.Text(tagData.name, {
fontFamily: ['PingFang SC', 'Microsoft YaHei', 'Arial'],
fontSize: tagData.size * ratio,
fill: tagData.fontColor,
padding: 4 * ratio,
resolution: 2,
});
text.anchor.set(0.5);
const paddingH = 26 * ratio;
const paddingV = 10 * ratio;
let bgWidth = text.width + paddingH;
let bgHeight = text.height + paddingV;
if (index === 0) bgWidth = Math.max(bgWidth, tagData.size * 4.5);
const bg = new PIXI.Graphics();
bg.beginFill(tagData.bgColor, tagData.opacity ?? 1);
bg.drawRoundedRect(-bgWidth / 2, -bgHeight / 2, bgWidth, bgHeight, bgHeight / 2);
bg.endFill();
tagGroup.addChild(bg);
tagGroup.addChild(text);
return tagGroup;
};
const createCometTail = (bgColor, tailRotation, parentWidth, parentHeight, ratio) => {
if (ratio > 1) ratio = ratio;
const tailGroup = new PIXI.Container();
const graphics = new PIXI.Graphics();
tailGroup.addChild(graphics);
const baseLength = 45 * ratio;
const startWidth = parentHeight + 20 * ratio;
const endWidth = parentHeight * 0.4;
let breathPhase = Math.random() * Math.PI * 2;
const breathSpeed = 0.04;
tailGroup.updateAnim = () => {
breathPhase += breathSpeed;
const breathScale = 0.85 + 0.15 * Math.sin(breathPhase);
graphics.clear();
const currentLength = baseLength * breathScale;
const cos = Math.cos(tailRotation);
const sin = Math.sin(tailRotation);
const perpX = -sin;
const perpY = cos;
const p1 = { x: perpX * (startWidth / 2), y: perpY * (startWidth / 2) };
const p2 = { x: -perpX * (startWidth / 2), y: -perpY * (startWidth / 2) };
const endCX = cos * currentLength;
const endCY = sin * currentLength;
const p3 = { x: endCX - perpX * (endWidth / 2), y: endCY - perpY * (endWidth / 2) };
const p4 = { x: endCX + perpX * (endWidth / 2), y: endCY + perpY * (endWidth / 2) };
const segments = 8;
for (let i = 0; i < segments; i++) {
const t1 = i / segments;
const t2 = (i + 1) / segments;
const alpha = 0.4 * (1 - t1);
const sp1 = { x: p1.x + (p4.x - p1.x) * t1, y: p1.y + (p4.y - p1.y) * t1 };
const sp2 = { x: p2.x + (p3.x - p2.x) * t1, y: p2.y + (p3.y - p2.y) * t1 };
const ep1 = { x: p1.x + (p4.x - p1.x) * t2, y: p1.y + (p4.y - p1.y) * t2 };
const ep2 = { x: p2.x + (p3.x - p2.x) * t2, y: p2.y + (p3.y - p2.y) * t2 };
graphics.beginFill(bgColor, alpha);
graphics.moveTo(sp1.x, sp1.y);
graphics.lineTo(sp2.x, sp2.y);
graphics.lineTo(ep2.x, ep2.y);
graphics.lineTo(ep1.x, ep1.y);
graphics.endFill();
}
};
tailGroup.updateAnim();
return tailGroup;
};
const handleResize = () => {
const container = getContainerDOM();
if (!app || !container) return;
app.destroy(true, { children: true, texture: true, baseTexture: true });
app = null;
initPixi();
};
</script>
<style scoped>
.out {
width: 100%;
height: 100%;
}
.loading {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.semicircle-loader {
width: 150rpx;
height: 150rpx;
border: 12rpx solid #f3f3f3;
border-top: 12rpx solid #3498db;
border-radius: 50%;
animation: spin 1.2s linear infinite;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.container {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
color: #b9d3ff;
}
</style>

View File

@@ -18,8 +18,13 @@
v-for="(_, index) in 2"
:key="index"
>
<component
:is="components[index]"
<IndexRefactor
v-if="index === 0"
@onShowTabbar="changeShowTabbar"
:ref="(el) => handelComponentsRef(el, index)"
/>
<IndexTwo
v-if="index === 1"
@onShowTabbar="changeShowTabbar"
:ref="(el) => handelComponentsRef(el, index)"
/>

View File

@@ -1,5 +1,6 @@
<template>
<view class="container">
<view v-show="searchFocus" class="search-mask" ></view>
<view>
<view class="top">
<image
@@ -9,22 +10,46 @@
@click="navBack"
></image>
<view class="search-box">
<my-icons
class="iconsearch"
color="#666666"
type="search"
size="36"
@confirm="searchCollection"
></my-icons>
<!-- 修改为左右布局的切换按钮 -->
<view class="search-type-tabs">
<view
class="type-tab button-click"
:class="{ active: searchType === 'job' }"
@click="setSearchType('job')"
>
职位
</view>
<view
class="type-tab button-click"
:class="{ active: searchType === 'major' }"
@click="setSearchType('major')"
>
专业
</view>
</view>
<input
class="inputed"
type="text"
focus
v-model="searchValue"
placeholder="搜索职位名称"
:placeholder="searchType === 'job' ? '搜索职位名称' : '搜索专业名称'"
placeholder-class="placeholder"
@input="handleInputChange"
@blur="handleInputBlur"
@focus="handleInputFocus"
@confirm="searchBtn"
/>
<!-- 联想搜索下拉列表 -->
<scroll-view scroll-y class="search-suggestions" v-show="showSuggestions && filteredSuggestions.length">
<view
class="suggestion-item"
v-for="(item, index) in filteredSuggestions"
:key="index"
@click="selectSuggestion(item)"
>
<view class="item-txt line_1">{{ item }}</view>
</view>
</scroll-view>
</view>
<view class="search-btn button-click" @click="searchBtn">搜索</view>
</view>
@@ -86,7 +111,7 @@
</template>
<script setup>
import { inject, ref, reactive, nextTick } from 'vue';
import { inject, ref, reactive, nextTick, computed } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import SelectJobs from '@/components/selectJobs/selectJobs.vue';
const { $api, navBack, navTo } = inject('globalFunction');
@@ -100,10 +125,34 @@ import useUserStore from '@/stores/useUserStore';
const { isMiniProgram } = storeToRefs(useUserStore());
import { playTextDirectly } from '@/hook/useTTSPlayer-all-in-one';
// 搜索类型job-职位major-专业
const searchType = ref('job');
const searchValue = ref('');
const historyList = ref([]);
const listCom = ref([]);
const showSuggestions = ref(false);
const searchFocus = ref(false);
// 专业数据源(示例数据,可以替换为实际数据)
const majorDataSource = ref([]);
// 计算属性:过滤后的联想列表
const filteredSuggestions = computed(() => {
if (!searchValue.value || searchType.value !== 'major') {
return [];
}
const searchText = searchValue.value.toLowerCase();
try {
return majorDataSource.value.filter(item =>
item.toLowerCase().includes(searchText)
);
} catch (error) {
return []
}
});
const pageState = reactive({
page: 0,
total: 0,
@@ -117,7 +166,7 @@ const isLoaded = ref(false);
const waterfallsFlowRef = ref(null);
const loadmoreRef = ref(null);
const currentTab = ref(0);
// 响应式搜索条件(可以被修改)
const searchParams = ref({});
const pageSize = ref(10);
@@ -166,8 +215,63 @@ onLoad((options) => {
if (arr) {
historyList.value = uni.getStorageSync('searchList');
}
getMajorDataSource()
});
function getMajorDataSource() {
const LoadCache = (resData) => {
if (resData.code === 200) {
majorDataSource.value = resData.data;
console.log(majorDataSource.value)
}
};
$api.createRequestWithCache('/app/common/jobTitle/treeselect', {}, 'GET', false, LoadCache).then(LoadCache);
}
// 设置搜索类型并触发搜索
function setSearchType(type) {
if (searchType.value === type) return;
searchType.value = type;
// 如果输入框有值且当前是专业搜索,显示联想列表
if (searchValue.value && searchType.value === 'major' && searchFocus.value) {
showSuggestions.value = true;
} else {
showSuggestions.value = false;
}
// 如果有搜索值,触发搜索
if (searchValue.value) {
// 重置页码
pageState.page = 0;
// 触发搜索
playTextDirectly('正在为您查找岗位')
// 根据搜索类型设置不同的参数
if (searchType.value === 'job') {
searchParams.value = {
jobTitle: searchValue.value,
};
} else {
searchParams.value = {
majorTitle: searchValue.value,
};
}
if (currentTab.value === 0) {
getJobList('refresh');
} else {
refresh();
waterfallsFlowRef.value?.refresh?.();
}
// 隐藏联想列表
showSuggestions.value = false;
}
}
function changeType(type) {
if (currentTab.value === type) return;
switch (type) {
@@ -182,28 +286,84 @@ function changeType(type) {
break;
}
}
function searchFn(item) {
searchValue.value = item;
searchBtn();
}
function handleInputChange(e) {
const val = e.detail.value;
searchValue.value = val;
// 如果是专业搜索且输入框有值,显示联想列表
if (searchType.value === 'major' && val && searchFocus.value) {
showSuggestions.value = true;
} else {
showSuggestions.value = false;
}
}
function handleInputFocus() {
searchFocus.value = true;
// 如果是专业搜索且输入框有值,显示联想列表
if (searchType.value === 'major' && searchValue.value) {
showSuggestions.value = true;
}
}
function handleInputBlur() {
searchFocus.value = false;
// 延迟隐藏联想列表,以便点击项能触发
setTimeout(() => {
showSuggestions.value = false;
}, 100);
}
// 选择联想项
function selectSuggestion(item) {
searchValue.value = item;
showSuggestions.value = false;
// 直接触发搜索
searchBtn();
}
function searchBtn() {
if (!searchValue.value) {
return;
}
playTextDirectly('正在为您查找岗位')
// 保存到历史记录(仅当搜索成功时保存)
historyList.value.unshift(searchValue.value);
historyList.value = unique(historyList.value);
uni.setStorageSync('searchList', historyList.value);
searchParams.value = {
jobTitle: searchValue,
};
// 根据搜索类型设置不同的参数
if (searchType.value === 'job') {
// 职位搜索
searchParams.value = {
jobTitle: searchValue.value,
};
} else {
// 专业搜索
searchParams.value = {
majorTitle: searchValue.value,
};
}
// 重置页码
pageState.page = 0;
if (currentTab.value === 0) {
getJobList('refresh');
} else {
refresh();
waterfallsFlowRef.value?.refresh?.();
}
// 隐藏联想列表
showSuggestions.value = false;
}
function searchCollection(e) {
@@ -254,12 +414,24 @@ function getJobList(type = 'add') {
pageState.page = 1;
pageState.maxPage = 2;
}
// 根据搜索类型构建参数
let params = {
current: pageState.page,
pageSize: pageState.pageSize,
...pageState.search,
jobTitle: searchValue.value,
};
// 移除之前的搜索参数,根据当前搜索类型添加
if (searchType.value === 'job') {
params.jobTitle = searchValue.value;
// 确保没有majorTitle参数
delete params.majorTitle;
} else {
params.majorTitle = searchValue.value;
// 确保没有jobTitle参数
delete params.jobTitle;
}
$api.createRequest('/app/job/list', params, 'GET', true).then((resData) => {
const { rows, total } = resData;
@@ -299,7 +471,6 @@ function dataToImg(data) {
.Detailscroll-view{
flex: 1
overflow: hidden
}
.container{
display: flex
@@ -367,8 +538,6 @@ function dataToImg(data) {
justify-content: space-between
background-color: #fff;
padding: 20rpx 20rpx;
position: sticky;
top: 0
.btnback{
width: 60rpx;
height: 60rpx;
@@ -376,27 +545,90 @@ function dataToImg(data) {
.search-box{
flex: 1;
padding: 0 24rpx 0 6rpx;
position: relative
position: relative;
z-index: 10;
.search-type-tabs {
background: #FFFFFF;
position: absolute;
top: 50%;
left: 21rpx;
transform: translate(0, -50%);
display: flex;
align-items: center;
border-radius: 8rpx;
padding: 4rpx;
z-index: 2;
border: 1rpx solid #E0E0E0;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
border-radius: 60rpx
.type-tab {
padding: 10rpx 24rpx;
font-size: 24rpx;
color: #666666;
border-radius: 30rpx;
transition: all 0.2s ease;
white-space: nowrap;
&.active {
background: #256BFA;
color: #FFFFFF;
font-weight: 500;
}
}
.type-tab:first-child {
margin-right: 1rpx;
}
}
.inputed {
padding-left: 30rpx
width: 100%;
background: #F8F8F8;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
line-height: 36rpx;
color: #666666;
padding: 0 30rpx 0 80rpx;
box-sizing: border-box;
width: 100%;
background: #F8F8F8;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
line-height: 36rpx;
color: #666666;
padding: 0 30rpx 0 230rpx;
box-sizing: border-box;
height: 80rpx;
background: #F5F5F5;
border-radius: 75rpx 75rpx 75rpx 75rpx;
border-radius: 73rpx;
}
.iconsearch{
position: absolute
top: 50%
left: 36rpx
transform: translate(0, -50%)
.search-suggestions {
position: absolute;
top: 105%;
width:calc(100% - 24rpx - 6rpx);
background: #FFFFFF;
border: 2rpx solid #ECECEC;
border-top: 0;
z-index: 10;
border-radius: 30rpx
max-height: 40vh;
overflow hidden;
.suggestion-item {
height: 80rpx;
padding: 0rpx 24rpx;
display: flex;
align-items: center;
justify-items: flex-start;
border-top: 2rpx dashed #e3e3e3;
.item-txt {
font-size: 28rpx;
color: #333333;
width: 100%;
}
}
.suggestion-item:hover {
background: #e5e5e5;
}
.suggestion-item:first-child {
border-top: none;
}
}
}
.search-btn {
@@ -473,4 +705,13 @@ function dataToImg(data) {
font-size: 24rpx;
color: #6C7282;
margin-top: 6rpx;
</style>
.search-mask{
position fixed;
width 100vw;
height:100vh;
top:0;
left:0
z-index:9;
background: #33333355;
}
</style>

View File

@@ -22,6 +22,9 @@ const useLocationStore = defineStore("location", () => {
const count = ref(0)
function getLocation() { // 获取经纬度两个平台
// #ifndef H5
const lightAppJssdk = {}
// #endif
return new Promise((resole, reject) => {
try {
if (lightAppJssdk.map) {

View File

@@ -5,7 +5,10 @@ import {
ref,
computed
} from 'vue';
// #ifndef MP-WEIXIN
import wideScreenStyles from '../common/wide-screen.css?inline';
// #endif
// 屏幕检测管理器类
class ScreenDetectionManager {
@@ -49,17 +52,25 @@ class ScreenDetectionManager {
// 检测折叠屏
checkVisualViewport() {
if (window.visualViewport?.segments?.length > 1) {
return {
foldable: true,
count: window.visualViewport.segments.length - 1
try {
if (window.visualViewport?.segments?.length > 1) {
return {
foldable: true,
count: window.visualViewport.segments.length - 1
}
} else {
return {
foldable: false,
count: 1
}
}
} else {
} catch (error) {
return {
foldable: false,
count: 1
}
}
}
// 动态加载 CSS

View File

@@ -1,4 +1,5 @@
import IndexedDBHelper from '@/common/IndexedDBHelper.js'
import UniStorageHelper from '@/common/UniStorageHelper.js'
import useChatGroupDBStore from '@/stores/userChatGroupStore'
import config from '@/config'
@@ -66,7 +67,14 @@ class BaseStore {
}
initDB() {
// #ifdef H5
this.db = new IndexedDBHelper(this.dbName, config.DBversion);
// #endif
// #ifndef H5
this.db = new UniStorageHelper(this.dbName, config.DBversion);
// #endif
return this.db.openDB([{
name: 'record',
keyPath: "id",
@@ -103,8 +111,15 @@ class BaseStore {
}
async clearDB() {
// 修正拼写错误并优化 Promise 写法
return new IndexedDBHelper().deleteDB(this.dbName);
// #ifdef H5
return new IndexedDBHelper().deleteDB(this.dbName);
// #endif
// #ifndef H5
return new UniStorageHelper().deleteDB(this.dbName);
// #endif
}
/**