This commit is contained in:
2025-11-28 17:22:37 +08:00
21 changed files with 999 additions and 336 deletions

View File

@@ -51,7 +51,6 @@ function getUserInfo() {
const sm2_privateKey = config.appInfo.sm2PrivateKey;
let sm2_encrypt_result = data.data;
let sm2_decrypt_result = sm2_Decrypt(sm2_encrypt_result, sm2_privateKey);
console.log(sm2_decrypt_result);
if (typeof sm2_decrypt_result == 'string') sm2_decrypt_result = JSON.parse(sm2_decrypt_result);
// 其次,对sm2解密后的结果进行 aes解密
@@ -100,7 +99,7 @@ function oncloseWindow() {
function loginCallback(userInfo) {
let params = {
username: userInfo,
userInfo,
};
$api.createRequest('/app/login', params, 'post').then((resData) => {
useUserStore()

View File

@@ -464,4 +464,8 @@ html {
/* 隐藏超出的文本 */
text-overflow: ellipsis;
/* 使用省略号 */
}
.grayscale {
filter: grayscale(100%) opacity(0.6);
}

View File

@@ -1,36 +1,18 @@
<template>
<view v-for="company in listData" :key="company.id">
<view v-if="company.dataType==2" class="cards" @click="nextDetail(company)">
<view class="card-company">
<text class="company line_1">{{ company.name }}</text>
</view>
<view class="card-bottom ">
<view class="fl_box fs_14">
<view class="mar_ri10">{{company.industry}}</view>
<view>{{company.scale }}</view>
</view>
<view class="ris">
<text class="fs_14">
在招职位·
<text class="color_256BFA">{{ company.totalRecruitment || '-' }}</text>
</text>
</view>
</view>
<view class="card-tags">
<view class="tag" v-if="company.nature">
{{company.nature}}
</view>
</view>
</view>
<view v-else class="cards" @click="nextDetail(company)">
<view
v-if="company.dataType == 2"
:class="{ grayscale: company.isPublish }"
class="cards"
@click="nextDetail(company)"
>
<view class="card-company">
<text class="company line_1">{{ company.name }}</text>
</view>
<view class="card-bottom">
<view class="fl_box fs_14">
<view class="mar_ri10">{{company.industry}}</view>
<view>{{company.scale }}</view>
<view class="mar_ri10">{{ company.industry }}</view>
<view>{{ company.scale }}</view>
</view>
<view class="ris">
<text class="fs_14">
@@ -42,7 +24,30 @@
</view>
<view class="card-tags">
<view class="tag" v-if="company.nature">
{{company.nature}}
{{ company.nature }}
</view>
</view>
</view>
<view v-else class="cards" :class="{ grayscale: company.isPublish }" @click="nextDetail(company)">
<view class="card-company">
<text class="company line_1">{{ company.name }}</text>
</view>
<view class="card-bottom">
<view class="fl_box fs_14">
<view class="mar_ri10">{{ company.industry }}</view>
<view>{{ company.scale }}</view>
</view>
<view class="ris">
<text class="fs_14">
在招职位·
<text class="color_256BFA">{{ company.totalRecruitment || '-' }}</text>
</text>
</view>
</view>
<view class="card-tags">
<view class="tag" v-if="company.nature">
{{ company.nature }}
</view>
</view>
</view>
@@ -51,7 +56,7 @@
<script setup>
import { inject, computed, toRaw } from 'vue';
const { insertSortData, navTo, vacanciesTo } = inject('globalFunction');
const { $api, insertSortData, navTo, vacanciesTo } = inject('globalFunction');
import { useRecommedIndexedDBStore } from '@/stores/useRecommedIndexedDBStore.js';
const recommedIndexDb = useRecommedIndexedDBStore();
const props = defineProps({
@@ -78,9 +83,14 @@ const listData = computed(() => {
});
function nextDetail(company) {
if(company.dataType == 2){
navTo(`/packageA/pages/UnitDetails/UnitDetails?companyId=${company.gsID}&companyName=${company.name}&zphId=${company.zphID}&dataType=2`);
}else{
if (company.isPublish) {
return $api.msg('已过期');
}
if (company.dataType == 2) {
navTo(
`/packageA/pages/UnitDetails/UnitDetails?companyId=${company.gsID}&companyName=${company.name}&zphId=${company.zphID}&dataType=2`
);
} else {
navTo(`/packageA/pages/UnitDetails/UnitDetails?companyId=${company.companyId}`);
}
}
@@ -154,4 +164,4 @@ function nextDetail(company) {
.ris{
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
}
</style>
</style>

View File

@@ -3,22 +3,25 @@
<view v-if="!job.isTitle" class="cards" @click="nextDetail(job)">
<!-- 数据类型2的完整模块 -->
<view v-if="job.dataType == 2">
<view class="card-company">
<view class="card-company" :class="{ grayscale: job.isPublish }">
<text class="company">{{ job.jobTitle }}</text>
<view class="salary">
<Salary-Expectation :max-salary="job.maxSalary" :min-salary="job.minSalary"></Salary-Expectation>
<Salary-Expectation
:max-salary="job.maxSalary"
:min-salary="job.minSalary"
></Salary-Expectation>
</view>
</view>
<view class="card-companyName">{{ job.companyName }}</view>
<view class="card-tags">
<view class="tag">
{{job.education == '不限' ? '学历不限' : job.education}}
{{ job.education == '不限' ? '学历不限' : job.education }}
</view>
<view class="tag">
{{job.experience == '不限' ? '经验不限' : job.experience}}
{{ job.experience == '不限' ? '经验不限' : job.experience }}
</view>
<view class="tag">
{{ vacanciesTo(job.vacancies) }}
{{ vacanciesTo(job.vacancies) }}
</view>
</view>
<view class="card-bottom">
@@ -34,22 +37,25 @@
</view>
</view>
</view>
<!-- 数据类型1的完整模块 -->
<view v-else>
<view class="card-company">
<view class="card-company" :class="{ grayscale: job.isPublish }">
<text class="company">{{ job.jobTitle }}</text>
<view class="salary">
<Salary-Expectation :max-salary="job.maxSalary" :min-salary="job.minSalary"></Salary-Expectation>
<Salary-Expectation
:max-salary="job.maxSalary"
:min-salary="job.minSalary"
></Salary-Expectation>
</view>
</view>
<view class="card-companyName">{{ job.companyName }}</view>
<view class="card-tags">
<view class="tag">
{{job.education == '不限' ? '学历不限' : job.education}}
{{ job.education == '不限' ? '学历不限' : job.education }}
</view>
<view class="tag">
{{job.experience == '不限' ? '经验不限' : job.experience}}
{{ job.experience == '不限' ? '经验不限' : job.experience }}
</view>
<view class="tag">
{{ vacanciesTo(job.vacancies) }}
@@ -77,7 +83,7 @@
<script setup>
import { inject, computed, toRaw } from 'vue';
const { insertSortData, navTo, vacanciesTo } = inject('globalFunction');
const { $api, insertSortData, navTo, vacanciesTo } = inject('globalFunction');
import { useRecommedIndexedDBStore } from '@/stores/useRecommedIndexedDBStore.js';
const recommedIndexDb = useRecommedIndexedDBStore();
const props = defineProps({
@@ -129,6 +135,9 @@ function parseDateTime(datetimeStr) {
}
function nextDetail(job) {
if (job.isPublish) {
return $api.msg('已过期');
}
navTo(`/packageA/pages/post/post?jobId=${btoa(job.jobId)}&dataType=${job.dataType}`);
}
</script>
@@ -198,4 +207,4 @@ function nextDetail(job) {
color: #6C7282;
}
}
</style>
</style>

View File

@@ -3,19 +3,22 @@
<view v-if="!job.isTitle" class="cards" @click="nextDetail(job)">
<!-- 数据类型2的完整模块 -->
<view v-if="job.dataType == 2">
<view class="card-company">
<view class="card-company" :class="{ grayscale: job.isPublish }">
<text class="company">{{ job.jobTitle }}</text>
<view class="salary">
<Salary-Expectation :max-salary="job.maxSalary" :min-salary="job.minSalary"></Salary-Expectation>
<Salary-Expectation
:max-salary="job.maxSalary"
:min-salary="job.minSalary"
></Salary-Expectation>
</view>
</view>
<view class="card-companyName">{{ job.companyName }}</view>
<view class="card-tags">
<view class="tag">
{{job.education == '不限' ? '学历不限' : job.education}}
{{ job.education == '不限' ? '学历不限' : job.education }}
</view>
<view class="tag">
{{job.experience == '不限' ? '经验不限' : job.experience}}
{{ job.experience == '不限' ? '经验不限' : job.experience }}
</view>
<view class="tag">
{{ vacanciesTo(job.vacancies) }}
@@ -34,22 +37,25 @@
</view>
</view>
</view>
<!-- 数据类型1的完整模块 -->
<view v-else>
<view class="card-company">
<view class="card-company" :class="{ grayscale: job.isPublish }">
<text class="company">{{ job.jobTitle }}</text>
<view class="salary">
<Salary-Expectation :max-salary="job.maxSalary" :min-salary="job.minSalary"></Salary-Expectation>
<Salary-Expectation
:max-salary="job.maxSalary"
:min-salary="job.minSalary"
></Salary-Expectation>
</view>
</view>
<view class="card-companyName">{{ job.companyName }}</view>
<view class="card-tags">
<view class="tag">
{{job.education == '不限' ? '学历不限' : job.education}}
{{ job.education == '不限' ? '学历不限' : job.education }}
</view>
<view class="tag">
{{job.experience == '不限' ? '经验不限' : job.experience}}
{{ job.experience == '不限' ? '经验不限' : job.experience }}
</view>
<view class="tag">
{{ vacanciesTo(job.vacancies) }}
@@ -77,7 +83,7 @@
<script setup>
import { inject, computed, toRaw } from 'vue';
const { insertSortData, navTo, vacanciesTo } = inject('globalFunction');
const { $api, insertSortData, navTo, vacanciesTo } = inject('globalFunction');
import { useRecommedIndexedDBStore } from '@/stores/useRecommedIndexedDBStore.js';
const recommedIndexDb = useRecommedIndexedDBStore();
const props = defineProps({
@@ -129,6 +135,9 @@ function parseDateTime(datetimeStr) {
}
function nextDetail(job) {
if (job.isPublish) {
return $api.msg('已过期');
}
// 根据数据类型跳转到不同的详情页
navTo(`/packageA/pages/post/post?jobId=${btoa(job.jobId)}&dataType=${job.dataType}`);
}
@@ -199,4 +208,4 @@ function nextDetail(job) {
color: #6C7282;
}
}
</style>
</style>

View File

@@ -3,22 +3,25 @@
<view v-if="!job.isTitle" class="cards" @click="nextDetail(job)">
<!-- 数据类型2的完整模块 -->
<view v-if="job.dataType == 2">
<view class="card-company">
<view class="card-company" :class="{ grayscale: job.isPublish }">
<text class="company">{{ job.jobTitle }}</text>
<view class="salary">
<Salary-Expectation :max-salary="job.maxSalary" :min-salary="job.minSalary"></Salary-Expectation>
<Salary-Expectation
:max-salary="job.maxSalary"
:min-salary="job.minSalary"
></Salary-Expectation>
</view>
</view>
<view class="card-companyName">{{ job.companyName }}</view>
<view class="card-tags">
<view class="tag">
{{job.education == '不限' ? '学历不限' : job.education}}
{{ job.education == '不限' ? '学历不限' : job.education }}
</view>
<view class="tag">
{{job.experience == '不限' ? '经验不限' : job.experience}}
{{ job.experience == '不限' ? '经验不限' : job.experience }}
</view>
<view class="tag">
{{ vacanciesTo(job.vacancies) }}
{{ vacanciesTo(job.vacancies) }}
</view>
</view>
<view class="card-bottom">
@@ -34,22 +37,25 @@
</view>
</view>
</view>
<!-- 数据类型1的完整模块 -->
<view v-else>
<view class="card-company">
<view class="card-company" :class="{ grayscale: job.isPublish }">
<text class="company">{{ job.jobTitle }}</text>
<view class="salary">
<Salary-Expectation :max-salary="job.maxSalary" :min-salary="job.minSalary"></Salary-Expectation>
<Salary-Expectation
:max-salary="job.maxSalary"
:min-salary="job.minSalary"
></Salary-Expectation>
</view>
</view>
<view class="card-companyName">{{ job.companyName }}</view>
<view class="card-tags">
<view class="tag">
{{job.education == '不限' ? '学历不限' : job.education}}
{{ job.education == '不限' ? '学历不限' : job.education }}
</view>
<view class="tag">
{{job.experience == '不限' ? '经验不限' : job.experience}}
{{ job.experience == '不限' ? '经验不限' : job.experience }}
</view>
<view class="tag">
{{ vacanciesTo(job.vacancies) }}
@@ -77,7 +83,7 @@
<script setup>
import { inject, computed, toRaw } from 'vue';
const { insertSortData, navTo, vacanciesTo } = inject('globalFunction');
const { $api, insertSortData, navTo, vacanciesTo } = inject('globalFunction');
import { useRecommedIndexedDBStore } from '@/stores/useRecommedIndexedDBStore.js';
const recommedIndexDb = useRecommedIndexedDBStore();
const props = defineProps({
@@ -129,6 +135,9 @@ function parseDateTime(datetimeStr) {
}
function nextDetail(job) {
if (job.isPublish) {
return $api.msg('已过期');
}
navTo(`/packageA/pages/post/post?jobId=${btoa(job.jobId)}&dataType=${job.dataType}`);
}
</script>
@@ -198,4 +207,4 @@ function nextDetail(job) {
color: #6C7282;
}
}
</style>
</style>

View File

@@ -86,14 +86,13 @@ const open = (newConfig = {}) => {
} = newConfig;
reset();
serchforIt(defaultId);
if (configTitle) title.value = configTitle;
if (typeof success === 'function') confirmCallback.value = success;
if (typeof cancel === 'function') cancelCallback.value = cancel;
if (typeof change === 'function') changeCallback.value = change;
if (Array.isArray(data)) listData.value = data;
serchforIt(defaultId);
rowLabel.value = configRowLabel;
rowKey.value = configRowKey;
maskClick.value = configMaskClick;
@@ -154,6 +153,18 @@ function serchforIt(defaultId) {
state.visible = true;
return;
}
if (listData.value.length) {
if (userInfo.value.jobTitleId) {
const ids = userInfo.value.jobTitleId.split(',').map((id) => Number(id));
count.value = ids.length;
setCheckedNodes(listData.value, ids);
}
state.jobTitleId = userInfo.value.jobTitleId;
state.stations = listData.value;
state.visible = true;
return;
}
$api.createRequest('/app/common/jobTitle/treeselect', {}, 'GET').then((resData) => {
if (userInfo.value.jobTitleId) {
const ids = userInfo.value.jobTitleId.split(',').map((id) => Number(id));

View File

@@ -2,10 +2,7 @@ export default {
// baseUrl: 'https://fw.rc.qingdao.gov.cn/rgpp-api/api', // 内网
baseUrl: 'https://qd.zhaopinzao8dian.com/api', // 测试
// baseUrl: 'http://192.168.3.29:8081',
// sseAI+
// StreamBaseURl: 'http://39.98.44.136:8000',
StreamBaseURl: 'https://qd.zhaopinzao8dian.com/ai',
// StreamBaseURl: 'https://qd.zhaopinzao8dian.com/ai/test',
// baseUrl: 'http://10.213.6.207:19010/api',
// 语音转文字
// vioceBaseURl: 'ws://39.98.44.136:8080/speech-recognition',
vioceBaseURl: 'wss://qd.zhaopinzao8dian.com/api/speech-recognition',

View File

@@ -20,6 +20,7 @@ import renderCompanyCollectionRecord from '@/components/renderCompanyCollectionR
import renderJobViewRecord from '@/components/renderJobViewRecord/renderJobViewRecord.vue';
// import Tabbar from '@/components/tabbar/midell-box.vue'
// 自动导入 directives 目录下所有指令
console.log(lightAppJssdk)
const directives = import.meta.glob('./directives/*.js', {
eager: true
});

View File

@@ -12,11 +12,33 @@
<view class="lf-text">选择想找的工作我的将在首页为你推荐</view>
</view>
<view class="title-ri">
<!-- <text style="color: #256bfa">2</text>
<!-- <text style="color: #256bfa">2</text>
<text>/2</text> -->
</view>
</view>
<view class="content-list">
<view class="list-search">
<uni-icons type="search" color="#333333" size="24"></uni-icons>
<input
class="search-input"
v-model="inputVal"
placeholder="请输入岗位名称"
@input="handelChangeInpute"
@blur="handleBlur"
@focus="handleFocus"
/>
<view class="search-container" v-show="filterList.length">
<view
class="list-item"
v-for="(item, index) in filterList"
@click="handelClickItem(item)"
:key="item.id"
>
<view class="item-txt line_1">{{ item.lable }}</view>
</view>
</view>
</view>
<view class="list-row" v-for="(item, index) in userInfo.jobTitle" :key="index">
<text>{{ item }}</text>
<image
@@ -31,18 +53,85 @@
</view>
<SelectJobs ref="selectJobsModel"></SelectJobs>
</AppLayout>
<uni-popup ref="popup" type="dialog">
<uni-popup-dialog
mode="base"
title="确定添加该期望岗位吗"
type="info"
:duration="2000"
:before-close="true"
@confirm="confirm"
@close="close"
></uni-popup-dialog>
</uni-popup>
</template>
<script setup>
import { inject, ref, reactive } from 'vue';
import SelectJobs from '@/components/selectJobs/selectJobs.vue';
import { onLoad, onUnload } from '@dcloudio/uni-app';
const { $api, navBack } = inject('globalFunction');
import { storeToRefs } from 'pinia';
import useUserStore from '@/stores/useUserStore';
const { getUserResume } = useUserStore();
const { userInfo } = storeToRefs(useUserStore());
const popup = ref(null);
const selectJobsModel = ref(null);
const treeDataList = ref([]);
const dataSource = ref([]);
const filterList = ref([]);
const dataItem = ref(null);
const inputVal = ref('');
onLoad(() => {
getTree();
});
function close() {
popup.value.close();
}
function handleBlur() {
setTimeout(() => {
filterList.value = [];
}, 100);
}
function handleFocus() {
const val = inputVal.value.toLowerCase();
if (val && dataSource.value) {
filterList.value = dataSource.value.filter((item) => item.lable.toLowerCase().search(val) !== -1);
} else {
filterList.value = [];
}
}
function confirm() {
const { id } = dataItem.value;
let ids = userInfo.value.jobTitleId + `,${id}`;
const result = dedupeAndCheck(ids);
if (result.hasDuplicate) {
popup.value.close();
$api.msg('期望岗位已重复');
return;
}
complete({ jobTitleId: result.deduplicated });
inputVal.value = '';
popup.value.close();
}
function dedupeAndCheck(str) {
const items = str.split(',').map((s) => s.trim());
const uniqueItems = [...new Set(items)];
const hasDuplicate = uniqueItems.length !== items.length;
return {
deduplicated: uniqueItems.join(','),
hasDuplicate,
};
}
function deleteItem(item, index) {
const ids = userInfo.value.jobTitleId
.split(',')
@@ -55,12 +144,27 @@ function changeJobs() {
selectJobsModel.value?.open({
title: '添加岗位',
maskClick: true,
data: treeDataList.value,
success: (ids, labels) => {
complete({ jobTitleId: ids });
},
});
}
function handelChangeInpute(e) {
const val = e.detail.value.toLowerCase();
if (val && dataSource.value) {
filterList.value = dataSource.value.filter((item) => item.lable.toLowerCase().search(val) !== -1);
} else {
filterList.value = [];
}
}
function handelClickItem(item) {
dataItem.value = item;
popup.value.open();
}
function complete(values) {
if (!values.jobTitleId.length) {
return $api.msg('至少添加一份期望岗位');
@@ -70,9 +174,81 @@ function complete(values) {
getUserResume();
});
}
function getTree() {
$api.createRequest('/app/common/jobTitle/treeselect', {}, 'GET').then((resData) => {
if (resData.code === 200) {
dataSource.value = flattenTree(resData.data);
treeDataList.value = resData.data;
}
});
}
function flattenTree(treeData, parentPath = '') {
let result = [];
treeData.forEach((node) => {
const currentName = node.lable || node.label;
const fullPath = parentPath ? `${parentPath}-${currentName}` : currentName;
const children = node.children || node.chidren;
if (children && children.length > 0) {
result = result.concat(flattenTree(children, fullPath));
} else {
result.push({
id: node.id,
lable: fullPath,
currentName,
});
}
});
return result;
}
</script>
<style lang="stylus" scoped>
.list-search{
height: 76rpx;
background: #FFFFFF;
border-radius: 8rpx;
border: 1px solid #ECECEC;
margin-bottom: 24rpx;
display: flex;
align-items: center;
padding: 0 24rpx;
position: relative;
.search-input{
flex: 1;
padding: 0 20rpx;
font-size: 28rpx;
color: #6C7282;
border: none;
outline: none;
background: transparent;
}
.search-container{
position: absolute;
top: 100%;
left: 0;
right: 0;
background: #FFFFFF;
border: 2rpx solid #ECECEC;
border-top: 0;
z-index: 1;
max-height: 30vh;
overflow: hidden;
.list-item{
height: 80rpx
padding: 0rpx 24rpx;
display: flex;
align-items: center;
justify-items: flex-start;
border-top: 2rpx dashed #e3e3e3;
}
.list-item:hover{
background: #e5e5e5
}
}
}
.btn {
display: flex;
justify-content: space-between;

View File

@@ -11,21 +11,31 @@
<view class="button-click" :class="{ active: type === 1 }" @click="changeType(1)">公司企业</view>
</view>
<view class="coll-main">
<swiper class="swiper" :current="type" @change="changeSwiperType">
<swiper-item class="list">
<swiper class="swiper" :disable-touch="disableTouch" :current="type" @change="changeSwiperType">
<swiper-item
class="list"
@touchstart.passive="handleTouchStart"
@touchmove.passive="handleTouchMove"
@touchend="disableTouch = false"
>
<scroll-view scroll-y class="main-scroll" @scrolltolower="handleScrollToLower">
<view class="mian">
<renderJobCollectionRecord
<renderJobCollectionRecord
v-if="pageState.list.length"
:list="pageState.list"
:longitude="longitudeVal"
:latitude="latitudeVal">
</renderJobCollectionRecord>
:latitude="latitudeVal"
></renderJobCollectionRecord>
<empty v-else pdTop="200"></empty>
</view>
</scroll-view>
</swiper-item>
<swiper-item class="list">
<swiper-item
class="list"
@touchstart.passive="handleTouchStart"
@touchmove.passive="handleTouchMove"
@touchend="disableTouch = false"
>
<scroll-view scroll-y class="main-scroll" @scrolltolower="handleScrollToLowerCompany">
<view class="mian">
<renderCompanyCollectionRecord
@@ -69,14 +79,79 @@ const pageCompanyState = reactive({
pageSize: 10,
});
const disableTouch = ref(false);
const startPointX = ref(0);
const totalPage = 2;
const THRESHOLD = 5;
onShow(() => {
getJobList();
getCompanyList();
});
function handleTouchStart(e) {
// 确保有触摸点
if (e.touches.length > 0) {
startPointX.value = e.touches[0].clientX;
disableTouch.value = false;
}
}
function handleTouchMove(e) {
if (e.touches.length === 0) return;
const currentX = e.touches[0].clientX;
const diffX = currentX - startPointX.value;
if (type.value === 0) {
if (diffX > THRESHOLD) {
disableTouch.value = true;
} else {
disableTouch.value = false;
}
return;
}
if (type.value === totalPage - 1) {
if (diffX < -THRESHOLD) {
disableTouch.value = true;
} else {
disableTouch.value = false;
}
return;
}
disableTouch.value = false;
}
function changeSwiperType(e) {
const newIndex = e.detail.current;
const lastIndex = type.value;
const isSwipingRight = newIndex < lastIndex;
const isSwipingLeft = newIndex > lastIndex;
if (lastIndex === 0 && isSwipingRight) {
disableTouch.value = true;
type.value = 0;
setTimeout(() => {
disableTouch.value = false;
}, 50);
return;
}
if (lastIndex === totalPage - 1 && isSwipingLeft) {
disableTouch.value = true;
type.value = lastIndex;
setTimeout(() => {
disableTouch.value = false;
}, 50);
return;
}
const current = e.detail.current;
type.value = current;
disableTouch.value = false;
}
function changeType(e) {

View File

@@ -11,9 +11,9 @@
<image src="@/static/icon/companyIcon.png" mode=""></image>
</view>
<view class="companyinfo-right">
<view class="row1 line_2">{{ fairInfo?.zphmc }}</view>
<view class="row1 line_2" @tap="$api.copyText(fairInfo.zphmc)">{{ fairInfo?.zphmc }}</view>
<view class="row2">
<text>{{ fairInfo.jbf }}</text>
<text @tap="$api.copyText(fairInfo.jbf)">{{ fairInfo.jbf }}</text>
<!-- <convert-distance
:alat="fairInfo.latitude"
:along="fairInfo.longitude"
@@ -27,7 +27,9 @@
<image class="location-img" src="/static/icon/mapLine.png"></image>
<view class="location-info">
<view class="info">
<text class="info-title">{{ fairInfo.zphdz }}</text>
<text class="info-title line_1" @tap="$api.copyText(fairInfo.zphdz)">
{{ fairInfo.zphdz }}
</text>
<!-- <text class="info-text">位置</text> -->
</view>
</view>
@@ -122,23 +124,23 @@ const pageState = reactive({
const hasnext = ref(true);
const zphId = ref('');
const pageOptions = ref({})
const pageOptions = ref({});
onLoad((options) => {
zphId.value = options.jobFairId
pageOptions.value = options
zphId.value = options.jobFairId;
pageOptions.value = options;
getJobFairInfo(options.jobFairId, options.jobFairName);
getCompanyList('refresh');
});
function getJobFairInfo(id,name) {
function getJobFairInfo(id, name) {
$api.createRequest(`/app/internal/jobFairThirdPart/${id}`).then((resData) => {
fairInfo.value = resData.data;
hasAppointment();
});
}
function getCompanyList(type='add') {
const { jobFairId,jobFairName} = pageOptions.value
function getCompanyList(type = 'add') {
const { jobFairId, jobFairName } = pageOptions.value;
if (type === 'refresh') {
pageState.current = 1;
pageState.maxPage = 1;
@@ -150,24 +152,26 @@ function getCompanyList(type='add') {
current: pageState.current,
pageSize: pageState.pageSize,
};
$api.createRequest(`/app/internal/companyThirdPart/?zphID=${jobFairId}&zphmc=${jobFairName}`,params ).then((resData) => {
const { rows, total } = resData;
if (type === 'add') {
const str = pageState.pageSize * (pageState.current - 1);
const end = pageState.list.length;
const reslist = rows;
pageState.list.splice(str, end, ...reslist);
} else {
pageState.list = rows;
$api.createRequest(`/app/internal/companyThirdPart/?zphID=${jobFairId}&zphmc=${jobFairName}`, params).then(
(resData) => {
const { rows, total } = resData;
if (type === 'add') {
const str = pageState.pageSize * (pageState.current - 1);
const end = pageState.list.length;
const reslist = rows;
pageState.list.splice(str, end, ...reslist);
} else {
pageState.list = rows;
}
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
}
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
});
);
}
const hasAppointment = () => {
const isTimePassed = (timeStr) => {
if(!timeStr) return false
if (!timeStr) return false;
const targetTime = new Date(timeStr.replace(/-/g, '/')).getTime(); // 兼容格式
const now = Date.now();
return now < targetTime;

View File

@@ -1,241 +1,212 @@
<template>
<AppLayout title="我的简历" title-color="#FFFFFF" back-gorund-color="#F4F4F4">
<template #headerleft>
<view class="btn">
<image src="@/static/icon/back-white.png" @click="navBack"></image>
</view>
</template>
<view v-if="userInfo.resumeOcrStatus && showNotice" class="notice-line" :class="userInfo.resumeOcrStatus?.includes('成功')?'green':'blue'">
<image v-if="userInfo.resumeOcrStatus?.includes('成功')" class="icon" src="@/static/icon/notice-green.png" />
<image v-else class="icon" src="@/static/icon/notice-blue.png" />
<view class="text">{{userInfo.resumeOcrStatus}}</view>
<image @click="closeNotice" v-if="userInfo.resumeOcrStatus?.includes('成功')" class="close" src="@/static/icon/close-green.png" />
<image @click="closeNotice" v-else class="close" src="@/static/icon/close-blue.png" />
</view>
<view class="mys-container">
<!-- 个人信息 -->
<view
class="card-top"
style="margin-top: 12rpx; padding: 0; background: none"
>
<view class="mys-tops btn-feel">
<view class="tops-left">
<view class="name">
<text>{{ userInfo.name || "编辑用户名" }}</text>
<view class="edit-icon mar_le10">
<image
class="button-click"
src="@/static/icon/edit1.png"
@click="navTo('/packageA/pages/personalInfo/personalInfo')"
></image>
</view>
<AppLayout title="我的简历" title-color="#FFFFFF" back-gorund-color="#F4F4F4">
<template #headerleft>
<view class="btn">
<image src="@/static/icon/back-white.png" @click="navBack"></image>
</view>
<view class="subName">
<dict-Label
class="mar_ri10"
dictType="sex"
:value="userInfo.sex"
></dict-Label>
<text class="mar_ri10">{{ userInfo.age }}</text>
<dict-Label
class="mar_ri10"
dictType="education"
:value="userInfo.education"
></dict-Label>
<dict-Label
class="mar_ri10"
dictType="affiliation"
:value="userInfo.politicalAffiliation"
></dict-Label>
</view>
<view class="subName">{{ userInfo.phone }}</view>
</view>
<view class="tops-right">
<view class="right-imghead">
<image v-if="userInfo.avatar" :src="userInfo.avatar"></image>
<image
v-else-if="userInfo.sex == '0'"
src="@/static/icon/boy.png"
></image>
<image v-else src="@/static/icon/girl.png"></image>
</view>
<view class="right-sex">
<image
v-if="userInfo.sex === '0'"
src="@/static/icon/boy1.png"
></image>
<image v-else src="@/static/icon/girl1.png"></image>
</view>
</view>
</view>
<!-- 求职期望 -->
<view class="mys-line">
<view class="line"></view>
</view>
<view class="mys-info btn-feel">
<view class="mys-h4">
<view>求职期望</view>
<image
class="icon"
src="@/static/icon/edit1.png"
@click="navTo('/packageA/pages/jobExpect/jobExpect')"
></image>
</view>
<view class="mys-text">
<text>期望薪资</text>
<text
>{{ userInfo.salaryMin / 1000 }}k-{{
userInfo.salaryMax / 1000
}}k</text
>
</view>
<view class="mys-text">
<text>期望工作地</text>
<text>青岛市-</text>
<dict-Label
dictType="area"
:value="Number(userInfo.area)"
></dict-Label>
</view>
<view class="mys-list">
<view
class="cards button-click"
v-for="(title, index) in userInfo.jobTitle"
:key="index"
>
{{ title }}
</view>
</view>
</view>
</view>
<view class="card-top" style="margin-top: 24rpx">
<view class="mys-info" style="padding: 0">
<view class="mys-h4 btn-feel">
<text>工作经历</text>
<view
class="mys-edit-icon btn-feel"
@click="navTo('/packageA/pages/workExp/workExp')"
>
<image
class="icon button-click btn-feel"
src="@/static/icon/plus.png"
></image>
<view class="txt">添加</view>
</view>
</view>
<view
class="exp-item btn-feel"
v-for="item in userInfo.workExp"
:key="item.id"
>
<view class="fl_box fl_justbet mar_top15">
<view class="fs_16">{{ item.company }}</view>
<image
class="icon btn-feel"
src="@/static/icon/edit1.png"
@click="navTo(`/packageA/pages/workExp/workExp?id=${item.id}`)"
></image>
</view>
<view class="mys-text fl_box fl_justbet">
<text class="color_333333 fs_14">{{ item.position }}</text>
<text class="datetext"
>{{ item.startTime }}--{{ item.endTime || "至今" }}</text
>
</view>
<view class="mys-text">
<text>{{ item.duty }}</text>
</view>
</view>
</view>
</view>
</view>
<template #footer>
<view class="footer-container">
<view class="footer-button btn-feel" @click="chooseResume"
>上传简历</view
</template>
<view
v-if="userInfo.resumeOcrStatus && showNotice"
class="notice-line"
:class="userInfo.resumeOcrStatus?.includes('成功') ? 'green' : 'blue'"
>
</view>
</template>
</AppLayout>
<image
v-if="userInfo.resumeOcrStatus?.includes('成功')"
class="icon"
src="@/static/icon/notice-green.png"
/>
<image v-else class="icon" src="@/static/icon/notice-blue.png" />
<view class="text">{{ userInfo.resumeOcrStatus }}</view>
<image
@click="closeNotice"
v-if="userInfo.resumeOcrStatus?.includes('成功')"
class="close"
src="@/static/icon/close-green.png"
/>
<image @click="closeNotice" v-else class="close" src="@/static/icon/close-blue.png" />
</view>
<view class="mys-container">
<!-- 个人信息 -->
<view class="card-top" style="margin-top: 12rpx; padding: 0; background: none">
<view class="mys-tops">
<view class="tops-left">
<view class="name">
<text>{{ userInfo.name || '编辑用户名' }}</text>
<view class="edit-icon mar_le10">
<image
class="button-click"
src="@/static/icon/edit1.png"
@click="navTo('/packageA/pages/personalInfo/personalInfo')"
></image>
</view>
</view>
<view class="subName">
<dict-Label class="mar_ri10" dictType="sex" :value="userInfo.sex"></dict-Label>
<text class="mar_ri10">{{ userInfo.age }}</text>
<dict-Label class="mar_ri10" dictType="education" :value="userInfo.education"></dict-Label>
<dict-Label
class="mar_ri10"
dictType="affiliation"
:value="userInfo.politicalAffiliation"
></dict-Label>
</view>
<view class="subName">{{ userInfo.phone }}</view>
</view>
<view class="tops-right">
<view class="right-imghead">
<image v-if="userInfo.avatar" :src="userInfo.avatar"></image>
<image v-else-if="userInfo.sex == '0'" src="@/static/icon/boy.png"></image>
<image v-else src="@/static/icon/girl.png"></image>
</view>
<view class="right-sex">
<image v-if="userInfo.sex === '0'" src="@/static/icon/boy1.png"></image>
<image v-else src="@/static/icon/girl1.png"></image>
</view>
</view>
</view>
<!-- 求职期望 -->
<view class="mys-line">
<view class="line"></view>
</view>
<view class="mys-info">
<view class="mys-h4">
<view>求职期望</view>
<image
class="icon"
src="@/static/icon/edit1.png"
@click="navTo('/packageA/pages/jobExpect/jobExpect')"
></image>
</view>
<view class="mys-text">
<text>期望薪资</text>
<text>{{ userInfo.salaryMin / 1000 }}k-{{ userInfo.salaryMax / 1000 }}k</text>
</view>
<view class="mys-text">
<text>期望工作地</text>
<text>青岛市-</text>
<dict-Label dictType="area" :value="Number(userInfo.area)"></dict-Label>
</view>
<view class="mys-list">
<view class="cards button-click" v-for="(title, index) in userInfo.jobTitle" :key="index">
{{ title }}
</view>
</view>
</view>
</view>
<view class="card-top" style="margin-top: 24rpx">
<view class="mys-info" style="padding: 0">
<view class="mys-h4">
<text>工作经历</text>
<view class="mys-edit-icon btn-tada" @click="navTo('/packageA/pages/workExp/workExp')">
<image class="icon button-click btn-feel" src="@/static/icon/plus.png"></image>
<view class="txt">添加</view>
</view>
</view>
<view class="exp-item button-click" v-for="item in userInfo.workExp" :key="item.id">
<view class="fl_box fl_justbet mar_top15">
<view class="fs_16">{{ item.company }}</view>
<image
class="icon btn-feel"
src="@/static/icon/edit1.png"
@click="navTo(`/packageA/pages/workExp/workExp?id=${item.id}`)"
></image>
</view>
<view class="mys-text fl_box fl_justbet">
<text class="color_333333 fs_14">{{ item.position }}</text>
<text class="datetext">{{ item.startTime }}--{{ item.endTime || '至今' }}</text>
</view>
<view class="mys-text">
<text>{{ item.duty }}</text>
</view>
</view>
</view>
</view>
</view>
<template #footer>
<view class="footer-container">
<view class="footer-button btn-feel" @click="chooseResume">上传简历</view>
</view>
</template>
</AppLayout>
</template>
<script setup>
import { reactive, inject, watch, ref, onMounted, computed } from "vue";
const { $api, navTo, navBack } = inject("globalFunction");
import { onLoad, onShow } from "@dcloudio/uni-app";
import { storeToRefs } from "pinia";
import useUserStore from "@/stores/useUserStore";
import useDictStore from "@/stores/useDictStore";
import { reactive, inject, watch, ref, onMounted, computed } from 'vue';
const { $api, navTo, navBack } = inject('globalFunction');
import { onLoad, onShow } from '@dcloudio/uni-app';
import { storeToRefs } from 'pinia';
import useUserStore from '@/stores/useUserStore';
import useDictStore from '@/stores/useDictStore';
const { userInfo } = storeToRefs(useUserStore());
const { getUserResume } = useUserStore();
const { getDictData, oneDictData } = useDictStore();
import config from "@/config.js";
import config from '@/config.js';
const showNotice = ref(true)
const showNotice = ref(true);
onLoad(() => {
getUserResume();
getUserResume();
});
function closeNotice() {
showNotice.value=false
showNotice.value = false;
}
function chooseResume() {
uni.chooseImage({
sizeType: ["original", "compressed"],
sourceType: ["album", "camera"],
count: 1,
success: ({ tempFilePaths, tempFiles }) => {
uploadResume(tempFilePaths[0], true)
.then((res) => {
res = JSON.parse(res);
getUserResume();
$api.msg("上传成功");
})
.catch((err) => {
$api.msg("上传失败");
});
},
fail: (error) => {},
});
uni.chooseImage({
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
count: 1,
success: ({ tempFilePaths, tempFiles }) => {
uploadResume(tempFilePaths[0], true)
.then((res) => {
res = JSON.parse(res);
getUserResume();
$api.msg('上传成功');
})
.catch((err) => {
$api.msg('上传失败');
});
},
fail: (error) => {},
});
}
function uploadResume(tempFilePath, loading) {
if (loading) {
uni.showLoading({
title: "请稍后",
mask: true,
if (loading) {
uni.showLoading({
title: '请稍后',
mask: true,
});
}
let Authorization = '';
if (useUserStore().token) {
Authorization = `${useUserStore().token}`;
}
const header = {};
header['Authorization'] = encodeURIComponent(Authorization);
return new Promise((resolve, reject) => {
uni.uploadFile({
url: config.baseUrl + '/app/oss/uploadToObs',
filePath: tempFilePath,
name: 'file',
header,
success: (uploadFileRes) => {
if (uploadFileRes.statusCode === 200) {
resolve(uploadFileRes.data);
} else {
reject();
}
},
fail: (err) => {
reject(err);
},
complete: () => {
if (loading) {
uni.hideLoading();
}
},
});
});
}
let Authorization = "";
if (useUserStore().token) {
Authorization = `${useUserStore().token}`;
}
const header = {};
header["Authorization"] = encodeURIComponent(Authorization);
return new Promise((resolve, reject) => {
uni.uploadFile({
url: config.baseUrl + "/app/oss/uploadToObs",
filePath: tempFilePath,
name: "file",
header,
success: (uploadFileRes) => {
if (uploadFileRes.statusCode === 200) {
resolve(uploadFileRes.data);
} else {
reject();
}
},
fail: (err) => {
reject(err);
},
complete: () => {
if (loading) {
uni.hideLoading();
}
},
});
});
}
</script>
@@ -286,7 +257,7 @@ function uploadResume(tempFilePath, loading) {
.close
width:25rpx;
height:25rpx;
.notice-line.blue{
background: #E8F1FF
color: #1677ff

View File

@@ -9,8 +9,8 @@
width: isFullScreen ? '100%' : videoWidth + 'rpx',
height: isFullScreen ? '100vh' : videoHeight + 'rpx',
}"
@touchstart="handleTouchStart"
@touchmove="handleTouchMove"
@touchstart.passive="handleTouchStart"
@touchmove.passive="handleTouchMove"
@touchend="handleTouchEnd"
@touchmove.stop.prevent
>
@@ -187,4 +187,4 @@ defineExpose({ open });
background: rgba(255, 255, 255, 0.2);
border-radius: 4rpx;
}
</style>
</style>

View File

@@ -148,7 +148,7 @@
<view
class="input_vio"
@touchstart.prevent="handleTouchStart"
@touchmove="handleTouchMove"
@touchmove.passive="handleTouchMove"
@touchend="handleTouchEnd"
@touchcancel="handleTouchCancel"
:catchtouchstart="true"

View File

@@ -3,8 +3,21 @@
<view class="app-container">
<!-- 主体内容区域 -->
<view class="container-main">
<swiper class="swiper" :current="state.current" @change="changeSwiperType">
<swiper-item class="swiper-item" v-for="(_, index) in 2" :key="index">
<swiper
class="swiper"
:disable-touch="disableTouch"
:current="state.current"
@change="changeSwiperType"
>
<!-- 绑定首页和尾页 -->
<swiper-item
@touchstart.passive="handleTouchStart"
@touchmove.passive="handleTouchMove"
@touchend="disableTouch = false"
class="swiper-item"
v-for="(_, index) in 2"
:key="index"
>
<!-- #ifndef MP-WEIXIN -->
<component
:is="components[index]"
@@ -58,6 +71,11 @@ const { unreadCount } = storeToRefs(useReadMsg());
const showTabbar = ref(true);
const maskFristEntry = ref(false);
const disableTouch = ref(false);
const startPointX = ref(0);
const totalPage = 2;
const THRESHOLD = 5;
onLoad(() => {
// 判断浏览器是否有 fristEntry 第一次进入
let fristEntry = uni.getStorageSync('fristEntry') === false ? false : true; // 默认未读
@@ -85,15 +103,69 @@ const handelComponentsRef = (el, index) => {
}
};
function handleTouchStart(e) {
startPointX.value = e.touches[0].clientX;
disableTouch.value = false;
}
function handleTouchMove(e) {
const currentX = e.touches[0].clientX;
const diffX = currentX - startPointX.value;
if (state.current === 0) {
if (diffX > THRESHOLD) {
disableTouch.value = true;
} else {
disableTouch.value = false;
}
return;
}
if (state.current === totalPage - 1) {
if (diffX < -THRESHOLD) {
disableTouch.value = true;
} else {
disableTouch.value = false;
}
return;
}
disableTouch.value = false;
}
function changeShowTabbar(val) {
showTabbar.value = val;
}
//1 查看消息类型
function changeSwiperType(e) {
const newIndex = e.detail.current;
const lastIndex = state.current;
const isSwipingRight = newIndex < lastIndex;
const isSwipingLeft = newIndex > lastIndex;
if (lastIndex === 0 && isSwipingRight) {
disableTouch.value = true;
state.current = 0;
setTimeout(() => {
disableTouch.value = false;
}, 50);
return;
}
if (lastIndex === totalPage - 1 && isSwipingLeft) {
disableTouch.value = true;
state.current = lastIndex;
setTimeout(() => {
disableTouch.value = false;
}, 50);
return;
}
const index = e.detail.current;
state.current = index;
handleTabChange(index);
disableTouch.value = false;
}
function changeType(index) {
state.current = index;

View File

@@ -109,7 +109,9 @@
</template>
</tabcontrolVue>
<SelectJobs ref="selectJobsModel"></SelectJobs>
<view class="backdoor" @click="loginbackdoor">后门</view>
<view class="backdoor" @click="loginbackdoor">
<uni-icons type="gift-filled" size="30"></uni-icons>
</view>
</AppLayout>
</template>
@@ -310,8 +312,7 @@ function complete() {
.backdoor{
position: fixed;
left: 0;
top: 500rpx;
background: red
bottom: 200rpx;
}
.input-nx
position: relative

View File

@@ -49,7 +49,7 @@
</view>
<view class="card-main">
<view class="main-title">服务专区</view>
<view class="main-row btn-feel">
<view class="main-row btn-feel" @click="selectFile">
<view class="row-left">
<image class="left-img" src="@/static/icon/server1.png"></image>
<text class="left-text">实名认证</text>
@@ -106,6 +106,7 @@ import { reactive, inject, watch, ref, onMounted } from 'vue';
import { storeToRefs } from 'pinia';
import Tabbar from '@/components/tabbar/midell-box.vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import FileUploader from '@/utils/FileUploader.js';
const { $api, navTo } = inject('globalFunction');
import useUserStore from '@/stores/useUserStore';
const popup = ref(null);
@@ -133,6 +134,15 @@ function getUserstatistics() {
counts.value = resData.data;
});
}
function selectFile() {
// FileUploader.showMenuAndUpload({
// success: function (res) {
// alert('上传成功: ' + JSON.stringify(res));
// },
// });
}
function chooseFileUploadTest(pam) {}
</script>
<style lang="stylus" scoped>

View File

@@ -15,8 +15,20 @@
<!-- 主体内容区域 -->
<view class="container-main">
<swiper class="swiper" :current="state.current" @change="changeSwiperType">
<swiper-item class="swiper-item" v-for="(_, index) in 2" :key="index">
<swiper
class="swiper"
:disable-touch="disableTouch"
:current="state.current"
@change="changeSwiperType"
>
<swiper-item
class="swiper-item"
@touchstart.passive="handleTouchStart"
@touchmove.passive="handleTouchMove"
@touchend="disableTouch = false"
v-for="(_, index) in 2"
:key="index"
>
<!-- #ifndef MP-WEIXIN -->
<component :is="components[index]" :ref="(el) => handelComponentsRef(el, index)" />
<!-- #endif -->
@@ -46,6 +58,11 @@ import { storeToRefs } from 'pinia';
import { useReadMsg } from '@/stores/useReadMsg';
const { unreadCount } = storeToRefs(useReadMsg());
const disableTouch = ref(false);
const startPointX = ref(0);
const totalPage = 2;
const THRESHOLD = 5;
onShow(() => {
// 获取消息列表
useReadMsg().fetchMessages();
@@ -59,6 +76,40 @@ onMounted(() => {
handleTabChange(state.current);
});
function handleTouchStart(e) {
// 确保有触摸点
if (e.touches.length > 0) {
startPointX.value = e.touches[0].clientX;
disableTouch.value = false;
}
}
function handleTouchMove(e) {
if (e.touches.length === 0) return;
const currentX = e.touches[0].clientX;
const diffX = currentX - startPointX.value;
if (state.current === 0) {
if (diffX > THRESHOLD) {
disableTouch.value = true;
} else {
disableTouch.value = false;
}
return;
}
if (state.current === totalPage - 1) {
if (diffX < -THRESHOLD) {
disableTouch.value = true;
} else {
disableTouch.value = false;
}
return;
}
disableTouch.value = false;
}
const handelComponentsRef = (el, index) => {
if (el) {
swiperRefs[index].value = el;
@@ -66,9 +117,35 @@ const handelComponentsRef = (el, index) => {
};
// 查看消息类型
function changeSwiperType(e) {
const newIndex = e.detail.current;
const lastIndex = state.current;
const isSwipingRight = newIndex < lastIndex;
const isSwipingLeft = newIndex > lastIndex;
if (lastIndex === 0 && isSwipingRight) {
disableTouch.value = true;
state.current = 0;
setTimeout(() => {
disableTouch.value = false;
}, 50);
return;
}
if (lastIndex === totalPage - 1 && isSwipingLeft) {
disableTouch.value = true;
state.current = lastIndex;
setTimeout(() => {
disableTouch.value = false;
}, 50);
return;
}
const index = e.detail.current;
state.current = index;
handleTabChange(index);
disableTouch.value = false;
}
function changeType(index) {
state.current = index;

View File

@@ -13,8 +13,20 @@
<view class="head-item" :class="{ actived: state.current === 3 }" @click="changeType(3)">商圈附近</view>
</view>
<view class="nearby-content">
<swiper class="swiper" :current="state.current" @change="changeSwiperType">
<swiper-item class="swiper-item" v-for="(_, index) in 4" :key="index">
<swiper
class="swiper"
:disable-touch="disableTouch"
:current="state.current"
@change="changeSwiperType"
>
<swiper-item
@touchstart.passive="handleTouchStart"
@touchmove.passive="handleTouchMove"
@touchend="disableTouch = false"
class="swiper-item"
v-for="(_, index) in 4"
:key="index"
>
<!-- #ifndef MP-WEIXIN -->
<component :is="components[index]" :ref="(el) => handelComponentsRef(el, index)" />
<!-- #endif -->
@@ -49,6 +61,11 @@ const showFilter1 = ref(false);
const showFilter2 = ref(false);
const showFilter3 = ref(false);
const disableTouch = ref(false);
const startPointX = ref(0);
const totalPage = 4;
const THRESHOLD = 5;
const state = reactive({
current: 0,
all: [{}],
@@ -63,11 +80,72 @@ const handelComponentsRef = (el, index) => {
swiperRefs[index].value = el;
}
};
function handleTouchStart(e) {
// 确保有触摸点
if (e.touches.length > 0) {
startPointX.value = e.touches[0].clientX;
disableTouch.value = false;
}
}
function handleTouchMove(e) {
if (e.touches.length === 0) return;
const currentX = e.touches[0].clientX;
const diffX = currentX - startPointX.value;
if (state.current === 0) {
if (diffX > THRESHOLD) {
disableTouch.value = true;
} else {
disableTouch.value = false;
}
return;
}
if (state.current === totalPage - 1) {
if (diffX < -THRESHOLD) {
disableTouch.value = true;
} else {
disableTouch.value = false;
}
return;
}
disableTouch.value = false;
}
// 查看消息类型
function changeSwiperType(e) {
const newIndex = e.detail.current;
const lastIndex = state.current;
const isSwipingRight = newIndex < lastIndex;
const isSwipingLeft = newIndex > lastIndex;
if (lastIndex === 0 && isSwipingRight) {
disableTouch.value = true;
state.current = 0;
setTimeout(() => {
disableTouch.value = false;
}, 50);
return;
}
if (lastIndex === totalPage - 1 && isSwipingLeft) {
disableTouch.value = true;
state.current = lastIndex;
setTimeout(() => {
disableTouch.value = false;
}, 50);
return;
}
const index = e.detail.current;
state.current = index;
handleTabChange(index);
disableTouch.value = false;
}
function changeType(index) {
state.current = index;

150
utils/FileUploader.js Normal file
View File

@@ -0,0 +1,150 @@
/**
* LightApp 文件上传工具类封装
* * 使用方法:
* 1. 列表选择上传:
* FileUploader.showMenuAndUpload({ baseUrl: 'http://...' }).then(res => ...);
* * 2. 直接调用某种类型上传:
* FileUploader.directUpload({
* baseUrl: 'http://...',
* chooseType: 'chooseImageUpload'
* }).then(res => ...);
*/
import config from "@/config.js"
export default {
/**
* 默认配置
*/
defaults: {
baseUrl: config.baseUrl, // 必填API的基础路径
uploadPath: '/app/oss/upload', // 上传接口路径
fileKey: 'file',
maxSize: 10,
maxSelectNum: 1,
minTime: 3,
maxTime: 15,
transmissionType: 0, // 0-图片地址, 1-base64
},
/**
* 映射菜单索引到上传类型
*/
typeMapping: {
0: 'chooseImageUpload', // 相册
1: 'takingPicturesUpload', // 相机
2: 'takingVideoUpload', // 视频
3: 'chooseFileUpload' // 文件
},
/**
* 核心方法:调用 SDK 的 chooseFileUpload
* @param {Object} options - 配置项
* @returns {Promise}
*/
_executeUpload: function(options) {
return new Promise((resolve, reject) => {
// 合并配置
const config = {
...this.defaults,
...options
};
// 构造 SDK 需要的参数结构
const pam = {
url: config.baseUrl + config.uploadPath,
fileKey: config.fileKey,
params: config.params || {},
header: config.header || {},
chooseType: config.chooseType || 'chooseFileUpload',
transmissionType: config.transmissionType,
maxSize: config.maxSize,
maxSelectNum: config.maxSelectNum,
minTime: config.minTime,
maxTime: config.maxTime
};
// 针对特定类型的特殊处理 (参考原代码逻辑)
if (config.chooseType === 'takingPicturesUpload') {
// 原代码注释中提到: // pam1.fileKey = 'picfile';
// 如果需要特殊 fileKey 可以在这里处理
}
console.log('开始调用SDK上传, 参数:', pam);
if (typeof lightAppJssdk === 'undefined') {
const msg = 'lightAppJssdk 未定义,请在 爱山东 环境中运行';
alert(msg);
return reject(msg);
}
lightAppJssdk.uploadFile.chooseFileUpload({
arg0: pam,
success: function(data) {
// 支持传入 success 回调,也支持 Promise resolve
if (options.success) options.success(data);
console.log(data)
resolve(data);
},
fail: function(err) {
// 支持传入 fail 回调,也支持 Promise reject
if (options.fail) options.fail(err);
// 默认弹窗提示错误,可以通过 silent: true 关闭
if (!options.silent) alert(typeof err === 'object' ? JSON.stringify(
err) : err);
reject(err);
}
});
});
},
/**
* 场景1: 弹出菜单选择,然后上传 (封装了原 selectFile)
* @param {Object} options - 配置项 (需包含 baseUrl)
*/
showMenuAndUpload: function(options = {}) {
return new Promise((resolve, reject) => {
if (typeof lightAppJssdk === 'undefined') {
alert('lightAppJssdk 未定义');
return reject('lightAppJssdk undefined');
}
const menuList = options.menuList || ['相册', '相机', '视频', '文件'];
lightAppJssdk.notification.showMediaAlert({
arg0: menuList,
success: (data) => {
// data.index 对应 menuList 的索引
const selectedType = this.typeMapping[data.index];
if (!selectedType) {
const err = '未知的选择类型';
if (options.fail) options.fail(err);
return reject(err);
}
// 选中后,调用核心上传方法
this._executeUpload({
...options,
chooseType: selectedType
}).then(resolve).catch(reject);
},
fail: (err) => {
if (options.fail) options.fail(err);
if (!options.silent) alert(err);
reject(err);
}
});
});
},
/**
* 场景2: 直接上传 (不弹窗,直接调起特定类型的上传)
* @param {Object} options - 需包含 baseUrl 和 chooseType
*/
directUpload: function(options = {}) {
if (!options.chooseType) {
// 如果没传类型,默认当做普通文件上传
options.chooseType = 'chooseFileUpload';
}
return this._executeUpload(options);
}
};