flat: 暂存
This commit is contained in:
@@ -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';
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
<template>
|
||||
<image v-if="type === 'application/pdf' || type === 'pdf'" :src="pdfIcon" class="file-icon" />
|
||||
<image
|
||||
v-else-if="
|
||||
type === 'application/msword' ||
|
||||
type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' ||
|
||||
type === 'doc' ||
|
||||
type === 'docx'
|
||||
"
|
||||
:src="docIcon"
|
||||
class="file-icon"
|
||||
/>
|
||||
<image
|
||||
v-else-if="
|
||||
type === 'application/vnd.ms-powerpoint' ||
|
||||
type === 'application/vnd.openxmlformats-officedocument.presentationml.presentation'||
|
||||
type === 'ppt' ||
|
||||
type === 'pptx'
|
||||
"
|
||||
:src="pptIcon"
|
||||
class="file-icon"
|
||||
/>
|
||||
<image v-else-if="type === 'text/markdown' || type === 'md'" :src="mdIcon" class="file-icon" />
|
||||
<image v-else-if="type === 'text/plain' || type=== 'txt'" :src="txtIcon" class="file-icon" />
|
||||
<image v-else-if="type === 'text/html' || type === 'html'" :src="htmlIcon" class="file-icon" />
|
||||
<image
|
||||
v-else-if="
|
||||
type === 'application/vnd.ms-excel' ||
|
||||
type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'||
|
||||
type === 'xls' ||
|
||||
type === 'xlsx'
|
||||
"
|
||||
:src="excelIcon"
|
||||
class="file-icon"
|
||||
/>
|
||||
<image v-else :src="otherIcon" class="file-icon" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import pdfIcon from '@/static/file/pdf.png';
|
||||
import docIcon from '@/static/file/doc.png';
|
||||
import pptIcon from '@/static/file/ppt.png';
|
||||
import mdIcon from '@/static/file/md.png';
|
||||
import txtIcon from '@/static/file/txt.png';
|
||||
import htmlIcon from '@/static/file/html.png';
|
||||
import excelIcon from '@/static/file/excel.png';
|
||||
import otherIcon from '@/static/file/other.png';
|
||||
|
||||
const props = defineProps({
|
||||
type: String,
|
||||
});
|
||||
|
||||
const type = props.type;
|
||||
</script>
|
||||
@@ -1,57 +0,0 @@
|
||||
<template>
|
||||
<view class="file-type-box">
|
||||
{{ fileAbbreviation }}
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
type: String,
|
||||
});
|
||||
|
||||
const fileAbbreviation = computed(() => {
|
||||
const typeMap = {
|
||||
'application/pdf': 'PDF',
|
||||
'application/msword': 'DOC',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'DOCX',
|
||||
'application/vnd.ms-powerpoint': 'PPT',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation': 'PPTX',
|
||||
'application/vnd.ms-excel': 'XLS',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'XLSX',
|
||||
'text/markdown': 'MD',
|
||||
'text/plain': 'TXT',
|
||||
'text/html': 'HTML',
|
||||
'pdf':'PDF',
|
||||
'doc':'DOC',
|
||||
'docx':'DOCX',
|
||||
'ppt':'PPT',
|
||||
'pptx':'PPTX',
|
||||
'xls': 'XLS',
|
||||
'xlsx': 'XLSX',
|
||||
'md':'MD',
|
||||
'txt':'TXT',
|
||||
'html':'HTML',
|
||||
'jpg':'JPG',
|
||||
'img':'IMG',
|
||||
'png':'PNG',
|
||||
'jpeg':'JPEG',
|
||||
'gif':'GIF',
|
||||
'webp':'WEBP',
|
||||
'svg':'SVG',
|
||||
'tiff':'TIFF',
|
||||
|
||||
};
|
||||
return typeMap[props.type] || 'OTHER';
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.file-type-box {
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #7b7b7b;
|
||||
line-height: 28rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -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';
|
||||
|
||||
395
pages/index/components/AIMatch copy.vue
Normal file
395
pages/index/components/AIMatch copy.vue
Normal 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>
|
||||
@@ -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)"
|
||||
/>
|
||||
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user