Compare commits
10 Commits
e5afbcedb1
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5955959c5 | ||
|
|
16b8ca84cd | ||
|
|
ecfacd13e3 | ||
|
|
9a38bbd298 | ||
|
|
8cf55d3925 | ||
|
|
0dec1618fa | ||
|
|
63d0cdb5ad | ||
|
|
636818361c | ||
|
|
23a2b84b4a | ||
|
|
d84fd90a11 |
22
App.vue
22
App.vue
@@ -2,10 +2,11 @@
|
|||||||
import { reactive, inject, onMounted } from 'vue';
|
import { reactive, inject, onMounted } from 'vue';
|
||||||
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app';
|
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app';
|
||||||
import useUserStore from './stores/useUserStore';
|
import useUserStore from './stores/useUserStore';
|
||||||
|
import usePageAnimation from './hook/usePageAnimation';
|
||||||
import useDictStore from './stores/useDictStore';
|
import useDictStore from './stores/useDictStore';
|
||||||
const { $api, navTo, appendScriptTagElement, aes_Decrypt, sm2_Decrypt } = inject('globalFunction');
|
const { $api, navTo, appendScriptTagElement, aes_Decrypt, sm2_Decrypt } = inject('globalFunction');
|
||||||
import config from '@/config.js';
|
import config from '@/config.js';
|
||||||
|
usePageAnimation();
|
||||||
const appword = 'aKd20dbGdFvmuwrt'; // 固定值
|
const appword = 'aKd20dbGdFvmuwrt'; // 固定值
|
||||||
|
|
||||||
onLaunch((options) => {
|
onLaunch((options) => {
|
||||||
@@ -124,11 +125,22 @@ function loginCallback(userInfo) {
|
|||||||
/*每个页面公共css */
|
/*每个页面公共css */
|
||||||
@import '@/common/animation.css';
|
@import '@/common/animation.css';
|
||||||
@import '@/common/common.css';
|
@import '@/common/common.css';
|
||||||
/* 修改pages tabbar样式 H5有效 */
|
|
||||||
|
/* 修改pages tabbar样式 H5才有效 */
|
||||||
.uni-tabbar .uni-tabbar__item:nth-child(4) .uni-tabbar__bd .uni-tabbar__icon {
|
.uni-tabbar .uni-tabbar__item:nth-child(4) .uni-tabbar__bd .uni-tabbar__icon {
|
||||||
height: 110rpx !important;
|
width: 108rpx !important;
|
||||||
width: 122rpx !important;
|
height: 98rpx !important;
|
||||||
margin-top: 6rpx;
|
margin-top: 0rpx;
|
||||||
|
transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
||||||
|
transform-origin: center center;
|
||||||
|
/* transition: transform 0.15s ease-in-out; */
|
||||||
|
/* transform-origin: center center; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-tabbar .uni-tabbar__item:nth-child(4) .uni-tabbar__bd .uni-tabbar__icon:active {
|
||||||
|
transform: scale(0.8);
|
||||||
|
transition: transform 0.1s ease-out;
|
||||||
|
/* animation: jelly 0.5s; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-tabbar-border {
|
.uni-tabbar-border {
|
||||||
|
|||||||
@@ -190,4 +190,38 @@
|
|||||||
.btn-rubberBand:active {
|
.btn-rubberBand:active {
|
||||||
-webkit-animation-name: tada;
|
-webkit-animation-name: tada;
|
||||||
animation-name: tada
|
animation-name: tada
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes jelly {
|
||||||
|
0% {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
30% {
|
||||||
|
transform: scale(1.25, 0.75);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 压扁 */
|
||||||
|
40% {
|
||||||
|
transform: scale(0.75, 1.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 拉长 */
|
||||||
|
50% {
|
||||||
|
transform: scale(1.15, 0.85);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 稍微压扁 */
|
||||||
|
65% {
|
||||||
|
transform: scale(0.95, 1.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 稍微拉长 */
|
||||||
|
75% {
|
||||||
|
transform: scale(1.05, 0.95);
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -468,4 +468,8 @@ html {
|
|||||||
|
|
||||||
.grayscale {
|
.grayscale {
|
||||||
filter: grayscale(100%) opacity(0.6);
|
filter: grayscale(100%) opacity(0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.height-100 {
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import '@/lib/encryption/sm4.min.js'
|
import '@/lib/encryption/sm4.min.js'
|
||||||
import useUserStore from "../stores/useUserStore";
|
import useUserStore from "../stores/useUserStore";
|
||||||
import {
|
import {
|
||||||
|
createRequestWithCache,
|
||||||
createRequest,
|
createRequest,
|
||||||
uploadFile
|
uploadFile
|
||||||
} from "../utils/request";
|
} from "../utils/request";
|
||||||
@@ -624,6 +625,7 @@ export const $api = {
|
|||||||
sendingMiniProgramMessage,
|
sendingMiniProgramMessage,
|
||||||
copyText,
|
copyText,
|
||||||
aes_Decrypt,
|
aes_Decrypt,
|
||||||
|
createRequestWithCache
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="empty" :style="{ background: bgcolor, marginTop: mrTop + 'rpx' }">
|
<view
|
||||||
|
class="empty"
|
||||||
|
:class="{ 'position-center': isPosition }"
|
||||||
|
:style="{ background: bgcolor, marginTop: mrTop + 'rpx' }"
|
||||||
|
>
|
||||||
<view class="ty_content" :style="{ paddingTop: pdTop + 'rpx' }">
|
<view class="ty_content" :style="{ paddingTop: pdTop + 'rpx' }">
|
||||||
<view class="content_top">
|
<view class="content_top">
|
||||||
<!-- <view class="content_top btn-shaky"> -->
|
<!-- <view class="content_top btn-shaky"> -->
|
||||||
@@ -30,18 +34,23 @@ export default {
|
|||||||
pdTop: {
|
pdTop: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
default: '80',
|
default: '0',
|
||||||
},
|
},
|
||||||
mrTop: {
|
mrTop: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
default: '20',
|
default: '0',
|
||||||
},
|
},
|
||||||
pictrue: {
|
pictrue: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
isPosition: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {},
|
methods: {},
|
||||||
};
|
};
|
||||||
@@ -52,19 +61,33 @@ image {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
.position-center {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
.empty {
|
.empty {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 100vh;
|
height: 100%;
|
||||||
position: relative;
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
// min-height: 100vh;
|
||||||
|
// height: 400rpx;
|
||||||
|
// position: relative;
|
||||||
.ty_content {
|
.ty_content {
|
||||||
position: absolute;
|
|
||||||
left: 50%;
|
|
||||||
top: 0;
|
|
||||||
transform: translate(-50%, 0);
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
// position: absolute;
|
||||||
|
// left: 50%;
|
||||||
|
// top: 0;
|
||||||
|
// transform: translate(-50%, 0);
|
||||||
|
|
||||||
.content_top {
|
.content_top {
|
||||||
width: 450rpx;
|
width: 450rpx;
|
||||||
height: 322rpx;
|
height: 322rpx;
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ function serchforIt(defaultId) {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$api.createRequest('/app/common/jobTitle/treeselect', {}, 'GET').then((resData) => {
|
const LoadCache = (resData) => {
|
||||||
if (userInfo.value.jobTitleId) {
|
if (userInfo.value.jobTitleId) {
|
||||||
const ids = userInfo.value.jobTitleId.split(',').map((id) => Number(id));
|
const ids = userInfo.value.jobTitleId.split(',').map((id) => Number(id));
|
||||||
count.value = ids.length;
|
count.value = ids.length;
|
||||||
@@ -174,7 +174,8 @@ function serchforIt(defaultId) {
|
|||||||
state.jobTitleId = userInfo.value.jobTitleId;
|
state.jobTitleId = userInfo.value.jobTitleId;
|
||||||
state.stations = resData.data;
|
state.stations = resData.data;
|
||||||
state.visible = true;
|
state.visible = true;
|
||||||
});
|
};
|
||||||
|
$api.createRequestWithCache('/app/common/jobTitle/treeselect', {}, 'GET', false, LoadCache).then(LoadCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
const reset = () => {
|
const reset = () => {
|
||||||
|
|||||||
30
hook/page-animation.css
Normal file
30
hook/page-animation.css
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/* #ifdef H5 */
|
||||||
|
uni-page {
|
||||||
|
opacity: 1;
|
||||||
|
will-change: opacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- 进场 (Enter) --- */
|
||||||
|
uni-page.animation-enter-from {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uni-page.animation-enter-active {
|
||||||
|
transition: opacity 0.2s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- 离场 (Leave) --- */
|
||||||
|
uni-page.animation-leave-active {
|
||||||
|
transition: opacity 0.15s ease-in;
|
||||||
|
}
|
||||||
|
|
||||||
|
uni-page.animation-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- 稳态 --- */
|
||||||
|
uni-page.animation-show {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* #endif */
|
||||||
66
hook/usePageAnimation.js
Normal file
66
hook/usePageAnimation.js
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
import {
|
||||||
|
onLaunch
|
||||||
|
} from '@dcloudio/uni-app'
|
||||||
|
import {
|
||||||
|
getCurrentInstance
|
||||||
|
} from 'vue'
|
||||||
|
import './page-animation.css'
|
||||||
|
|
||||||
|
const DURATION = 130
|
||||||
|
|
||||||
|
export default function usePageAnimation() {
|
||||||
|
// #ifdef H5
|
||||||
|
const show = () => {
|
||||||
|
const page = document.querySelector('uni-page')
|
||||||
|
if (!page) return
|
||||||
|
const cl = page.classList
|
||||||
|
|
||||||
|
cl.add('animation-enter-from')
|
||||||
|
cl.remove('animation-leave-to', 'animation-leave-active')
|
||||||
|
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
cl.remove('animation-enter-from')
|
||||||
|
cl.add('animation-enter-active', 'animation-show')
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
cl.remove('animation-enter-active')
|
||||||
|
}, DURATION)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const hide = (next) => {
|
||||||
|
const page = document.querySelector('uni-page')
|
||||||
|
if (!page) {
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const cl = page.classList
|
||||||
|
|
||||||
|
cl.add('animation-leave-active')
|
||||||
|
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
cl.remove('animation-show')
|
||||||
|
cl.add('animation-leave-to')
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
cl.remove('animation-leave-active', 'animation-leave-to')
|
||||||
|
next()
|
||||||
|
}, DURATION - 50)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
onLaunch(() => {
|
||||||
|
const instance = getCurrentInstance()
|
||||||
|
const router = instance?.proxy?.$router
|
||||||
|
if (router) {
|
||||||
|
show()
|
||||||
|
|
||||||
|
router.beforeEach((to, from, next) => hide(next))
|
||||||
|
|
||||||
|
router.afterEach(() => show())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
@@ -18,10 +18,15 @@
|
|||||||
</script>
|
</script>
|
||||||
<title></title>
|
<title></title>
|
||||||
<!-- eruda -->
|
<!-- eruda -->
|
||||||
<script src="https://cdn.jsdelivr.net/npm/eruda"></script>
|
<!-- <script src="https://cdn.jsdelivr.net/npm/eruda"></script>
|
||||||
<script>
|
<script>
|
||||||
eruda.init();
|
eruda.init();
|
||||||
</script>
|
</script> -->
|
||||||
|
<!-- <script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
|
||||||
|
<script>
|
||||||
|
// VConsole 默认会挂载到 `window.VConsole` 上
|
||||||
|
var vConsole = new window.VConsole();
|
||||||
|
</script> -->
|
||||||
<!-- 爱山东jssdk 本sdk存在性能问题 -->
|
<!-- 爱山东jssdk 本sdk存在性能问题 -->
|
||||||
<script type="text/javascript" src="https://isdapp.shandong.gov.cn/jmopen/jssdk/index.js"></script>
|
<script type="text/javascript" src="https://isdapp.shandong.gov.cn/jmopen/jssdk/index.js"></script>
|
||||||
<!-- 只在内网有效 -->
|
<!-- 只在内网有效 -->
|
||||||
|
|||||||
9
main.js
9
main.js
@@ -1,8 +1,12 @@
|
|||||||
import App from '@/App'
|
import App from '@/App'
|
||||||
import * as Pinia from 'pinia'
|
import * as Pinia from 'pinia'
|
||||||
|
import {
|
||||||
|
createUnistorage
|
||||||
|
} from "./uni_modules/pinia-plugin-unistorage";
|
||||||
import globalFunction from '@/common/globalFunction'
|
import globalFunction from '@/common/globalFunction'
|
||||||
import '@/lib/string-similarity.min.js'
|
import '@/lib/string-similarity.min.js'
|
||||||
import similarityJobs from '@/utils/similarity_Job.js';
|
import similarityJobs from '@/utils/similarity_Job.js';
|
||||||
|
|
||||||
// 组件
|
// 组件
|
||||||
import AppLayout from './components/AppLayout/AppLayout.vue';
|
import AppLayout from './components/AppLayout/AppLayout.vue';
|
||||||
import Empty from './components/empty/empty.vue';
|
import Empty from './components/empty/empty.vue';
|
||||||
@@ -65,7 +69,10 @@ export function createApp() {
|
|||||||
app.provide('deviceInfo', globalFunction.getdeviceInfo());
|
app.provide('deviceInfo', globalFunction.getdeviceInfo());
|
||||||
|
|
||||||
app.use(SelectPopupPlugin);
|
app.use(SelectPopupPlugin);
|
||||||
app.use(Pinia.createPinia());
|
|
||||||
|
const store = Pinia.createPinia();
|
||||||
|
store.use(createUnistorage());
|
||||||
|
app.use(store);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
app,
|
app,
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="collection-content">
|
<view class="collection-content">
|
||||||
<renderDeliveryRecord
|
<renderDeliveryRecord
|
||||||
v-if="pageState.list.length"
|
v-if="pageState.list.length"
|
||||||
seeDate="applyTime"
|
seeDate="applyTime"
|
||||||
:list="pageState.list"
|
:list="pageState.list"
|
||||||
:longitude="longitudeVal"
|
:longitude="longitudeVal"
|
||||||
:latitude="latitudeVal">
|
:latitude="latitudeVal"
|
||||||
</renderDeliveryRecord>
|
></renderDeliveryRecord>
|
||||||
<empty v-else pdTop="200"></empty>
|
<empty v-else :is-position="true"></empty>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ function getJobList(type = 'add') {
|
|||||||
current: pageState.page,
|
current: pageState.page,
|
||||||
pageSize: pageState.pageSize,
|
pageSize: pageState.pageSize,
|
||||||
};
|
};
|
||||||
$api.createRequest('/app/user/apply/job', params).then((resData) => {
|
const LoadCache = (resData) => {
|
||||||
const { rows, total } = resData;
|
const { rows, total } = resData;
|
||||||
if (type === 'add') {
|
if (type === 'add') {
|
||||||
const str = pageState.pageSize * (pageState.page - 1);
|
const str = pageState.pageSize * (pageState.page - 1);
|
||||||
@@ -66,8 +66,9 @@ function getJobList(type = 'add') {
|
|||||||
// pageState.list = resData.rows;
|
// pageState.list = resData.rows;
|
||||||
pageState.total = resData.total;
|
pageState.total = resData.total;
|
||||||
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
|
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
|
||||||
console.log(pageState.list);
|
};
|
||||||
});
|
|
||||||
|
$api.createRequestWithCache('/app/user/apply/job', params, 'GET', false, {}, LoadCache).then(LoadCache);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -75,7 +76,8 @@ function getJobList(type = 'add') {
|
|||||||
.collection-content{
|
.collection-content{
|
||||||
padding: 1rpx 28rpx 20rpx 28rpx;
|
padding: 1rpx 28rpx 20rpx 28rpx;
|
||||||
background: #F4F4F4;
|
background: #F4F4F4;
|
||||||
height: 100%
|
height: 100%;
|
||||||
min-height: calc(100vh - var(--window-top) - var(--status-bar-height) - var(--window-bottom));
|
min-height: calc(100vh - var(--window-top) - var(--status-bar-height) - var(--window-bottom));
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
:longitude="longitudeVal"
|
:longitude="longitudeVal"
|
||||||
:latitude="latitudeVal"
|
:latitude="latitudeVal"
|
||||||
></renderJobs>
|
></renderJobs>
|
||||||
<empty v-else pdTop="200"></empty>
|
<empty v-else :is-position="true"></empty>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
@@ -93,10 +93,10 @@ const pageOptions = ref({});
|
|||||||
const dataType = ref(1); // 1: 原数据, 2: 第三方数据
|
const dataType = ref(1); // 1: 原数据, 2: 第三方数据
|
||||||
|
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
console.log(options);
|
// console.log(options);
|
||||||
dataType.value = options.dataType ? parseInt(options.dataType) : 1;
|
dataType.value = options.dataType ? parseInt(options.dataType) : 1;
|
||||||
pageOptions.value = options;
|
pageOptions.value = options;
|
||||||
|
|
||||||
if (dataType.value === 2) {
|
if (dataType.value === 2) {
|
||||||
// 第三方数据
|
// 第三方数据
|
||||||
getCompanyInfo(options.companyId, options.zphId);
|
getCompanyInfo(options.companyId, options.zphId);
|
||||||
@@ -145,13 +145,13 @@ function getCompanyInfo(...args) {
|
|||||||
if (dataType.value === 2) {
|
if (dataType.value === 2) {
|
||||||
// 第三方数据接口
|
// 第三方数据接口
|
||||||
const [companyId, zphId] = args;
|
const [companyId, zphId] = args;
|
||||||
$api.createRequest(`/app/internal/companyThirdPart/${companyId}/${zphId}`).then((resData) => {
|
$api.createRequest(`/app/internal/companyThirdPart/${companyId}/${zphId}`, {}, 'GET', true).then((resData) => {
|
||||||
companyInfo.value = resData.data;
|
companyInfo.value = resData.data;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 原数据接口
|
// 原数据接口
|
||||||
const [companyId] = args;
|
const [companyId] = args;
|
||||||
$api.createRequest(`/app/company/${companyId}`).then((resData) => {
|
$api.createRequest(`/app/company/${companyId}`, {}, 'GET', true).then((resData) => {
|
||||||
companyInfo.value = resData.data;
|
companyInfo.value = resData.data;
|
||||||
getJobsList();
|
getJobsList();
|
||||||
});
|
});
|
||||||
@@ -170,7 +170,7 @@ function getJobsList(type = 'add') {
|
|||||||
|
|
||||||
function getThirdPartyJobsList(type = 'add') {
|
function getThirdPartyJobsList(type = 'add') {
|
||||||
const { companyId, companyName, zphId } = pageOptions.value;
|
const { companyId, companyName, zphId } = pageOptions.value;
|
||||||
|
|
||||||
if (type === 'refresh') {
|
if (type === 'refresh') {
|
||||||
pageState.current = 1;
|
pageState.current = 1;
|
||||||
pageState.maxPage = 1;
|
pageState.maxPage = 1;
|
||||||
@@ -178,13 +178,18 @@ function getThirdPartyJobsList(type = 'add') {
|
|||||||
if (type === 'add' && pageState.current < pageState.maxPage) {
|
if (type === 'add' && pageState.current < pageState.maxPage) {
|
||||||
pageState.current += 1;
|
pageState.current += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
let params = {
|
let params = {
|
||||||
current: pageState.current,
|
current: pageState.current,
|
||||||
pageSize: pageState.pageSize,
|
pageSize: pageState.pageSize,
|
||||||
};
|
};
|
||||||
|
|
||||||
$api.createRequest(`/app/internal/jobThirdPart?gsID=${companyId}&gsmc=${companyName}&zphID=${zphId}`, params).then((resData) => {
|
$api.createRequest(
|
||||||
|
`/app/internal/jobThirdPart?gsID=${companyId}&gsmc=${companyName}&zphID=${zphId}`,
|
||||||
|
params,
|
||||||
|
'GET',
|
||||||
|
true
|
||||||
|
).then((resData) => {
|
||||||
const { rows, total } = resData;
|
const { rows, total } = resData;
|
||||||
handleJobsListResponse(type, rows, total, 'current');
|
handleJobsListResponse(type, rows, total, 'current');
|
||||||
});
|
});
|
||||||
@@ -198,13 +203,13 @@ function getOriginalJobsList(type = 'add') {
|
|||||||
if (type === 'add' && pageState.page < pageState.maxPage) {
|
if (type === 'add' && pageState.page < pageState.maxPage) {
|
||||||
pageState.page += 1;
|
pageState.page += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
let params = {
|
let params = {
|
||||||
current: pageState.page,
|
current: pageState.page,
|
||||||
pageSize: pageState.pageSize,
|
pageSize: pageState.pageSize,
|
||||||
};
|
};
|
||||||
|
|
||||||
$api.createRequest(`/app/company/job/${companyInfo.value.companyId}`, params).then((resData) => {
|
$api.createRequest(`/app/company/job/${companyInfo.value.companyId}`, params, 'GET', true).then((resData) => {
|
||||||
const { rows, total } = resData;
|
const { rows, total } = resData;
|
||||||
handleJobsListResponse(type, rows, total, 'page');
|
handleJobsListResponse(type, rows, total, 'page');
|
||||||
});
|
});
|
||||||
@@ -322,6 +327,8 @@ image {
|
|||||||
background: #F4F4F4;
|
background: #F4F4F4;
|
||||||
.views{
|
.views{
|
||||||
padding: 28rpx
|
padding: 28rpx
|
||||||
|
min-height: calc(100% - 56rpx)
|
||||||
|
position: relative
|
||||||
.Detail-title{
|
.Detail-title{
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
@@ -402,4 +409,4 @@ image {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -176,12 +176,13 @@ function complete(values) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getTree() {
|
function getTree() {
|
||||||
$api.createRequest('/app/common/jobTitle/treeselect', {}, 'GET').then((resData) => {
|
const LoadCache = (resData) => {
|
||||||
if (resData.code === 200) {
|
if (resData.code === 200) {
|
||||||
dataSource.value = flattenTree(resData.data);
|
dataSource.value = flattenTree(resData.data);
|
||||||
treeDataList.value = resData.data;
|
treeDataList.value = resData.data;
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
$api.createRequestWithCache('/app/common/jobTitle/treeselect', {}, 'GET', false, LoadCache).then(LoadCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
function flattenTree(treeData, parentPath = '') {
|
function flattenTree(treeData, parentPath = '') {
|
||||||
|
|||||||
@@ -24,15 +24,14 @@
|
|||||||
</view>
|
</view>
|
||||||
<scroll-view scroll-y class="main-scroll" @scrolltolower="getJobList('add')">
|
<scroll-view scroll-y class="main-scroll" @scrolltolower="getJobList('add')">
|
||||||
<view class="one-cards">
|
<view class="one-cards">
|
||||||
<renderJobViewRecord
|
<renderJobViewRecord
|
||||||
:list="pageState.list"
|
:list="pageState.list"
|
||||||
v-if="pageState.list.length"
|
v-if="pageState.list.length"
|
||||||
:longitude="longitudeVal"
|
:longitude="longitudeVal"
|
||||||
:latitude="latitudeVal"
|
:latitude="latitudeVal"
|
||||||
></renderJobViewRecord>
|
></renderJobViewRecord>
|
||||||
<empty v-else pdTop="200"></empty>
|
<empty v-else></empty>
|
||||||
<!-- <loadmore ref="loadmoreRef"></loadmore> -->
|
<!-- <loadmore ref="loadmoreRef"></loadmore> -->
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
@@ -87,8 +86,6 @@ function toSelectDate() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function searchCollection(e) {
|
function searchCollection(e) {
|
||||||
const value = e.detail.value;
|
const value = e.detail.value;
|
||||||
pageState.search.jobTitle = value;
|
pageState.search.jobTitle = value;
|
||||||
@@ -167,9 +164,12 @@ image {
|
|||||||
.collection-content
|
.collection-content
|
||||||
height: 100%
|
height: 100%
|
||||||
display: flex
|
display: flex
|
||||||
flex-direction: column
|
flex-direction: column;
|
||||||
|
background: #f4f4f4
|
||||||
|
|
||||||
.collection-search
|
.collection-search
|
||||||
padding: 10rpx 20rpx;
|
padding: 10rpx 20rpx;
|
||||||
|
background: #FFFFFF;
|
||||||
|
|
||||||
.search-content
|
.search-content
|
||||||
position: relative
|
position: relative
|
||||||
@@ -216,6 +216,6 @@ image {
|
|||||||
.one-cards{
|
.one-cards{
|
||||||
padding: 0 20rpx 20rpx 20rpx;
|
padding: 0 20rpx 20rpx 20rpx;
|
||||||
background: #f4f4f4
|
background: #f4f4f4
|
||||||
|
height: 100%
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -50,10 +50,11 @@ function delCollectionCard(item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getPremiumList() {
|
function getPremiumList() {
|
||||||
$api.createRequest('/app/company/card').then((resData) => {
|
const LoadCache = (resData) => {
|
||||||
const { rows, total } = resData;
|
const { rows, total } = resData;
|
||||||
list.value = rows;
|
list.value = rows;
|
||||||
});
|
};
|
||||||
|
$api.createRequestWithCache('/app/company/card', {}, 'GET', false, {}, LoadCache).then(LoadCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
function seeDetail(item) {
|
function seeDetail(item) {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
:longitude="longitudeVal"
|
:longitude="longitudeVal"
|
||||||
:latitude="latitudeVal"
|
:latitude="latitudeVal"
|
||||||
></renderCompanys>
|
></renderCompanys>
|
||||||
<empty v-else pdTop="200"></empty>
|
<empty v-else is-position></empty>
|
||||||
</view>
|
</view>
|
||||||
</AppLayout>
|
</AppLayout>
|
||||||
</template>
|
</template>
|
||||||
@@ -151,6 +151,8 @@ image {
|
|||||||
}
|
}
|
||||||
.main-list{
|
.main-list{
|
||||||
background-color: #F4F4F4;
|
background-color: #F4F4F4;
|
||||||
padding: 1rpx 28rpx 28rpx 28rpx
|
padding: 1rpx 28rpx 28rpx 28rpx;
|
||||||
|
min-height: calc(100% - 29rpx);
|
||||||
|
position: relative
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
:longitude="longitudeVal"
|
:longitude="longitudeVal"
|
||||||
:latitude="latitudeVal"
|
:latitude="latitudeVal"
|
||||||
></renderJobCollectionRecord>
|
></renderJobCollectionRecord>
|
||||||
<empty v-else pdTop="200"></empty>
|
<empty v-else></empty>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
:longitude="longitudeVal"
|
:longitude="longitudeVal"
|
||||||
:latitude="latitudeVal"
|
:latitude="latitudeVal"
|
||||||
></renderCompanyCollectionRecord>
|
></renderCompanyCollectionRecord>
|
||||||
<empty v-else pdTop="200"></empty>
|
<empty v-else></empty>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
@@ -178,7 +178,8 @@ function getJobList(type = 'add') {
|
|||||||
current: pageState.page,
|
current: pageState.page,
|
||||||
pageSize: pageState.pageSize,
|
pageSize: pageState.pageSize,
|
||||||
};
|
};
|
||||||
$api.createRequest('/app/user/collection/job', params).then((resData) => {
|
const LoadCache = (resData) => {
|
||||||
|
console.log(resData);
|
||||||
const { rows, total } = resData;
|
const { rows, total } = resData;
|
||||||
if (type === 'add') {
|
if (type === 'add') {
|
||||||
const str = pageState.pageSize * (pageState.page - 1);
|
const str = pageState.pageSize * (pageState.page - 1);
|
||||||
@@ -191,7 +192,8 @@ function getJobList(type = 'add') {
|
|||||||
// pageState.list = resData.rows;
|
// pageState.list = resData.rows;
|
||||||
pageState.total = resData.total;
|
pageState.total = resData.total;
|
||||||
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
|
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
|
||||||
});
|
};
|
||||||
|
$api.createRequestWithCache('/app/user/collection/job', params, 'GET', false, {}, LoadCache).then(LoadCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCompanyList(type = 'add') {
|
function getCompanyList(type = 'add') {
|
||||||
@@ -206,7 +208,7 @@ function getCompanyList(type = 'add') {
|
|||||||
current: pageCompanyState.page,
|
current: pageCompanyState.page,
|
||||||
pageSize: pageCompanyState.pageSize,
|
pageSize: pageCompanyState.pageSize,
|
||||||
};
|
};
|
||||||
$api.createRequest('/app/user/collection/company', params).then((resData) => {
|
const LoadCache = (resData) => {
|
||||||
const { rows, total } = resData;
|
const { rows, total } = resData;
|
||||||
if (type === 'add') {
|
if (type === 'add') {
|
||||||
const str = pageCompanyState.pageSize * (pageCompanyState.page - 1);
|
const str = pageCompanyState.pageSize * (pageCompanyState.page - 1);
|
||||||
@@ -219,7 +221,8 @@ function getCompanyList(type = 'add') {
|
|||||||
// pageCompanyState.list = resData.rows;
|
// pageCompanyState.list = resData.rows;
|
||||||
pageCompanyState.total = resData.total;
|
pageCompanyState.total = resData.total;
|
||||||
pageCompanyState.maxPage = Math.ceil(pageCompanyState.total / pageCompanyState.pageSize);
|
pageCompanyState.maxPage = Math.ceil(pageCompanyState.total / pageCompanyState.pageSize);
|
||||||
});
|
};
|
||||||
|
$api.createRequestWithCache('/app/user/collection/company', params, 'GET', false, {}, LoadCache).then(LoadCache);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -262,6 +265,7 @@ function getCompanyList(type = 'add') {
|
|||||||
.swiper{
|
.swiper{
|
||||||
height: 100%
|
height: 100%
|
||||||
.mian{
|
.mian{
|
||||||
|
height: 100%
|
||||||
padding: 0 28rpx 28rpx 28rpx
|
padding: 0 28rpx 28rpx 28rpx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
:longitude="longitudeVal"
|
:longitude="longitudeVal"
|
||||||
:latitude="latitudeVal"
|
:latitude="latitudeVal"
|
||||||
></renderCompanysOutData>
|
></renderCompanysOutData>
|
||||||
<empty v-else pdTop="200"></empty>
|
<empty v-else is-position></empty>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
@@ -134,7 +134,7 @@ onLoad((options) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function getJobFairInfo(id, name) {
|
function getJobFairInfo(id, name) {
|
||||||
$api.createRequest(`/app/internal/jobFairThirdPart/${id}`).then((resData) => {
|
$api.createRequest(`/app/internal/jobFairThirdPart/${id}`, {}, 'GET', true).then((resData) => {
|
||||||
fairInfo.value = resData.data;
|
fairInfo.value = resData.data;
|
||||||
hasAppointment();
|
hasAppointment();
|
||||||
});
|
});
|
||||||
@@ -152,21 +152,24 @@ function getCompanyList(type = 'add') {
|
|||||||
current: pageState.current,
|
current: pageState.current,
|
||||||
pageSize: pageState.pageSize,
|
pageSize: pageState.pageSize,
|
||||||
};
|
};
|
||||||
$api.createRequest(`/app/internal/companyThirdPart/?zphID=${jobFairId}&zphmc=${jobFairName}`, params).then(
|
$api.createRequest(
|
||||||
(resData) => {
|
`/app/internal/companyThirdPart/?zphID=${jobFairId}&zphmc=${jobFairName}`,
|
||||||
const { rows, total } = resData;
|
params,
|
||||||
if (type === 'add') {
|
'GET',
|
||||||
const str = pageState.pageSize * (pageState.current - 1);
|
true
|
||||||
const end = pageState.list.length;
|
).then((resData) => {
|
||||||
const reslist = rows;
|
const { rows, total } = resData;
|
||||||
pageState.list.splice(str, end, ...reslist);
|
if (type === 'add') {
|
||||||
} else {
|
const str = pageState.pageSize * (pageState.current - 1);
|
||||||
pageState.list = rows;
|
const end = pageState.list.length;
|
||||||
}
|
const reslist = rows;
|
||||||
pageState.total = resData.total;
|
pageState.list.splice(str, end, ...reslist);
|
||||||
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
|
} else {
|
||||||
|
pageState.list = rows;
|
||||||
}
|
}
|
||||||
);
|
pageState.total = resData.total;
|
||||||
|
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasAppointment = () => {
|
const hasAppointment = () => {
|
||||||
@@ -433,6 +436,8 @@ image {
|
|||||||
background: #F4F4F4;
|
background: #F4F4F4;
|
||||||
.views{
|
.views{
|
||||||
padding: 28rpx
|
padding: 28rpx
|
||||||
|
min-height: calc(100% - 56rpx);
|
||||||
|
position: relative
|
||||||
.Detail-title{
|
.Detail-title{
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
|
|||||||
@@ -24,12 +24,11 @@
|
|||||||
<scroll-view class="scroll-view" scroll-y @scrolltolower="scrollBottom">
|
<scroll-view class="scroll-view" scroll-y @scrolltolower="scrollBottom">
|
||||||
<view class="list">
|
<view class="list">
|
||||||
<renderJobs
|
<renderJobs
|
||||||
:list="pageState.list"
|
|
||||||
v-if="pageState.list.length"
|
v-if="pageState.list.length"
|
||||||
:longitude="longitudeVal"
|
:longitude="longitudeVal"
|
||||||
:latitude="latitudeVal"
|
:latitude="latitudeVal"
|
||||||
></renderJobs>
|
></renderJobs>
|
||||||
<empty v-else pdTop="200"></empty>
|
<empty v-else></empty>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
@@ -140,6 +139,7 @@ function getList(type = 'add', loading = true) {
|
|||||||
height: 100%
|
height: 100%
|
||||||
.list{
|
.list{
|
||||||
padding: 0 28rpx 28rpx 28rpx
|
padding: 0 28rpx 28rpx 28rpx
|
||||||
|
height: calc(100% - 28rpx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<image src="@/static/icon/collect2.png" v-else @click="jobCollection"></image>
|
<image src="@/static/icon/collect2.png" v-else @click="jobCollection"></image>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 根据 dataType 显示不同内容 -->
|
<!-- 根据 dataType 显示不同内容 -->
|
||||||
<view class="content" v-show="!isEmptyObject(jobInfo)">
|
<view class="content" v-show="!isEmptyObject(jobInfo)">
|
||||||
<!-- 顶部信息区域 -->
|
<!-- 顶部信息区域 -->
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
:is-month="true"
|
:is-month="true"
|
||||||
></Salary-Expectation>
|
></Salary-Expectation>
|
||||||
</view>
|
</view>
|
||||||
<view class="top-salary" v-else>
|
<view class="top-salary" v-else>
|
||||||
<Salary-Expectation
|
<Salary-Expectation
|
||||||
:max-salary="jobInfo.maxSalary"
|
:max-salary="jobInfo.maxSalary"
|
||||||
:min-salary="jobInfo.minSalary"
|
:min-salary="jobInfo.minSalary"
|
||||||
@@ -35,17 +35,17 @@
|
|||||||
<view class="info-img"><image src="/static/icon/post12.png"></image></view>
|
<view class="info-img"><image src="/static/icon/post12.png"></image></view>
|
||||||
<!-- 第三方数据展示 -->
|
<!-- 第三方数据展示 -->
|
||||||
<view class="info-text" v-if="dataType === 2">
|
<view class="info-text" v-if="dataType === 2">
|
||||||
{{jobInfo.xlyq == '不限' ? '学历不限' : jobInfo.xlyq}}
|
{{ jobInfo.xlyq == '不限' ? '学历不限' : jobInfo.xlyq }}
|
||||||
</view>
|
</view>
|
||||||
<!-- 原数据展示 -->
|
<!-- 原数据展示 -->
|
||||||
<view class="info-text" v-else>
|
<view class="info-text" v-else>
|
||||||
<dict-Label dictType="experience" :value="jobInfo.experience"></dict-Label>
|
<dict-Label dictType="experience" :value="jobInfo.experience"></dict-Label>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="info-img mar_le20"><image src="/static/icon/post13.png"></image></view>
|
<view class="info-img mar_le20"><image src="/static/icon/post13.png"></image></view>
|
||||||
<!-- 第三方数据展示 -->
|
<!-- 第三方数据展示 -->
|
||||||
<view class="info-text" v-if="dataType === 2">
|
<view class="info-text" v-if="dataType === 2">
|
||||||
{{jobInfo.gwgzjy == '不限' ? '经验不限' : jobInfo.gwgzjy}}
|
{{ jobInfo.gwgzjy == '不限' ? '经验不限' : jobInfo.gwgzjy }}
|
||||||
</view>
|
</view>
|
||||||
<!-- 原数据展示 -->
|
<!-- 原数据展示 -->
|
||||||
<view class="info-text" v-else>
|
<view class="info-text" v-else>
|
||||||
@@ -83,12 +83,7 @@
|
|||||||
<view class="content-card">
|
<view class="content-card">
|
||||||
<view class="card-title">
|
<view class="card-title">
|
||||||
<text class="title">公司信息</text>
|
<text class="title">公司信息</text>
|
||||||
<text
|
<text class="btntext button-click" @click="handleCompanyDetail">单位详情</text>
|
||||||
class="btntext button-click"
|
|
||||||
@click="handleCompanyDetail"
|
|
||||||
>
|
|
||||||
单位详情
|
|
||||||
</text>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="company-info">
|
<view class="company-info">
|
||||||
<view class="companyinfo-left">
|
<view class="companyinfo-left">
|
||||||
@@ -103,12 +98,12 @@
|
|||||||
:value="jobInfo.company?.industry"
|
:value="jobInfo.company?.industry"
|
||||||
></dict-tree-Label>
|
></dict-tree-Label>
|
||||||
<span v-if="dataType !== 2 && jobInfo.company?.industry"> </span>
|
<span v-if="dataType !== 2 && jobInfo.company?.industry"> </span>
|
||||||
<dict-Label
|
<dict-Label
|
||||||
v-if="dataType !== 2"
|
v-if="dataType !== 2"
|
||||||
dictType="scale"
|
dictType="scale"
|
||||||
:value="jobInfo.company?.scale"
|
:value="jobInfo.company?.scale"
|
||||||
></dict-Label>
|
></dict-Label>
|
||||||
<span v-if="dataType === 2">{{jobInfo.qyxz}}</span>
|
<span v-if="dataType === 2">{{ jobInfo.qyxz }}</span>
|
||||||
</view>
|
</view>
|
||||||
<view class="row2">
|
<view class="row2">
|
||||||
<text>在招</text>
|
<text>在招</text>
|
||||||
@@ -156,19 +151,24 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view style="height: 24px"></view>
|
<view style="height: 24px"></view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<view class="footer">
|
<view class="footer">
|
||||||
<view v-if="dataType==2" class="btn-wq button-click" :class="{'btn-des' : jobInfo.isApply}" @click="jobApply">
|
<view
|
||||||
<span v-if="jobInfo.isApply"> 已投递 </span>
|
v-if="dataType == 2"
|
||||||
<span v-if="!jobInfo.isApply"> 立即投递</span>
|
class="btn-wq button-click"
|
||||||
|
:class="{ 'btn-des': jobInfo.isApply }"
|
||||||
|
@click="jobApply"
|
||||||
|
>
|
||||||
|
<span v-if="jobInfo.isApply">已投递</span>
|
||||||
|
<span v-if="!jobInfo.isApply">立即投递</span>
|
||||||
</view>
|
</view>
|
||||||
<view v-else class="btn-wq button-click" @click="jobApply">
|
<view v-else class="btn-wq button-click" @click="jobApply">
|
||||||
<span v-if="jobInfo.isApply"> 立即前往</span>
|
<span v-if="jobInfo.isApply">立即前往</span>
|
||||||
<span v-if="!jobInfo.isApply">立即投递 </span>
|
<span v-if="!jobInfo.isApply">立即投递</span>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -232,12 +232,12 @@ function getDetail(jobId) {
|
|||||||
if (dataType.value === 2) {
|
if (dataType.value === 2) {
|
||||||
// 第三方数据接口
|
// 第三方数据接口
|
||||||
return new Promise((reslove, reject) => {
|
return new Promise((reslove, reject) => {
|
||||||
$api.createRequest(`/app/internal/jobThirdPart/${jobId}`).then((resData) => {
|
$api.createRequest(`/app/internal/jobThirdPart/${jobId}`, {}, 'GET', true).then((resData) => {
|
||||||
const { gsID, gsmc, zphID } = resData.data;
|
const { gsID, gsmc, zphID } = resData.data;
|
||||||
jobInfo.value = resData.data;
|
jobInfo.value = resData.data;
|
||||||
reslove(resData.data);
|
reslove(resData.data);
|
||||||
getCompanyIsAJobs(gsID, gsmc, zphID);
|
getCompanyIsAJobs(gsID, gsmc, zphID);
|
||||||
|
|
||||||
if (resData.data.latitude && resData.data.longitude) {
|
if (resData.data.latitude && resData.data.longitude) {
|
||||||
initMapCovers(resData.data.latitude, resData.data.longitude, resData.data.gsmc);
|
initMapCovers(resData.data.latitude, resData.data.longitude, resData.data.gsmc);
|
||||||
}
|
}
|
||||||
@@ -245,12 +245,12 @@ function getDetail(jobId) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 原数据接口
|
// 原数据接口
|
||||||
$api.createRequest(`/app/job/${jobId}`).then((resData) => {
|
$api.createRequest(`/app/job/${jobId}`, {}, 'GET', true).then((resData) => {
|
||||||
const { latitude, longitude, companyName, companyId } = resData.data;
|
const { latitude, longitude, companyName, companyId } = resData.data;
|
||||||
jobInfo.value = resData.data;
|
jobInfo.value = resData.data;
|
||||||
getCompanyIsAJobs(companyId);
|
getCompanyIsAJobs(companyId);
|
||||||
getCompetivetuveness(jobId);
|
getCompetivetuveness(jobId);
|
||||||
|
|
||||||
if (latitude && longitude) {
|
if (latitude && longitude) {
|
||||||
initMapCovers(latitude, longitude, companyName);
|
initMapCovers(latitude, longitude, companyName);
|
||||||
}
|
}
|
||||||
@@ -315,12 +315,12 @@ function jobApply() {
|
|||||||
if (dataType.value === 2) {
|
if (dataType.value === 2) {
|
||||||
// 第三方数据申请逻辑
|
// 第三方数据申请逻辑
|
||||||
const params = {
|
const params = {
|
||||||
jobid:jobInfo.value.id,
|
jobid: jobInfo.value.id,
|
||||||
jobname:jobInfo.value.gwmc
|
jobname: jobInfo.value.gwmc,
|
||||||
}
|
};
|
||||||
if (jobInfo.value.isApply) {
|
if (jobInfo.value.isApply) {
|
||||||
$api.msg('已经投递过该岗位了~');
|
$api.msg('已经投递过该岗位了~');
|
||||||
return ;
|
return;
|
||||||
} else {
|
} else {
|
||||||
$api.createRequest(`/app/internal/sendResume`, params, 'POST').then((resData) => {
|
$api.createRequest(`/app/internal/sendResume`, params, 'POST').then((resData) => {
|
||||||
$api.msg('投递成功');
|
$api.msg('投递成功');
|
||||||
@@ -380,7 +380,9 @@ function jobCollection() {
|
|||||||
// 处理公司详情跳转
|
// 处理公司详情跳转
|
||||||
function handleCompanyDetail() {
|
function handleCompanyDetail() {
|
||||||
if (dataType.value === 2) {
|
if (dataType.value === 2) {
|
||||||
navTo(`/packageA/pages/UnitDetails/UnitDetails?companyId=${jobInfo.value.gsID}&companyName=${jobInfo.value.gsmc}&zphId=${jobInfo.value.zphID}&dataType=2`);
|
navTo(
|
||||||
|
`/packageA/pages/UnitDetails/UnitDetails?companyId=${jobInfo.value.gsID}&companyName=${jobInfo.value.gsmc}&zphId=${jobInfo.value.zphID}&dataType=2`
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
navTo(`/packageA/pages/UnitDetails/UnitDetails?companyId=${jobInfo.value.company.companyId}`);
|
navTo(`/packageA/pages/UnitDetails/UnitDetails?companyId=${jobInfo.value.company.companyId}`);
|
||||||
}
|
}
|
||||||
@@ -660,4 +662,4 @@ for i in 0..100
|
|||||||
box-shadow: 0rpx -4rpx 24rpx 0rpx rgba(11,44,112,0.12);
|
box-shadow: 0rpx -4rpx 24rpx 0rpx rgba(11,44,112,0.12);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -12,10 +12,19 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="main">
|
<view class="main">
|
||||||
<scroll-view scroll-y>
|
<scroll-view class="height-100" scroll-y>
|
||||||
<view v-if="pageState.list.length">
|
<view>
|
||||||
<view class="card" v-for="(item, index) in pageState.list" :key="index">
|
<view class="card" v-for="(item, index) in pageState.list" :key="index">
|
||||||
<view @click="navTo('/packageA/pages/exhibitors/exhibitors?jobFairId=' + item.zphID + '&jobFairName=' + item.zphmc)">
|
<view
|
||||||
|
@click="
|
||||||
|
navTo(
|
||||||
|
'/packageA/pages/exhibitors/exhibitors?jobFairId=' +
|
||||||
|
item.zphID +
|
||||||
|
'&jobFairName=' +
|
||||||
|
item.zphmc
|
||||||
|
)
|
||||||
|
"
|
||||||
|
>
|
||||||
<view class="card-row">
|
<view class="card-row">
|
||||||
<Countdown :startTime="item.zphjbsj" :endTime="item.zphjzsj" />
|
<Countdown :startTime="item.zphjbsj" :endTime="item.zphjzsj" />
|
||||||
</view>
|
</view>
|
||||||
@@ -37,7 +46,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<empty v-else pdTop="200"></empty>
|
<empty v-if="!pageState.list.length"></empty>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -72,7 +81,7 @@ const ranOptions = ref([
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
function isTimePassed(timeStr) {
|
function isTimePassed(timeStr) {
|
||||||
if(!timeStr) return false
|
if (!timeStr) return false;
|
||||||
const targetTime = new Date(timeStr.replace(/-/g, '/')).getTime(); // 兼容格式
|
const targetTime = new Date(timeStr.replace(/-/g, '/')).getTime(); // 兼容格式
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
return now < targetTime;
|
return now < targetTime;
|
||||||
@@ -95,16 +104,14 @@ function updateCancel(item) {
|
|||||||
content: '确定要取消预约吗?',
|
content: '确定要取消预约吗?',
|
||||||
showCancel: true,
|
showCancel: true,
|
||||||
success: ({ confirm, cancel }) => {
|
success: ({ confirm, cancel }) => {
|
||||||
if(confirm){
|
if (confirm) {
|
||||||
$api.createRequest(`/app/fair/collection/${fairId}`, {}, 'DELETE').then((resData) => {
|
$api.createRequest(`/app/fair/collection/${fairId}`, {}, 'DELETE').then((resData) => {
|
||||||
getList('refresh');
|
getList('refresh');
|
||||||
$api.msg('取消预约成功');
|
$api.msg('取消预约成功');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getList(type = 'add', loading = true) {
|
function getList(type = 'add', loading = true) {
|
||||||
@@ -120,7 +127,7 @@ function getList(type = 'add', loading = true) {
|
|||||||
pageSize: pageState.pageSize,
|
pageSize: pageState.pageSize,
|
||||||
type: ranItem.value.value,
|
type: ranItem.value.value,
|
||||||
};
|
};
|
||||||
$api.createRequest('/app/user/collection/fair', params).then((resData) => {
|
const LoadCache = (resData) => {
|
||||||
const { rows, total } = resData;
|
const { rows, total } = resData;
|
||||||
if (type === 'add') {
|
if (type === 'add') {
|
||||||
const str = pageState.pageSize * (pageState.page - 1);
|
const str = pageState.pageSize * (pageState.page - 1);
|
||||||
@@ -133,7 +140,8 @@ function getList(type = 'add', loading = true) {
|
|||||||
// pageState.list = resData.rows;
|
// pageState.list = resData.rows;
|
||||||
pageState.total = resData.total;
|
pageState.total = resData.total;
|
||||||
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
|
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
|
||||||
});
|
};
|
||||||
|
$api.createRequestWithCache('/app/user/collection/fair', params, 'GET', false, {}, LoadCache).then(LoadCache);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -178,7 +186,7 @@ function getList(type = 'add', loading = true) {
|
|||||||
display: flex
|
display: flex
|
||||||
align-items: center
|
align-items: center
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
.card-Title{
|
.card-Title{
|
||||||
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
|
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<view
|
<view
|
||||||
class="item button-click"
|
class="item button-click"
|
||||||
:class="{
|
:class="{
|
||||||
optional:hasZphInData(item),
|
optional: item.isThisMonth && hasZphInData(item),
|
||||||
noOptional: !item.isThisMonth,
|
noOptional: !item.isThisMonth,
|
||||||
active: current.date === item.date && item.isThisMonth,
|
active: current.date === item.date && item.isThisMonth,
|
||||||
}"
|
}"
|
||||||
@@ -60,10 +60,9 @@ const pages = reactive({
|
|||||||
month: 0,
|
month: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
const hasZphDateArray = ref([])
|
const hasZphDateArray = ref([]);
|
||||||
|
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
updateDateArray()
|
|
||||||
if (options.date) {
|
if (options.date) {
|
||||||
current.value = {
|
current.value = {
|
||||||
date: options?.date || null,
|
date: options?.date || null,
|
||||||
@@ -81,20 +80,30 @@ onLoad((options) => {
|
|||||||
addMonth();
|
addMonth();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (options.entrance === 'careerfair') {
|
||||||
|
updateDateArray();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function hasZphInData(item) {
|
function hasZphInData(item) {
|
||||||
return hasZphDateArray.value.some(date=>date == item.date)
|
if (!item || typeof item.date !== 'string') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dateArray = Array.isArray(hasZphDateArray.value) ? hasZphDateArray.value : [];
|
||||||
|
|
||||||
|
return dateArray.some((date) => {
|
||||||
|
return typeof date === 'string' && date === item.date;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateDateArray() {
|
async function updateDateArray() {
|
||||||
if(localStorage.getItem('hasZphDateArray')) hasZphDateArray.value = localStorage.getItem('hasZphDateArray')
|
const LoadCache = (resData) => {
|
||||||
|
if (resData.code === 200) {
|
||||||
let res = await $api.createRequest('/app/internal/getDateList', {}, 'get')
|
hasZphDateArray.value = resData.data;
|
||||||
if(res.data){
|
}
|
||||||
hasZphDateArray.value = res.data
|
};
|
||||||
localStorage.setItem('hasZphDateArray',res.data)
|
$api.createRequestWithCache('/app/internal/getDateList', {}, 'GET', false, {}, LoadCache).then(LoadCache);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function backParams() {
|
function backParams() {
|
||||||
|
|||||||
@@ -227,8 +227,8 @@
|
|||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
"tabBar": {
|
"tabBar": {
|
||||||
"custom": true,
|
// "custom": true,
|
||||||
"display": "none",
|
// "display": "none",
|
||||||
"color": "#5E5F60",
|
"color": "#5E5F60",
|
||||||
"selectedColor": "#256BFA",
|
"selectedColor": "#256BFA",
|
||||||
"borderStyle": "black",
|
"borderStyle": "black",
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
<!-- 主体内容区域 -->
|
<!-- 主体内容区域 -->
|
||||||
<view class="container-main">
|
<view class="container-main">
|
||||||
<scroll-view scroll-y class="main-scroll" @scrolltolower="handleScrollToLower">
|
<scroll-view scroll-y class="main-scroll" @scrolltolower="handleScrollToLower">
|
||||||
<view class="cards" v-if="fairList.length">
|
<view class="cards">
|
||||||
<view
|
<view
|
||||||
class="card press-button"
|
class="card press-button"
|
||||||
v-for="(item, index) in fairList"
|
v-for="(item, index) in fairList"
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
<view class="card-footer">内容简介:{{ item.zphjj }}</view>
|
<view class="card-footer">内容简介:{{ item.zphjj }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<empty v-else pdTop="200"></empty>
|
<empty v-if="!fairList.length" pdTop="200"></empty>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
<Tabbar :currentpage="1"></Tabbar>
|
<Tabbar :currentpage="1"></Tabbar>
|
||||||
@@ -122,7 +122,7 @@ onLoad(() => {
|
|||||||
startDate: currentDate,
|
startDate: currentDate,
|
||||||
});
|
});
|
||||||
weekList.value = result;
|
weekList.value = result;
|
||||||
currentDay.value.fullDate = result[0].fullDate
|
currentDay.value.fullDate = result[0].fullDate;
|
||||||
getFair('refresh');
|
getFair('refresh');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -162,12 +162,11 @@ function seemsg(index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleScrollToLower = () => {
|
const handleScrollToLower = () => {
|
||||||
return
|
return;
|
||||||
getFair();
|
getFair();
|
||||||
console.log('触底');
|
console.log('触底');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function getFair(type = 'add') {
|
function getFair(type = 'add') {
|
||||||
if (type === 'refresh') {
|
if (type === 'refresh') {
|
||||||
pageState.page = 1;
|
pageState.page = 1;
|
||||||
@@ -194,7 +193,7 @@ function getFair(type = 'add') {
|
|||||||
// const end = fairList.value.length;
|
// const end = fairList.value.length;
|
||||||
// const reslist = rows;
|
// const reslist = rows;
|
||||||
// fairList.value.splice(str, end, ...reslist);
|
// fairList.value.splice(str, end, ...reslist);
|
||||||
fairList.value = rows
|
fairList.value = rows;
|
||||||
} else {
|
} else {
|
||||||
fairList.value = rows;
|
fairList.value = rows;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,14 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="header-input btn-feel">
|
<view class="header-input btn-feel">
|
||||||
<uni-icons class="iconsearch" color="#666666" type="search" size="18"></uni-icons>
|
<uni-icons class="iconsearch" color="#666666" type="search" size="18"></uni-icons>
|
||||||
<input v-model="pageState.zphmc" confirm-type="search" @confirm="getFair" class="input" placeholder="招聘会" placeholder-class="inputplace" />
|
<input
|
||||||
|
v-model="pageState.zphmc"
|
||||||
|
confirm-type="search"
|
||||||
|
@confirm="getFair"
|
||||||
|
class="input"
|
||||||
|
placeholder="招聘会"
|
||||||
|
placeholder-class="inputplace"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="header-date">
|
<view class="header-date">
|
||||||
<view class="data-week">
|
<view class="data-week">
|
||||||
@@ -37,12 +44,19 @@
|
|||||||
<!-- 主体内容区域 -->
|
<!-- 主体内容区域 -->
|
||||||
<view class="container-main">
|
<view class="container-main">
|
||||||
<scroll-view scroll-y class="main-scroll" @scrolltolower="handleScrollToLower">
|
<scroll-view scroll-y class="main-scroll" @scrolltolower="handleScrollToLower">
|
||||||
<view class="cards" v-if="fairList.length">
|
<view class="cards">
|
||||||
<view
|
<view
|
||||||
class="card press-button"
|
class="card press-button"
|
||||||
v-for="(item, index) in fairList"
|
v-for="(item, index) in fairList"
|
||||||
:key="index"
|
:key="index"
|
||||||
@click="navTo('/packageA/pages/exhibitors/exhibitors?jobFairId=' + item.zphID + '&jobFairName=' + item.zphmc)"
|
@click="
|
||||||
|
navTo(
|
||||||
|
'/packageA/pages/exhibitors/exhibitors?jobFairId=' +
|
||||||
|
item.zphID +
|
||||||
|
'&jobFairName=' +
|
||||||
|
item.zphmc
|
||||||
|
)
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<view class="card-title">{{ item.zphmc }}</view>
|
<view class="card-title">{{ item.zphmc }}</view>
|
||||||
<view class="card-row">
|
<view class="card-row">
|
||||||
@@ -80,10 +94,10 @@
|
|||||||
<view class="card-footer">内容简介:{{ item.zphjj }}</view>
|
<view class="card-footer">内容简介:{{ item.zphjj }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<empty v-else pdTop="200"></empty>
|
<empty v-if="!fairList.length"></empty>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
<Tabbar :currentpage="1"></Tabbar>
|
<!-- <Tabbar :currentpage="1"></Tabbar> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -95,7 +109,7 @@ import Tabbar from '@/components/tabbar/midell-box.vue';
|
|||||||
import useLocationStore from '@/stores/useLocationStore';
|
import useLocationStore from '@/stores/useLocationStore';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
const { longitudeVal, latitudeVal } = storeToRefs(useLocationStore());
|
const { longitudeVal, latitudeVal } = storeToRefs(useLocationStore());
|
||||||
const { $api, navTo, cloneDeep,debounce } = inject('globalFunction');
|
const { $api, navTo, cloneDeep, debounce } = inject('globalFunction');
|
||||||
const weekList = ref([]);
|
const weekList = ref([]);
|
||||||
const fairList = ref([]);
|
const fairList = ref([]);
|
||||||
const currentDay = ref({});
|
const currentDay = ref({});
|
||||||
@@ -108,7 +122,7 @@ const pageState = reactive({
|
|||||||
total: 0,
|
total: 0,
|
||||||
maxPage: 2,
|
maxPage: 2,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
zphmc:''
|
zphmc: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
@@ -122,7 +136,7 @@ onLoad(() => {
|
|||||||
startDate: currentDate,
|
startDate: currentDate,
|
||||||
});
|
});
|
||||||
weekList.value = result;
|
weekList.value = result;
|
||||||
currentDay.value.fullDate = result[0].fullDate
|
currentDay.value.fullDate = result[0].fullDate;
|
||||||
getFair('refresh');
|
getFair('refresh');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -130,6 +144,7 @@ function toSelectDate() {
|
|||||||
navTo('/packageA/pages/selectDate/selectDate', {
|
navTo('/packageA/pages/selectDate/selectDate', {
|
||||||
query: {
|
query: {
|
||||||
date: currentDay.value.fullDate,
|
date: currentDay.value.fullDate,
|
||||||
|
entrance: 'careerfair',
|
||||||
},
|
},
|
||||||
onBack: (res) => {
|
onBack: (res) => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
@@ -162,12 +177,11 @@ function seemsg(index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleScrollToLower = () => {
|
const handleScrollToLower = () => {
|
||||||
return
|
return;
|
||||||
getFair();
|
getFair();
|
||||||
console.log('触底');
|
console.log('触底');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function getFair(type = 'add') {
|
function getFair(type = 'add') {
|
||||||
if (type === 'refresh') {
|
if (type === 'refresh') {
|
||||||
pageState.page = 1;
|
pageState.page = 1;
|
||||||
@@ -177,7 +191,7 @@ function getFair(type = 'add') {
|
|||||||
pageState.page += 1;
|
pageState.page += 1;
|
||||||
}
|
}
|
||||||
let params = {
|
let params = {
|
||||||
zphmc:pageState.zphmc,
|
zphmc: pageState.zphmc,
|
||||||
// current: pageState.page,
|
// current: pageState.page,
|
||||||
// pageSize: pageState.pageSize,
|
// pageSize: pageState.pageSize,
|
||||||
};
|
};
|
||||||
@@ -187,14 +201,14 @@ function getFair(type = 'add') {
|
|||||||
if (currentDay.value?.fullDate) {
|
if (currentDay.value?.fullDate) {
|
||||||
params.zphjbsj = currentDay.value.fullDate.replace(/-/g, '');
|
params.zphjbsj = currentDay.value.fullDate.replace(/-/g, '');
|
||||||
}
|
}
|
||||||
$api.createRequest('/app/internal/jobFairThirdPart', params).then((resData) => {
|
$api.createRequest('/app/internal/jobFairThirdPart', params, 'GET', true).then((resData) => {
|
||||||
const { rows, total } = resData;
|
const { rows, total } = resData;
|
||||||
if (type === 'add') {
|
if (type === 'add') {
|
||||||
// const str = pageState.pageSize * (pageState.page - 1);
|
// const str = pageState.pageSize * (pageState.page - 1);
|
||||||
// const end = fairList.value.length;
|
// const end = fairList.value.length;
|
||||||
// const reslist = rows;
|
// const reslist = rows;
|
||||||
// fairList.value.splice(str, end, ...reslist);
|
// fairList.value.splice(str, end, ...reslist);
|
||||||
fairList.value = rows
|
fairList.value = rows;
|
||||||
} else {
|
} else {
|
||||||
fairList.value = rows;
|
fairList.value = rows;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,9 +63,9 @@
|
|||||||
<ai-paging ref="paging"></ai-paging>
|
<ai-paging ref="paging"></ai-paging>
|
||||||
</view>
|
</view>
|
||||||
<!-- 自定义tabbar -->
|
<!-- 自定义tabbar -->
|
||||||
<view class="chatmain-footer" v-show="!isDrawerOpen">
|
<!-- <view class="chatmain-footer" v-show="!isDrawerOpen">
|
||||||
<Tabbar :currentpage="2"></Tabbar>
|
<Tabbar :currentpage="2"></Tabbar>
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -213,27 +213,48 @@ footer-height = 98rpx
|
|||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
display: flex
|
display: flex
|
||||||
flex-direction: column
|
flex-direction: column
|
||||||
.drawer-user
|
.drawer-user {
|
||||||
border-top: 1rpx solid rgba(0,0,0,.1);
|
display: flex;
|
||||||
padding: 20rpx 28rpx
|
align-items: center;
|
||||||
display: flex
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 24rpx 32rpx;
|
||||||
|
padding-bottom: calc(24rpx + constant(safe-area-inset-bottom));
|
||||||
|
padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
|
||||||
|
border-top: 1rpx solid rgba(0, 0, 0, 0.06);
|
||||||
|
background-color: #ffffff;
|
||||||
|
color: #333333;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
align-items: center
|
font-size: 28rpx;
|
||||||
position: relative
|
|
||||||
margin-bottom: calc( 32rpx + var(--window-bottom)); /*兼容 IOS<11.2*/
|
&:active {
|
||||||
margin-bottom: calc( 32rpx +var(--window-bottom)); /*兼容 IOS>11.2*/
|
background-color: #f9f9f9;
|
||||||
color: #000000
|
}
|
||||||
.drawer-user-img
|
|
||||||
width: 57.2rpx;
|
.drawer-user-img {
|
||||||
height: 57.2rpx
|
width: 60rpx;
|
||||||
margin-right: 20rpx
|
height: 60rpx;
|
||||||
.drawer-user-setting
|
border-radius: 50%;
|
||||||
width: 48rpx
|
margin-right: 24rpx;
|
||||||
height: 48rpx
|
background-color: #eee;
|
||||||
position: absolute
|
flex-shrink: 0;
|
||||||
top: 50%
|
}
|
||||||
right: 28rpx
|
|
||||||
transform: translate(0,-50%)
|
.user-name {
|
||||||
|
flex: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer-user-setting {
|
||||||
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
margin-left: auto;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
.drawer-title
|
.drawer-title
|
||||||
height: header-height;
|
height: header-height;
|
||||||
line-height: header-height;
|
line-height: header-height;
|
||||||
|
|||||||
@@ -268,10 +268,10 @@ import WaveDisplay from './WaveDisplay.vue';
|
|||||||
import FileIcon from './fileIcon.vue';
|
import FileIcon from './fileIcon.vue';
|
||||||
import FileText from './fileText.vue';
|
import FileText from './fileText.vue';
|
||||||
// 系统功能hook和阿里云hook
|
// 系统功能hook和阿里云hook
|
||||||
// import { useAudioRecorder } from '@/hook/useRealtimeRecorder.js';
|
import { useAudioRecorder } from '@/hook/useRealtimeRecorder.js';
|
||||||
import { useAudioRecorder } from '@/hook/useSystemSpeechReader.js';
|
// import { useAudioRecorder } from '@/hook/useSystemSpeechReader.js';
|
||||||
// import { useTTSPlayer } from '@/hook/useTTSPlayer.js';
|
import { useTTSPlayer } from '@/hook/useTTSPlayer.js';
|
||||||
import { useTTSPlayer } from '@/hook/useSystemPlayer.js';
|
// import { useTTSPlayer } from '@/hook/useSystemPlayer.js';
|
||||||
// 全局
|
// 全局
|
||||||
const { $api, navTo, throttle } = inject('globalFunction');
|
const { $api, navTo, throttle } = inject('globalFunction');
|
||||||
const emit = defineEmits(['onConfirm']);
|
const emit = defineEmits(['onConfirm']);
|
||||||
@@ -632,7 +632,7 @@ function readMarkdown(value, index) {
|
|||||||
if (isPaused.value) {
|
if (isPaused.value) {
|
||||||
resume();
|
resume();
|
||||||
} else {
|
} else {
|
||||||
console.log(value, speechIndex.value, index, isPaused.value)
|
// console.log(value, speechIndex.value, index, isPaused.value)
|
||||||
speak(value);
|
speak(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="table-list">
|
<view class="table-list">
|
||||||
<scroll-view :scroll-y="true" class="falls-scroll" @scroll="handleScroll" @scrolltolower="scrollBottom">
|
<scroll-view :scroll-y="true" class="falls-scroll" @scroll="handleScroll" @scrolltolower="scrollBottom">
|
||||||
<view class="falls" v-if="list.length">
|
<view class="falls">
|
||||||
<custom-waterfalls-flow
|
<custom-waterfalls-flow
|
||||||
:column="columnCount"
|
:column="columnCount"
|
||||||
:columnSpace="columnSpace"
|
:columnSpace="columnSpace"
|
||||||
@@ -142,7 +142,7 @@
|
|||||||
</custom-waterfalls-flow>
|
</custom-waterfalls-flow>
|
||||||
<loadmore ref="loadmoreRef"></loadmore>
|
<loadmore ref="loadmoreRef"></loadmore>
|
||||||
</view>
|
</view>
|
||||||
<empty v-else pdTop="200"></empty>
|
<empty v-if="!list.length"></empty>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 筛选 -->
|
<!-- 筛选 -->
|
||||||
@@ -298,6 +298,7 @@ function nextDetail(job) {
|
|||||||
function openFilter() {
|
function openFilter() {
|
||||||
showFilter.value = true;
|
showFilter.value = true;
|
||||||
emits('onShowTabbar', false);
|
emits('onShowTabbar', false);
|
||||||
|
uni.hideTabBar();
|
||||||
selectFilterModel.value?.open({
|
selectFilterModel.value?.open({
|
||||||
title: '筛选',
|
title: '筛选',
|
||||||
maskClick: true,
|
maskClick: true,
|
||||||
@@ -310,10 +311,12 @@ function openFilter() {
|
|||||||
}
|
}
|
||||||
showFilter.value = false;
|
showFilter.value = false;
|
||||||
getJobList('refresh');
|
getJobList('refresh');
|
||||||
|
uni.showTabBar();
|
||||||
},
|
},
|
||||||
cancel: () => {
|
cancel: () => {
|
||||||
showFilter.value = false;
|
showFilter.value = false;
|
||||||
emits('onShowTabbar', true);
|
emits('onShowTabbar', true);
|
||||||
|
uni.showTabBar();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
</swiper>
|
</swiper>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<Tabbar v-show="showTabbar" :currentpage="0"></Tabbar>
|
<!-- <Tabbar v-show="showTabbar" :currentpage="0"></Tabbar> -->
|
||||||
|
|
||||||
<!-- maskFristEntry -->
|
<!-- maskFristEntry -->
|
||||||
<view class="maskFristEntry" v-if="maskFristEntry">
|
<view class="maskFristEntry" v-if="maskFristEntry">
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
<text class="text1">左滑查看视频</text>
|
<text class="text1">左滑查看视频</text>
|
||||||
<text class="text2">快去体验吧~</text>
|
<text class="text2">快去体验吧~</text>
|
||||||
<view class="goExperience" @click="goExperience">去体验</view>
|
<view class="goExperience" @click="goExperience">去体验</view>
|
||||||
<view class="maskFristEntry-Close" @click="closeFristEntry">1</view>
|
<view class="maskFristEntry-Close" @click="closeFristEntry"></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -80,7 +80,16 @@ onLoad(() => {
|
|||||||
// 判断浏览器是否有 fristEntry 第一次进入
|
// 判断浏览器是否有 fristEntry 第一次进入
|
||||||
let fristEntry = uni.getStorageSync('fristEntry') === false ? false : true; // 默认未读
|
let fristEntry = uni.getStorageSync('fristEntry') === false ? false : true; // 默认未读
|
||||||
maskFristEntry.value = fristEntry;
|
maskFristEntry.value = fristEntry;
|
||||||
// maskFristEntry.value = true;
|
if (fristEntry) {
|
||||||
|
uni.hideTabBar();
|
||||||
|
}
|
||||||
|
// 预加载较重页面
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.preloadPage({ url: '/packageA/pages/post/post' });
|
||||||
|
uni.preloadPage({ url: '/pages/nearby/nearby' });
|
||||||
|
uni.preloadPage({ url: '/pages/chat/chat' });
|
||||||
|
uni.preloadPage({ url: '/packageA/pages/choiceness/choiceness' });
|
||||||
|
}, 3000);
|
||||||
});
|
});
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
@@ -187,10 +196,12 @@ function changeSwiperMsgType(e) {
|
|||||||
function closeFristEntry() {
|
function closeFristEntry() {
|
||||||
uni.setStorageSync('fristEntry', false);
|
uni.setStorageSync('fristEntry', false);
|
||||||
maskFristEntry.value = false;
|
maskFristEntry.value = false;
|
||||||
|
uni.showTabBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
function goExperience() {
|
function goExperience() {
|
||||||
closeFristEntry();
|
closeFristEntry();
|
||||||
|
uni.showTabBar();
|
||||||
state.current = 1;
|
state.current = 1;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -241,9 +241,10 @@ function nextStep() {
|
|||||||
|
|
||||||
// 获取职位
|
// 获取职位
|
||||||
function getTreeselect() {
|
function getTreeselect() {
|
||||||
$api.createRequest('/app/common/jobTitle/treeselect', {}, 'GET').then((resData) => {
|
const LoadCache = (resData) => {
|
||||||
state.station = resData.data;
|
state.station = resData.data;
|
||||||
});
|
};
|
||||||
|
$api.createRequestWithCache('/app/common/jobTitle/treeselect', {}, 'GET', false, LoadCache).then(LoadCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loginbackdoor() {
|
function loginbackdoor() {
|
||||||
|
|||||||
@@ -95,9 +95,9 @@
|
|||||||
></uni-popup-dialog>
|
></uni-popup-dialog>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
</view>
|
</view>
|
||||||
<template #footer>
|
<!-- <template #footer>
|
||||||
<Tabbar :currentpage="4"></Tabbar>
|
<Tabbar :currentpage="4"></Tabbar>
|
||||||
</template>
|
</template> -->
|
||||||
</AppLayout>
|
</AppLayout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -110,13 +110,13 @@ import FileUploader from '@/utils/FileUploader.js';
|
|||||||
const { $api, navTo } = inject('globalFunction');
|
const { $api, navTo } = inject('globalFunction');
|
||||||
import useUserStore from '@/stores/useUserStore';
|
import useUserStore from '@/stores/useUserStore';
|
||||||
const popup = ref(null);
|
const popup = ref(null);
|
||||||
const { userInfo, Completion } = storeToRefs(useUserStore());
|
const { userInfo, Completion, counts } = storeToRefs(useUserStore());
|
||||||
const counts = ref({});
|
|
||||||
function logOut() {
|
function logOut() {
|
||||||
popup.value.open();
|
popup.value.open();
|
||||||
}
|
}
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
getUserstatistics();
|
useUserStore().getUserstatistics();
|
||||||
});
|
});
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
@@ -129,12 +129,6 @@ function confirm() {
|
|||||||
|
|
||||||
const isAbove90 = (percent) => parseFloat(percent) < 90;
|
const isAbove90 = (percent) => parseFloat(percent) < 90;
|
||||||
|
|
||||||
function getUserstatistics() {
|
|
||||||
$api.createRequest('/app/user/statistics').then((resData) => {
|
|
||||||
counts.value = resData.data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectFile() {
|
function selectFile() {
|
||||||
// FileUploader.showMenuAndUpload({
|
// FileUploader.showMenuAndUpload({
|
||||||
// success: function (res) {
|
// success: function (res) {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
</swiper>
|
</swiper>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<Tabbar :currentpage="3"></Tabbar>
|
<!-- <Tabbar :currentpage="3"></Tabbar> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
<view class="info-text line_2">{{ item.subTitle || '消息' }}</view>
|
<view class="info-text line_2">{{ item.subTitle || '消息' }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<empty v-if="!msgList.length"></empty>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</template>
|
</template>
|
||||||
@@ -83,6 +84,7 @@ defineExpose({ loadData });
|
|||||||
}
|
}
|
||||||
.scrollmain{
|
.scrollmain{
|
||||||
padding: 28rpx
|
padding: 28rpx
|
||||||
|
height: calc(100% - 56rpx)
|
||||||
}
|
}
|
||||||
.read{
|
.read{
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
<view class="info-text line_2">{{ item.subTitle || '消息' }}</view>
|
<view class="info-text line_2">{{ item.subTitle || '消息' }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<empty v-if="!unreadMsgList.length"></empty>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</template>
|
</template>
|
||||||
@@ -69,6 +70,7 @@ defineExpose({ loadData });
|
|||||||
}
|
}
|
||||||
.scrollmain{
|
.scrollmain{
|
||||||
padding: 28rpx
|
padding: 28rpx
|
||||||
|
height: calc(100% - 56rpx)
|
||||||
}
|
}
|
||||||
.read{
|
.read{
|
||||||
|
|
||||||
|
|||||||
@@ -69,14 +69,9 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="one-cards">
|
<view class="one-cards">
|
||||||
<renderJobs
|
<renderJobs :list="list" :longitude="longitudeVal" :latitude="latitudeVal"></renderJobs>
|
||||||
v-if="list.length"
|
<empty v-if="!list.length"></empty>
|
||||||
:list="list"
|
<loadmore v-show="list.length > pageState.pageSize" ref="loadmoreRef"></loadmore>
|
||||||
:longitude="longitudeVal"
|
|
||||||
:latitude="latitudeVal"
|
|
||||||
></renderJobs>
|
|
||||||
<empty v-else pdTop="60"></empty>
|
|
||||||
<loadmore ref="loadmoreRef"></loadmore>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 筛选 -->
|
<!-- 筛选 -->
|
||||||
@@ -340,15 +335,18 @@ defineExpose({ loadData, handleFilterConfirm });
|
|||||||
color: #4778EC !important
|
color: #4778EC !important
|
||||||
.nearby-scroll
|
.nearby-scroll
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
height: 100%;
|
||||||
|
background: #f4f4f4;
|
||||||
.two-head
|
.two-head
|
||||||
margin: 22rpx;
|
padding: 22rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column
|
flex-direction: column
|
||||||
flex-wrap: no-wrap
|
flex-wrap: no-wrap
|
||||||
// grid-template-columns: repeat(4, 1fr);
|
// grid-template-columns: repeat(4, 1fr);
|
||||||
// grid-column-gap: 10rpx;
|
// grid-column-gap: 10rpx;
|
||||||
// grid-row-gap: 24rpx;
|
// grid-row-gap: 24rpx;
|
||||||
border-radius: 17rpx 17rpx 17rpx 17rpx;
|
background: #FFFFFF
|
||||||
|
// border-radius: 17rpx 17rpx 17rpx 17rpx;
|
||||||
.head-all{
|
.head-all{
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -380,15 +378,21 @@ defineExpose({ loadData, handleFilterConfirm });
|
|||||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||||
.nearby-list
|
.nearby-list
|
||||||
border-top: 2rpx solid #EBEBEB;
|
border-top: 2rpx solid #EBEBEB;
|
||||||
height: 100%
|
min-height: calc(100% - 140rpx)
|
||||||
|
background: #f4f4f4
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
.one-cards{
|
.one-cards{
|
||||||
|
height: 100%
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 0 20rpx 20rpx 20rpx;
|
padding: 0 20rpx 20rpx 20rpx;
|
||||||
background: #f4f4f4
|
background: #f4f4f4
|
||||||
|
flex: 1
|
||||||
}
|
}
|
||||||
.nav-filter
|
.nav-filter
|
||||||
padding: 16rpx 28rpx 0 28rpx
|
padding: 16rpx 28rpx 0 28rpx
|
||||||
|
background: #ffffff
|
||||||
.filter-top
|
.filter-top
|
||||||
display: flex
|
display: flex
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -447,4 +451,4 @@ defineExpose({ loadData, handleFilterConfirm });
|
|||||||
height: 26rpx;
|
height: 26rpx;
|
||||||
.active
|
.active
|
||||||
transform: rotate(180deg)
|
transform: rotate(180deg)
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -74,14 +74,9 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="one-cards">
|
<view class="one-cards">
|
||||||
<renderJobs
|
<renderJobs :list="list" :longitude="longitudeVal" :latitude="latitudeVal"></renderJobs>
|
||||||
v-if="list.length"
|
<empty v-if="!list.length"></empty>
|
||||||
:list="list"
|
<loadmore v-show="list.length > pageState.pageSize" ref="loadmoreRef"></loadmore>
|
||||||
:longitude="longitudeVal"
|
|
||||||
:latitude="latitudeVal"
|
|
||||||
></renderJobs>
|
|
||||||
<empty v-else pdTop="60"></empty>
|
|
||||||
<loadmore ref="loadmoreRef"></loadmore>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 筛选 -->
|
<!-- 筛选 -->
|
||||||
@@ -364,20 +359,28 @@ defineExpose({ loadData, handleFilterConfirm });
|
|||||||
}
|
}
|
||||||
.nearby-scroll
|
.nearby-scroll
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
height: 100%;
|
||||||
|
background: #f4f4f4;
|
||||||
.nearby-map
|
.nearby-map
|
||||||
height: 767rpx;
|
height: 767rpx;
|
||||||
background: #e8e8e8;
|
background: #e8e8e8;
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
.nearby-list
|
.nearby-list
|
||||||
|
min-height: calc(100% - 384rpx)
|
||||||
|
background: #f4f4f4
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
.one-cards{
|
.one-cards{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 0 20rpx 20rpx 20rpx;
|
padding: 0 20rpx 20rpx 20rpx;
|
||||||
background: #f4f4f4
|
background: #f4f4f4
|
||||||
height: 100%
|
height: 100%
|
||||||
|
flex: 1
|
||||||
}
|
}
|
||||||
.nav-filter
|
.nav-filter
|
||||||
padding: 16rpx 28rpx 0 28rpx
|
padding: 16rpx 28rpx 0 28rpx
|
||||||
|
background: #ffffff
|
||||||
.filter-top
|
.filter-top
|
||||||
display: flex
|
display: flex
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|||||||
@@ -95,14 +95,9 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="one-cards">
|
<view class="one-cards">
|
||||||
<renderJobs
|
<renderJobs :list="list" :longitude="longitudeVal" :latitude="latitudeVal"></renderJobs>
|
||||||
v-if="list.length"
|
<empty v-if="!list.length"></empty>
|
||||||
:list="list"
|
<loadmore v-show="list.length > pageState.pageSize" ref="loadmoreRef"></loadmore>
|
||||||
:longitude="longitudeVal"
|
|
||||||
:latitude="latitudeVal"
|
|
||||||
></renderJobs>
|
|
||||||
<empty v-else pdTop="60"></empty>
|
|
||||||
<loadmore ref="loadmoreRef"></loadmore>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 筛选 -->
|
<!-- 筛选 -->
|
||||||
@@ -359,9 +354,12 @@ defineExpose({ loadData, handleFilterConfirm });
|
|||||||
color: #4778EC !important;
|
color: #4778EC !important;
|
||||||
.nearby-scroll
|
.nearby-scroll
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
background: #f4f4f4;
|
||||||
|
height: 100%
|
||||||
.three-head
|
.three-head
|
||||||
margin: 24rpx 0 0 0;
|
// margin: 24rpx 0 0 0;
|
||||||
padding: 26rpx 0 0 0;
|
padding: 26rpx 0 0 0;
|
||||||
|
background: #FFFFFF;
|
||||||
border-radius: 17rpx 17rpx 17rpx 17rpx;
|
border-radius: 17rpx 17rpx 17rpx 17rpx;
|
||||||
.one-picker
|
.one-picker
|
||||||
height: 100%
|
height: 100%
|
||||||
@@ -482,14 +480,21 @@ defineExpose({ loadData, handleFilterConfirm });
|
|||||||
z-index: 1;
|
z-index: 1;
|
||||||
.nearby-list
|
.nearby-list
|
||||||
border-top: 2rpx solid #EBEBEB;
|
border-top: 2rpx solid #EBEBEB;
|
||||||
|
min-height: calc(100% - 222rpx)
|
||||||
|
background: #f4f4f4
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
.one-cards{
|
.one-cards{
|
||||||
|
height: 100%
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 0 20rpx 20rpx 20rpx;
|
padding: 0 20rpx 20rpx 20rpx;
|
||||||
background: #f4f4f4
|
background: #f4f4f4
|
||||||
|
flex: 1
|
||||||
}
|
}
|
||||||
.nav-filter
|
.nav-filter
|
||||||
padding: 16rpx 28rpx 0 28rpx
|
padding: 16rpx 28rpx 0 28rpx
|
||||||
|
background: #ffffff
|
||||||
.filter-top
|
.filter-top
|
||||||
display: flex
|
display: flex
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|||||||
@@ -65,14 +65,9 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="one-cards">
|
<view class="one-cards">
|
||||||
<renderJobs
|
<renderJobs :list="list" :longitude="longitudeVal" :latitude="latitudeVal"></renderJobs>
|
||||||
v-if="list.length"
|
<empty v-if="!list.length"></empty>
|
||||||
:list="list"
|
<loadmore v-show="list.length > pageState.pageSize" ref="loadmoreRef"></loadmore>
|
||||||
:longitude="longitudeVal"
|
|
||||||
:latitude="latitudeVal"
|
|
||||||
></renderJobs>
|
|
||||||
<empty v-else pdTop="60"></empty>
|
|
||||||
<loadmore ref="loadmoreRef"></loadmore>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 筛选 -->
|
<!-- 筛选 -->
|
||||||
@@ -255,10 +250,13 @@ defineExpose({ loadData, handleFilterConfirm });
|
|||||||
color: #4778EC !important
|
color: #4778EC !important
|
||||||
.nearby-scroll
|
.nearby-scroll
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
height: 100%;
|
||||||
|
background: #f4f4f4;
|
||||||
.two-head
|
.two-head
|
||||||
margin: 22rpx;
|
padding: 22rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap
|
flex-wrap: wrap
|
||||||
|
background: #FFFFFF;
|
||||||
// grid-template-columns: repeat(4, 1fr);
|
// grid-template-columns: repeat(4, 1fr);
|
||||||
// grid-column-gap: 10rpx;
|
// grid-column-gap: 10rpx;
|
||||||
// grid-row-gap: 24rpx;
|
// grid-row-gap: 24rpx;
|
||||||
@@ -284,14 +282,21 @@ defineExpose({ loadData, handleFilterConfirm });
|
|||||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||||
.nearby-list
|
.nearby-list
|
||||||
border-top: 2rpx solid #EBEBEB;
|
border-top: 2rpx solid #EBEBEB;
|
||||||
|
min-height: calc(100% - 252rpx)
|
||||||
|
background: #f4f4f4
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
.one-cards{
|
.one-cards{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 0 20rpx 20rpx 20rpx;
|
padding: 0 20rpx 20rpx 20rpx;
|
||||||
background: #f4f4f4
|
background: #f4f4f4
|
||||||
|
height: 100%
|
||||||
|
flex: 1
|
||||||
}
|
}
|
||||||
.nav-filter
|
.nav-filter
|
||||||
padding: 16rpx 28rpx 0 28rpx
|
padding: 16rpx 28rpx 0 28rpx
|
||||||
|
background: #ffffff
|
||||||
.filter-top
|
.filter-top
|
||||||
display: flex
|
display: flex
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
// BaseStore.js - 基础Store类
|
|
||||||
import IndexedDBHelper from '@/common/IndexedDBHelper.js'
|
|
||||||
// import UniStorageHelper from '../common/UniStorageHelper'
|
|
||||||
import useChatGroupDBStore from './userChatGroupStore'
|
|
||||||
import config from '@/config'
|
|
||||||
|
|
||||||
|
|
||||||
class BaseStore {
|
|
||||||
db = null
|
|
||||||
isDBReady = false
|
|
||||||
dbName = 'BrowsingHistory'
|
|
||||||
constructor() {
|
|
||||||
this.checkAndInitDB()
|
|
||||||
}
|
|
||||||
checkAndInitDB() {
|
|
||||||
// 获取本地数据库版本
|
|
||||||
if (config.OnlyUseCachedDB) {
|
|
||||||
return this.initDB()
|
|
||||||
}
|
|
||||||
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() {
|
|
||||||
// // #ifdef H5
|
|
||||||
this.db = new IndexedDBHelper(this.dbName, config.DBversion);
|
|
||||||
// // #endif
|
|
||||||
// // #ifndef H5
|
|
||||||
// this.db = new UniStorageHelper(this.dbName, config.DBversion);
|
|
||||||
// // #endif
|
|
||||||
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
|
|
||||||
@@ -12,27 +12,25 @@ import {
|
|||||||
$api,
|
$api,
|
||||||
} from '../common/globalFunction';
|
} from '../common/globalFunction';
|
||||||
|
|
||||||
// 控制消息
|
// 常量定义:消息在 TabBar 的索引位置
|
||||||
|
const TABBAR_INDEX = 3;
|
||||||
|
|
||||||
export const useReadMsg = defineStore('readMsg', () => {
|
export const useReadMsg = defineStore('readMsg', () => {
|
||||||
const msgList = ref([])
|
const msgList = ref([])
|
||||||
|
// 用于自定义 Tabbar 组件的渲染
|
||||||
const badges = ref([{
|
const badges = ref([{
|
||||||
count: 0
|
count: 0
|
||||||
},
|
}, {
|
||||||
{
|
count: 0
|
||||||
count: 0
|
}, {
|
||||||
},
|
count: 0
|
||||||
{
|
}, {
|
||||||
count: 0
|
count: 0
|
||||||
},
|
}, {
|
||||||
{
|
count: 0
|
||||||
count: 0
|
}])
|
||||||
},
|
|
||||||
{
|
|
||||||
count: 0
|
|
||||||
},
|
|
||||||
])
|
|
||||||
|
|
||||||
// 计算总未读数量,基于 notReadCount 字段
|
// 计算总未读数量
|
||||||
const unreadCount = computed(() =>
|
const unreadCount = computed(() =>
|
||||||
msgList.value.reduce((sum, msg) => sum + (msg.notReadCount || 0), 0)
|
msgList.value.reduce((sum, msg) => sum + (msg.notReadCount || 0), 0)
|
||||||
)
|
)
|
||||||
@@ -42,40 +40,49 @@ export const useReadMsg = defineStore('readMsg', () => {
|
|||||||
msgList.value.filter(msg => msg.notReadCount > 0)
|
msgList.value.filter(msg => msg.notReadCount > 0)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
function updateBadgeEffect() {
|
||||||
// 设置 TabBar 角标
|
|
||||||
function updateTabBarBadge() {
|
|
||||||
const count = unreadCount.value
|
const count = unreadCount.value
|
||||||
const index = 3
|
// 处理显示文本:超过99显示99+
|
||||||
const countVal = count > 99 ? '99+' : String(count)
|
const countStr = count > 99 ? '99+' : String(count)
|
||||||
if (count === 0) {
|
|
||||||
uni.removeTabBarBadge({
|
// 1. 更新内部状态 (用于自定义 UI)
|
||||||
index
|
if (badges.value[TABBAR_INDEX]) {
|
||||||
}) // 替换为你消息页面的 TabBar index
|
badges.value[TABBAR_INDEX].count = count === 0 ? 0 : countStr
|
||||||
badges.value[index] = {
|
}
|
||||||
count: 0
|
|
||||||
|
// 2. 更新系统原生 TabBar
|
||||||
|
// 加 try-catch 防止在非 Tabbar 页面或加栽未完成时报错
|
||||||
|
try {
|
||||||
|
if (count > 0) {
|
||||||
|
uni.setTabBarBadge({
|
||||||
|
index: TABBAR_INDEX,
|
||||||
|
text: countStr
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.removeTabBarBadge({
|
||||||
|
index: TABBAR_INDEX
|
||||||
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} catch (e) {
|
||||||
badges.value[index] = {
|
console.warn('TabBar Badge 更新失败(可能当前非TabBar页面):', e)
|
||||||
count: countVal
|
|
||||||
}
|
|
||||||
uni.setTabBarBadge({
|
|
||||||
index,
|
|
||||||
text: countVal
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(unreadCount, () => {
|
||||||
|
updateBadgeEffect()
|
||||||
|
console.log('value', unreadCount.value)
|
||||||
|
}, {
|
||||||
|
immediate: true
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
// 拉取消息列表
|
// 拉取消息列表
|
||||||
async function fetchMessages() {
|
async function fetchMessages() {
|
||||||
try {
|
try {
|
||||||
$api.createRequest('/app/notice/info', {
|
const res = await $api.createRequest('/app/notice/info', {
|
||||||
isRead: 1
|
isRead: 1
|
||||||
}, "GET").then((res) => {
|
}, "GET")
|
||||||
msgList.value = res.data || []
|
msgList.value = res.data || []
|
||||||
updateTabBarBadge()
|
|
||||||
})
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('获取消息失败:', err)
|
console.error('获取消息失败:', err)
|
||||||
}
|
}
|
||||||
@@ -83,17 +90,23 @@ export const useReadMsg = defineStore('readMsg', () => {
|
|||||||
|
|
||||||
// 设置为已读
|
// 设置为已读
|
||||||
async function markAsRead(item, index) {
|
async function markAsRead(item, index) {
|
||||||
const msg = msgList.value[index]
|
const targetMsg = msgList.value[index]
|
||||||
if (!msg || msg.isRead === 1) return
|
if (!targetMsg) return
|
||||||
|
|
||||||
|
// 如果已经是已读,直接返回,避免无效请求
|
||||||
|
// 假设服务端逻辑是:isRead=1 表示已读 (注意检查你的字段定义)
|
||||||
|
// 你的原代码判断是 if (msg.isRead === 1) return,如果是这样,下面请求成功应该设为 1
|
||||||
|
// 但通常未读是0,已读是1。这里维持你原有的逻辑,假设服务端把 notReadCount 清零
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let params = {
|
let params = {
|
||||||
id: msg.noticeId
|
id: targetMsg.noticeId
|
||||||
}
|
}
|
||||||
$api.createRequest('/app/notice/read?id=' + msg.noticeId, params, "POST").then((res) => {
|
await $api.createRequest('/app/notice/read?id=' + targetMsg.noticeId, params, "POST")
|
||||||
msgList.value[index].isRead = 1
|
|
||||||
updateTabBarBadge()
|
// 更新本地数据
|
||||||
})
|
msgList.value[index].notReadCount = 0
|
||||||
|
msgList.value[index].isRead = 1 // 标记已读状态
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('设置消息已读失败:', err)
|
console.error('设置消息已读失败:', err)
|
||||||
}
|
}
|
||||||
@@ -106,6 +119,8 @@ export const useReadMsg = defineStore('readMsg', () => {
|
|||||||
unreadCount,
|
unreadCount,
|
||||||
fetchMessages,
|
fetchMessages,
|
||||||
markAsRead,
|
markAsRead,
|
||||||
updateTabBarBadge
|
updateTabBarBadge: updateBadgeEffect
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
unistorage: true, // 开启持久化
|
||||||
})
|
})
|
||||||
@@ -9,7 +9,7 @@ import jobAnalyzer from '@/utils/jobAnalyzer';
|
|||||||
import {
|
import {
|
||||||
msg
|
msg
|
||||||
} from '@/common/globalFunction.js'
|
} from '@/common/globalFunction.js'
|
||||||
import baseDB from './BaseDBStore';
|
import baseDB from '@/utils/db.js';
|
||||||
import config from '../config';
|
import config from '../config';
|
||||||
|
|
||||||
class JobRecommendation {
|
class JobRecommendation {
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ import {
|
|||||||
import {
|
import {
|
||||||
useReadMsg
|
useReadMsg
|
||||||
} from '@/stores/useReadMsg';
|
} from '@/stores/useReadMsg';
|
||||||
|
import {
|
||||||
|
msg,
|
||||||
|
$api,
|
||||||
|
} from '../common/globalFunction';
|
||||||
|
|
||||||
// 简历完成度计算
|
// 简历完成度计算
|
||||||
function getResumeCompletionPercentage(resume) {
|
function getResumeCompletionPercentage(resume) {
|
||||||
@@ -52,7 +56,8 @@ const useUserStore = defineStore("user", () => {
|
|||||||
const token = ref('')
|
const token = ref('')
|
||||||
const resume = ref({})
|
const resume = ref({})
|
||||||
const Completion = ref('0%')
|
const Completion = ref('0%')
|
||||||
const seesionId = ref(uni.getStorageSync('seesionId') || '')
|
const seesionId = ref('')
|
||||||
|
const counts = ref({})
|
||||||
|
|
||||||
const login = (value) => {
|
const login = (value) => {
|
||||||
hasLogin.value = true;
|
hasLogin.value = true;
|
||||||
@@ -128,6 +133,13 @@ const useUserStore = defineStore("user", () => {
|
|||||||
seesionId.value = seesionIdVal
|
seesionId.value = seesionIdVal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getUserstatistics() {
|
||||||
|
$api.createRequest('/app/user/statistics').then((resData) => {
|
||||||
|
counts.value = resData.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 导入
|
// 导入
|
||||||
return {
|
return {
|
||||||
hasLogin,
|
hasLogin,
|
||||||
@@ -140,8 +152,12 @@ const useUserStore = defineStore("user", () => {
|
|||||||
getUserResume,
|
getUserResume,
|
||||||
initSeesionId,
|
initSeesionId,
|
||||||
seesionId,
|
seesionId,
|
||||||
Completion
|
Completion,
|
||||||
|
getUserstatistics,
|
||||||
|
counts
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
unistorage: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
export default useUserStore;
|
export default useUserStore;
|
||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
ref,
|
ref,
|
||||||
toRaw
|
toRaw
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
import baseDB from './BaseDBStore';
|
import baseDB from '@/utils/db.js';
|
||||||
import {
|
import {
|
||||||
msg,
|
msg,
|
||||||
CloneDeep,
|
CloneDeep,
|
||||||
|
|||||||
31
uni_modules/pinia-plugin-unistorage/changelog.md
Normal file
31
uni_modules/pinia-plugin-unistorage/changelog.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
## 0.1.2(2024-07-17)
|
||||||
|
chore: 移除冗余的 typescript 依赖
|
||||||
|
## 0.1.1(2024-07-17)
|
||||||
|
fix: 修复 createUnistorage 导出
|
||||||
|
## 0.1.0(2024-07-10)
|
||||||
|
fix!: 更新 pinia 类型
|
||||||
|
## 0.0.21(2024-07-10)
|
||||||
|
chore!: 继承 pinia-plugin-persistedstate
|
||||||
|
## 0.0.19(2024-01-18)
|
||||||
|
|
||||||
|
fix: 重新构建,不需要默认参数
|
||||||
|
|
||||||
|
## 0.0.16(2023-05-06)
|
||||||
|
|
||||||
|
fix: 修复全局 key 移除
|
||||||
|
|
||||||
|
## 0.0.14(2023-04-29)
|
||||||
|
|
||||||
|
fix: 修复全局 global key 选项
|
||||||
|
|
||||||
|
## 0.0.12(2023-04-07)
|
||||||
|
|
||||||
|
- fix: 修复类型错误
|
||||||
|
|
||||||
|
## 0.0.11(2023-03-22)
|
||||||
|
|
||||||
|
- chore: ts 支持
|
||||||
|
|
||||||
|
## 0.0.7(2022-04-29)
|
||||||
|
|
||||||
|
- 更新 README
|
||||||
112
uni_modules/pinia-plugin-unistorage/index.d.ts
vendored
Normal file
112
uni_modules/pinia-plugin-unistorage/index.d.ts
vendored
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
import * as pinia from 'pinia';
|
||||||
|
import { StateTree, PiniaPluginContext, PiniaPlugin } from 'pinia';
|
||||||
|
|
||||||
|
type Prettify<T> = {
|
||||||
|
[K in keyof T]: T[K];
|
||||||
|
};
|
||||||
|
type StorageLike = Pick<Storage, 'getItem' | 'setItem'>;
|
||||||
|
interface Serializer {
|
||||||
|
/**
|
||||||
|
* Serializes state into string before storing
|
||||||
|
* @default JSON.stringify
|
||||||
|
*/
|
||||||
|
serialize: (value: StateTree) => string;
|
||||||
|
/**
|
||||||
|
* Deserializes string into state before hydrating
|
||||||
|
* @default JSON.parse
|
||||||
|
*/
|
||||||
|
deserialize: (value: string) => StateTree;
|
||||||
|
}
|
||||||
|
interface PersistedStateOptions {
|
||||||
|
/**
|
||||||
|
* Storage key to use.
|
||||||
|
* @default $store.id
|
||||||
|
*/
|
||||||
|
key?: string | ((id: string) => string);
|
||||||
|
/**
|
||||||
|
* Where to store persisted state.
|
||||||
|
* @default localStorage
|
||||||
|
*/
|
||||||
|
storage?: StorageLike;
|
||||||
|
/**
|
||||||
|
* Dot-notation paths to partially save state. Saves everything if undefined.
|
||||||
|
* @default undefined
|
||||||
|
*/
|
||||||
|
paths?: Array<string>;
|
||||||
|
/**
|
||||||
|
* Customer serializer to serialize/deserialize state.
|
||||||
|
*/
|
||||||
|
serializer?: Serializer;
|
||||||
|
/**
|
||||||
|
* Hook called before state is hydrated from storage.
|
||||||
|
* @default null
|
||||||
|
*/
|
||||||
|
beforeRestore?: (context: PiniaPluginContext) => void;
|
||||||
|
/**
|
||||||
|
* Hook called after state is hydrated from storage.
|
||||||
|
* @default undefined
|
||||||
|
*/
|
||||||
|
afterRestore?: (context: PiniaPluginContext) => void;
|
||||||
|
/**
|
||||||
|
* Logs errors in console when enabled.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
debug?: boolean;
|
||||||
|
}
|
||||||
|
type PersistedStateFactoryOptions = Prettify<Pick<PersistedStateOptions, 'storage' | 'serializer' | 'afterRestore' | 'beforeRestore' | 'debug'> & {
|
||||||
|
/**
|
||||||
|
* Global key generator, allows pre/postfixing store keys.
|
||||||
|
* @default storeKey => storeKey
|
||||||
|
*/
|
||||||
|
key?: (storeKey: string) => string;
|
||||||
|
/**
|
||||||
|
* Automatically persists all stores, opt-out individually.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
auto?: boolean;
|
||||||
|
}>;
|
||||||
|
declare module 'pinia' {
|
||||||
|
interface DefineStoreOptionsBase<S extends StateTree, Store> {
|
||||||
|
/**
|
||||||
|
* Persists store in storage.
|
||||||
|
* @see https://prazdevs.github.io/pinia-plugin-persistedstate
|
||||||
|
*/
|
||||||
|
persist?: boolean | PersistedStateOptions | PersistedStateOptions[];
|
||||||
|
unistorage?: boolean | PersistedStateOptions | PersistedStateOptions[];
|
||||||
|
}
|
||||||
|
interface PiniaCustomProperties {
|
||||||
|
/**
|
||||||
|
* Rehydrates store from persisted state
|
||||||
|
* Warning: this is for advances usecases, make sure you know what you're doing.
|
||||||
|
* @see https://prazdevs.github.io/pinia-plugin-persistedstate/guide/advanced.html#forcing-the-rehydration
|
||||||
|
*/
|
||||||
|
$hydrate: (opts?: {
|
||||||
|
runHooks?: boolean;
|
||||||
|
}) => void;
|
||||||
|
/**
|
||||||
|
* Persists store into configured storage
|
||||||
|
* Warning: this is for advances usecases, make sure you know what you're doing.
|
||||||
|
* @see https://prazdevs.github.io/pinia-plugin-persistedstate/guide/advanced.html#forcing-the-persistence
|
||||||
|
*/
|
||||||
|
$persist: () => void;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a pinia persistence plugin
|
||||||
|
* @param factoryOptions global persistence options
|
||||||
|
* @returns pinia plugin
|
||||||
|
*/
|
||||||
|
declare function createPersistedState(factoryOptions?: PersistedStateFactoryOptions): PiniaPlugin;
|
||||||
|
|
||||||
|
declare const _default: pinia.PiniaPlugin;
|
||||||
|
|
||||||
|
export { PersistedStateFactoryOptions, PersistedStateOptions, Serializer, StorageLike, createPersistedState, _default as default, createUnistorage };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a pinia persistence plugin with uniapp
|
||||||
|
* @param factoryOptions global persistence options
|
||||||
|
* @returns pinia plugin
|
||||||
|
*/
|
||||||
|
declare function createUnistorage(factoryOptions?: PersistedStateFactoryOptions): PiniaPlugin;
|
||||||
|
|
||||||
162
uni_modules/pinia-plugin-unistorage/index.js
Normal file
162
uni_modules/pinia-plugin-unistorage/index.js
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
// src/normalize.ts
|
||||||
|
function isObject(v) {
|
||||||
|
return typeof v === "object" && v !== null;
|
||||||
|
}
|
||||||
|
function normalizeOptions(options, factoryOptions) {
|
||||||
|
options = isObject(options) ? options : /* @__PURE__ */ Object.create(null);
|
||||||
|
return new Proxy(options, {
|
||||||
|
get(target, key, receiver) {
|
||||||
|
if (key === "key")
|
||||||
|
return Reflect.get(target, key, receiver);
|
||||||
|
return Reflect.get(target, key, receiver) || Reflect.get(factoryOptions, key, receiver);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// src/pick.ts
|
||||||
|
function get(state, path) {
|
||||||
|
return path.reduce((obj, p) => {
|
||||||
|
return obj == null ? void 0 : obj[p];
|
||||||
|
}, state);
|
||||||
|
}
|
||||||
|
function set(state, path, val) {
|
||||||
|
return path.slice(0, -1).reduce((obj, p) => {
|
||||||
|
if (/^(__proto__)$/.test(p))
|
||||||
|
return {};
|
||||||
|
else
|
||||||
|
return obj[p] = obj[p] || {};
|
||||||
|
}, state)[path[path.length - 1]] = val, state;
|
||||||
|
}
|
||||||
|
function pick(baseState, paths) {
|
||||||
|
return paths.reduce((substate, path) => {
|
||||||
|
const pathArray = path.split(".");
|
||||||
|
return set(substate, pathArray, get(baseState, pathArray));
|
||||||
|
}, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
// src/plugin.ts
|
||||||
|
function parsePersistence(factoryOptions, store) {
|
||||||
|
return (o) => {
|
||||||
|
var _a;
|
||||||
|
try {
|
||||||
|
const {
|
||||||
|
storage = localStorage,
|
||||||
|
beforeRestore = void 0,
|
||||||
|
afterRestore = void 0,
|
||||||
|
serializer = {
|
||||||
|
serialize: JSON.stringify,
|
||||||
|
deserialize: JSON.parse
|
||||||
|
},
|
||||||
|
key = store.$id,
|
||||||
|
paths = null,
|
||||||
|
debug = false
|
||||||
|
} = o;
|
||||||
|
return {
|
||||||
|
storage,
|
||||||
|
beforeRestore,
|
||||||
|
afterRestore,
|
||||||
|
serializer,
|
||||||
|
key: ((_a = factoryOptions.key) != null ? _a : (k) => k)(typeof key == "string" ? key : key(store.$id)),
|
||||||
|
paths,
|
||||||
|
debug
|
||||||
|
};
|
||||||
|
} catch (e) {
|
||||||
|
if (o.debug)
|
||||||
|
console.error("[pinia-plugin-persistedstate]", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function hydrateStore(store, { storage, serializer, key, debug }) {
|
||||||
|
try {
|
||||||
|
const fromStorage = storage == null ? void 0 : storage.getItem(key);
|
||||||
|
if (fromStorage)
|
||||||
|
store.$patch(serializer == null ? void 0 : serializer.deserialize(fromStorage));
|
||||||
|
} catch (e) {
|
||||||
|
if (debug)
|
||||||
|
console.error("[pinia-plugin-persistedstate]", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function persistState(state, { storage, serializer, key, paths, debug }) {
|
||||||
|
try {
|
||||||
|
const toStore = Array.isArray(paths) ? pick(state, paths) : state;
|
||||||
|
storage.setItem(key, serializer.serialize(toStore));
|
||||||
|
} catch (e) {
|
||||||
|
if (debug)
|
||||||
|
console.error("[pinia-plugin-persistedstate]", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function createPersistedState(factoryOptions = {}) {
|
||||||
|
return (context) => {
|
||||||
|
const { auto = false } = factoryOptions;
|
||||||
|
const {
|
||||||
|
options: { persist = auto },
|
||||||
|
store,
|
||||||
|
pinia
|
||||||
|
} = context;
|
||||||
|
if (!persist)
|
||||||
|
return;
|
||||||
|
if (!(store.$id in pinia.state.value)) {
|
||||||
|
const original_store = pinia._s.get(store.$id.replace("__hot:", ""));
|
||||||
|
if (original_store)
|
||||||
|
Promise.resolve().then(() => original_store.$persist());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const persistences = (Array.isArray(persist) ? persist.map((p) => normalizeOptions(p, factoryOptions)) : [normalizeOptions(persist, factoryOptions)]).map(parsePersistence(factoryOptions, store)).filter(Boolean);
|
||||||
|
store.$persist = () => {
|
||||||
|
persistences.forEach((persistence) => {
|
||||||
|
persistState(store.$state, persistence);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
store.$hydrate = ({ runHooks = true } = {}) => {
|
||||||
|
persistences.forEach((persistence) => {
|
||||||
|
const { beforeRestore, afterRestore } = persistence;
|
||||||
|
if (runHooks)
|
||||||
|
beforeRestore == null ? void 0 : beforeRestore(context);
|
||||||
|
hydrateStore(store, persistence);
|
||||||
|
if (runHooks)
|
||||||
|
afterRestore == null ? void 0 : afterRestore(context);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
persistences.forEach((persistence) => {
|
||||||
|
const { beforeRestore, afterRestore } = persistence;
|
||||||
|
beforeRestore == null ? void 0 : beforeRestore(context);
|
||||||
|
hydrateStore(store, persistence);
|
||||||
|
afterRestore == null ? void 0 : afterRestore(context);
|
||||||
|
store.$subscribe(
|
||||||
|
(_mutation, state) => {
|
||||||
|
persistState(state, persistence);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
detached: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function createUnistorage(globalOptions = {}) {
|
||||||
|
const persistedState = createPersistedState({
|
||||||
|
storage: {
|
||||||
|
getItem(key) {
|
||||||
|
return uni.getStorageSync(key);
|
||||||
|
},
|
||||||
|
setItem(key, value) {
|
||||||
|
uni.setStorageSync(key, value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
serializer: {
|
||||||
|
deserialize: JSON.parse,
|
||||||
|
serialize: JSON.stringify
|
||||||
|
},
|
||||||
|
...globalOptions
|
||||||
|
});
|
||||||
|
return (ctx) => {
|
||||||
|
if (ctx.options.unistorage) {
|
||||||
|
ctx.options.persist = ctx.options.unistorage;
|
||||||
|
}
|
||||||
|
return persistedState(ctx);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export { createPersistedState, createUnistorage };
|
||||||
94
uni_modules/pinia-plugin-unistorage/package.json
Normal file
94
uni_modules/pinia-plugin-unistorage/package.json
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
{
|
||||||
|
"id": "pinia-plugin-unistorage",
|
||||||
|
"displayName": "pinia-plugin-unistorage",
|
||||||
|
"version": "0.1.2",
|
||||||
|
"description": "uniapp 下 pinia 的本地数据缓存插件",
|
||||||
|
"keywords": [
|
||||||
|
"pinia",
|
||||||
|
"uniapp",
|
||||||
|
"storage",
|
||||||
|
"pinia-plugin",
|
||||||
|
"persistence"
|
||||||
|
],
|
||||||
|
"type": "module",
|
||||||
|
"main": "./index.js",
|
||||||
|
"types": "./index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./index.js",
|
||||||
|
"types": "./index.d.ts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"HBuilderX": "^3.4.7"
|
||||||
|
},
|
||||||
|
"dcloudext": {
|
||||||
|
"sale": {
|
||||||
|
"regular": {
|
||||||
|
"price": "0.00"
|
||||||
|
},
|
||||||
|
"sourcecode": {
|
||||||
|
"price": "0.00"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contact": {
|
||||||
|
"qq": ""
|
||||||
|
},
|
||||||
|
"declaration": {
|
||||||
|
"ads": "无",
|
||||||
|
"data": "无",
|
||||||
|
"permissions": "无"
|
||||||
|
},
|
||||||
|
"npmurl": "https://www.npmjs.com/package/pinia-plugin-unistorage",
|
||||||
|
"type": "sdk-js"
|
||||||
|
},
|
||||||
|
"uni_modules": {
|
||||||
|
"dependencies": [],
|
||||||
|
"encrypt": [],
|
||||||
|
"platforms": {
|
||||||
|
"cloud": {
|
||||||
|
"tcb": "y",
|
||||||
|
"aliyun": "y",
|
||||||
|
"alipay": "n"
|
||||||
|
},
|
||||||
|
"client": {
|
||||||
|
"Vue": {
|
||||||
|
"vue2": "y",
|
||||||
|
"vue3": "y"
|
||||||
|
},
|
||||||
|
"App": {
|
||||||
|
"app-vue": "y",
|
||||||
|
"app-nvue": "y"
|
||||||
|
},
|
||||||
|
"H5-mobile": {
|
||||||
|
"Safari": "y",
|
||||||
|
"Android Browser": "y",
|
||||||
|
"微信浏览器(Android)": "y",
|
||||||
|
"QQ浏览器(Android)": "y"
|
||||||
|
},
|
||||||
|
"H5-pc": {
|
||||||
|
"Chrome": "y",
|
||||||
|
"IE": "y",
|
||||||
|
"Edge": "y",
|
||||||
|
"Firefox": "y",
|
||||||
|
"Safari": "y"
|
||||||
|
},
|
||||||
|
"小程序": {
|
||||||
|
"微信": "y",
|
||||||
|
"阿里": "y",
|
||||||
|
"百度": "y",
|
||||||
|
"字节跳动": "y",
|
||||||
|
"QQ": "y",
|
||||||
|
"钉钉": "y",
|
||||||
|
"快手": "y",
|
||||||
|
"飞书": "y",
|
||||||
|
"京东": "y"
|
||||||
|
},
|
||||||
|
"快应用": {
|
||||||
|
"华为": "y",
|
||||||
|
"联盟": "y"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
226
uni_modules/pinia-plugin-unistorage/readme.md
Normal file
226
uni_modules/pinia-plugin-unistorage/readme.md
Normal file
@@ -0,0 +1,226 @@
|
|||||||
|
<div align="center">
|
||||||
|
<img width="200px" height="200px" src="https://gitee.com/dishait/pinia-plugin-unistorage/raw/main/static/favicon.png" />
|
||||||
|
<h1>pinia-plugin-unistorage</h1>
|
||||||
|
<p>uniapp 下 pinia 的本地数据缓存插件</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
<img width="100%" height="100%" src="https://gitee.com/dishait/pinia-plugin-unistorage/raw/main/static/pinia-plugin-unistorage.gif" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
## 引用
|
||||||
|
|
||||||
|
该插件是
|
||||||
|
[pinia-plugin-persistedstate](https://github.com/prazdevs/pinia-plugin-persistedstate)
|
||||||
|
的 `uniapp` 版本,如果你需要在纯 `vue` 或者 `nuxt` 项目中使用 `pinia`
|
||||||
|
的本地数据缓存,请使用
|
||||||
|
[pinia-plugin-persistedstate](https://github.com/prazdevs/pinia-plugin-persistedstate)。
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
## 动机
|
||||||
|
|
||||||
|
为了实现多端的更简单的全局本地数据缓存
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
## 组织 🦔
|
||||||
|
|
||||||
|
欢迎关注 **帝莎编程**
|
||||||
|
|
||||||
|
- [官网](http://dishaxy.dishait.cn/)
|
||||||
|
- [Gitee](https://gitee.com/dishait)
|
||||||
|
- [Github](https://github.com/dishait)
|
||||||
|
- [网易云课堂](https://study.163.com/provider/480000001892585/index.htm?share=2&shareId=480000001892585)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
## 使用
|
||||||
|
|
||||||
|
### 安装
|
||||||
|
|
||||||
|
#### 1. `cli` 创建的 `uniapp` 项目
|
||||||
|
|
||||||
|
```shell
|
||||||
|
npm i pinia-plugin-unistorage -D
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
// main.js
|
||||||
|
import { createSSRApp } from "vue";
|
||||||
|
import * as Pinia from "pinia";
|
||||||
|
import { createUnistorage } from "pinia-plugin-unistorage";
|
||||||
|
|
||||||
|
export function createApp() {
|
||||||
|
const app = createSSRApp(App);
|
||||||
|
|
||||||
|
const store = Pinia.createPinia();
|
||||||
|
|
||||||
|
// 关键代码 👇
|
||||||
|
store.use(createUnistorage());
|
||||||
|
|
||||||
|
app.use(store);
|
||||||
|
|
||||||
|
return {
|
||||||
|
app,
|
||||||
|
Pinia, // 此处必须将 Pinia 返回
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
#### 2. `hbuilderx` 创建的 `uniapp` 项目
|
||||||
|
|
||||||
|
直接插件市场安装后引入注册
|
||||||
|
|
||||||
|
```js
|
||||||
|
// main.js
|
||||||
|
import { createSSRApp } from "vue";
|
||||||
|
import * as Pinia from "pinia";
|
||||||
|
import { createUnistorage } from "./uni_modules/pinia-plugin-unistorage";
|
||||||
|
|
||||||
|
export function createApp() {
|
||||||
|
const app = createSSRApp(App);
|
||||||
|
|
||||||
|
const store = Pinia.createPinia();
|
||||||
|
|
||||||
|
// 关键代码 👇
|
||||||
|
store.use(createUnistorage());
|
||||||
|
|
||||||
|
app.use(store);
|
||||||
|
|
||||||
|
return {
|
||||||
|
app,
|
||||||
|
Pinia, // 此处必须将 Pinia 返回
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 基础
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { defineStore } from "pinia";
|
||||||
|
|
||||||
|
export const useStore = defineStore("main", {
|
||||||
|
state() {
|
||||||
|
return {
|
||||||
|
someState: "hello pinia",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
unistorage: true, // 开启后对 state 的数据读写都将持久化
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
或者 `setup` 语法也是支持的
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { defineStore } from "pinia";
|
||||||
|
|
||||||
|
export const useStore = defineStore(
|
||||||
|
"main",
|
||||||
|
() => {
|
||||||
|
const someState = ref("hello pinia");
|
||||||
|
return { someState };
|
||||||
|
},
|
||||||
|
{
|
||||||
|
unistorage: true, // 开启后对 state 的数据读写都将持久化
|
||||||
|
},
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
### 选项
|
||||||
|
|
||||||
|
#### 钩子
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { defineStore } from "pinia";
|
||||||
|
|
||||||
|
export const useStore = defineStore("main", {
|
||||||
|
state() {
|
||||||
|
return {
|
||||||
|
someState: "hello pinia",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
unistorage: {
|
||||||
|
// 初始化恢复前触发
|
||||||
|
beforeRestore(ctx) {},
|
||||||
|
// 初始化恢复后触发
|
||||||
|
afterRestore(ctx) {},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
#### 序列化
|
||||||
|
|
||||||
|
大多数情况下你并不需要了解该选项
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { defineStore } from "pinia";
|
||||||
|
|
||||||
|
export const useStore = defineStore("main", {
|
||||||
|
state() {
|
||||||
|
return {
|
||||||
|
someState: "hello pinia",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
unistorage: {
|
||||||
|
serializer: {
|
||||||
|
// 序列化,默认为 JSON.stringify
|
||||||
|
serialize(v) {
|
||||||
|
return JSON.stringify(v);
|
||||||
|
},
|
||||||
|
// 反序列化,默认为 JSON.parse
|
||||||
|
deserialize(v) {
|
||||||
|
return JSON.parse(v);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
#### 其他
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { defineStore } from "pinia";
|
||||||
|
|
||||||
|
export const useStore = defineStore("main", {
|
||||||
|
state() {
|
||||||
|
return {
|
||||||
|
foo: "foo",
|
||||||
|
nested: {
|
||||||
|
data: "nested pinia",
|
||||||
|
},
|
||||||
|
someState: "hello pinia",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
unistorage: {
|
||||||
|
key: "foo", // 缓存的键,默认为该 store 的 id,这里是 main,
|
||||||
|
paths: ["foo", "nested.data"], // 需要缓存的路径,这里设置 foo 和 nested 下的 data 会被缓存
|
||||||
|
},
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Made with [markthree](https://github.com/markthree)
|
||||||
|
|
||||||
|
Published under [MIT License](./LICENSE).
|
||||||
35
uni_modules/pinia-plugin-unistorage/src/index.ts
Normal file
35
uni_modules/pinia-plugin-unistorage/src/index.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import {
|
||||||
|
createPersistedState,
|
||||||
|
type PersistedStateFactoryOptions,
|
||||||
|
} from "pinia-plugin-persistedstate";
|
||||||
|
|
||||||
|
export * from "pinia-plugin-persistedstate";
|
||||||
|
|
||||||
|
export function createUnistorage(
|
||||||
|
globalOptions: PersistedStateFactoryOptions = {},
|
||||||
|
) {
|
||||||
|
const persistedState = createPersistedState({
|
||||||
|
storage: {
|
||||||
|
getItem(key) {
|
||||||
|
// @ts-ignore
|
||||||
|
return uni.getStorageSync(key);
|
||||||
|
},
|
||||||
|
setItem(key, value) {
|
||||||
|
// @ts-ignore
|
||||||
|
uni.setStorageSync(key, value);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
serializer: {
|
||||||
|
deserialize: JSON.parse,
|
||||||
|
serialize: JSON.stringify,
|
||||||
|
},
|
||||||
|
...globalOptions,
|
||||||
|
});
|
||||||
|
// @ts-ignore
|
||||||
|
return (ctx) => {
|
||||||
|
if (ctx.options.unistorage) {
|
||||||
|
ctx.options.persist = ctx.options.unistorage;
|
||||||
|
}
|
||||||
|
return persistedState(ctx);
|
||||||
|
};
|
||||||
|
}
|
||||||
91
utils/db.js
Normal file
91
utils/db.js
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
// BaseDBStore.js
|
||||||
|
import IndexedDBHelper from '@/common/IndexedDBHelper.js'
|
||||||
|
// import UniStorageHelper from '../common/UniStorageHelper'
|
||||||
|
import useChatGroupDBStore from '@/stores/userChatGroupStore'
|
||||||
|
import config from '@/config'
|
||||||
|
|
||||||
|
class BaseStore {
|
||||||
|
db = null
|
||||||
|
isDBReady = false
|
||||||
|
dbName = 'BrowsingHistory' // 'AppMainDB'
|
||||||
|
initPromise = null
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.initPromise = this.checkAndInitDB()
|
||||||
|
}
|
||||||
|
|
||||||
|
async getDB() {
|
||||||
|
if (!this.initPromise) {
|
||||||
|
this.initPromise = this.checkAndInitDB();
|
||||||
|
}
|
||||||
|
await this.initPromise; // 等待初始化完成
|
||||||
|
return this.db;
|
||||||
|
}
|
||||||
|
|
||||||
|
async checkAndInitDB() {
|
||||||
|
if (config.OnlyUseCachedDB) {
|
||||||
|
return this.initDB()
|
||||||
|
}
|
||||||
|
const localVersion = uni.getStorageSync('indexedDBVersion') || 1
|
||||||
|
console.log('DBVersion: ', localVersion, config.DBversion)
|
||||||
|
if (localVersion === config.DBversion) {
|
||||||
|
return this.initDB() // 🟢 记得加 return
|
||||||
|
} else {
|
||||||
|
console.log('清空本地数据库')
|
||||||
|
await this.clearDB() // 🟢 建议用 await
|
||||||
|
uni.setStorageSync('indexedDBVersion', config.DBversion);
|
||||||
|
return this.initDB(); // 🟢 记得加 return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initDB() {
|
||||||
|
// // #ifdef H5
|
||||||
|
this.db = new IndexedDBHelper(this.dbName, config.DBversion);
|
||||||
|
// // #endif
|
||||||
|
|
||||||
|
return 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
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'api_cache',
|
||||||
|
keyPath: "cacheKey", // 使用 URL+参数 作为主键
|
||||||
|
indexes: []
|
||||||
|
}
|
||||||
|
]).then(async () => {
|
||||||
|
// 这里原来的逻辑保留
|
||||||
|
if (useChatGroupDBStore) {
|
||||||
|
useChatGroupDBStore().init()
|
||||||
|
}
|
||||||
|
this.isDBReady = true
|
||||||
|
return this.db;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async clearDB() {
|
||||||
|
return new Promise((resolve, rejetc) => {
|
||||||
|
new IndexedDBHelper().deleteDB(this.dbName).then(() => {
|
||||||
|
resolve()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const baseDB = new BaseStore()
|
||||||
|
export default baseDB
|
||||||
@@ -1,14 +1,15 @@
|
|||||||
import config from "@/config.js"
|
import config from "@/config.js"
|
||||||
import {
|
import {
|
||||||
sm2_Decrypt,
|
sm2_Decrypt,
|
||||||
sm2_Encrypt
|
sm2_Encrypt,
|
||||||
} from '@/common/globalFunction';
|
|
||||||
import useUserStore from '@/stores/useUserStore';
|
|
||||||
import {
|
|
||||||
sm4Decrypt,
|
sm4Decrypt,
|
||||||
sm4Encrypt
|
sm4Encrypt
|
||||||
} from '../common/globalFunction';
|
} from '@/common/globalFunction';
|
||||||
|
import IndexedDBHelper from '@/common/IndexedDBHelper';
|
||||||
|
import useUserStore from '@/stores/useUserStore';
|
||||||
|
import baseDB from '@/utils/db.js';
|
||||||
|
|
||||||
|
const CACHE_STORE_NAME = 'api_cache';
|
||||||
|
|
||||||
const needToEncrypt = [
|
const needToEncrypt = [
|
||||||
["post", "/app/login"],
|
["post", "/app/login"],
|
||||||
@@ -20,6 +21,51 @@ const needToEncrypt = [
|
|||||||
["get", "/app/user/experience/list"]
|
["get", "/app/user/experience/list"]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 带缓存的请求方法
|
||||||
|
*/
|
||||||
|
export async function createRequestWithCache(url, data = {}, method = 'GET', loading = false, headers = {},
|
||||||
|
onCacheLoad = null) {
|
||||||
|
// 是分页接口的话, 只缓存第一页的数据
|
||||||
|
if (data.current && data.current > 1) {
|
||||||
|
return createRequest(url, data, method, loading, headers);
|
||||||
|
}
|
||||||
|
const cacheKey = `${method.toUpperCase()}:${url}:${JSON.stringify(data)}`;
|
||||||
|
|
||||||
|
baseDB.getDB().then(async (dbHelper) => {
|
||||||
|
try {
|
||||||
|
const cachedRecord = await dbHelper.get(CACHE_STORE_NAME, cacheKey);
|
||||||
|
|
||||||
|
if (cachedRecord && cachedRecord.response && typeof onCacheLoad === 'function') {
|
||||||
|
onCacheLoad(cachedRecord.response);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('读取缓存失败', e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 3. 发起网络请求
|
||||||
|
try {
|
||||||
|
const networkResponse = await createRequest(url, data, method, loading, headers);
|
||||||
|
baseDB.getDB().then(async (dbHelper) => {
|
||||||
|
try {
|
||||||
|
await dbHelper.update(CACHE_STORE_NAME, {
|
||||||
|
cacheKey: cacheKey,
|
||||||
|
response: networkResponse,
|
||||||
|
timestamp: Date.now()
|
||||||
|
});
|
||||||
|
console.log('💾 [BaseDB] 缓存更新:', url);
|
||||||
|
} catch (e) {
|
||||||
|
console.error('更新缓存失败', e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return networkResponse;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param url String,请求的地址,默认:none
|
* @param url String,请求的地址,默认:none
|
||||||
* @param data Object,请求的参数,默认:{}
|
* @param data Object,请求的参数,默认:{}
|
||||||
@@ -35,13 +81,16 @@ export function createRequest(url, data = {}, method = 'GET', loading = false, h
|
|||||||
mask: true
|
mask: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
let Authorization = ''
|
let header = {
|
||||||
if (useUserStore().token) {
|
...headers
|
||||||
Authorization = `${useUserStore().token}`
|
};
|
||||||
}
|
const userStore = useUserStore();
|
||||||
|
const token = userStore.token;
|
||||||
|
|
||||||
const header = headers || {};
|
if (token) {
|
||||||
header["Authorization"] = encodeURIComponent(Authorization);
|
// 确保 Authorization 不会被覆盖,且进行编码
|
||||||
|
header["Authorization"] = encodeURIComponent(token);
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// 检查当前请求是否需要加密
|
// 检查当前请求是否需要加密
|
||||||
@@ -88,10 +137,12 @@ export function createRequest(url, data = {}, method = 'GET', loading = false, h
|
|||||||
resolve(resData.data)
|
resolve(resData.data)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
uni.showToast({
|
if (msg) {
|
||||||
title: msg,
|
uni.showToast({
|
||||||
icon: 'none'
|
title: msg,
|
||||||
})
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (resData.data?.code === 401 || resData.data?.code === 402) {
|
if (resData.data?.code === 401 || resData.data?.code === 402) {
|
||||||
useUserStore().logOut()
|
useUserStore().logOut()
|
||||||
|
|||||||
Reference in New Issue
Block a user