flat: 演示版

This commit is contained in:
Apcallover
2025-12-09 11:13:32 +08:00
parent f24d95cedf
commit 67f5dbbfb0
12 changed files with 161 additions and 36 deletions

25
App.vue
View File

@@ -4,7 +4,7 @@ import { onLaunch, onShow, onHide } from '@dcloudio/uni-app';
import useUserStore from './stores/useUserStore';
import usePageAnimation from './hook/usePageAnimation';
import useDictStore from './stores/useDictStore';
const { $api, navTo, appendScriptTagElement, aes_Decrypt, sm2_Decrypt } = inject('globalFunction');
const { $api, navTo, appendScriptTagElement, aes_Decrypt, sm2_Decrypt, safeReLaunch } = inject('globalFunction');
import config from '@/config.js';
usePageAnimation();
const appword = 'aKd20dbGdFvmuwrt'; // 固定值
@@ -27,9 +27,10 @@ onLaunch((options) => {
$api.msg('登录成功');
});
} else {
uni.redirectTo({
url: '/pages/login/login',
});
safeReLaunch('/pages/login/login');
// uni.redirectTo({
// url: '/pages/login/login',
// });
}
}
});
@@ -110,13 +111,15 @@ function loginCallback(userInfo) {
.then((resume) => {
if (resume.data.jobTitleId) {
useUserStore().initSeesionId();
uni.reLaunch({
url: '/pages/index/index',
});
// uni.reLaunch({
// url: '/pages/index/index',
// });
safeReLaunch('/pages/index/index');
} else {
uni.redirectTo({
url: '/pages/login/login',
});
safeReLaunch('/pages/login/login');
// uni.redirectTo({
// url: '/pages/login/login',
// });
}
});
});
@@ -187,4 +190,4 @@ uni-modal,
body {
font-family: 'PingFangSC-Regular', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
</style>
</style>

View File

@@ -51,6 +51,23 @@ const prePage = () => {
}
export function safeReLaunch(url) {
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
// 移除传入url开头的斜杠用于对比
const cleanUrl = url.startsWith('/') ? url.slice(1) : url;
if (currentPage && currentPage.route === cleanUrl) {
console.log('已在当前页');
return;
}
uni.reLaunch({
url
});
}
/**
@@ -627,7 +644,8 @@ export const $api = {
sendingMiniProgramMessage,
copyText,
aes_Decrypt,
createRequestWithCache
createRequestWithCache,
safeReLaunch
}
@@ -660,5 +678,6 @@ export default {
sm4Decrypt,
aes_Decrypt,
sm2_Decrypt,
sm2_Encrypt
sm2_Encrypt,
safeReLaunch
}

View File

@@ -70,8 +70,29 @@ watch(
() => props.list,
(newList) => {
if (!Array.isArray(newList)) return;
let shouldReset = false;
if (dataSource.value.length > newList.length) {
shouldReset = true;
} else if (dataSource.value.length > 0 && newList.length > 0) {
// 注意:这里沿用你代码中使用的 item.id 作为唯一标识
const oldId = dataSource.value[0].id;
const newId = newList[0].id;
if (oldId !== newId) {
shouldReset = true;
}
}
if (shouldReset) {
dataSource.value = [];
processedIds.clear();
}
const newItems = newList.filter((item) => !processedIds.has(item.id));
if (newItems.length === 0) return;
newItems.forEach((item) => processedIds.add(item.id));
const delay = 50;
newItems.forEach((item, index) => {
@@ -80,7 +101,7 @@ watch(
}, index * delay);
});
},
{ immediate: true }
{ immediate: true, deep: true }
);
function nextDetail(company) {

View File

@@ -82,9 +82,36 @@ watch(
() => props.list,
(newList) => {
if (!Array.isArray(newList)) return;
const newItems = newList.filter((item) => !processedIds.has(item.id));
// --- 新增逻辑开始 ---
// 判断是否需要重置数据 (例如点击了搜索、切换了Tab、或下拉刷新)
let shouldReset = false;
// 场景1: 新列表长度比当前渲染的列表短说明发生了重置如从20条变成了10条
if (dataSource.value.length > newList.length) {
shouldReset = true;
}
// 场景2: 列表不为空且第一条数据的ID发生了变化说明是全新的搜索结果
else if (dataSource.value.length > 0 && newList.length > 0) {
const oldId = dataSource.value[0].id || dataSource.value[0].jobId;
const newId = newList[0].id || newList[0].jobId;
if (oldId !== newId) {
shouldReset = true;
}
}
// 如果判定为重置则清空现有数据和ID记录
if (shouldReset) {
dataSource.value = [];
processedIds.clear();
}
// --- 新增逻辑结束 ---
const newItems = newList.filter((item) => !processedIds.has(item.id || item.jobId));
if (newItems.length === 0) return;
newItems.forEach((item) => processedIds.add(item.id));
newItems.forEach((item) => processedIds.add(item.id || item.jobId));
const delay = 50;
newItems.forEach((item, index) => {
setTimeout(() => {
@@ -92,7 +119,7 @@ watch(
}, index * delay);
});
},
{ immediate: true }
{ immediate: true, deep: true } // 建议加上 deep虽然这里监听的是数组引用变化
);
function nextDetail(job) {

View File

@@ -14,11 +14,13 @@ export default {
// 只使用本地缓寸的数据
OnlyUseCachedDB: false,
// 素质测评URL
Quality_assessment_URL: 'https://web1.isdapp.shandong.gov.cn/jmopen_files/unzip/49ee8533b31b46238906b31c27c5dfc9/zycpvhyjw/index.html#/pages/evaluation_record/evaluation_record?uuid=2',
Quality_assessment_URL: 'https://web1.isdapp.shandong.gov.cn/jmopen_files/unzip/3511c4a8b32c468489ace780d40f6d92/zycpvhyjw/index.html#/pages/evaluation_record/evaluation_record?uuid=2f19e4d676df4650b6fb7edf87461571',
// 职业指导
Career_guidance: 'https://web1.isdapp.shandong.gov.cn/jmopen_files/unzip/2626f6e3c899445db8639a873d172d73/zyzd/index.html',
Career_guidance: 'https://web1.isdapp.shandong.gov.cn/jmopen_files/unzip/927b0032dfe3405ab0124fda9282ebdd/zyzd/index.html',
// ai 模拟面试
mock_interview: 'https://web1.isdapp.shandong.gov.cn/jmopen_files/unzip/08c660be20b74e15acd8763001db5fd1/szjx-rgzn-xnsc/#/pages/mine/interview/index',
mock_interview: 'https://web1.isdapp.shandong.gov.cn/jmopen_files/unzip/4a21b3b6efec4f8db2c3d3d5fa51edc9/szjx-rgzn-xnsc/#/pages/interview/schedule',
// VR虚拟招聘会
virtualJobFair: 'https://web1.isdapp.shandong.gov.cn/jmopen_files/unzip/4a21b3b6efec4f8db2c3d3d5fa51edc9/szjx-rgzn-xnsc/#/pages/metaverse/job_fair',
// 使用模拟定位
UsingSimulatedPositioning: true,
// 应用信息

View File

@@ -22,11 +22,11 @@
<script>
eruda.init();
</script> -->
<script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
<!-- <script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
<script>
// VConsole 默认会挂载到 `window.VConsole` 上
var vConsole = new window.VConsole();
</script>
</script> -->
<!-- 爱山东jssdk 本sdk存在性能问题 -->
<script type="text/javascript" src="https://isdapp.shandong.gov.cn/jmopen/jssdk/index.js"></script>
<!-- 只在内网有效 -->

View File

@@ -42,7 +42,7 @@ const { $api, navTo, debounce, customSystem } = inject('globalFunction');
import { storeToRefs } from 'pinia';
import useLocationStore from '@/stores/useLocationStore';
import useUserStore from '@/stores/useUserStore';
const { userInfo } = storeToRefs(useUserStore());
const { userInfo, isMiniProgram } = storeToRefs(useUserStore());
const { longitudeVal, latitudeVal } = storeToRefs(useLocationStore());
const pageState = reactive({
@@ -58,6 +58,15 @@ const state = reactive({
tabIndex: 'all',
});
onMounted(() => {
// #ifdef H5
if (!isMiniProgram.value) {
const a = document.getElementsByClassName('uni-page-head-hd')[0];
a.style.display = 'none';
}
// #endif
});
onLoad(() => {
getList('refresh');
});

View File

@@ -1,6 +1,6 @@
<template>
<div class="video-container">
<view class="back-box">
<view class="back-box" v-if="isMiniProgram">
<view class="btn">
<uni-icons type="left" size="26" color="#FFFFFF" @click="navBack"></uni-icons>
</view>
@@ -31,6 +31,8 @@ import mTikTok from '@/components/TikTok/TikTok.vue';
import useUserStore from '@/stores/useUserStore';
import { useRecommedIndexedDBStore } from '@/stores/useRecommedIndexedDBStore.js';
const recommedIndexDb = useRecommedIndexedDBStore();
import { storeToRefs } from 'pinia';
const { isMiniProgram } = storeToRefs(useUserStore());
const state = reactive({
videoList: [],
});

View File

@@ -111,6 +111,7 @@ import { onLoad, onShow } from '@dcloudio/uni-app';
import Tabbar from '@/components/tabbar/midell-box.vue';
import useLocationStore from '@/stores/useLocationStore';
import { storeToRefs } from 'pinia';
import config from '@/config';
const { longitudeVal, latitudeVal } = storeToRefs(useLocationStore());
const { $api, navTo, cloneDeep, debounce } = inject('globalFunction');
const weekList = ref([]);
@@ -143,6 +144,12 @@ onLoad(() => {
getFair('refresh');
});
const handleItemClick = (item) => {
lightAppJssdk.navigation.hide({
url: config.virtualJobFair,
});
};
function toSelectDate() {
navTo('/packageA/pages/selectDate/selectDate', {
query: {
@@ -174,7 +181,9 @@ function changeSwiperMsgType(e) {
function seemsg(index) {
if (index === 1) {
return $api.msg('功能确定中');
handleItemClick();
// $api.msg('功能确定中');
return;
}
state.current = index;
}
@@ -204,7 +213,7 @@ function getFair(type = 'add') {
if (currentDay.value?.fullDate) {
params.zphjbsj = currentDay.value.fullDate.replace(/-/g, '');
}
$api.createRequest('/app/internal/jobFairThirdPart', params, 'GET', true).then((resData) => {
$api.createRequest('/app/internal/jobFairThirdPart', params, 'GET', false).then((resData) => {
const { rows, total } = resData;
if (type === 'add') {
// const str = pageState.pageSize * (pageState.page - 1);

View File

@@ -1,5 +1,5 @@
<template>
<AppLayout title="AI+就业服务程序">
<AppLayout title="就业服务程序">
<tabcontrolVue :current="tabCurrent">
<template v-slot:tab0>
<view class="login-content">
@@ -109,9 +109,10 @@
</template>
</tabcontrolVue>
<SelectJobs ref="selectJobsModel"></SelectJobs>
<view class="backdoor" @click="loginbackdoor">
<!-- 后门 -->
<!-- <view class="backdoor" @click="loginbackdoor">
<uni-icons type="gift-filled" size="30"></uni-icons>
</view>
</view> -->
</AppLayout>
</template>
@@ -153,6 +154,7 @@ const fromValue = reactive({
onLoad((parmas) => {
getTreeselect();
$api.msg('请完善微简历');
});
onMounted(() => {});
@@ -283,7 +285,7 @@ function loginTest() {
password: 'test',
};
$api.createRequest('/app/login', params, 'post').then((resData) => {
$api.msg('模拟帐号密码测试登录成功');
$api.msg('模拟帐号密码测试登录成功 测试环境使用模拟定位');
loginSetToken(resData.token).then((resume) => {
if (resume.data.jobTitleId) {
// 设置推荐列表,每次退出登录都需要更新

View File

@@ -56,7 +56,7 @@
</view>
<view class="row-right">已认证</view>
</view>
<view class="main-row btn-feel">
<view class="main-row btn-feel" @click="handleItemClick('素质测评')">
<view class="row-left">
<image class="left-img" src="@/static/icon/server2.png"></image>
<text class="left-text">素质测评</text>
@@ -65,7 +65,7 @@
<uni-icons color="#909090" type="right" size="14"></uni-icons>
</view>
</view>
<view class="main-row btn-feel">
<view class="main-row btn-feel" @click="handleItemClick('模拟面试')">
<view class="row-left">
<image class="left-img" src="@/static/icon/server3.png"></image>
<text class="left-text">AI面试</text>
@@ -82,7 +82,7 @@
<view class="row-right">已开启</view>
</view>
</view>
<view class="card-back button-click" @click="logOut">退出登录</view>
<!-- <view class="card-back button-click" @click="logOut">退出登录</view> -->
<uni-popup ref="popup" type="dialog">
<uni-popup-dialog
mode="base"
@@ -107,6 +107,7 @@ import { storeToRefs } from 'pinia';
import Tabbar from '@/components/tabbar/midell-box.vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import FileUploader from '@/utils/FileUploader.js';
import config from '@/config';
const { $api, navTo } = inject('globalFunction');
import useUserStore from '@/stores/useUserStore';
const popup = ref(null);
@@ -137,6 +138,28 @@ function selectFile() {
// });
}
function chooseFileUploadTest(pam) {}
const handleItemClick = (item) => {
switch (item) {
case '素质测评':
lightAppJssdk.navigation.hide({
url: config.Quality_assessment_URL,
});
break;
case '就业指导':
lightAppJssdk.navigation.hide({
url: config.Career_guidance,
});
break;
case '模拟面试':
lightAppJssdk.navigation.hide({
url: config.mock_interview,
});
break;
default:
$api.msg('暂未开放');
}
};
</script>
<style lang="stylus" scoped>

View File

@@ -2,7 +2,12 @@
<view class="container">
<view>
<view class="top">
<image class="btnback button-click" src="@/static/icon/back.png" @click="navBack"></image>
<image
v-if="isMiniProgram"
class="btnback button-click"
src="@/static/icon/back.png"
@click="navBack"
></image>
<view class="search-box">
<uni-icons
class="iconsearch"
@@ -91,6 +96,8 @@ import { useColumnCount } from '@/hook/useColumnCount';
import { usePagination } from '@/hook/usePagination';
import img from '@/static/icon/filter.png';
const { longitudeVal, latitudeVal } = storeToRefs(useLocationStore());
import useUserStore from '@/stores/useUserStore';
const { isMiniProgram } = storeToRefs(useUserStore());
const searchValue = ref('');
const historyList = ref([]);
const listCom = ref([]);
@@ -253,9 +260,10 @@ function getJobList(type = 'add') {
const str = pageState.pageSize * (pageState.page - 1);
const end = listCom.value.length;
const reslist = rows;
listCom.value.splice(str, end, ...reslist);
// listCom.value.splice(str, end, ...reslist);
listCom.value = [...listCom.value, ...reslist];
} else {
listCom.value = rows;
listCom.value = [...rows];
}
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);