Compare commits
4 Commits
main
...
577b20661a
| Author | SHA1 | Date | |
|---|---|---|---|
| 577b20661a | |||
| fc345ad26b | |||
| 95bc79b1d3 | |||
| 5b1d11eb37 |
25
.gitignore
vendored
25
.gitignore
vendored
@@ -1,26 +1 @@
|
||||
/unpackage/
|
||||
/node_modules/
|
||||
/docs/
|
||||
/.qoder/
|
||||
/.idea/
|
||||
.DS_Store
|
||||
/dist/
|
||||
/build/
|
||||
.vscode/
|
||||
*.log
|
||||
*.tmp
|
||||
*.swp
|
||||
.env
|
||||
.env.*
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
/coverage/
|
||||
/.nyc_output/
|
||||
/.turbo/
|
||||
/cache/
|
||||
/output/
|
||||
/hs_err_pid*
|
||||
*.local
|
||||
yarn.lock
|
||||
8
.idea/.gitignore
generated
vendored
8
.idea/.gitignore
generated
vendored
@@ -1,8 +0,0 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
9
.idea/ks-app-employment-service.iml
generated
9
.idea/ks-app-employment-service.iml
generated
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
8
.idea/modules.xml
generated
8
.idea/modules.xml
generated
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/ks-app-employment-service.iml" filepath="$PROJECT_DIR$/.idea/ks-app-employment-service.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
43
App.vue
43
App.vue
@@ -3,37 +3,32 @@ import { reactive, inject, onMounted } from 'vue';
|
||||
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app';
|
||||
import useUserStore from './stores/useUserStore';
|
||||
import useDictStore from './stores/useDictStore';
|
||||
import { tabbarManager } from './utils/tabbarManager';
|
||||
const { $api, navTo, appendScriptTagElement } = inject('globalFunction');
|
||||
import config from '@/config.js';
|
||||
|
||||
onLaunch((options) => {
|
||||
useUserStore().initSeesionId(); //更新
|
||||
useDictStore().getDictData();
|
||||
// uni.hideTabBar();
|
||||
|
||||
// 先尝试从缓存恢复用户信息
|
||||
const restored = useUserStore().restoreUserInfo();
|
||||
|
||||
// 用户信息恢复后再初始化自定义tabbar
|
||||
tabbarManager.initTabBar();
|
||||
|
||||
if (restored) {
|
||||
// 如果成功恢复用户信息,验证token是否有效
|
||||
let token = uni.getStorageSync('token') || '';
|
||||
if (token) {
|
||||
useUserStore()
|
||||
.loginSetToken(token)
|
||||
.then(() => {
|
||||
console.log('用户登录状态已恢复');
|
||||
})
|
||||
.catch(() => {
|
||||
// token无效,清除缓存(不跳转登录页)
|
||||
console.log('token已过期,需要重新登录');
|
||||
useUserStore().logOut(false);
|
||||
// 登录
|
||||
let token = uni.getStorageSync('token') || ''; // 同步获取 缓存信息
|
||||
if (token) {
|
||||
useUserStore()
|
||||
.loginSetToken(token)
|
||||
.then(() => {
|
||||
$api.msg('登录成功');
|
||||
})
|
||||
.catch(() => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login',
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login',
|
||||
});
|
||||
}
|
||||
// 不再强制跳转到登录页,而是在需要登录时弹出授权弹窗
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
@@ -58,8 +53,6 @@ onHide(() => {
|
||||
/*每个页面公共css */
|
||||
@import '@/common/animation.css';
|
||||
@import '@/common/common.css';
|
||||
/* 引入阿里图标库 */
|
||||
@import url("/static/iconfont/iconfont.css");
|
||||
/* 修改pages tabbar样式 H5有效 */
|
||||
.uni-tabbar .uni-tabbar__item:nth-child(4) .uni-tabbar__bd .uni-tabbar__icon {
|
||||
height: 110rpx !important;
|
||||
@@ -88,7 +81,6 @@ uni-modal,
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
/* #ifdef H5 */
|
||||
@font-face {
|
||||
font-family: PingFangSC-Regular;
|
||||
src: url('https://qd.zhaopinzao8dian.com/file/csn/PingFangSC-Regular.woff2') format('woff2');
|
||||
@@ -106,7 +98,6 @@ uni-modal,
|
||||
src: url('https://qd.zhaopinzao8dian.com/file/csn/DIN-Medium.woff2') format('woff2');
|
||||
font-display: swap;
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
body {
|
||||
font-family: 'PingFangSC-Regular', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
|
||||
@@ -1,514 +0,0 @@
|
||||
// 获取人员基本信息详情
|
||||
|
||||
|
||||
|
||||
// import { post, get } from '../../utils/request.js'
|
||||
|
||||
// export function getPersonInfo(id) {
|
||||
// return get({
|
||||
// url: `personnel/personBaseInfo/${id}`,
|
||||
// method: 'get'
|
||||
// })
|
||||
// }
|
||||
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 根据 userId 获取企业详情
|
||||
export function companyDetails(userId) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: `/company/unitBaseInfo/user/${userId}`,
|
||||
})
|
||||
}
|
||||
|
||||
// 企业-推荐人员信息
|
||||
export function recommendedPerson(params) {
|
||||
return request({
|
||||
url: '/company/unitBaseInfo/recommend/person',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 人员邀请
|
||||
export function invitePerson(params) {
|
||||
return request({
|
||||
url: '/company/unitBaseInfo/invite',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 获取企业招聘岗位列表
|
||||
export function jobList(params) {
|
||||
return request({
|
||||
url: '/company/unitPostInfo/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 查找已投递、已推荐、已邀请的人员信息
|
||||
export function listMatch(query) {
|
||||
return request({
|
||||
url: '/company/unitBaseInfo/relevance',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 添加企业基本信息
|
||||
export function addJobBase(data) {
|
||||
return request({
|
||||
url: '/company/unitBaseInfo',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 查询部门下拉树结构
|
||||
export function deptTreeSelect() {
|
||||
return request({
|
||||
url: '/system/center/user/deptTree',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 企业发布招聘岗位
|
||||
export function addJob(data) {
|
||||
return request({
|
||||
url: '/company/unitPostInfo',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 获取招聘工种列表
|
||||
export function jobTypeList(params) {
|
||||
return request({
|
||||
url: '/basicdata/workType/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 企业基本信息列表
|
||||
export function jobBaseList(query) {
|
||||
return request({
|
||||
url: '/company/unitBaseInfo/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 获取企业招聘岗位信息详细信息
|
||||
export function getJob(id) {
|
||||
return request({
|
||||
url: `/company/unitPostInfo/${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
// 修改企业招聘岗位信息
|
||||
export function updateJob(data) {
|
||||
return request({
|
||||
url: '/company/unitPostInfo',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改企业基本信息
|
||||
export function updateJobBase(data) {
|
||||
return request({
|
||||
url: '/company/unitBaseInfo',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 查询角色详细
|
||||
export function getJobService(id) {
|
||||
return request({
|
||||
url: '/personnel/personBaseInfo/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询推荐人员、已推荐、已邀请 详情
|
||||
export function getUnitBaseInfo(id) {
|
||||
return request({
|
||||
url: '/manage/personDemand/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 查询工种列表
|
||||
export function listJobType(query) {
|
||||
return request({
|
||||
url: '/basicdata/workType/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 人员基本信息 - 列表
|
||||
export function personInfoList(query) {
|
||||
return request({
|
||||
url: '/personnel/personBaseInfo/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 获取人员基本信息详情
|
||||
export function getPersonInfo(id) {
|
||||
return request({
|
||||
url: `/personnel/personBaseInfo/${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 删除人员基本信息
|
||||
export function delPersonInfo(ids) {
|
||||
return request({
|
||||
url: '/personnel/personBaseInfo/' + ids,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 删除录入人员 公用 type = 1 失业中 2 就业困难 3 离校生 4 其他人员
|
||||
export function delPersonUser(ids) {
|
||||
return request({
|
||||
url: `/personnel/personInputInfo/${ids}`,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
||||
// 新增人员基本信息
|
||||
export function addPersonInfo(data) {
|
||||
return request({
|
||||
url: '/personnel/personBaseInfo',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改人员基本信息
|
||||
export function updatePersonInfo(data) {
|
||||
return request({
|
||||
url: '/personnel/personBaseInfo',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
//社区人员审核
|
||||
export function personInfoAudit(data) {
|
||||
return request({
|
||||
url: '/personnel/personBaseInfo/audit',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//记录查看身份证
|
||||
export function recordLookIdCard(params) {
|
||||
return request({
|
||||
url: '/personnel/personBaseInfo/recordLookIdCard',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* 失业人员 --------------------------------------------- start */
|
||||
|
||||
// 新增失业人员
|
||||
export function addPersonUnemployed(data) {
|
||||
return request({
|
||||
url: '/person/unemployment',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 失业人员修改
|
||||
export function updatePersonUnemployed(data) {
|
||||
return request({
|
||||
url: '/person/unemployment',
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 失业人员列表
|
||||
export function unemployment(params) {
|
||||
return request({
|
||||
url: '/person/unemployment/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 失业人员详情
|
||||
export function unemploymentDetails(id) {
|
||||
return request({
|
||||
url: `/person/unemployment/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 失业人员删除
|
||||
export function unemploymentDelete(id) {
|
||||
return request({
|
||||
url: `/person/unemployment/${id}`,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
||||
/* 失业人员 --------------------------------------------- end */
|
||||
|
||||
|
||||
/* 就业困难人员 --------------------------------------------- start */
|
||||
|
||||
// 新增就业困难
|
||||
export function addPersonDifficult(data) {
|
||||
return request({
|
||||
url: '/person/findingEmployment',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改就业困难
|
||||
export function updatePersonDifficult(data) {
|
||||
return request({
|
||||
url: '/person/findingEmployment',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 就业困难列表
|
||||
export function findingEmployment(params) {
|
||||
return request({
|
||||
url: '/person/findingEmployment/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 就业困难详情
|
||||
export function findingEmploymentDetails(id) {
|
||||
return request({
|
||||
url: `/person/findingEmployment/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 就业困难删除
|
||||
export function findingEmploymentDelete(id) {
|
||||
return request({
|
||||
url: `/person/findingEmployment/${id}`,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
/* 就业困难人员 --------------------------------------------- end */
|
||||
|
||||
|
||||
/* 离校未就业高校生 --------------------------------------------- start */
|
||||
|
||||
// 新增离校未就业高校生
|
||||
export function addLeaveSchool(data) {
|
||||
return request({
|
||||
url: '/person/leavingSchoolInfo',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改离校未就业高校生
|
||||
export function updateLeaveSchool(data) {
|
||||
return request({
|
||||
url: '/person/leavingSchoolInfo',
|
||||
method: 'put',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 高校未就业列表
|
||||
export function leavingSchoolInfo(params) {
|
||||
return request({
|
||||
url: '/person/leavingSchoolInfo/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 高校未就业详情
|
||||
export function leavingSchoolInfoDetails(id) {
|
||||
return request({
|
||||
url: `/person/leavingSchoolInfo/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 高校未就业删除
|
||||
export function leavingSchoolInfoDelete(id) {
|
||||
return request({
|
||||
url: `/person/leavingSchoolInfo/${id}`,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/* 离校未就业高校生 --------------------------------------------- end */
|
||||
|
||||
/* 其他人员 --------------------------------------------- start */
|
||||
|
||||
// 新增其他人员
|
||||
export function addOther(data) {
|
||||
return request({
|
||||
url: '/person/other',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 其他人员修改
|
||||
export function updateOther(data) {
|
||||
return request({
|
||||
url: '/person/other',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 其他人员列表
|
||||
export function other(params) {
|
||||
return request({
|
||||
url: '/person/other/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 其他人员详情
|
||||
export function otherDetails(id) {
|
||||
return request({
|
||||
url: `/person/other/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 其他人员删除
|
||||
export function otherDelete(id) {
|
||||
return request({
|
||||
url: `/person/other/${id}`,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
/* 其他人员 --------------------------------------------- end */
|
||||
|
||||
// 需求预警列表
|
||||
export function personAlertList(params) {
|
||||
return request({
|
||||
url: '/manage/personDemand/warningList',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
export function personDealList(params) {
|
||||
return request({
|
||||
url: '/manage/personDemand/dealingList',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
// 服务追踪 服务类型/服务id
|
||||
export function serviceTraceability({
|
||||
demandType,
|
||||
id
|
||||
}) {
|
||||
return request({
|
||||
// url: `/system/personRequirementsRecords/serviceTraceability/${demandType}/${id}`,
|
||||
url: `/timelime/timelime/fwzs/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 需求办结
|
||||
export function requirementCompletion(url, data) {
|
||||
return request({
|
||||
url,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
//岗位审核
|
||||
export function jobAudit(data) {
|
||||
return request({
|
||||
url: '/company/unitPostInfo/audit',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
//社群 首页未完成数
|
||||
// export function getPeopleCount() {
|
||||
// return request({
|
||||
// url: '/pc/index/getPeopleCount',
|
||||
// method: 'get',
|
||||
// })
|
||||
// }
|
||||
|
||||
//社群 首页未完成数
|
||||
export function getDemandUnfinished() {
|
||||
return request({
|
||||
url: '/pc/index/todo',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 删除企业招聘岗位信息
|
||||
export function delJob(ids) {
|
||||
return request({
|
||||
url: '/company/unitPostInfo/' + ids,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 所在社区列表
|
||||
export function deptList(params) {
|
||||
return request({
|
||||
'url': `/system/center/user/deptList`,
|
||||
'method': 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 所在社区列表
|
||||
export function returnPerson(params) {
|
||||
return request({
|
||||
'url': `/personnel/personBaseInfo/returnPerson`,
|
||||
'method': 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
// 根据人的身份证查询人的详细信息
|
||||
export function getIdNumberInfo(params) {
|
||||
return request({
|
||||
'url': `/personnel/personBaseInfo/getIdNumberInfo`,
|
||||
'method': 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* @Date: 2025-10-31 11:06:15
|
||||
* @LastEditors: lip
|
||||
* @LastEditTime: 2025-11-03 12:48:22
|
||||
*/
|
||||
// import { post, get } from '@/utilsRc/request'
|
||||
|
||||
import request from '@/utilsRc/request'
|
||||
export function listJobType(query) {
|
||||
return request({
|
||||
url: '/basicdata/workType/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* @Date: 2025-10-31 11:06:15
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-12-16 16:29:33
|
||||
*/
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 登录方法
|
||||
export function login(data) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/not/login/person/zkrLogin',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
// 登录方法
|
||||
export function loginByUserId(data) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/ksSso/getTjmhTokenById?userId='+data,
|
||||
// params: data,
|
||||
})
|
||||
}
|
||||
export function smsLogin(data) {
|
||||
return request({
|
||||
method: 'post',
|
||||
url: '/personnel/personBaseInfo/loginGrAndQy',
|
||||
data,
|
||||
headers: {
|
||||
isToken: false
|
||||
}
|
||||
})
|
||||
}
|
||||
export function wechatLogin(data) {
|
||||
return request({
|
||||
method: 'post',
|
||||
url: '/personnel/personBaseInfo/loginGrAndQy',
|
||||
data,
|
||||
headers: {
|
||||
isToken: false
|
||||
}
|
||||
})
|
||||
}
|
||||
export function register(data) {
|
||||
return request({
|
||||
method: 'post',
|
||||
url: '/personnel/personBaseInfo/loginGrAndQy',
|
||||
data,
|
||||
headers: {
|
||||
isToken: false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 身份证号码登录
|
||||
export function idCardLogin(data) {
|
||||
return request({
|
||||
method: 'post',
|
||||
url: '/app/idCardLogin',
|
||||
data,
|
||||
headers: {
|
||||
isToken: false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 手机号登录
|
||||
export function phoneLogin(data) {
|
||||
return request({
|
||||
method: 'post',
|
||||
url: '/app/phoneLogin',
|
||||
data,
|
||||
headers: {
|
||||
isToken: false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 获取用户详细信息
|
||||
export function getInfo() {
|
||||
return request({
|
||||
url: '/getInfo',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* @Date: 2024-09-25 11:14:29
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-11-04 08:56:51
|
||||
*/
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 查询援助需求列表
|
||||
export function listAssistService(query) {
|
||||
return request({
|
||||
url: '/demand/personAssistDemandInfo/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询援助需求详细
|
||||
export function getAssistService(ids) {
|
||||
return request({
|
||||
url: '/demand/personAssistDemandInfo/' + ids,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增援助需求
|
||||
export function addAssistService(data) {
|
||||
return request({
|
||||
url: '/demand/personAssistDemandInfo',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改援助需求
|
||||
export function updateAssistService(data) {
|
||||
return request({
|
||||
url: '/demand/personAssistDemandInfo',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除援助需求
|
||||
export function delAssistService(ids) {
|
||||
return request({
|
||||
url: '/manage/personDemand/' + ids,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 个人援助需求办结
|
||||
export function finishAssistService(data) {
|
||||
return request({
|
||||
url: '/demand/personAssistDemandInfo/assistDone',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* @Date: 2024-09-25 11:14:29
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-11-04 08:56:35
|
||||
*/
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 查询创业需求列表
|
||||
export function listEntrepreneurshipService(query) {
|
||||
return request({
|
||||
url: '/demand/personEntrepreneurshipDemandInfo/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询创业需求详细
|
||||
export function getEntrepreneurshipService(ids) {
|
||||
return request({
|
||||
url: '/demand/personEntrepreneurshipDemandInfo/' + ids,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增创业需求
|
||||
export function addEntrepreneurshipService(data) {
|
||||
return request({
|
||||
url: '/demand/personEntrepreneurshipDemandInfo',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改创业需求
|
||||
export function updateEntrepreneurshipService(data) {
|
||||
return request({
|
||||
url: '/demand/personEntrepreneurshipDemandInfo',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除创业需求
|
||||
export function delEntrepreneurshipService(ids) {
|
||||
return request({
|
||||
url: '/manage/personDemand/' + ids,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 个人援助需求办结
|
||||
export function finishEntrepreneurshipService(data) {
|
||||
return request({
|
||||
url: '/demand/personEntrepreneurshipDemandInfo/entrepreneurshipDone',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* @Date: 2025-04-07 14:23:47
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-11-04 08:56:39
|
||||
*/
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 查询求职需求列表
|
||||
export function listJobService(query) {
|
||||
return request({
|
||||
url: '/manage/personDemand/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询求职需求详细
|
||||
export function getJobService(ids) {
|
||||
return request({
|
||||
url: '/manage/personDemand/' + ids,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增求职需求
|
||||
export function addJobService(data) {
|
||||
return request({
|
||||
url: '/manage/personDemand',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改求职需求
|
||||
export function updateJobService(data) {
|
||||
return request({
|
||||
url: '/manage/personDemand',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除求职需求
|
||||
export function delJobService(ids) {
|
||||
return request({
|
||||
url: '/manage/personDemand/' + ids,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
//查询服务次数
|
||||
export function serviceTraceability(userId) {
|
||||
return request({
|
||||
url: '/timelime/timelime/getFwcs/' + userId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* @Date: 2024-09-25 11:14:29
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-11-04 08:56:42
|
||||
*/
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 查询其他需求列表
|
||||
export function listOtherService(query) {
|
||||
return request({
|
||||
url: '/demand/personOtherDemandInfo/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询其他需求详细
|
||||
export function getOtherService(ids) {
|
||||
return request({
|
||||
url: '/demand/personOtherDemandInfo/' + ids,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增其他需求
|
||||
export function addOtherService(data) {
|
||||
return request({
|
||||
url: '/demand/personOtherDemandInfo',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改其他需求
|
||||
export function updateOtherService(data) {
|
||||
return request({
|
||||
url: '/demand/personOtherDemandInfo',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除其他需求
|
||||
export function delOtherService(ids) {
|
||||
return request({
|
||||
url: '/manage/personDemand/' + ids,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 个人援助需求办结
|
||||
export function finishOtherService(data) {
|
||||
return request({
|
||||
url: '/demand/personOtherDemandInfo/otherDemandDone',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* @Date: 2025-10-31 11:06:15
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-11-05 15:33:21
|
||||
*/
|
||||
// 人员接口
|
||||
// import { post, get } from '@/utilsRc/request'
|
||||
import request from '@/utilsRc/request'
|
||||
export function getPersonBase(params) {
|
||||
return request({
|
||||
url: '/personnel/personBaseInfo/list',
|
||||
method: 'get',
|
||||
|
||||
params
|
||||
})
|
||||
}
|
||||
export function getPersonList(params) {
|
||||
return request({
|
||||
url: '/personnel/personBaseInfo/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 新增角色
|
||||
export function addInvestigate(data) {
|
||||
return request({
|
||||
// url: '//process/processInterview',
|
||||
url: '/timelime/timelime',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* @Date: 2025-11-03 08:48:44
|
||||
* @LastEditors: lip
|
||||
* @LastEditTime: 2025-11-03 12:48:41
|
||||
*/
|
||||
// 查询个人需求信息列表
|
||||
// import { post, get } from '@/utilsRc/request'
|
||||
import request from '@/utilsRc/request'
|
||||
export function listPersonDemand(query) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/manage/personDemand/list',
|
||||
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function delPersonDemand(id) {
|
||||
return request({
|
||||
url: '/manage/personDemand/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 查询个人需求信息详细
|
||||
export function getPersonDemand(id) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/manage/personDemand/' + id,
|
||||
})
|
||||
}
|
||||
|
||||
// 新增个人需求信息
|
||||
export function addPersonDemand(data) {
|
||||
// 确保传递数据前进行日志输出
|
||||
console.log('addPersonDemand函数接收到的数据:', data);
|
||||
return request({
|
||||
url: '/manage/personDemand',
|
||||
method: 'post', // 修改为大写POST,确保请求参数正确传递
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改个人需求信息
|
||||
export function updatePersonDemand(data) {
|
||||
return request({
|
||||
url: '/manage/personDemand',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* @Date: 2024-09-25 11:14:29
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-11-04 08:56:47
|
||||
*/
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 查询培训需求列表
|
||||
export function listTrainService(query) {
|
||||
return request({
|
||||
url: '/demand/personTrainDemandInfo/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询培训需求详细
|
||||
export function getTrainService(ids) {
|
||||
return request({
|
||||
url: '/demand/personTrainDemandInfo/' + ids,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增培训需求
|
||||
export function addTrainService(data) {
|
||||
return request({
|
||||
url: '/demand/personTrainDemandInfo',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改培训需求
|
||||
export function updateTrainService(data) {
|
||||
return request({
|
||||
url: '/demand/personTrainDemandInfo',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除培训需求
|
||||
export function delTrainService(ids) {
|
||||
return request({
|
||||
url: '/manage/personDemand/' + ids,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* @Date: 2025-10-31 13:50:15
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-10-31 14:30:31
|
||||
*/
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 人员信息保存
|
||||
export function savePersonBase(data) {
|
||||
return request({
|
||||
'url': '/personnel/personBaseInfo',
|
||||
'method': 'put',
|
||||
'data': data
|
||||
})
|
||||
}
|
||||
|
||||
// 人员信息查询
|
||||
export function getPersonBase(userId) {
|
||||
return request({
|
||||
'url': `/personnel/personBaseInfo/user/${userId}`,
|
||||
'method': 'get',
|
||||
})
|
||||
}
|
||||
// 获取行政区划列表
|
||||
export function getQUList() {
|
||||
return request({
|
||||
url: `/manage/xzqh//xzqhTree`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
// 查询部门下拉树结构
|
||||
export function deptTreeSelect() {
|
||||
return request({
|
||||
url: '/system/center/user/deptTree',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 社群端 根据所在社区 获取姓名
|
||||
export function generateUserName(deptId) {
|
||||
return request({
|
||||
url: `/generateUserName/${deptId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取部门列表
|
||||
export function getDeptList(name,personId) {
|
||||
return request({
|
||||
url: `/system/center/user/getDeptList?name=${name}&parentId=${personId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
// 求职工种列表
|
||||
export function touristWork() {
|
||||
return request({
|
||||
url: `/basicdata/workType/workTypeTree`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
// 获取招聘工种列表
|
||||
export function jobTypeList(params) {
|
||||
return request({
|
||||
url: '/basicdata/workType/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
// 未读消息数量
|
||||
|
||||
export function unreadNum() {
|
||||
return request({
|
||||
url: '/manage/tjgw/notReadNum',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
// 地图类型列表
|
||||
export function jyshdt(cyfhjd) {
|
||||
return request({
|
||||
url: `/jyshdt/jyshdt/queryList?lx=${cyfhjd}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* @Descripttion:
|
||||
* @Author: lip
|
||||
* @Date: 2025-11-03 12:35:56
|
||||
* @LastEditors: shirlwang
|
||||
*/
|
||||
// import { post, get } from '../../utils/request.js'
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 登录方法
|
||||
export function personInfoList(data) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/personnel/personBaseInfo/list',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
// 需求预警列表
|
||||
export function personAlertList(params) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/manage/personDemand/warningList',
|
||||
|
||||
params
|
||||
})
|
||||
}
|
||||
//经办人数据获取
|
||||
export function getJbrInfo() {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: `/system/center/user/selectHxjbr`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
export function getPersonBase() {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: `/system/center/user/selectHxjbr`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
export function returnPerson(params) {
|
||||
return request({
|
||||
method: 'get',
|
||||
'url': `/personnel/personBaseInfo/returnPerson`,
|
||||
|
||||
params
|
||||
})
|
||||
}
|
||||
export function getStatistic(params) {
|
||||
return request({
|
||||
method: 'get',
|
||||
'url': `/pc/index/fwqkfx`,
|
||||
params
|
||||
})
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* @Date: 2024-09-25 11:14:29
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-12-23 17:40:11
|
||||
* @Description: 职业路径相关接口
|
||||
*/
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 获取当前职位
|
||||
export function getCurrentPosition(query) {
|
||||
return request({
|
||||
url: '/jobPath/getJob',
|
||||
method: 'get',
|
||||
params: query,
|
||||
baseUrlType: 'zytp'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取路径列表
|
||||
export function getPath(query) {
|
||||
return request({
|
||||
url: '/jobPath/getJobPathList',
|
||||
method: 'get',
|
||||
params: query,
|
||||
baseUrlType: 'zytp'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取路径详情
|
||||
export function getPathDetail(query) {
|
||||
return request({
|
||||
url: '/jobPath/getJobPathById',
|
||||
method: 'get',
|
||||
params: query,
|
||||
baseUrlType: 'zytp'
|
||||
})
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* @Date: 2024-09-25 11:14:29
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-12-23 17:40:11
|
||||
* @Description: 职业推荐相关接口
|
||||
*/
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 获取职业列表
|
||||
export function getProfessions(query) {
|
||||
return request({
|
||||
url: '/jobSimilarity/getJob',
|
||||
method: 'get',
|
||||
params: query,
|
||||
baseUrlType: 'zytp'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取技能标签
|
||||
export function getSkillTags(query) {
|
||||
return request({
|
||||
url: '/jobSkillDet/getJobSkill',
|
||||
method: 'get',
|
||||
params: query,
|
||||
baseUrlType: 'zytp'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取推荐职业
|
||||
export function getRecommend(query) {
|
||||
return request({
|
||||
url: '/jobSimilarity/recommendJobByJobName',
|
||||
method: 'get',
|
||||
params: query,
|
||||
baseUrlType: 'zytp'
|
||||
})
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* @Date: 2024-09-25 11:14:29
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-11-04 08:56:56
|
||||
*/
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 查询角色列表
|
||||
export function listInvestigate(query) {
|
||||
return request({
|
||||
url: '/process/processInterview/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询角色详细
|
||||
export function getInvestigate(ids) {
|
||||
return request({
|
||||
url: '/process/processInterview/' + ids,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增角色
|
||||
export function addInvestigate(data) {
|
||||
return request({
|
||||
// url: '/process/processInterview',
|
||||
url: '/timelime/timelime',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改角色
|
||||
export function updateInvestigate(data) {
|
||||
return request({
|
||||
url: '/process/processInterview',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除角色
|
||||
export function delInvestigate(ids) {
|
||||
return request({
|
||||
url: '/process/processInterview/' + ids,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* @Date: 2025-11-12
|
||||
* @Description: 职业路径相关接口
|
||||
*/
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 根据职业名称获取路径列表
|
||||
export function getJobPathPage(params) {
|
||||
return request({
|
||||
url: '/jobPath/getJobPathPage',
|
||||
method: 'get',
|
||||
params,
|
||||
baseUrlType: 'zytp'
|
||||
})
|
||||
}
|
||||
|
||||
// 根据职业路径ID获取详情
|
||||
export function getJobPathDetail(params) {
|
||||
const {startJobId, endJobId} = params;
|
||||
const requestParams = {};
|
||||
if (startJobId !== undefined && startJobId !== null && startJobId !== '') {
|
||||
requestParams.startJobId = startJobId;
|
||||
}
|
||||
if (endJobId !== undefined && endJobId !== null && endJobId !== '') {
|
||||
requestParams.endJobId = endJobId;
|
||||
}
|
||||
|
||||
if (!startJobId || !endJobId) {
|
||||
return Promise.reject('缺少必需的 startJobId 和 endJobId 参数');
|
||||
}
|
||||
|
||||
return request({
|
||||
url: '/jobPath/getJobPathById',
|
||||
method: 'get',
|
||||
params: requestParams,
|
||||
baseUrlType: 'zytp'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取职业路径数量
|
||||
export function getJobPathNum() {
|
||||
return request({
|
||||
url: '/jobPath/getJobPathNum',
|
||||
method: 'get',
|
||||
baseUrlType: 'zytp'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
/*
|
||||
* @Date: 2024-09-25 11:14:29
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-12-23 17:40:11
|
||||
*/
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 查询角色列表
|
||||
export function listJobRecommend(query) {
|
||||
return request({
|
||||
url: '/process/processJobRecommend/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
// 查询角色列表
|
||||
export function getWorkListReq(query) {
|
||||
return request({
|
||||
// url: '/personnel/personBaseInfo/postRecommend',
|
||||
url: '/manage/info/postElectedList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询角色详细
|
||||
export function getJobRecommend(ids) {
|
||||
return request({
|
||||
url: '/process/processJobRecommend/' + ids,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增角色
|
||||
export function addJobRecommend(data) {
|
||||
return request({
|
||||
url: '/process/processJobRecommend',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
//岗位推荐保存和办结
|
||||
export function saveJobRecommend(data) {
|
||||
return request({
|
||||
url: '/process/processJobRecommend/createJob',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改角色
|
||||
export function updateJobRecommend(data) {
|
||||
return request({
|
||||
url: '/process/processJobRecommend',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除角色
|
||||
export function delJobRecommend(ids) {
|
||||
return request({
|
||||
url: '/process/processJobRecommend/' + ids,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取绑定的职位
|
||||
export function getAddedJobs(params) {
|
||||
return request({
|
||||
// url: '/company/postDeliverInfo/list',
|
||||
url: '/manage/info/no/permission/list',
|
||||
method: 'get',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
export function recommendJob(data) {
|
||||
const params = {};
|
||||
if (data?.jobName !== undefined && data?.jobName !== null && data?.jobName !== '') {
|
||||
params.jobName = String(data.jobName);
|
||||
}
|
||||
|
||||
return request({
|
||||
url: '/job/recommendJobByJobName',
|
||||
method: 'get',
|
||||
params: params,
|
||||
baseUrlType: 'zytp'
|
||||
})
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* @Date: 2025-11-12
|
||||
* @Description: 职业技能相关接口
|
||||
*/
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
export function getJobSkillDetail(params) {
|
||||
return request({
|
||||
url: '/jobSkillDet/getJobSkillDet',
|
||||
method: 'get',
|
||||
params,
|
||||
baseUrlType: 'zytp'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取技能权重
|
||||
export function getJobSkillWeight(params) {
|
||||
return request({
|
||||
url: '/jobSkillDet/getJobSkillWeight',
|
||||
method: 'get',
|
||||
params,
|
||||
baseUrlType: 'zytp'
|
||||
})
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* @Date: 2024-09-25 11:14:29
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-11-04 08:57:02
|
||||
*/
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 查询角色列表
|
||||
export function listJobTrack(query) {
|
||||
return request({
|
||||
url: '/process/processEmploymentTracking/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询角色详细
|
||||
export function getJobTrack(ids) {
|
||||
return request({
|
||||
url: '/process/processEmploymentTracking/' + ids,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增角色
|
||||
export function addJobTrack(data) {
|
||||
return request({
|
||||
url: '/process/processEmploymentTracking',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改角色
|
||||
export function updateJobTrack(data) {
|
||||
return request({
|
||||
url: '/process/processEmploymentTracking',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除角色
|
||||
export function delJobTrack(ids) {
|
||||
return request({
|
||||
url: '/process/processEmploymentTracking/' + ids,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* @Date: 2024-09-25 11:14:29
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-11-04 08:57:05
|
||||
*/
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 查询角色列表
|
||||
export function listPolicyConsultation(query) {
|
||||
return request({
|
||||
url: '/process/processPolicyConsult/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询角色详细
|
||||
export function getPolicyConsultation(ids) {
|
||||
return request({
|
||||
url: '/process/processPolicyConsult/' + ids,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增角色
|
||||
export function addPolicyConsultation(data) {
|
||||
return request({
|
||||
url: '/process/processPolicyConsult',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改角色
|
||||
export function updatePolicyConsultation(data) {
|
||||
return request({
|
||||
url: '/process/processPolicyConsult',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除角色
|
||||
export function delPolicyConsultation(ids) {
|
||||
return request({
|
||||
url: '/process/processPolicyConsult/' + ids,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* @Date: 2024-09-25 11:14:29
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-12-23 17:40:11
|
||||
* @Description: 技能发展相关接口
|
||||
*/
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 获取技能信息
|
||||
export function getSkill(query) {
|
||||
return request({
|
||||
url: '/jobSkillDet/getJobSkillWeight',
|
||||
method: 'get',
|
||||
params: query,
|
||||
baseUrlType: 'zytp'
|
||||
})
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* @Date: 2024-09-25 11:14:29
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-11-04 08:57:09
|
||||
*/
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 查询角色列表
|
||||
export function listSkillTrain(query) {
|
||||
return request({
|
||||
url: '/process/processSkillTraining/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询角色详细
|
||||
export function getSkillTrain(ids) {
|
||||
return request({
|
||||
url: '/process/processSkillTraining/' + ids,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增角色
|
||||
export function addSkillTrain(data) {
|
||||
return request({
|
||||
url: '/process/processSkillTraining',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改角色
|
||||
export function updateSkillTrain(data) {
|
||||
return request({
|
||||
url: '/process/processSkillTraining',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除角色
|
||||
export function delSkillTrain(ids) {
|
||||
return request({
|
||||
url: '/process/processSkillTraining/' + ids,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* @Date: 2025-10-31 15:06:34
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-11-03 12:20:28
|
||||
*/
|
||||
import request from '@/utilsRc/request'
|
||||
// 查询字典数据列表
|
||||
export function listData (query) {
|
||||
return request({
|
||||
url: '/system/dict/data/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询字典数据详细
|
||||
export function getData (dictCode) {
|
||||
return request({
|
||||
url: '/system/dict/data/' + dictCode,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 根据字典类型查询字典数据信息
|
||||
export function getDicts (dictType) {
|
||||
return request({
|
||||
url: '/system/dict/data/type/' + dictType,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
// 根据字典类型查询字典数据信息
|
||||
export function getDict (dictType) {
|
||||
return request({
|
||||
url: '/system/dict/data/type/' + dictType,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增字典数据
|
||||
export function addData (data) {
|
||||
return request({
|
||||
url: '/system/dict/data/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改字典数据
|
||||
export function updateData (data) {
|
||||
return request({
|
||||
url: '/system/dict/data',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除字典数据
|
||||
export function delData (dictCode) {
|
||||
return request({
|
||||
url: '/system/dict/data/remove' + dictCode,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 查询时间轴列表
|
||||
export function timelineList(params) {
|
||||
return request({
|
||||
url: '/timelime/timelime/timeline',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 查询时间轴详情列表
|
||||
export function timeList(params) {
|
||||
return request({
|
||||
url: '/timelime/timelime/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
//获取时间轴详细信息
|
||||
export function timeDetails(id) {
|
||||
return request({
|
||||
url: '/timelime/timelime/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* @Date: 2025-01-XX
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-12-16 16:35:06
|
||||
*/
|
||||
import request from '@/utilsRc/request'
|
||||
|
||||
// 获取用户信息(职业规划推荐用)
|
||||
export function appUserInfo() {
|
||||
return request({
|
||||
fullUrl: 'https://www.xjksly.cn/api/ks/app/user/appUserInfo',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
@echo off
|
||||
REM 清理 uni-app 项目编译缓存脚本
|
||||
|
||||
echo ================================================
|
||||
echo uni-app 项目缓存清理工具
|
||||
echo ================================================
|
||||
echo.
|
||||
|
||||
echo [提示] 此脚本将清理以下内容:
|
||||
echo 1. unpackage 编译输出目录
|
||||
echo 2. node_modules 依赖目录(如果需要)
|
||||
echo 3. HBuilderX 临时文件
|
||||
echo.
|
||||
|
||||
set /p confirm="确认清理缓存吗?(Y/N): "
|
||||
if /i not "%confirm%"=="Y" (
|
||||
echo 已取消操作
|
||||
pause
|
||||
exit
|
||||
)
|
||||
|
||||
echo.
|
||||
echo ================================================
|
||||
echo 开始清理...
|
||||
echo ================================================
|
||||
echo.
|
||||
|
||||
REM 1. 清理 unpackage 目录
|
||||
if exist "unpackage" (
|
||||
echo [1/3] 正在删除 unpackage 目录...
|
||||
rd /s /q "unpackage"
|
||||
echo 已删除 unpackage 目录
|
||||
) else (
|
||||
echo [1/3] unpackage 目录不存在,跳过
|
||||
)
|
||||
echo.
|
||||
|
||||
REM 2. 询问是否清理 node_modules
|
||||
if exist "node_modules" (
|
||||
set /p cleanNodeModules="[2/3] 检测到 node_modules 目录,是否删除?(Y/N): "
|
||||
if /i "!cleanNodeModules!"=="Y" (
|
||||
echo 正在删除 node_modules 目录...
|
||||
rd /s /q "node_modules"
|
||||
echo 已删除 node_modules 目录
|
||||
echo 提示:如需重新安装,请运行 npm install
|
||||
) else (
|
||||
echo 跳过 node_modules 目录
|
||||
)
|
||||
) else (
|
||||
echo [2/3] node_modules 目录不存在,跳过
|
||||
)
|
||||
echo.
|
||||
|
||||
REM 3. 清理 HBuilderX 临时文件
|
||||
echo [3/3] 清理 HBuilderX 临时文件...
|
||||
|
||||
REM 删除可能的临时文件和缓存
|
||||
if exist ".hbuilderx" (
|
||||
rd /s /q ".hbuilderx"
|
||||
echo 已删除 .hbuilderx 目录
|
||||
)
|
||||
|
||||
if exist ".temp" (
|
||||
rd /s /q ".temp"
|
||||
echo 已删除 .temp 目录
|
||||
)
|
||||
|
||||
if exist ".cache" (
|
||||
rd /s /q ".cache"
|
||||
echo 已删除 .cache 目录
|
||||
)
|
||||
|
||||
echo 完成
|
||||
echo.
|
||||
|
||||
echo ================================================
|
||||
echo 清理完成!
|
||||
echo ================================================
|
||||
echo.
|
||||
echo 建议操作:
|
||||
echo 1. 重启 HBuilderX
|
||||
echo 2. 重新编译项目
|
||||
echo 3. 如果清理了 node_modules,请先运行 npm install
|
||||
echo.
|
||||
echo 按任意键退出...
|
||||
pause >nul
|
||||
|
||||
@@ -111,23 +111,6 @@ class UniStorageHelper {
|
||||
return storeData.filter(item => item[fieldName] === value);
|
||||
}
|
||||
|
||||
async getRecordCount(storeName) {
|
||||
const storeData = this._storageGet(this._getStoreKey(storeName)) || [];
|
||||
return storeData.length;
|
||||
}
|
||||
|
||||
async deleteOldestRecord(storeName) {
|
||||
const storeKey = this._getStoreKey(storeName);
|
||||
const storeData = this._storageGet(storeKey) || [];
|
||||
if (storeData.length > 0) {
|
||||
// 删除第一条记录(最早的记录)
|
||||
const newData = storeData.slice(1);
|
||||
this._storageSet(storeKey, newData);
|
||||
this._log(`删除最早的记录,剩余${newData.length}条记录`);
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
/*==================
|
||||
更新/删除方法
|
||||
==================*/
|
||||
|
||||
@@ -7,42 +7,6 @@ page {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 安全区域适配 - 通用解决方案 */
|
||||
/* #ifdef MP-WEIXIN */
|
||||
.safe-area-container {
|
||||
padding-top: env(safe-area-inset-top);
|
||||
padding-left: env(safe-area-inset-left);
|
||||
padding-right: env(safe-area-inset-right);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
|
||||
.safe-area-top {
|
||||
padding-top: env(safe-area-inset-top);
|
||||
}
|
||||
|
||||
.safe-area-left {
|
||||
padding-left: env(safe-area-inset-left);
|
||||
}
|
||||
|
||||
.safe-area-right {
|
||||
padding-right: env(safe-area-inset-right);
|
||||
}
|
||||
|
||||
.safe-area-bottom {
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
|
||||
.safe-area-horizontal {
|
||||
padding-left: env(safe-area-inset-left);
|
||||
padding-right: env(safe-area-inset-right);
|
||||
}
|
||||
|
||||
.safe-area-vertical {
|
||||
padding-top: env(safe-area-inset-top);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
/* 禁止页面回弹 */
|
||||
/* html,
|
||||
body,
|
||||
|
||||
@@ -2,8 +2,7 @@ import useUserStore from "../stores/useUserStore";
|
||||
import {
|
||||
request,
|
||||
createRequest,
|
||||
uploadFile,
|
||||
myRequest
|
||||
uploadFile
|
||||
} from "../utils/request";
|
||||
import streamRequest, {
|
||||
chatRequest
|
||||
@@ -50,8 +49,7 @@ const prePage = () => {
|
||||
return prePage.$vm;
|
||||
}
|
||||
|
||||
// export const urls ='http://10.110.145.145/images/train/'
|
||||
export const urls ='https://www.xjksly.cn/images/train/'
|
||||
|
||||
|
||||
/**
|
||||
* 页面跳转封装,支持 query 参数传递和返回回调
|
||||
@@ -69,28 +67,9 @@ export const navTo = function(url, {
|
||||
const userStore = useUserStore();
|
||||
|
||||
if (needLogin && !userStore.hasLogin) {
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length >= 10) {
|
||||
uni.redirectTo({
|
||||
url: '/packageA/pages/complete-info/complete-info',
|
||||
fail: (err) => {
|
||||
console.error('页面跳转失败:', err);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: '/packageA/pages/complete-info/complete-info',
|
||||
fail: (err) => {
|
||||
console.error('页面跳转失败:', err);
|
||||
uni.redirectTo({
|
||||
url: '/packageA/pages/complete-info/complete-info',
|
||||
fail: (err2) => {
|
||||
console.error('redirectTo也失败:', err2);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/login'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -105,30 +84,9 @@ export const navTo = function(url, {
|
||||
currentPage.__onBackCallback__ = onBack;
|
||||
}
|
||||
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length >= 10) {
|
||||
// 页面栈已满,使用redirectTo替代
|
||||
uni.redirectTo({
|
||||
url: finalUrl,
|
||||
fail: (err) => {
|
||||
console.error('页面跳转失败:', err);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: finalUrl,
|
||||
fail: (err) => {
|
||||
console.error('页面跳转失败:', err);
|
||||
// 失败后尝试redirectTo
|
||||
uni.redirectTo({
|
||||
url: finalUrl,
|
||||
fail: (err2) => {
|
||||
console.error('redirectTo也失败:', err2);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: finalUrl
|
||||
});
|
||||
};
|
||||
|
||||
export const navBack = function({
|
||||
@@ -927,15 +885,13 @@ export const $api = {
|
||||
uploadFile,
|
||||
formatFileSize,
|
||||
sendingMiniProgramMessage,
|
||||
copyText,
|
||||
myRequest
|
||||
copyText
|
||||
}
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
$api,
|
||||
urls,
|
||||
navTo,
|
||||
navBack,
|
||||
cloneDeep,
|
||||
@@ -960,4 +916,4 @@ export default {
|
||||
insertSortData,
|
||||
isInWechatMiniProgramWebview,
|
||||
isEmptyObject,
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
>
|
||||
<!-- 顶部头部区域 -->
|
||||
<view
|
||||
v-if="title"
|
||||
class="container-header"
|
||||
:style="border ? { borderBottom: `2rpx solid ${borderColor}` } : { borderBottom: 'none' }"
|
||||
>
|
||||
@@ -50,7 +49,7 @@ const emit = defineEmits(['onScrollBottom']);
|
||||
defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
default: '',
|
||||
default: '标题',
|
||||
},
|
||||
border: {
|
||||
type: Boolean,
|
||||
@@ -90,10 +89,6 @@ const handleScrollToLower = () => {
|
||||
width: 100vw;
|
||||
height: calc(100% - var(--window-bottom));
|
||||
overflow: hidden;
|
||||
/* H5环境安全区域适配 */
|
||||
/* #ifdef H5 */
|
||||
height: 100vh;
|
||||
/* #endif */
|
||||
}
|
||||
.app-container {
|
||||
// background-image: url('@/static/icon/background2.png');
|
||||
@@ -144,13 +139,7 @@ const handleScrollToLower = () => {
|
||||
.container-main {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
/* #ifdef H5 */
|
||||
.container-main {
|
||||
padding-bottom: 120rpx!important;
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
.main-scroll {
|
||||
width: 100%;
|
||||
|
||||
@@ -1,355 +0,0 @@
|
||||
<template>
|
||||
<view class="custom-tabbar">
|
||||
<view
|
||||
class="tabbar-item"
|
||||
v-for="(item, index) in tabbarList"
|
||||
:key="index"
|
||||
@click.stop="switchTab(item, index)"
|
||||
@tap.stop="switchTab(item, index)"
|
||||
>
|
||||
<view class="tabbar-icon">
|
||||
<image
|
||||
:src="currentItem === item.id ? item.selectedIconPath : item.iconPath"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
<view class="badge" v-if="item.badge && item.badge > 0">{{ item.badge }}</view>
|
||||
<view class="tabbar-text" :class="{ 'active': currentItem === item.id }">
|
||||
{{ item.text }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, watch, onMounted } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import useUserStore from '@/stores/useUserStore';
|
||||
import { useReadMsg } from '@/stores/useReadMsg';
|
||||
import { checkLoginAndNavigate } from '@/utils/loginHelper';
|
||||
|
||||
const props = defineProps({
|
||||
currentPage: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
});
|
||||
|
||||
const userStore = useUserStore();
|
||||
const { userInfo } = storeToRefs(userStore);
|
||||
const readMsg = useReadMsg();
|
||||
const currentItem = ref(props.currentPage);
|
||||
|
||||
// 监听props变化
|
||||
watch(() => props.currentPage, (newPage) => {
|
||||
currentItem.value = newPage;
|
||||
});
|
||||
|
||||
// 生成tabbar配置的函数
|
||||
const generateTabbarList = () => {
|
||||
const baseItems = [
|
||||
{
|
||||
id: 0,
|
||||
text: '职位',
|
||||
path: '/pages/index/index',
|
||||
iconPath: '/static/tabbar/calendar.png',
|
||||
selectedIconPath: '/static/tabbar/calendared.png',
|
||||
centerItem: false,
|
||||
badge: readMsg.badges[0]?.count || 0,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
text: 'AI+',
|
||||
path: '/pages/chat/chat',
|
||||
iconPath: '/static/tabbar/logo3.png',
|
||||
selectedIconPath: '/static/tabbar/logo3.png',
|
||||
centerItem: true,
|
||||
badge: readMsg.badges[2]?.count || 0,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
text: '消息',
|
||||
path: '/pages/msglog/msglog',
|
||||
iconPath: '/static/tabbar/chat4.png',
|
||||
selectedIconPath: '/static/tabbar/chat4ed.png',
|
||||
centerItem: false,
|
||||
badge: readMsg.badges[3]?.count || 0,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
text: '我的',
|
||||
path: '/pages/mine/mine',
|
||||
iconPath: '/static/tabbar/mine.png',
|
||||
selectedIconPath: '/static/tabbar/mined.png',
|
||||
centerItem: false,
|
||||
badge: readMsg.badges[4]?.count || 0,
|
||||
},
|
||||
];
|
||||
|
||||
// 获取用户类型,统一使用isCompanyUser字段(0=企业用户,1=求职者, 3=网格员)
|
||||
// 优先从store获取,如果为空则直接从缓存获取
|
||||
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
|
||||
|
||||
// 获取isCompanyUser字段
|
||||
const storeIsCompanyUser = userInfo.value?.isCompanyUser;
|
||||
const cachedIsCompanyUser = cachedUserInfo.isCompanyUser;
|
||||
|
||||
// 获取用户类型的逻辑:
|
||||
// 1. 优先使用store中的isCompanyUser
|
||||
// 2. 如果store中没有,使用缓存中的isCompanyUser
|
||||
// 3. 最后默认为1(求职者)
|
||||
const userType = Number(storeIsCompanyUser !== undefined ? storeIsCompanyUser : (cachedIsCompanyUser !== undefined ? cachedIsCompanyUser : 1));
|
||||
if (userType === 0 || userType === 2) {
|
||||
// 企业用户:显示发布岗位
|
||||
baseItems.splice(1, 0, {
|
||||
id: 1,
|
||||
text: '发布岗位',
|
||||
path: '/packageA/pages/job/publishJob',
|
||||
iconPath: '/static/tabbar/post.png',
|
||||
selectedIconPath: '/static/tabbar/posted.png',
|
||||
centerItem: false,
|
||||
badge: 0,
|
||||
});
|
||||
} else {
|
||||
// 求职者用户(包括未登录状态):显示招聘会
|
||||
// H5端隐藏招聘会
|
||||
// #ifndef H5
|
||||
// baseItems.splice(1, 0, {
|
||||
// id: 1,
|
||||
// text: '招聘会',
|
||||
// path: '/pages/careerfair/careerfair',
|
||||
// iconPath: '/static/tabbar/post.png',
|
||||
// selectedIconPath: '/static/tabbar/posted.png',
|
||||
// centerItem: false,
|
||||
// badge: readMsg.badges[1]?.count || 0,
|
||||
// });
|
||||
// #endif
|
||||
}
|
||||
if (userType === 0) {
|
||||
baseItems.splice(2, 0, {
|
||||
id: 5,
|
||||
text: '招聘会',
|
||||
path: '/pages/careerfair/careerfair',
|
||||
iconPath: '/static/tabbar/careerfair.png',
|
||||
selectedIconPath: '/static/tabbar/careerfaired.png',
|
||||
centerItem: false,
|
||||
badge: 0,
|
||||
});
|
||||
}
|
||||
return baseItems;
|
||||
};
|
||||
|
||||
// 根据用户类型生成不同的导航栏配置
|
||||
const tabbarList = computed(() => {
|
||||
return generateTabbarList();
|
||||
});
|
||||
|
||||
// 强制刷新tabbar的方法
|
||||
const forceRefresh = () => {
|
||||
// 触发响应式更新
|
||||
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
|
||||
const currentUserType = userInfo.value?.isCompanyUser !== undefined ? userInfo.value.isCompanyUser : (cachedUserInfo.isCompanyUser !== undefined ? cachedUserInfo.isCompanyUser : 1);
|
||||
};
|
||||
|
||||
// 监听用户类型变化(只监听isCompanyUser字段)
|
||||
watch(() => userInfo.value?.isCompanyUser, (newIsCompanyUser, oldIsCompanyUser) => {
|
||||
if (newIsCompanyUser !== oldIsCompanyUser) {
|
||||
// 强制触发computed重新计算
|
||||
forceRefresh();
|
||||
}
|
||||
}, { immediate: true });
|
||||
|
||||
// 监听用户信息变化(包括登录状态)
|
||||
watch(() => userInfo.value, (newUserInfo, oldUserInfo) => {
|
||||
if (newUserInfo !== oldUserInfo) {
|
||||
// 强制触发computed重新计算
|
||||
forceRefresh();
|
||||
}
|
||||
}, { immediate: true, deep: true });
|
||||
|
||||
// 切换tab
|
||||
const switchTab = (item, index) => {
|
||||
console.log('switchTab called', item, index);
|
||||
|
||||
// 检查是否为需要登录的页面
|
||||
const loginRequiredPages = [
|
||||
'/packageA/pages/job/publishJob',
|
||||
'/pages/mine/mine',
|
||||
'/pages/mine/company-mine'
|
||||
];
|
||||
|
||||
if (loginRequiredPages.includes(item.path)) {
|
||||
// 检查用户是否已登录
|
||||
const token = uni.getStorageSync('token') || '';
|
||||
const hasLogin = userStore.hasLogin;
|
||||
|
||||
if (!token || !hasLogin) {
|
||||
// 未登录,根据平台类型跳转到对应的登录页面
|
||||
checkLoginAndNavigate();
|
||||
return; // 不进行页面跳转
|
||||
}
|
||||
|
||||
// 已登录,处理特定页面的逻辑
|
||||
if (item.path === '/packageA/pages/job/publishJob') {
|
||||
// 检查企业信息是否完整
|
||||
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
|
||||
const storeUserInfo = userInfo.value || {};
|
||||
const currentUserInfo = storeUserInfo.id ? storeUserInfo : cachedUserInfo;
|
||||
|
||||
// 判断企业信息字段company是否为null或undefined
|
||||
if (!currentUserInfo.company || currentUserInfo.company === null) {
|
||||
// 企业信息为空,跳转到企业信息补全页面
|
||||
uni.navigateTo({
|
||||
url: '/packageA/pages/complete-info/company-info',
|
||||
});
|
||||
} else {
|
||||
// 企业信息完整,跳转到发布岗位页面
|
||||
uni.navigateTo({
|
||||
url: '/packageA/pages/job/publishJob',
|
||||
});
|
||||
}
|
||||
|
||||
currentItem.value = item.id;
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.path === '/pages/mine/mine') {
|
||||
// 根据用户类型跳转到不同的"我的"页面
|
||||
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
|
||||
const storeIsCompanyUser = userInfo.value?.isCompanyUser;
|
||||
const cachedIsCompanyUser = cachedUserInfo.isCompanyUser;
|
||||
|
||||
// 获取用户类型
|
||||
const userType = Number(storeIsCompanyUser !== undefined ? storeIsCompanyUser : (cachedIsCompanyUser !== undefined ? cachedIsCompanyUser : 1));
|
||||
|
||||
let targetPath = '/pages/mine/mine'; // 默认求职者页面
|
||||
|
||||
if (userType === 0) {
|
||||
// 企业用户,跳转到企业我的页面
|
||||
targetPath = '/pages/mine/company-mine';
|
||||
} else {
|
||||
// 求职者或其他用户类型,跳转到普通我的页面
|
||||
targetPath = '/pages/mine/mine';
|
||||
}
|
||||
|
||||
// 跳转到对应的页面
|
||||
uni.navigateTo({
|
||||
url: targetPath,
|
||||
});
|
||||
|
||||
currentItem.value = item.id;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 判断是否为 tabBar 页面
|
||||
const tabBarPages = [
|
||||
'/pages/index/index',
|
||||
'/pages/careerfair/careerfair',
|
||||
'/pages/chat/chat',
|
||||
'/pages/msglog/msglog',
|
||||
'/pages/mine/mine'
|
||||
];
|
||||
|
||||
if (tabBarPages.includes(item.path)) {
|
||||
// TabBar 页面使用 redirectTo 避免页面栈溢出
|
||||
uni.redirectTo({
|
||||
url: item.path,
|
||||
});
|
||||
} else {
|
||||
// 非 TabBar 页面使用 navigateTo
|
||||
uni.navigateTo({
|
||||
url: item.path,
|
||||
});
|
||||
}
|
||||
|
||||
currentItem.value = item.id;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
currentItem.value = props.currentPage;
|
||||
// 调试信息:显示当前用户状态和tabbar配置
|
||||
forceRefresh();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.custom-tabbar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 88rpx;
|
||||
background-color: #ffffff;
|
||||
border-top: 1rpx solid #e5e5e5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
z-index: 9999;
|
||||
box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.1);
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.tabbar-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
color: #5E5F60;
|
||||
font-size: 22rpx;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
pointer-events: auto;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
|
||||
.tabbar-icon {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
margin-bottom: 4rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tabbar-icon image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.tabbar-text {
|
||||
font-size: 20rpx;
|
||||
line-height: 1;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
.tabbar-text.active {
|
||||
color: #256BFA;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.badge {
|
||||
position: absolute;
|
||||
top: 4rpx;
|
||||
right: 20rpx;
|
||||
min-width: 30rpx;
|
||||
height: 30rpx;
|
||||
background-color: #ff4444;
|
||||
color: #fff;
|
||||
font-size: 18rpx;
|
||||
border-radius: 15rpx;
|
||||
text-align: center;
|
||||
line-height: 30rpx;
|
||||
padding: 0 10rpx;
|
||||
transform: scale(0.8);
|
||||
}
|
||||
|
||||
/* 中间按钮特殊样式 */
|
||||
.tabbar-item:has(.center-item) {
|
||||
.tabbar-icon {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,70 +0,0 @@
|
||||
<template>
|
||||
<text class="iconfont" :class="iconClass" :style="iconStyle" @click="handleClick"></text>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
// 图标名称,如:home、user、search
|
||||
name: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
// 图标大小(单位:rpx)
|
||||
size: {
|
||||
type: [String, Number],
|
||||
default: 32
|
||||
},
|
||||
// 图标颜色
|
||||
color: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 是否粗体
|
||||
bold: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['click'])
|
||||
|
||||
// 图标类名
|
||||
const iconClass = computed(() => {
|
||||
const prefix = props.name.startsWith('icon-') ? '' : 'icon-'
|
||||
return `${prefix}${props.name}`
|
||||
})
|
||||
|
||||
// 图标样式
|
||||
const iconStyle = computed(() => {
|
||||
const style = {
|
||||
fontSize: `${props.size}rpx`
|
||||
}
|
||||
|
||||
if (props.color) {
|
||||
style.color = props.color
|
||||
}
|
||||
|
||||
if (props.bold) {
|
||||
style.fontWeight = 'bold'
|
||||
}
|
||||
|
||||
return style
|
||||
})
|
||||
|
||||
// 点击事件
|
||||
const handleClick = (e) => {
|
||||
emit('click', e)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.iconfont {
|
||||
font-style: normal;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
display: inline-block;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
</view>
|
||||
<text class="text-content button-click">{{ content }}</text>
|
||||
<template v-if="showButton">
|
||||
<button class="popup-button button-click reset-button" v-if="isTip" @click="close">{{ buttonText }}</button>
|
||||
<uni-button class="popup-button button-click" v-if="isTip" @click="close">{{ buttonText }}</uni-button>
|
||||
<view v-else class="confirm-btns">
|
||||
<button class="popup-button button-click reset-button" @click="close">{{ cancelText }}</button>
|
||||
<button class="popup-button button-click reset-button" @click="confirm">{{ confirmText }}</button>
|
||||
<uni-button class="popup-button button-click" @click="close">{{ cancelText }}</uni-button>
|
||||
<uni-button class="popup-button button-click" @click="confirm">{{ confirmText }}</uni-button>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
@@ -137,18 +137,4 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 重置button样式,使用类选择器代替标签选择器
|
||||
.reset-button {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
background: none;
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
.reset-button::after {
|
||||
border: none;
|
||||
}
|
||||
</style>
|
||||
@@ -1,100 +0,0 @@
|
||||
<template>
|
||||
<view class="user-type-switcher">
|
||||
<view class="switcher-title">用户类型切换(测试用)</view>
|
||||
<view class="switcher-buttons">
|
||||
<button
|
||||
v-for="(type, index) in userTypes"
|
||||
:key="index"
|
||||
:class="['type-btn', { active: currentUserType === type.value }]"
|
||||
@click="switchUserType(type.value)"
|
||||
>
|
||||
{{ type.label }}
|
||||
</button>
|
||||
</view>
|
||||
<view class="current-type">
|
||||
当前用户类型:{{ getCurrentTypeLabel() }} ({{ currentUserType }})
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import useUserStore from '@/stores/useUserStore';
|
||||
|
||||
const { userInfo } = storeToRefs(useUserStore());
|
||||
|
||||
const userTypes = [
|
||||
{ value: 0, label: '企业用户' },
|
||||
{ value: 1, label: '求职者' },
|
||||
{ value: 2, label: '网格员' },
|
||||
{ value: 3, label: '政府人员' }
|
||||
];
|
||||
|
||||
const currentUserType = computed(() => userInfo.value?.isCompanyUser !== undefined ? userInfo.value.isCompanyUser : 0);
|
||||
|
||||
const switchUserType = (userType) => {
|
||||
console.log('切换用户类型:', userType);
|
||||
console.log('切换前 userInfo:', userInfo.value);
|
||||
|
||||
userInfo.value.isCompanyUser = userType;
|
||||
|
||||
console.log('切换后 userInfo:', userInfo.value);
|
||||
|
||||
// 保存到本地存储
|
||||
uni.setStorageSync('userInfo', userInfo.value);
|
||||
|
||||
uni.showToast({
|
||||
title: `已切换到${getCurrentTypeLabel()}`,
|
||||
icon: 'success'
|
||||
});
|
||||
};
|
||||
|
||||
const getCurrentTypeLabel = () => {
|
||||
const type = userTypes.find(t => t.value === currentUserType.value);
|
||||
return type ? type.label : '未知';
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.user-type-switcher {
|
||||
padding: 20rpx;
|
||||
background: #f5f5f5;
|
||||
border-radius: 10rpx;
|
||||
margin: 20rpx;
|
||||
|
||||
.switcher-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.switcher-buttons {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.type-btn {
|
||||
padding: 10rpx 20rpx;
|
||||
border: 2rpx solid #ddd;
|
||||
border-radius: 8rpx;
|
||||
background: #fff;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
|
||||
&.active {
|
||||
background: #256BFA;
|
||||
color: #fff;
|
||||
border-color: #256BFA;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.current-type {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,335 +0,0 @@
|
||||
# 五级联动地址选择器组件
|
||||
|
||||
## 组件简介
|
||||
|
||||
`area-cascade-picker` 是一个支持省市区县街道社区的五级联动地址选择组件,适用于需要选择详细地址的场景。
|
||||
|
||||
## 功能特点
|
||||
|
||||
- ✅ 五级联动选择(省/市/区/街道/社区)
|
||||
- ✅ 自动级联更新
|
||||
- ✅ 支持取消和确认操作
|
||||
- ✅ 底部弹出式交互
|
||||
- ✅ 支持自定义标题
|
||||
- ✅ 返回完整的地址信息和各级代码
|
||||
|
||||
## 使用方法
|
||||
|
||||
### 1. 引入组件
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<view>
|
||||
<button @click="openPicker">选择地址</button>
|
||||
<area-cascade-picker ref="areaPicker"></area-cascade-picker>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import AreaCascadePicker from '@/components/area-cascade-picker/area-cascade-picker.vue'
|
||||
|
||||
const areaPicker = ref(null)
|
||||
</script>
|
||||
```
|
||||
|
||||
### 2. 打开选择器
|
||||
|
||||
```javascript
|
||||
const openPicker = () => {
|
||||
areaPicker.value?.open({
|
||||
title: '选择地址',
|
||||
maskClick: true,
|
||||
success: (addressData) => {
|
||||
console.log('选择的地址:', addressData)
|
||||
// 处理选择结果
|
||||
},
|
||||
cancel: () => {
|
||||
console.log('取消选择')
|
||||
},
|
||||
change: (addressData) => {
|
||||
console.log('地址变化:', addressData)
|
||||
}
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
## API 说明
|
||||
|
||||
### open(config)
|
||||
|
||||
打开地址选择器
|
||||
|
||||
#### 参数 config
|
||||
|
||||
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
||||
|--------|------|------|--------|------|
|
||||
| title | String | 否 | '选择地址' | 选择器标题 |
|
||||
| maskClick | Boolean | 否 | false | 是否允许点击遮罩关闭 |
|
||||
| success | Function | 否 | - | 确认选择的回调函数 |
|
||||
| cancel | Function | 否 | - | 取消选择的回调函数 |
|
||||
| change | Function | 否 | - | 选择变化的回调函数 |
|
||||
| defaultValue | Object | 否 | null | 默认选中的地址(暂未实现) |
|
||||
| forceRefresh | Boolean | 否 | false | 是否强制刷新数据(忽略缓存) |
|
||||
|
||||
#### success 回调参数
|
||||
|
||||
```javascript
|
||||
{
|
||||
address: "新疆维吾尔自治区/喀什地区/喀什市/学府街道/学府社区居委会",
|
||||
province: {
|
||||
code: "650000",
|
||||
name: "新疆维吾尔自治区"
|
||||
},
|
||||
city: {
|
||||
code: "653100",
|
||||
name: "喀什地区"
|
||||
},
|
||||
district: {
|
||||
code: "653101",
|
||||
name: "喀什市"
|
||||
},
|
||||
street: {
|
||||
code: "65310101",
|
||||
name: "学府街道"
|
||||
},
|
||||
community: {
|
||||
code: "6531010101",
|
||||
name: "学府社区居委会"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### close()
|
||||
|
||||
关闭地址选择器
|
||||
|
||||
```javascript
|
||||
areaPicker.value?.close()
|
||||
```
|
||||
|
||||
### clearCache()
|
||||
|
||||
清除地址数据缓存
|
||||
|
||||
```javascript
|
||||
areaPicker.value?.clearCache()
|
||||
```
|
||||
|
||||
## 数据格式
|
||||
|
||||
组件使用树形结构的地址数据,格式如下:
|
||||
|
||||
```javascript
|
||||
[
|
||||
{
|
||||
code: '650000', // 行政区划代码
|
||||
name: '新疆维吾尔自治区', // 名称
|
||||
children: [ // 下级行政区
|
||||
{
|
||||
code: '653100',
|
||||
name: '喀什地区',
|
||||
children: [
|
||||
{
|
||||
code: '653101',
|
||||
name: '喀什市',
|
||||
children: [
|
||||
{
|
||||
code: '65310101',
|
||||
name: '学府街道',
|
||||
children: [
|
||||
{
|
||||
code: '6531010101',
|
||||
name: '学府社区居委会'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## 完整示例
|
||||
|
||||
### 企业注册地址选择
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<view class="form-item" @click="selectLocation">
|
||||
<text class="label">企业注册地点</text>
|
||||
<view class="input-content">
|
||||
<text :class="{ placeholder: !formData.address }">
|
||||
{{ formData.address || '请选择注册地点' }}
|
||||
</text>
|
||||
<uni-icons type="arrowright" size="16"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<area-cascade-picker ref="areaPicker"></area-cascade-picker>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import AreaCascadePicker from '@/components/area-cascade-picker/area-cascade-picker.vue'
|
||||
|
||||
const areaPicker = ref(null)
|
||||
const formData = reactive({
|
||||
address: '',
|
||||
provinceCode: '',
|
||||
provinceName: '',
|
||||
cityCode: '',
|
||||
cityName: '',
|
||||
districtCode: '',
|
||||
districtName: '',
|
||||
streetCode: '',
|
||||
streetName: '',
|
||||
communityCode: '',
|
||||
communityName: ''
|
||||
})
|
||||
|
||||
const selectLocation = () => {
|
||||
areaPicker.value?.open({
|
||||
title: '选择企业注册地点',
|
||||
maskClick: true,
|
||||
success: (addressData) => {
|
||||
// 保存完整地址
|
||||
formData.address = addressData.address
|
||||
|
||||
// 保存各级信息
|
||||
formData.provinceCode = addressData.province?.code
|
||||
formData.provinceName = addressData.province?.name
|
||||
formData.cityCode = addressData.city?.code
|
||||
formData.cityName = addressData.city?.name
|
||||
formData.districtCode = addressData.district?.code
|
||||
formData.districtName = addressData.district?.name
|
||||
formData.streetCode = addressData.street?.code
|
||||
formData.streetName = addressData.street?.name
|
||||
formData.communityCode = addressData.community?.code
|
||||
formData.communityName = addressData.community?.name
|
||||
|
||||
console.log('已选择地址:', formData)
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
## 性能优化
|
||||
|
||||
### 懒加载方案(已实现)⭐
|
||||
|
||||
组件已实现**懒加载**机制,大幅优化90M+地址数据的加载性能:
|
||||
|
||||
#### 核心优化
|
||||
|
||||
1. **首次加载**:只加载省份列表(< 1MB,3-5秒完成)
|
||||
2. **按需加载**:用户选择省份后,再加载该省份的详细数据(2-5MB,5-10秒)
|
||||
3. **智能缓存**:已加载的数据会缓存,切换省份时秒开
|
||||
4. **自动降级**:如果服务器不支持分片接口,自动从完整数据中提取
|
||||
|
||||
#### 性能对比
|
||||
|
||||
| 场景 | 优化前 | 优化后(懒加载) |
|
||||
|------|--------|------------------|
|
||||
| 首次打开选择器 | 加载90M+(3-5分钟) | 加载省份列表(< 1MB,3-5秒) |
|
||||
| 选择省份 | 无需加载 | 加载该省份数据(2-5MB,5-10秒) |
|
||||
| 切换省份 | 无需加载 | 从缓存读取(< 1秒) |
|
||||
|
||||
#### 使用方式
|
||||
|
||||
组件已自动使用懒加载模式,无需修改调用代码:
|
||||
|
||||
```javascript
|
||||
// 正常使用,自动懒加载
|
||||
areaPicker.value?.open({
|
||||
success: (addressData) => {
|
||||
console.log('选择的地址:', addressData)
|
||||
}
|
||||
})
|
||||
|
||||
// 强制刷新数据(忽略缓存)
|
||||
areaPicker.value?.open({
|
||||
forceRefresh: true, // 强制从服务器重新加载
|
||||
success: (addressData) => {
|
||||
console.log('选择的地址:', addressData)
|
||||
}
|
||||
})
|
||||
|
||||
// 清除缓存
|
||||
areaPicker.value?.clearCache()
|
||||
```
|
||||
|
||||
### 服务器分片接口(最佳方案)🚀
|
||||
|
||||
如果服务器可以提供分片接口,性能会进一步提升。详见:[地址数据懒加载优化方案.md](../../docs/地址数据懒加载优化方案.md)
|
||||
|
||||
需要的接口:
|
||||
- 省份列表接口:`/address_provinces.json`(轻量级,< 1MB)
|
||||
- 省份详情接口:`/address_province_{code}.json`(按需加载,每个2-5MB)
|
||||
|
||||
### 缓存机制
|
||||
|
||||
1. **自动缓存**:已加载的数据会自动缓存到 IndexedDB(H5)或 uni.storage(小程序)
|
||||
2. **缓存有效期**:默认7天,过期后自动重新加载
|
||||
3. **离线支持**:网络失败时自动使用缓存数据
|
||||
4. **存储方案**:优先使用 IndexedDB,自动降级到 uni.storage
|
||||
|
||||
## 注意事项
|
||||
|
||||
1. **数据来源**:当前从远程JSON文件加载,生产环境建议接入后端API
|
||||
2. **数据更新**:如需接入后端API,修改 `loadAreaData` 方法即可
|
||||
3. **性能优化**:已集成缓存机制,首次加载后速度大幅提升
|
||||
4. **兼容性**:支持 H5、微信小程序等多端
|
||||
5. **存储限制**:小程序环境有存储限制,如遇问题会自动清理旧缓存
|
||||
|
||||
## 接入后端API
|
||||
|
||||
在组件的 `loadAreaData` 方法中取消注释并配置API:
|
||||
|
||||
```javascript
|
||||
async loadAreaData() {
|
||||
try {
|
||||
const resp = await uni.request({
|
||||
url: '/app/common/area/cascade',
|
||||
method: 'GET'
|
||||
});
|
||||
if (resp.statusCode === 200 && resp.data && resp.data.data) {
|
||||
this.areaData = resp.data.data;
|
||||
return;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载地区数据失败:', error);
|
||||
}
|
||||
|
||||
// 失败时使用模拟数据
|
||||
this.areaData = this.getMockData();
|
||||
}
|
||||
```
|
||||
|
||||
## 更新日志
|
||||
|
||||
### v1.2.0 (2025-01-XX)
|
||||
- 🚀 **懒加载优化**:实现按需加载,首次加载从几分钟减少到几秒
|
||||
- ✅ 首次只加载省份列表(< 1MB,3-5秒)
|
||||
- ✅ 按需加载省份详情(选择省份时才加载)
|
||||
- ✅ 智能缓存已加载的数据,切换省份秒开
|
||||
- ✅ 支持服务器分片接口(最佳性能)
|
||||
- ✅ 自动降级方案(兼容完整数据)
|
||||
|
||||
### v1.1.0 (2025-01-XX)
|
||||
- 🚀 **性能优化**:集成智能缓存系统,优化90M+地址数据加载
|
||||
- ✅ 支持 IndexedDB 和 uni.storage 双缓存方案
|
||||
- ✅ 支持缓存过期管理和自动清理
|
||||
- ✅ 支持强制刷新数据
|
||||
- ✅ 优化首次加载体验,后续加载秒开
|
||||
|
||||
### v1.0.0 (2025-10-21)
|
||||
- ✨ 初始版本
|
||||
- ✅ 实现五级联动选择功能
|
||||
- ✅ 支持省市区县街道社区选择
|
||||
- ✅ 提供完整的地址信息返回
|
||||
|
||||
@@ -1,621 +0,0 @@
|
||||
<template>
|
||||
<uni-popup
|
||||
ref="popup"
|
||||
type="bottom"
|
||||
borderRadius="10px 10px 0 0"
|
||||
background-color="#FFFFFF"
|
||||
:mask-click="maskClick"
|
||||
>
|
||||
<view class="popup-content">
|
||||
<view class="popup-header">
|
||||
<view class="btn-cancel" @click="cancel">取消</view>
|
||||
<view class="title">{{ title }}</view>
|
||||
<view class="btn-confirm" @click="confirm">确认</view>
|
||||
</view>
|
||||
<view class="popup-list">
|
||||
<picker-view
|
||||
indicator-style="height: 84rpx;"
|
||||
:value="selectedIndex"
|
||||
@change="bindChange"
|
||||
class="picker-view"
|
||||
>
|
||||
<!-- 省 -->
|
||||
<picker-view-column>
|
||||
<view
|
||||
v-for="(item, index) in provinceList"
|
||||
:key="item.code"
|
||||
class="item"
|
||||
:class="{ 'item-active': selectedIndex[0] === index }"
|
||||
>
|
||||
<text>{{ item.name }}</text>
|
||||
</view>
|
||||
</picker-view-column>
|
||||
|
||||
<!-- 市 -->
|
||||
<picker-view-column>
|
||||
<view
|
||||
v-for="(item, index) in cityList"
|
||||
:key="item.code"
|
||||
class="item"
|
||||
:class="{ 'item-active': selectedIndex[1] === index }"
|
||||
>
|
||||
<text>{{ item.name }}</text>
|
||||
</view>
|
||||
</picker-view-column>
|
||||
|
||||
<!-- 区县 -->
|
||||
<picker-view-column>
|
||||
<view
|
||||
v-for="(item, index) in districtList"
|
||||
:key="item.code"
|
||||
class="item"
|
||||
:class="{ 'item-active': selectedIndex[2] === index }"
|
||||
>
|
||||
<text>{{ item.name }}</text>
|
||||
</view>
|
||||
</picker-view-column>
|
||||
|
||||
<!-- 街道 -->
|
||||
<picker-view-column>
|
||||
<view
|
||||
v-for="(item, index) in streetList"
|
||||
:key="item.code"
|
||||
class="item"
|
||||
:class="{ 'item-active': selectedIndex[3] === index }"
|
||||
>
|
||||
<text>{{ item.name }}</text>
|
||||
</view>
|
||||
</picker-view-column>
|
||||
|
||||
<!-- 社区/居委会 -->
|
||||
<picker-view-column>
|
||||
<view
|
||||
v-for="(item, index) in communityList"
|
||||
:key="item.code"
|
||||
class="item"
|
||||
:class="{ 'item-active': selectedIndex[4] === index }"
|
||||
>
|
||||
<text>{{ item.name }}</text>
|
||||
</view>
|
||||
</picker-view-column>
|
||||
</picker-view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createRequest } from '@/utils/request';
|
||||
export default {
|
||||
name: 'AreaCascadePicker',
|
||||
data() {
|
||||
return {
|
||||
maskClick: false,
|
||||
title: '选择地址',
|
||||
confirmCallback: null,
|
||||
cancelCallback: null,
|
||||
changeCallback: null,
|
||||
selectedIndex: [0, 0, 0, 0, 0],
|
||||
// 原始数据(懒加载模式下,只存储省份列表)
|
||||
areaData: [],
|
||||
// 各级列表
|
||||
provinceList: [],
|
||||
cityList: [],
|
||||
districtList: [],
|
||||
streetList: [],
|
||||
communityList: [],
|
||||
// 当前选中的项
|
||||
selectedProvince: null,
|
||||
selectedCity: null,
|
||||
selectedDistrict: null,
|
||||
selectedStreet: null,
|
||||
selectedCommunity: null,
|
||||
// 加载状态
|
||||
isLoading: false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
async open(newConfig = {}) {
|
||||
const {
|
||||
title,
|
||||
success,
|
||||
cancel,
|
||||
change,
|
||||
maskClick = false,
|
||||
defaultValue = null,
|
||||
forceRefresh = false, // 是否强制刷新数据
|
||||
} = newConfig;
|
||||
|
||||
this.reset();
|
||||
if (title) this.title = title;
|
||||
if (typeof success === 'function') this.confirmCallback = success;
|
||||
if (typeof cancel === 'function') this.cancelCallback = cancel;
|
||||
if (typeof change === 'function') this.changeCallback = change;
|
||||
this.maskClick = maskClick;
|
||||
|
||||
// 加载地区数据
|
||||
this.isLoading = true;
|
||||
try {
|
||||
// 先显示弹窗,避免长时间等待
|
||||
this.$nextTick(() => {
|
||||
this.$refs.popup.open();
|
||||
});
|
||||
|
||||
// 加载省份数据
|
||||
await this.loadAreaData(forceRefresh);
|
||||
|
||||
// 只有当provinceList有数据时才初始化后续列表
|
||||
if (this.areaData && this.areaData.length > 0) {
|
||||
await this.initLists();
|
||||
console.log('地址选择器初始化完成');
|
||||
} else {
|
||||
console.warn('没有加载到省份数据');
|
||||
// 即使没有数据,也保持弹窗打开,让用户可以关闭它
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('打开地址选择器失败:', error);
|
||||
// 注意:由于loadAreaData已经处理了错误,这里不应该会被触发
|
||||
// 但保留作为额外的安全措施
|
||||
} finally {
|
||||
this.isLoading = false;
|
||||
}
|
||||
},
|
||||
|
||||
async loadAreaData(forceRefresh = false) {
|
||||
try {
|
||||
console.log('正在加载省份列表...');
|
||||
const resp = await createRequest('/cms/dict/sysarea/list', { parentCode: '' }, 'GET', false);
|
||||
console.log('省份列表接口响应:', resp);
|
||||
|
||||
// 处理正确的数据格式
|
||||
if (resp && resp.code === 200 && resp.data) {
|
||||
// 数据在data字段中
|
||||
this.areaData = resp.data.map(item => ({
|
||||
code: item.code,
|
||||
name: item.name
|
||||
}));
|
||||
|
||||
console.log('省份列表加载成功:', this.areaData);
|
||||
if (this.areaData.length === 0) {
|
||||
console.warn('省份列表为空');
|
||||
}
|
||||
} else {
|
||||
console.error('获取省份列表失败:', resp);
|
||||
throw new Error(`获取省份列表失败: ${resp?.msg || '未知错误'}`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载省份列表失败:', error);
|
||||
// 不抛出错误,避免阻止页面打开
|
||||
// 而是使用默认空数据,让用户可以继续操作
|
||||
this.areaData = [];
|
||||
// 显示更友好的错误提示
|
||||
uni.showToast({
|
||||
title: error.message || '加载地址数据失败,请检查网络连接',
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
async initLists() {
|
||||
// 初始化省列表
|
||||
this.provinceList = this.areaData || [];
|
||||
|
||||
if (this.provinceList.length > 0) {
|
||||
this.selectedProvince = this.provinceList[0];
|
||||
// 懒加载:首次选择第一个省份时,加载其详情
|
||||
await this.updateCityList();
|
||||
|
||||
// 如果有城市数据,初始化第一个城市的区县数据
|
||||
if (this.cityList.length > 0) {
|
||||
this.selectedCity = this.cityList[0];
|
||||
await this.updateDistrictList();
|
||||
|
||||
// 如果有区县数据,初始化第一个区县的街道数据
|
||||
if (this.districtList.length > 0) {
|
||||
this.selectedDistrict = this.districtList[0];
|
||||
await this.updateStreetList();
|
||||
|
||||
// 如果有街道数据,初始化第一个街道的社区数据
|
||||
if (this.streetList.length > 0) {
|
||||
this.selectedStreet = this.streetList[0];
|
||||
await this.updateCommunityList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 更新选中索引
|
||||
this.selectedIndex = [0, 0, 0, 0, 0];
|
||||
}
|
||||
},
|
||||
|
||||
async updateCityList() {
|
||||
if (!this.selectedProvince) {
|
||||
this.cityList = [];
|
||||
this.districtList = [];
|
||||
this.streetList = [];
|
||||
this.communityList = [];
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
console.log(`正在加载城市列表,父级编码: ${this.selectedProvince.code}`);
|
||||
|
||||
// 使用createRequest工具调用接口
|
||||
const resp = await createRequest('/cms/dict/sysarea/list', { parentCode: this.selectedProvince.code }, 'GET', false);
|
||||
|
||||
console.log('城市列表接口响应:', resp);
|
||||
|
||||
// 处理正确的数据格式
|
||||
let cityData = [];
|
||||
if (resp && resp.code === 200 && resp.data) {
|
||||
cityData = resp.data;
|
||||
|
||||
this.cityList = cityData.map(item => ({
|
||||
code: item.code,
|
||||
name: item.name
|
||||
}));
|
||||
console.log('城市列表加载成功:', this.cityList);
|
||||
} else {
|
||||
console.error('获取城市列表失败:', resp);
|
||||
this.cityList = [];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载城市列表失败:', error);
|
||||
this.cityList = [];
|
||||
}
|
||||
|
||||
this.selectedIndex[1] = 0;
|
||||
|
||||
if (this.cityList.length > 0) {
|
||||
this.selectedCity = this.cityList[0];
|
||||
await this.updateDistrictList();
|
||||
} else {
|
||||
this.districtList = [];
|
||||
this.streetList = [];
|
||||
this.communityList = [];
|
||||
}
|
||||
},
|
||||
|
||||
async updateDistrictList() {
|
||||
if (!this.selectedCity) {
|
||||
this.districtList = [];
|
||||
this.streetList = [];
|
||||
this.communityList = [];
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
console.log(`正在加载区县列表,父级编码: ${this.selectedCity.code}`);
|
||||
|
||||
// 使用createRequest工具调用接口
|
||||
const resp = await createRequest('/cms/dict/sysarea/list', { parentCode: this.selectedCity.code }, 'GET', false);
|
||||
|
||||
console.log('区县列表接口响应:', resp);
|
||||
|
||||
// 处理正确的数据格式
|
||||
let districtData = [];
|
||||
if (resp && resp.code === 200 && resp.data) {
|
||||
districtData = resp.data;
|
||||
|
||||
this.districtList = districtData.map(item => ({
|
||||
code: item.code,
|
||||
name: item.name
|
||||
}));
|
||||
console.log('区县列表加载成功:', this.districtList);
|
||||
} else {
|
||||
console.error('获取区县列表失败:', resp);
|
||||
this.districtList = [];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载区县列表失败:', error);
|
||||
this.districtList = [];
|
||||
}
|
||||
|
||||
this.selectedIndex[2] = 0;
|
||||
|
||||
if (this.districtList.length > 0) {
|
||||
this.selectedDistrict = this.districtList[0];
|
||||
await this.updateStreetList();
|
||||
} else {
|
||||
this.streetList = [];
|
||||
this.communityList = [];
|
||||
}
|
||||
},
|
||||
|
||||
async updateStreetList() {
|
||||
if (!this.selectedDistrict) {
|
||||
this.streetList = [];
|
||||
this.communityList = [];
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
console.log(`正在加载街道列表,父级编码: ${this.selectedDistrict.code}`);
|
||||
|
||||
// 使用createRequest工具调用接口
|
||||
const resp = await createRequest('/cms/dict/sysarea/list', { parentCode: this.selectedDistrict.code }, 'GET', false);
|
||||
|
||||
console.log('街道列表接口响应:', resp);
|
||||
|
||||
// 处理正确的数据格式
|
||||
let streetData = [];
|
||||
if (resp && resp.code === 200 && resp.data) {
|
||||
streetData = resp.data;
|
||||
|
||||
this.streetList = streetData.map(item => ({
|
||||
code: item.code,
|
||||
name: item.name
|
||||
}));
|
||||
console.log('街道列表加载成功:', this.streetList);
|
||||
} else {
|
||||
console.error('获取街道列表失败:', resp);
|
||||
this.streetList = [];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载街道列表失败:', error);
|
||||
this.streetList = [];
|
||||
}
|
||||
|
||||
this.selectedIndex[3] = 0;
|
||||
|
||||
if (this.streetList.length > 0) {
|
||||
this.selectedStreet = this.streetList[0];
|
||||
await this.updateCommunityList();
|
||||
} else {
|
||||
this.communityList = [];
|
||||
}
|
||||
},
|
||||
|
||||
async updateCommunityList() {
|
||||
if (!this.selectedStreet) {
|
||||
this.communityList = [];
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
console.log(`正在加载社区列表,父级编码: ${this.selectedStreet.code}`);
|
||||
|
||||
// 使用createRequest工具调用接口
|
||||
const resp = await createRequest('/cms/dict/sysarea/list', { parentCode: this.selectedStreet.code }, 'GET', false);
|
||||
|
||||
console.log('社区列表接口响应:', resp);
|
||||
|
||||
// 处理正确的数据格式
|
||||
let communityData = [];
|
||||
if (resp && resp.code === 200 && resp.data) {
|
||||
communityData = resp.data;
|
||||
|
||||
this.communityList = communityData.map(item => ({
|
||||
code: item.code,
|
||||
name: item.name
|
||||
}));
|
||||
console.log('社区列表加载成功:', this.communityList);
|
||||
} else {
|
||||
console.error('获取社区列表失败:', resp);
|
||||
this.communityList = [];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载社区列表失败:', error);
|
||||
this.communityList = [];
|
||||
}
|
||||
|
||||
this.selectedIndex[4] = 0;
|
||||
|
||||
if (this.communityList.length > 0) {
|
||||
this.selectedCommunity = this.communityList[0];
|
||||
}
|
||||
},
|
||||
|
||||
async bindChange(e) {
|
||||
const newIndex = e.detail.value;
|
||||
|
||||
// 检查哪一列发生了变化
|
||||
for (let i = 0; i < 5; i++) {
|
||||
if (newIndex[i] !== this.selectedIndex[i]) {
|
||||
this.selectedIndex[i] = newIndex[i];
|
||||
|
||||
// 根据变化的列更新后续列
|
||||
if (i === 0) {
|
||||
// 省变化 - 需要加载新省份的城市
|
||||
this.selectedProvince = this.provinceList[newIndex[0]];
|
||||
await this.updateCityList();
|
||||
} else if (i === 1) {
|
||||
// 市变化
|
||||
this.selectedCity = this.cityList[newIndex[1]];
|
||||
await this.updateDistrictList();
|
||||
} else if (i === 2) {
|
||||
// 区县变化
|
||||
this.selectedDistrict = this.districtList[newIndex[2]];
|
||||
await this.updateStreetList();
|
||||
} else if (i === 3) {
|
||||
// 街道变化
|
||||
this.selectedStreet = this.streetList[newIndex[3]];
|
||||
await this.updateCommunityList();
|
||||
} else if (i === 4) {
|
||||
// 社区变化
|
||||
this.selectedCommunity = this.communityList[newIndex[4]];
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.changeCallback) {
|
||||
this.changeCallback(this.getSelectedAddress());
|
||||
}
|
||||
},
|
||||
|
||||
getSelectedAddress() {
|
||||
const parts = [];
|
||||
if (this.selectedProvince) parts.push(this.selectedProvince.name);
|
||||
if (this.selectedCity) parts.push(this.selectedCity.name);
|
||||
if (this.selectedDistrict) parts.push(this.selectedDistrict.name);
|
||||
if (this.selectedStreet) parts.push(this.selectedStreet.name);
|
||||
if (this.selectedCommunity) parts.push(this.selectedCommunity.name);
|
||||
|
||||
return {
|
||||
address: parts.join('/'),
|
||||
province: this.selectedProvince,
|
||||
city: this.selectedCity,
|
||||
district: this.selectedDistrict,
|
||||
street: this.selectedStreet,
|
||||
community: this.selectedCommunity,
|
||||
};
|
||||
},
|
||||
|
||||
close() {
|
||||
this.$refs.popup.close();
|
||||
},
|
||||
|
||||
cancel() {
|
||||
this.clickCallback(this.cancelCallback);
|
||||
},
|
||||
|
||||
confirm() {
|
||||
this.clickCallback(this.confirmCallback);
|
||||
},
|
||||
|
||||
async clickCallback(callback) {
|
||||
if (typeof callback !== 'function') {
|
||||
this.$refs.popup.close();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await callback(this.getSelectedAddress());
|
||||
if (result !== false) {
|
||||
this.$refs.popup.close();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('callback 执行出错:', error);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 重置所有状态(内部使用)
|
||||
*/
|
||||
reset() {
|
||||
this.maskClick = false;
|
||||
this.confirmCallback = null;
|
||||
this.cancelCallback = null;
|
||||
this.changeCallback = null;
|
||||
this.selectedIndex = [0, 0, 0, 0, 0];
|
||||
this.selectedProvince = null;
|
||||
this.selectedCity = null;
|
||||
this.selectedDistrict = null;
|
||||
this.selectedStreet = null;
|
||||
this.selectedCommunity = null;
|
||||
this.provinceList = [];
|
||||
this.cityList = [];
|
||||
this.districtList = [];
|
||||
this.streetList = [];
|
||||
this.communityList = [];
|
||||
this.areaData = [];
|
||||
},
|
||||
|
||||
/**
|
||||
* 清除地址数据缓存(供外部调用)
|
||||
*/
|
||||
async clearCache() {
|
||||
try {
|
||||
// 清除内存缓存
|
||||
this.reset();
|
||||
uni.showToast({
|
||||
title: '缓存已清除',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('清除缓存失败:', error);
|
||||
uni.showToast({
|
||||
title: '清除缓存失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.popup-content {
|
||||
color: #000000;
|
||||
height: 60vh;
|
||||
}
|
||||
|
||||
.popup-list {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
|
||||
.picker-view {
|
||||
width: 100%;
|
||||
height: calc(60vh - 100rpx);
|
||||
margin-top: 20rpx;
|
||||
|
||||
.uni-picker-view-mask {
|
||||
background: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
.item {
|
||||
line-height: 84rpx;
|
||||
height: 84rpx;
|
||||
text-align: center;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #cccccc;
|
||||
padding: 0 4rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.item-active {
|
||||
color: #333333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.uni-picker-view-indicator:after {
|
||||
border-color: #e3e3e3;
|
||||
}
|
||||
|
||||
.uni-picker-view-indicator:before {
|
||||
border-color: #e3e3e3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.popup-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 40rpx 40rpx 10rpx 40rpx;
|
||||
|
||||
.title {
|
||||
font-weight: 500;
|
||||
font-size: 36rpx;
|
||||
color: #333333;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.btn-cancel {
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
color: #666d7f;
|
||||
line-height: 38rpx;
|
||||
}
|
||||
|
||||
.btn-confirm {
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
color: #256bfa;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
<template>
|
||||
<uni-data-pickerview
|
||||
ref="pickerView"
|
||||
v-bind="$attrs"
|
||||
@change="handleChange"
|
||||
@datachange="handleDatachange"
|
||||
@nodeclick="handleNodeclick"
|
||||
@update:modelValue="handleUpdateModelValue"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DataPickerView',
|
||||
inheritAttrs: false,
|
||||
methods: {
|
||||
updateData(data) {
|
||||
if (this.$refs.pickerView && this.$refs.pickerView.updateData) {
|
||||
this.$refs.pickerView.updateData(data)
|
||||
}
|
||||
},
|
||||
handleChange(event) {
|
||||
this.$emit('change', event)
|
||||
},
|
||||
handleDatachange(event) {
|
||||
this.$emit('datachange', event)
|
||||
},
|
||||
handleNodeclick(event) {
|
||||
this.$emit('nodeclick', event)
|
||||
},
|
||||
handleUpdateModelValue(value) {
|
||||
this.$emit('update:modelValue', value)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<view class="empty" :style="{ background: bgcolor, marginTop: mrTop + 'rpx' }">
|
||||
<view class="ty_content" :style="{ paddingTop: pdTop + 'rpx' }">
|
||||
<view class="content_top btn-shaky">
|
||||
<image v-if="pictrue" :src="pictrue" mode="" class="empty-image"></image>
|
||||
<image v-else src="@/static/icon/empty.png" mode="" class="empty-image"></image>
|
||||
<image v-if="pictrue" :src="pictrue" mode=""></image>
|
||||
<image v-else src="@/static/icon/empty.png" mode=""></image>
|
||||
</view>
|
||||
<view class="content_c">{{ content }}</view>
|
||||
</view>
|
||||
@@ -47,8 +47,7 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 使用类选择器代替标签选择器
|
||||
.empty-image {
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<input class="uni-input searchinput" confirm-type="search" />
|
||||
</view>
|
||||
<view class="sex-content">
|
||||
<scroll-view ref="leftScroll" :show-scrollbar="false" :scroll-y="true" class="sex-content-left">
|
||||
<scroll-view :show-scrollbar="false" :scroll-y="true" class="sex-content-left">
|
||||
<view
|
||||
v-for="item in copyTree"
|
||||
:key="item.id"
|
||||
@@ -57,8 +57,6 @@ export default {
|
||||
stationCateLog: 0,
|
||||
copyTree: [],
|
||||
scrollTop: 0,
|
||||
scrollTimer: null,
|
||||
lastScrollTime: 0,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
@@ -91,131 +89,14 @@ export default {
|
||||
}
|
||||
},
|
||||
},
|
||||
beforeDestroy() {
|
||||
// 组件销毁前清除定时器
|
||||
if (this.scrollTimer) {
|
||||
clearTimeout(this.scrollTimer);
|
||||
this.scrollTimer = null;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeStationLog(item) {
|
||||
this.leftValue = item;
|
||||
this.rightValue = item.children;
|
||||
this.scrollTop = 0;
|
||||
|
||||
// 使用更激进的防抖策略,避免频繁的左侧滚动
|
||||
if (this.scrollTimer) {
|
||||
clearTimeout(this.scrollTimer);
|
||||
}
|
||||
|
||||
this.scrollTimer = setTimeout(() => {
|
||||
// 确保左侧列表滚动到正确位置,让当前选中的标签可见
|
||||
const index = this.copyTree.findIndex(i => i.id === item.id);
|
||||
if (index !== -1 && this.$refs.leftScroll) {
|
||||
const itemHeight = 160; // 每个选项高度
|
||||
const visibleHeight = 4 * itemHeight; // 可见区域高度
|
||||
|
||||
// 计算目标位置
|
||||
const targetTop = index * itemHeight;
|
||||
|
||||
// 获取当前左侧列表的滚动位置
|
||||
const currentLeftScrollTop = this.$refs.leftScroll.scrollTop || 0;
|
||||
|
||||
// 只有当目标位置不在当前可见区域内时才滚动
|
||||
if (targetTop < currentLeftScrollTop || targetTop > currentLeftScrollTop + visibleHeight - itemHeight) {
|
||||
let targetScrollTop = targetTop;
|
||||
|
||||
// 如果选中的标签在底部,确保它不会滚动出可见区域
|
||||
if (targetTop > this.$refs.leftScroll.scrollHeight - visibleHeight) {
|
||||
targetScrollTop = Math.max(0, this.$refs.leftScroll.scrollHeight - visibleHeight);
|
||||
}
|
||||
|
||||
this.$refs.leftScroll.scrollTo({
|
||||
top: targetScrollTop,
|
||||
duration: 100 // 进一步减少滚动动画时间
|
||||
});
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
},
|
||||
scrollTopBack(e) {
|
||||
const currentTime = Date.now();
|
||||
|
||||
// 更严格的防抖处理:如果距离上次滚动时间太短,则跳过处理
|
||||
if (currentTime - this.lastScrollTime < 80) {
|
||||
return;
|
||||
}
|
||||
this.lastScrollTime = currentTime;
|
||||
|
||||
// 清除之前的定时器
|
||||
if (this.scrollTimer) {
|
||||
clearTimeout(this.scrollTimer);
|
||||
}
|
||||
|
||||
// 设置新的定时器,延迟处理滚动事件
|
||||
this.scrollTimer = setTimeout(() => {
|
||||
this.scrollTop = e.detail.scrollTop;
|
||||
|
||||
// 滚动时自动选中对应的左侧标签
|
||||
const scrollTop = e.detail.scrollTop;
|
||||
let currentSection = null;
|
||||
let minDistance = Infinity;
|
||||
|
||||
// 遍历所有右侧的二级标题,找到当前最接近顶部的那个
|
||||
this.rightValue.forEach((section, index) => {
|
||||
// 更精确地估算每个section的位置(考虑标题高度和内容高度)
|
||||
const sectionTop = index * 280; // 增加估算高度,避免过于敏感
|
||||
const distance = Math.abs(sectionTop - scrollTop);
|
||||
|
||||
if (distance < minDistance) {
|
||||
minDistance = distance;
|
||||
currentSection = section;
|
||||
}
|
||||
});
|
||||
|
||||
// 只有当距离足够近时才切换左侧标签,避免过于敏感
|
||||
if (currentSection && minDistance < 100 && this.leftValue.id !== currentSection.parentId) {
|
||||
const parentItem = this.copyTree.find(item => item.id === currentSection.parentId);
|
||||
if (parentItem) {
|
||||
this.leftValue = parentItem;
|
||||
|
||||
// 使用更激进的防抖策略,避免频繁的左侧滚动
|
||||
if (this.scrollTimer) {
|
||||
clearTimeout(this.scrollTimer);
|
||||
}
|
||||
|
||||
this.scrollTimer = setTimeout(() => {
|
||||
// 只在必要时滚动左侧列表,避免频繁滚动导致的抖动
|
||||
const index = this.copyTree.findIndex(i => i.id === parentItem.id);
|
||||
if (index !== -1 && this.$refs.leftScroll) {
|
||||
// 获取当前左侧列表的滚动位置
|
||||
const currentLeftScrollTop = this.$refs.leftScroll.scrollTop || 0;
|
||||
const itemHeight = 160; // 每个选项高度
|
||||
const visibleHeight = 4 * itemHeight; // 可见区域高度
|
||||
|
||||
// 计算目标位置
|
||||
const targetTop = index * itemHeight;
|
||||
|
||||
// 只有当目标位置不在当前可见区域内时才滚动
|
||||
if (targetTop < currentLeftScrollTop || targetTop > currentLeftScrollTop + visibleHeight - itemHeight) {
|
||||
let targetScrollTop = targetTop;
|
||||
|
||||
// 如果选中的标签在底部,确保它不会滚动出可见区域
|
||||
if (targetTop > this.$refs.leftScroll.scrollHeight - visibleHeight) {
|
||||
targetScrollTop = Math.max(0, this.$refs.leftScroll.scrollHeight - visibleHeight);
|
||||
}
|
||||
|
||||
this.$refs.leftScroll.scrollTo({
|
||||
top: targetScrollTop,
|
||||
duration: 100 // 进一步减少滚动动画时间
|
||||
});
|
||||
}
|
||||
}
|
||||
}, 150); // 增加延迟,避免滚动冲突
|
||||
}
|
||||
}
|
||||
}, 80); // 增加防抖延迟到80ms
|
||||
this.scrollTop = e.detail.scrollTop;
|
||||
},
|
||||
addItem(item) {
|
||||
let titiles = [];
|
||||
@@ -308,10 +189,6 @@ export default {
|
||||
.sex-content-left
|
||||
width: 198rpx;
|
||||
padding: 20rpx 0 0 0;
|
||||
/* 添加硬件加速优化 */
|
||||
transform: translateZ(0);
|
||||
-webkit-transform: translateZ(0);
|
||||
will-change: transform;
|
||||
.left-list-btn
|
||||
padding: 0 40rpx 0 24rpx;
|
||||
display: grid;
|
||||
@@ -322,9 +199,6 @@ export default {
|
||||
font-size: 28rpx;
|
||||
position: relative
|
||||
margin-top: 60rpx
|
||||
/* 优化渲染性能 */
|
||||
transform: translateZ(0);
|
||||
-webkit-transform: translateZ(0);
|
||||
.left-list-btn:first-child
|
||||
margin-top: 0
|
||||
// .positionNum
|
||||
@@ -353,10 +227,6 @@ export default {
|
||||
// border-left: 2px solid #D9D9D9;
|
||||
background: #F6F6F6;
|
||||
flex: 1;
|
||||
/* 添加硬件加速优化 */
|
||||
transform: translateZ(0);
|
||||
-webkit-transform: translateZ(0);
|
||||
will-change: transform;
|
||||
.grid-sex
|
||||
display: grid;
|
||||
grid-template-columns: 50% 50%;
|
||||
@@ -374,9 +244,6 @@ export default {
|
||||
margin-top: 30rpx;
|
||||
background: #E8EAEE;
|
||||
color: #606060;
|
||||
/* 优化渲染性能 */
|
||||
transform: translateZ(0);
|
||||
-webkit-transform: translateZ(0);
|
||||
.sex-right-btned
|
||||
font-weight: 500
|
||||
width: 224rpx;
|
||||
@@ -384,7 +251,4 @@ export default {
|
||||
background: rgba(37,107,250,0.06);
|
||||
border: 2rpx solid #256BFA;
|
||||
color: #256BFA
|
||||
/* 优化渲染性能 */
|
||||
transform: translateZ(0);
|
||||
-webkit-transform: translateZ(0);
|
||||
</style>
|
||||
|
||||
@@ -1,654 +0,0 @@
|
||||
<template>
|
||||
<view class="job-dialog">
|
||||
<view class="header-title">
|
||||
<image :src="`${imgBaseUrl}/jobfair/xb.png`" mode=""></image>
|
||||
<text>招聘会报名</text>
|
||||
</view>
|
||||
<view class="dialog-content">
|
||||
<view class="detail-item" v-if="type == 2">
|
||||
<view class="gw-label">选择展区展位:</view>
|
||||
<!-- 展位状态说明 -->
|
||||
<view class="status-description">
|
||||
<view class="status-title">
|
||||
<text>展位状态说明:</text>
|
||||
</view>
|
||||
<view class="status-item">
|
||||
<view class="status-color available"></view>
|
||||
<text class="status-text">未被占用</text>
|
||||
</view>
|
||||
<view class="status-item">
|
||||
<view class="status-color occupied"></view>
|
||||
<text class="status-text">已被占用</text>
|
||||
</view>
|
||||
<view class="status-item">
|
||||
<view class="status-color pending"></view>
|
||||
<text class="status-text">待审核占用</text>
|
||||
</view>
|
||||
<view class="status-item">
|
||||
<view class="status-color selected"></view>
|
||||
<text class="status-text">当前选中</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="gw-value">
|
||||
<view class="cd-detail" v-for="(item, index) in areaAndBoothList" :key="index">
|
||||
<view class="cd-name">{{ item.jobFairAreaName }}</view>
|
||||
<view class="cd-con">
|
||||
<view class="cd-con-item" :class="getBoothStatusClass(booth)"
|
||||
v-for="(booth, boothIndex) in item.boothList" :key="boothIndex"
|
||||
@click="selectBooth(booth, item.jobFairAreaId)">
|
||||
<text>{{ booth.jobFairBoothName }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="detail-item">
|
||||
<view class="gw-label">请选择招聘岗位:</view>
|
||||
<view class="gw-value">
|
||||
<view class="checkbox-group">
|
||||
<view class="checkbox-item job-item" v-for="(item, index) in jobList" :key="index"
|
||||
:class="{ 'checked': checkList.includes(item) }" @click="toggleJobSelection(item)">
|
||||
<view class="item-checkbox">
|
||||
<view class="checkbox-icon" :class="{ 'checked': checkList.includes(item) }">
|
||||
<text v-if="checkList.includes(item)">✓</text>
|
||||
</view>
|
||||
<view class="job-info">
|
||||
<view class="job-name">{{ item.jobTitle }}</view>
|
||||
<view class="salary">{{ item.minSalary }} - {{ item.maxSalary }}元/月</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="detail-item">
|
||||
<view class="gw-label">请上传招聘海报:</view>
|
||||
<view class="gw-value">
|
||||
<view v-if="imageUrl">
|
||||
<image v-if="imageUrl" :src="publicUrl + '/file/file/minio' + imageUrl" class="avatar"
|
||||
mode="aspectFit" />
|
||||
<button type="warn" class="del-icon" @click="imageUrl = ''" size="mini">删除</button>
|
||||
</view>
|
||||
<view v-else>
|
||||
<button @click="chooseImage" class="avatar-uploader transparent-btn" type="default">
|
||||
<view class="avatar-uploader-icon">+</view>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn-box">
|
||||
<button style="background: #409EFF;color: #fff;" @click="submitForm">提交</button>
|
||||
<button type="default" @click="closeDialog">取消</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import config from "@/config.js"
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
nextTick,
|
||||
watch,
|
||||
inject
|
||||
} from 'vue';
|
||||
|
||||
const emit = defineEmits(['closePopup']);
|
||||
import {
|
||||
createRequest
|
||||
} from '@/utils/request.js';
|
||||
const {
|
||||
$api
|
||||
} = inject('globalFunction');
|
||||
|
||||
// 定义props
|
||||
const props = defineProps({
|
||||
// 招聘会类型1线上 2线下
|
||||
signType: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
// 报名角色 ent企业 person个人
|
||||
signRole: {
|
||||
type: String,
|
||||
default: 'ent'
|
||||
},
|
||||
// 招聘会id
|
||||
jobFairId: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
});
|
||||
|
||||
// 监听props变化
|
||||
watch(() => props.signType, (newVal) => {
|
||||
type.value = newVal;
|
||||
});
|
||||
|
||||
// 响应式数据
|
||||
const checkList = ref([]);
|
||||
const imageUrl = ref('');
|
||||
const type = ref('');
|
||||
const id = ref('');
|
||||
const jobList = ref([]);
|
||||
const userId = ref('');
|
||||
const areaAndBoothList = ref([]);
|
||||
const jobFairAreaId = ref(null);
|
||||
const jobFairBoothId = ref(null);
|
||||
const avatarUploader = ref(null);
|
||||
|
||||
// 配置
|
||||
const publicUrl = config.LCBaseUrl;
|
||||
const imgBaseUrl = config.imgBaseUrl
|
||||
const uploadUrl = config.LCBaseUrl + "/file/file/upload";
|
||||
|
||||
// 方法
|
||||
const selectBooth = (booth, jobFairAreaIdVal) => {
|
||||
if (booth.status == 0) {
|
||||
jobFairBoothId.value = booth.jobFairBoothId;
|
||||
jobFairAreaId.value = jobFairAreaIdVal;
|
||||
}
|
||||
};
|
||||
|
||||
const submitForm = async () => {
|
||||
if (type.value == "2") {
|
||||
if (!jobFairBoothId.value || !jobFairAreaId.value) {
|
||||
uni.showToast({
|
||||
title: '请选择展区展位',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (checkList.value.length === 0) {
|
||||
uni.showToast({
|
||||
title: '请选择招聘岗位',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!imageUrl.value) {
|
||||
uni.showToast({
|
||||
title: '请上传招聘海报',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
$api.myRequest("/system/user/login/user/info", {}, "GET", 10100, {
|
||||
Authorization: `Bearer ${uni.getStorageSync("Padmin-Token")}`
|
||||
}).then((userInfo) => {
|
||||
let data = {}
|
||||
if (type.value == "2") {
|
||||
data = {
|
||||
jobFairId: id.value,
|
||||
enterpriseId: userInfo.info.userId,
|
||||
jobInfoList: checkList.value,
|
||||
poster: imageUrl.value,
|
||||
jobFairAreaId: jobFairAreaId.value,
|
||||
jobFairBoothId: jobFairBoothId.value,
|
||||
code: userInfo.info.entCreditCode
|
||||
};
|
||||
} else {
|
||||
data = {
|
||||
jobFairId: id.value,
|
||||
enterpriseId: userInfo.info.userId,
|
||||
jobInfoList: checkList.value,
|
||||
poster: imageUrl.value,
|
||||
code: userInfo.info.entCreditCode
|
||||
};
|
||||
}
|
||||
$api.myRequest("/jobfair/public/job-fair-sign-up-enterprise/sign-up", data, "post", 9100, {
|
||||
Authorization: `Bearer ${uni.getStorageSync("Padmin-Token")}`
|
||||
}).then((res) => {
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: '报名成功',
|
||||
icon: 'success'
|
||||
});
|
||||
closeDialog();
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg || '报名失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
checkList.value = [];
|
||||
imageUrl.value = '';
|
||||
jobFairBoothId.value = null;
|
||||
jobFairAreaId.value = null;
|
||||
emit('closePopup')
|
||||
};
|
||||
|
||||
const handleAvatarSuccess = (response) => {
|
||||
imageUrl.value = response.data.url;
|
||||
uni.showToast({
|
||||
title: '海报上传成功',
|
||||
icon: 'success'
|
||||
});
|
||||
};
|
||||
|
||||
const showDialog = (dialogType, dialogId) => {
|
||||
type.value = dialogType;
|
||||
id.value = dialogId;
|
||||
nextTick(() => {
|
||||
getJobList();
|
||||
if (type.value === "2") {
|
||||
getAreaAndBoothInfo();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 展区展位列表
|
||||
const getAreaAndBoothInfo = () => {
|
||||
const data = {
|
||||
jobFairId: props.jobFairId,
|
||||
}
|
||||
$api.myRequest("/jobfair/public/jobfair/area-and-booth-info-by-job-fair-id", data, "GET", 9100, {
|
||||
Authorization: `Bearer ${uni.getStorageSync("Padmin-Token")}`
|
||||
}).then((resData) => {
|
||||
areaAndBoothList.value = resData.data || [];
|
||||
});
|
||||
};
|
||||
|
||||
// 岗位列表
|
||||
const getJobList = () => {
|
||||
$api.myRequest("/system/user/login/user/info", {}, "GET", 10100, {
|
||||
Authorization: `Bearer ${uni.getStorageSync("Padmin-Token")}`
|
||||
}).then((userInfo) => {
|
||||
const data = {
|
||||
jobFairId: id.value,
|
||||
enterpriseId: userInfo.info.userId,
|
||||
pageNum: 1,
|
||||
pageSize: 1000,
|
||||
code: userInfo.info.entCreditCode
|
||||
}
|
||||
$api.myRequest("/jobfair/public/job-info/list", data, "GET", 9100, {
|
||||
Authorization: `Bearer ${uni.getStorageSync("Padmin-Token")}`
|
||||
}).then((resData) => {
|
||||
if(resData.code == 200){
|
||||
jobList.value = resData.data.list || [];
|
||||
// let isPublishJobList = resData.data.list || [];
|
||||
// jobList.value = isPublishJobList.filter(job => job.isPublish === "1");
|
||||
// if (isPublishJobList.length > 0 && jobList.value.length === 0) {
|
||||
// uni.showToast({
|
||||
// title: '请等待岗位审核通过后,再进行报名',
|
||||
// icon: 'none'
|
||||
// });
|
||||
// }
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: '请前往基本信息中完善企业信息和岗位信息',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const getBoothStatusClass = (booth) => {
|
||||
const s = booth.status || 0;
|
||||
if (s == 1) return "cd-con-item-checked";
|
||||
if (s == 2) return "cd-con-item-review";
|
||||
if (jobFairBoothId.value && jobFairBoothId.value == booth.jobFairBoothId)
|
||||
return "cd-con-item-mychecked";
|
||||
return "";
|
||||
};
|
||||
|
||||
// 选择图片
|
||||
const chooseImage = () => {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: (res) => {
|
||||
const tempFilePath = res.tempFilePaths[0];
|
||||
uploadImage(tempFilePath);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 上传图片
|
||||
const uploadImage = (tempFilePath) => {
|
||||
uni.uploadFile({
|
||||
url: uploadUrl,
|
||||
filePath: tempFilePath,
|
||||
name: 'file',
|
||||
success: (uploadFileRes) => {
|
||||
try {
|
||||
const response = JSON.parse(uploadFileRes.data);
|
||||
handleAvatarSuccess(response);
|
||||
} catch (e) {
|
||||
uni.showToast({
|
||||
title: '上传失败,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('上传失败:', err);
|
||||
uni.showToast({
|
||||
title: '上传失败,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 切换岗位选择
|
||||
const toggleJobSelection = (item) => {
|
||||
const index = checkList.value.indexOf(item);
|
||||
if (index > -1) {
|
||||
checkList.value.splice(index, 1);
|
||||
} else {
|
||||
checkList.value.push(item);
|
||||
}
|
||||
};
|
||||
|
||||
// 暴露方法给父组件
|
||||
defineExpose({
|
||||
showDialog
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
setTimeout(() => {
|
||||
type.value = props.signType;
|
||||
if (props.jobFairId) {
|
||||
id.value = props.jobFairId;
|
||||
getJobList();
|
||||
if (props.signType == 2) {
|
||||
getAreaAndBoothInfo();
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
|
||||
// 监听jobFairId变化
|
||||
watch(() => props.jobFairId, (newVal) => {
|
||||
if (newVal) {
|
||||
id.value = newVal;
|
||||
getJobList();
|
||||
if (type.value === 2) {
|
||||
getAreaAndBoothInfo();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.del-icon {
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
|
||||
.btn-box {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.btn-box button {
|
||||
padding: 0 80rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
}
|
||||
|
||||
.avatar-uploader {
|
||||
border: 2rpx solid #0983ff;
|
||||
border-radius: 12rpx;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
width: 400rpx;
|
||||
height: 200rpx;
|
||||
}
|
||||
|
||||
.avatar-uploader-icon {
|
||||
font-size: 56rpx;
|
||||
color: #007AFF;
|
||||
line-height: 200rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.job-dialog {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.dialog-content {
|
||||
padding: 0 20rpx;
|
||||
height: calc(100% - 17vh);
|
||||
overflow-y: auto;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.checkbox-group {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.checkbox-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 2rpx solid #b5d3ff;
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
|
||||
.job-item {
|
||||
width: 97%;
|
||||
}
|
||||
|
||||
.checkbox-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border: 2rpx solid #ddd;
|
||||
border-radius: 8rpx;
|
||||
margin-right: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.checkbox-icon.checked {
|
||||
background-color: #409eff;
|
||||
border-color: #409eff;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.job-info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.detail-item {
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.detail-item .gw-label {
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.detail-item .gw-value {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.detail-item .gw-value .cd-detail {
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
margin-bottom: 28rpx;
|
||||
margin-top: 28rpx;
|
||||
}
|
||||
|
||||
.detail-item .gw-value .cd-detail .cd-name {
|
||||
background: #d3e8ff;
|
||||
color: #0076d9;
|
||||
font-size: 40rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
padding: 0 40rpx;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.detail-item .gw-value .cd-detail .cd-name::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 10rpx;
|
||||
height: 100%;
|
||||
background: #349cfc;
|
||||
}
|
||||
|
||||
.detail-item .gw-value .cd-detail .cd-con {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
padding: 30rpx 40rpx;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.detail-item .gw-value .cd-detail .cd-con .cd-con-item {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
background: #67CFA7;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
border: 2rpx solid #ddd;
|
||||
border-radius: 20rpx;
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.detail-item .gw-value .cd-detail .cd-con .cd-con-item-review {
|
||||
background-color: #F8BB92;
|
||||
}
|
||||
|
||||
.detail-item .gw-value .cd-detail .cd-con .cd-con-item-checked {
|
||||
background: #F6A1A1;
|
||||
}
|
||||
|
||||
.detail-item .gw-value .cd-detail .cd-con .cd-con-item-mychecked {
|
||||
background: #79BEFE;
|
||||
}
|
||||
|
||||
.item-checkbox {
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.job-name {
|
||||
font-size: 32rpx;
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.salary {
|
||||
font-size: 32rpx;
|
||||
color: #ff6e27;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.header-title {
|
||||
font-size: 38rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
padding: 20rpx;
|
||||
padding-bottom: 40rpx;
|
||||
background: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.header-title image {
|
||||
width: 14rpx;
|
||||
height: 33rpx;
|
||||
margin-right: 14rpx;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 400rpx;
|
||||
height: 200rpx;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
/* 展位状态说明样式 */
|
||||
.status-description {
|
||||
margin-top: 30rpx;
|
||||
padding: 20rpx;
|
||||
background-color: #f5f7fa;
|
||||
border-radius: 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.status-title {
|
||||
font-weight: bold;
|
||||
margin-bottom: 16rpx;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.status-item {
|
||||
width: 43%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 30rpx;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.status-color {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.status-color.available {
|
||||
background-color: #67CFA7;
|
||||
border: 2rpx solid #ddd;
|
||||
}
|
||||
|
||||
.status-color.occupied {
|
||||
background-color: #F6A1A1;
|
||||
}
|
||||
|
||||
.status-color.pending {
|
||||
background-color: #F8BB92;
|
||||
}
|
||||
|
||||
.status-color.selected {
|
||||
background-color: #79BEFE;
|
||||
}
|
||||
|
||||
.status-text {
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
/* 透明按钮样式 */
|
||||
.transparent-btn {
|
||||
background: transparent !important;
|
||||
border: 2rpx dashed #0983ff !important;
|
||||
}
|
||||
</style>
|
||||
@@ -1,52 +0,0 @@
|
||||
<!-- #ifdef H5 -->
|
||||
<template>
|
||||
<view></view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// #ifdef H5
|
||||
export default {
|
||||
name: 'Keypress',
|
||||
props: {
|
||||
disable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
const keyNames = {
|
||||
esc: ['Esc', 'Escape'],
|
||||
tab: 'Tab',
|
||||
enter: 'Enter',
|
||||
space: [' ', 'Spacebar'],
|
||||
up: ['Up', 'ArrowUp'],
|
||||
left: ['Left', 'ArrowLeft'],
|
||||
right: ['Right', 'ArrowRight'],
|
||||
down: ['Down', 'ArrowDown'],
|
||||
delete: ['Backspace', 'Delete', 'Del']
|
||||
}
|
||||
const listener = ($event) => {
|
||||
if (this.disable) {
|
||||
return
|
||||
}
|
||||
const keyName = Object.keys(keyNames).find(key => {
|
||||
const keyName = $event.key
|
||||
const value = keyNames[key]
|
||||
return value === keyName || (Array.isArray(value) && value.includes(keyName))
|
||||
})
|
||||
if (keyName) {
|
||||
// 避免和其他按键事件冲突
|
||||
setTimeout(() => {
|
||||
this.$emit(keyName, {})
|
||||
}, 0)
|
||||
}
|
||||
}
|
||||
document.addEventListener('keyup', listener)
|
||||
// this.$once('hook:beforeDestroy', () => {
|
||||
// document.removeEventListener('keyup', listener)
|
||||
// })
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
</script>
|
||||
<!-- #endif -->
|
||||
@@ -1,45 +1,13 @@
|
||||
<template>
|
||||
<view class="markdown-body">
|
||||
<!-- 根据不同平台使用不同的渲染方式 -->
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<!-- 微信小程序端:使用v-for遍历岗位卡片列表,每个卡片单独渲染,支持点击事件 -->
|
||||
<scroll-view class="markdownRich" id="markdown-content">
|
||||
<!-- 渲染普通markdown内容 -->
|
||||
<rich-text :nodes="renderedHtml" />
|
||||
|
||||
<!-- 单独渲染岗位卡片,支持点击事件 -->
|
||||
<view v-if="localJobCardsList.length > 0" class="job-cards-container">
|
||||
<view
|
||||
v-for="(card, index) in localJobCardsList"
|
||||
:key="index"
|
||||
class="custom-card"
|
||||
@tap="navigateToJobDetail(card.jobId)"
|
||||
>
|
||||
<view class="card-title">
|
||||
<text class="title-text">{{ card.jobTitle }}</text>
|
||||
<view class="card-salary">{{ card.salary }}</view>
|
||||
</view>
|
||||
<view class="card-company">{{ card.location }}·{{ card.companyName }}</view>
|
||||
<view class="card-info">
|
||||
<view class="info-item">
|
||||
<view class="card-tag">{{ card.education }}</view>
|
||||
<view class="card-tag">{{ card.experience }}</view>
|
||||
</view>
|
||||
<view class="info-item">查看详情<view class="position-nav"></view></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<view class="markdown-body" v-html="renderedHtml" @click="handleH5Click"></view>
|
||||
<!-- #endif -->
|
||||
<rich-text class="markdownRich" id="markdown-content" :nodes="renderedHtml" @itemclick="handleItemClick" />
|
||||
<!-- <view class="markdown-body" v-html="renderedHtml"></view> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, inject, ref, watch, nextTick } from 'vue';
|
||||
import { parseMarkdown, codeDataList, jobCardsList } from '@/utils/markdownParser';
|
||||
import { computed, onMounted, inject } from 'vue';
|
||||
import { parseMarkdown, codeDataList } from '@/utils/markdownParser';
|
||||
const { navTo } = inject('globalFunction');
|
||||
const props = defineProps({
|
||||
content: {
|
||||
@@ -53,191 +21,30 @@ const props = defineProps({
|
||||
});
|
||||
|
||||
const renderedHtml = computed(() => parseMarkdown(props.content));
|
||||
const markdownContainer = ref(null);
|
||||
// 响应式岗位卡片列表,用于微信小程序端单独渲染
|
||||
const localJobCardsList = ref([]);
|
||||
|
||||
// 监听content的变化,当内容更新时,解析岗位卡片
|
||||
watch(() => props.content, (newContent) => {
|
||||
if (newContent) {
|
||||
// 直接调用parseMarkdown来触发jobCardsList的更新
|
||||
parseMarkdown(newContent);
|
||||
// 将解析器生成的岗位卡片列表赋值给响应式数据
|
||||
localJobCardsList.value = [...jobCardsList];
|
||||
console.log('Content changed, jobCardsList updated:', localJobCardsList.value);
|
||||
}
|
||||
}, { immediate: true });
|
||||
|
||||
// 同时监听renderedHtml的变化作为备份
|
||||
watch(() => renderedHtml.value, (newVal) => {
|
||||
console.log('renderedHtml changed, jobCardsList from parser:', jobCardsList);
|
||||
// 将解析器生成的岗位卡片列表赋值给响应式数据
|
||||
localJobCardsList.value = [...jobCardsList];
|
||||
});
|
||||
|
||||
// 微信小程序端导航到岗位详情页面
|
||||
const navigateToJobDetail = (jobId) => {
|
||||
console.log('navigateToJobDetail called with jobId:', jobId);
|
||||
if (jobId && jobId !== 'undefined' && jobId !== 'null') {
|
||||
// 跳转到岗位详情页面
|
||||
uni.navigateTo({
|
||||
url: `/packageA/pages/post/post?jobId=${jobId}`,
|
||||
success: (res) => {
|
||||
console.log('navigateTo success:', res);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('navigateTo failed:', err);
|
||||
// 如果navigateTo失败,尝试redirectTo
|
||||
uni.redirectTo({
|
||||
url: `/packageA/pages/post/post?jobId=${jobId}`,
|
||||
success: (res2) => {
|
||||
console.log('redirectTo success:', res2);
|
||||
},
|
||||
fail: (err2) => {
|
||||
console.error('redirectTo also failed:', err2);
|
||||
// 如果还是失败,显示错误提示
|
||||
uni.showToast({
|
||||
title: '跳转失败,请稍后重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error('Invalid jobId:', jobId);
|
||||
uni.showToast({
|
||||
title: '岗位信息不完整',
|
||||
icon: 'none'
|
||||
});
|
||||
const handleItemClick = (e) => {
|
||||
let { attrs } = e.detail.node;
|
||||
console.log(attrs);
|
||||
let { 'data-copy-index': codeDataIndex, 'data-job-id': jobId, class: className } = attrs;
|
||||
switch (className) {
|
||||
case 'custom-card':
|
||||
return navTo('/packageA/pages/post/post?jobId=' + jobId);
|
||||
case 'custom-more':
|
||||
return navTo('/packageA/pages/moreJobs/moreJobs?jobId=' + jobId);
|
||||
case 'copy-btn':
|
||||
uni.setClipboardData({
|
||||
data: codeDataList[codeDataIndex],
|
||||
showToast: false,
|
||||
success() {
|
||||
uni.showToast({
|
||||
title: '复制成功',
|
||||
icon: 'none',
|
||||
});
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
// 微信小程序端点击事件处理已移除,改用v-for遍历岗位卡片列表,每个卡片单独渲染,支持点击事件
|
||||
// 微信小程序端和H5端的jobId取值方式一致,都是从JSON数据的appJobUrl字段提取
|
||||
// 不同的是,微信小程序端现在使用v-for遍历渲染,而H5端使用v-html渲染
|
||||
|
||||
// H5平台点击事件处理
|
||||
// 微信小程序端和H5端的jobId取值方式一致,都是从JSON数据的appJobUrl字段提取
|
||||
// 不同的是,H5端可以直接从DOM属性获取,而微信小程序端使用v-for遍历渲染
|
||||
const handleH5Click = (e) => {
|
||||
console.log('H5 click event triggered:', e.target);
|
||||
let target = e.target;
|
||||
// 查找最接近的带有class的元素
|
||||
while (target && target.tagName !== 'BODY') {
|
||||
console.log('Checking target:', target, 'className:', target.className, 'tagName:', target.tagName);
|
||||
|
||||
// 直接使用closest方法查找,不依赖className
|
||||
const cardElement = target.closest('.custom-card');
|
||||
const moreElement = target.closest('.custom-more');
|
||||
|
||||
console.log('Found elements:', { cardElement, moreElement });
|
||||
|
||||
if (cardElement) {
|
||||
// 尝试多种方式获取jobId
|
||||
let jobId = cardElement.getAttribute('data-job-id');
|
||||
console.log('Found custom-card, data-job-id attribute:', jobId);
|
||||
|
||||
// 如果data-job-id为空,尝试从onclick事件中提取jobId
|
||||
if (!jobId) {
|
||||
const onclick = cardElement.getAttribute('onclick');
|
||||
if (onclick) {
|
||||
const match = onclick.match(/jobId=(\w+)/);
|
||||
if (match && match[1]) {
|
||||
jobId = match[1];
|
||||
console.log('Extracted jobId from onclick:', jobId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (jobId) {
|
||||
console.log('Final jobId for navigation:', jobId);
|
||||
try {
|
||||
// 直接使用uni.navigateTo,避免navTo函数的潜在问题
|
||||
uni.navigateTo({
|
||||
url: `/packageA/pages/post/post?jobId=${jobId}`,
|
||||
success: (res) => {
|
||||
console.log('navigateTo success:', res);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('navigateTo failed:', err);
|
||||
// 如果navigateTo失败,尝试redirectTo
|
||||
uni.redirectTo({
|
||||
url: `/packageA/pages/post/post?jobId=${jobId}`,
|
||||
success: (res2) => {
|
||||
console.log('redirectTo success:', res2);
|
||||
},
|
||||
fail: (err2) => {
|
||||
console.error('redirectTo also failed:', err2);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Navigation error:', error);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
console.error('No jobId found for custom-card');
|
||||
}
|
||||
} else if (moreElement) {
|
||||
// 尝试多种方式获取jobId
|
||||
let jobId = moreElement.getAttribute('data-job-id');
|
||||
console.log('Found custom-more, data-job-id attribute:', jobId);
|
||||
|
||||
// 如果data-job-id为空,尝试从onclick事件中提取jobId
|
||||
if (!jobId) {
|
||||
const onclick = moreElement.getAttribute('onclick');
|
||||
if (onclick) {
|
||||
const match = onclick.match(/jobId=(\w+)/);
|
||||
if (match && match[1]) {
|
||||
jobId = match[1];
|
||||
console.log('Extracted jobId from onclick:', jobId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (jobId) {
|
||||
console.log('Final jobId for more jobs:', jobId);
|
||||
try {
|
||||
// 直接使用uni.navigateTo,避免navTo函数的潜在问题
|
||||
uni.navigateTo({
|
||||
url: `/packageA/pages/moreJobs/moreJobs?jobId=${jobId}`,
|
||||
success: (res) => {
|
||||
console.log('navigateTo success:', res);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('navigateTo failed:', err);
|
||||
// 如果navigateTo失败,尝试redirectTo
|
||||
uni.redirectTo({
|
||||
url: `/packageA/pages/moreJobs/moreJobs?jobId=${jobId}`,
|
||||
success: (res2) => {
|
||||
console.log('redirectTo success:', res2);
|
||||
},
|
||||
fail: (err2) => {
|
||||
console.error('redirectTo also failed:', err2);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Navigation error:', error);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
console.error('No jobId found for custom-more');
|
||||
}
|
||||
}
|
||||
|
||||
target = target.parentElement;
|
||||
}
|
||||
};
|
||||
|
||||
// 移除旧的事件监听逻辑,改用全局点击处理
|
||||
|
||||
onMounted(() => {
|
||||
console.log('onMounted called');
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@@ -309,7 +116,6 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
/* 表格 */
|
||||
/* #ifndef MP-WEIXIN */
|
||||
table {
|
||||
// display: block; /* 让表格可滚动 */
|
||||
// width: 100%;
|
||||
@@ -341,7 +147,6 @@ tr:hover {
|
||||
background-color: #f1f1f1;
|
||||
transition: 0.3s;
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
/* 代码块 */
|
||||
pre,
|
||||
@@ -402,13 +207,11 @@ pre code:empty {
|
||||
cursor: pointer;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
/* #ifndef MP-WEIXIN */
|
||||
.copy-btn:hover {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
color: #259939;
|
||||
text-decoration: underline;
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
pre.hljs {
|
||||
padding: 0 24rpx;
|
||||
@@ -443,7 +246,6 @@ ol {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* #ifndef MP-WEIXIN */
|
||||
#markdown-content ::v-deep div > pre:first-of-type {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
@@ -452,7 +254,6 @@ ol {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
/* #endif */
|
||||
.markdownRich > div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -460,7 +261,7 @@ ol {
|
||||
</style>
|
||||
|
||||
<style lang="stylus">
|
||||
.custom-more
|
||||
.custom-more{
|
||||
display: flex
|
||||
justify-content: center
|
||||
align-items: center
|
||||
@@ -475,16 +276,15 @@ ol {
|
||||
transition: all 0.3s ease
|
||||
position: relative
|
||||
overflow: hidden
|
||||
|
||||
.more-icon
|
||||
width: 32rpx
|
||||
height: 32rpx
|
||||
background: url('@/static/svg/seemore.svg') center center no-repeat
|
||||
.more-icon{
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
background: url('@/static/svg/seemore.svg') center center no-repeat;
|
||||
background-size: 100% 100%
|
||||
margin-left: 12rpx
|
||||
filter: brightness(0) invert(1)
|
||||
|
||||
&::before
|
||||
}
|
||||
&::before {
|
||||
content: ''
|
||||
position: absolute
|
||||
top: 0
|
||||
@@ -493,490 +293,93 @@ ol {
|
||||
height: 100%
|
||||
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent)
|
||||
transition: left 0.5s ease
|
||||
|
||||
&:active
|
||||
}
|
||||
&:active {
|
||||
transform: translateY(2rpx)
|
||||
box-shadow: 0rpx 4rpx 16rpx rgba(37, 107, 250, 0.4)
|
||||
|
||||
&:active::before
|
||||
}
|
||||
&:active::before {
|
||||
left: 100%
|
||||
|
||||
/* 为小程序专门优化的样式 */
|
||||
/* #ifdef MP-WEIXIN */
|
||||
.rich-text-container
|
||||
padding: 0 20rpx
|
||||
|
||||
.markdownRich
|
||||
padding: 0
|
||||
/* #endif */
|
||||
|
||||
/* H5端和小程序端样式优化 */
|
||||
.custom-card
|
||||
background: #FFFFFF !important
|
||||
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0,0,0,0.04) !important
|
||||
border-radius: 20rpx !important
|
||||
padding: 28rpx 24rpx !important
|
||||
font-weight: 400 !important
|
||||
font-size: 28rpx !important
|
||||
color: #333333 !important
|
||||
margin-bottom: 22rpx !important
|
||||
position: relative !important
|
||||
display: block !important
|
||||
flex-direction: column !important
|
||||
/* 确保在所有平台中边距正确应用 */
|
||||
margin-left: auto !important
|
||||
margin-right: auto !important
|
||||
width: 100% !important
|
||||
box-sizing: border-box !important
|
||||
text-decoration: none !important
|
||||
overflow: hidden !important
|
||||
|
||||
.custom-card .card-title
|
||||
font-weight: 600 !important
|
||||
display: flex !important
|
||||
align-items: center !important
|
||||
justify-content: space-between !important
|
||||
margin-bottom: 16rpx !important
|
||||
|
||||
.custom-card .card-title .title-text
|
||||
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif !important
|
||||
max-width: calc(100% - 160rpx) !important
|
||||
overflow: hidden !important
|
||||
text-overflow: ellipsis !important
|
||||
font-size: 32rpx !important
|
||||
line-height: 1.4 !important
|
||||
white-space: nowrap !important
|
||||
margin-bottom: 0 !important
|
||||
|
||||
.custom-card .card-title .card-salary
|
||||
font-family: DIN-Medium !important
|
||||
font-size: 32rpx !important
|
||||
color: #4C6EFB !important
|
||||
line-height: 1.4 !important
|
||||
font-weight: 500 !important
|
||||
margin-bottom: 0 !important
|
||||
|
||||
.custom-card .card-company
|
||||
margin-bottom: 18rpx !important
|
||||
max-width: 100% !important
|
||||
overflow: hidden !important
|
||||
text-overflow: ellipsis !important
|
||||
color: #6C7282 !important
|
||||
line-height: 1.4 !important
|
||||
white-space: nowrap !important
|
||||
font-size: 28rpx !important
|
||||
margin-top: 0 !important
|
||||
display: block !important
|
||||
|
||||
.custom-card .card-tags
|
||||
display: flex !important
|
||||
flex-wrap: wrap !important
|
||||
margin-bottom: 24rpx !important
|
||||
|
||||
.custom-card .card-tag
|
||||
font-weight: 400 !important
|
||||
font-size: 24rpx !important
|
||||
color: #6C7282 !important
|
||||
width: fit-content !important
|
||||
background: #F4F4F4 !important
|
||||
border-radius: 4rpx !important
|
||||
padding: 6rpx 20rpx !important
|
||||
margin-right: 20rpx !important
|
||||
margin-bottom: 14rpx !important
|
||||
display: inline-flex !important
|
||||
align-items: center !important
|
||||
justify-content: center !important
|
||||
height: 30rpx !important
|
||||
line-height: 30rpx !important
|
||||
|
||||
.custom-card .card-bottom
|
||||
display: flex !important
|
||||
justify-content: space-between !important
|
||||
font-size: 24rpx !important
|
||||
color: #6C7282 !important
|
||||
margin-top: 0 !important
|
||||
margin-bottom: 0 !important
|
||||
|
||||
.custom-card .card-bottom .info-item
|
||||
display: flex !important
|
||||
align-items: center !important
|
||||
justify-content: center !important
|
||||
margin-bottom: 0 !important
|
||||
|
||||
.custom-card .card-info
|
||||
display: flex !important
|
||||
align-items: center !important
|
||||
justify-content: space-between !important
|
||||
padding-right: 40rpx !important
|
||||
|
||||
.custom-card .card-info .info-item
|
||||
display: flex !important
|
||||
position: relative !important
|
||||
align-items: center !important
|
||||
|
||||
.custom-card .card-info .info-item:last-child
|
||||
color: #256BFA !important
|
||||
font-size: 28rpx !important
|
||||
padding-right: 10rpx !important
|
||||
|
||||
.custom-card .position-nav
|
||||
position: absolute !important
|
||||
right: -10rpx !important
|
||||
top: 50% !important
|
||||
transform: translateY(-50%) !important
|
||||
|
||||
.custom-card .position-nav::before
|
||||
position: absolute !important
|
||||
left: 0 !important
|
||||
top: -4rpx !important
|
||||
content: '' !important
|
||||
width: 4rpx !important
|
||||
height: 16rpx !important
|
||||
border-radius: 2rpx !important
|
||||
background: #256BFA !important
|
||||
transform: translate(0, -50%) rotate(-45deg) !important
|
||||
|
||||
.custom-card .position-nav::after
|
||||
position: absolute !important
|
||||
left: 0 !important
|
||||
top: -4rpx !important
|
||||
content: '' !important
|
||||
width: 4rpx !important
|
||||
height: 16rpx !important
|
||||
border-radius: 2rpx !important
|
||||
background: #256BFA !important
|
||||
transform: rotate(45deg) !important
|
||||
|
||||
/* 为微信小程序专门优化的样式选择器 */
|
||||
/* #ifdef MP-WEIXIN */
|
||||
.job-cards-container .custom-card
|
||||
background: #FFFFFF !important
|
||||
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0,0,0,0.04) !important
|
||||
border-radius: 20rpx !important
|
||||
padding: 28rpx 24rpx !important
|
||||
font-weight: 400 !important
|
||||
font-size: 28rpx !important
|
||||
color: #333333 !important
|
||||
margin-bottom: 22rpx !important
|
||||
position: relative !important
|
||||
display: block !important
|
||||
flex-direction: column !important
|
||||
margin-left: auto !important
|
||||
margin-right: auto !important
|
||||
width: 100% !important
|
||||
box-sizing: border-box !important
|
||||
text-decoration: none !important
|
||||
overflow: hidden !important
|
||||
|
||||
.job-cards-container .custom-card .card-title
|
||||
font-weight: 600 !important
|
||||
display: flex !important
|
||||
align-items: center !important
|
||||
justify-content: space-between !important
|
||||
margin-bottom: 16rpx !important
|
||||
|
||||
.job-cards-container .custom-card .card-title .title-text
|
||||
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif !important
|
||||
max-width: calc(100% - 160rpx) !important
|
||||
overflow: hidden !important
|
||||
text-overflow: ellipsis !important
|
||||
font-size: 32rpx !important
|
||||
line-height: 1.4 !important
|
||||
white-space: nowrap !important
|
||||
margin-bottom: 0 !important
|
||||
|
||||
.job-cards-container .custom-card .card-title .card-salary
|
||||
font-family: DIN-Medium !important
|
||||
font-size: 32rpx !important
|
||||
color: #4C6EFB !important
|
||||
line-height: 1.4 !important
|
||||
font-weight: 500 !important
|
||||
margin-bottom: 0 !important
|
||||
|
||||
.job-cards-container .custom-card .card-company
|
||||
margin-bottom: 18rpx !important
|
||||
max-width: 100% !important
|
||||
overflow: hidden !important
|
||||
text-overflow: ellipsis !important
|
||||
color: #6C7282 !important
|
||||
line-height: 1.4 !important
|
||||
white-space: nowrap !important
|
||||
font-size: 28rpx !important
|
||||
margin-top: 0 !important
|
||||
display: block !important
|
||||
|
||||
.job-cards-container .custom-card .card-info
|
||||
display: flex !important
|
||||
align-items: center !important
|
||||
justify-content: space-between !important
|
||||
padding-right: 40rpx !important
|
||||
|
||||
.job-cards-container .custom-card .card-info .info-item
|
||||
display: flex !important
|
||||
position: relative !important
|
||||
align-items: center !important
|
||||
|
||||
.job-cards-container .custom-card .card-info .info-item:last-child
|
||||
color: #256BFA !important
|
||||
font-size: 28rpx !important
|
||||
padding-right: 10rpx !important
|
||||
|
||||
.job-cards-container .custom-card .card-info .info-item .card-tag
|
||||
font-weight: 400 !important
|
||||
font-size: 24rpx !important
|
||||
color: #6C7282 !important
|
||||
width: fit-content !important
|
||||
background: #F4F4F4 !important
|
||||
border-radius: 4rpx !important
|
||||
padding: 6rpx 20rpx !important
|
||||
margin-right: 20rpx !important
|
||||
margin-bottom: 14rpx !important
|
||||
display: inline-flex !important
|
||||
align-items: center !important
|
||||
justify-content: center !important
|
||||
height: 30rpx !important
|
||||
line-height: 30rpx !important
|
||||
|
||||
.job-cards-container .custom-card .position-nav
|
||||
position: absolute !important
|
||||
right: -10rpx !important
|
||||
top: 50% !important
|
||||
transform: translateY(-50%) !important
|
||||
|
||||
.job-cards-container .custom-card .position-nav::before
|
||||
position: absolute !important
|
||||
left: 0 !important
|
||||
top: -4rpx !important
|
||||
content: '' !important
|
||||
width: 4rpx !important
|
||||
height: 16rpx !important
|
||||
border-radius: 2rpx !important
|
||||
background: #256BFA !important
|
||||
transform: translate(0, -50%) rotate(-45deg) !important
|
||||
|
||||
.job-cards-container .custom-card .position-nav::after
|
||||
position: absolute !important
|
||||
left: 0 !important
|
||||
top: -4rpx !important
|
||||
content: '' !important
|
||||
width: 4rpx !important
|
||||
height: 16rpx !important
|
||||
border-radius: 2rpx !important
|
||||
background: #256BFA !important
|
||||
transform: rotate(45deg) !important
|
||||
/* #endif */
|
||||
|
||||
/* 额外的H5端样式优化 */
|
||||
/* #ifndef MP-WEIXIN */
|
||||
/* 确保样式能正确应用到v-html生成的内容 */
|
||||
.markdown-body {
|
||||
/* 重置v-html容器样式 */
|
||||
display: block !important;
|
||||
|
||||
/* 为v-html生成的a.custom-card标签添加基础样式 */
|
||||
a.custom-card {
|
||||
display: block !important;
|
||||
margin-bottom: 22rpx !important;
|
||||
background: #FFFFFF !important;
|
||||
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0,0,0,0.04) !important;
|
||||
border-radius: 20rpx !important;
|
||||
padding: 28rpx 24rpx !important;
|
||||
font-weight: 400 !important;
|
||||
font-size: 28rpx !important;
|
||||
color: #333333 !important;
|
||||
text-decoration: none !important;
|
||||
overflow: hidden !important;
|
||||
box-sizing: border-box !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
/* 卡片标题样式 */
|
||||
a.custom-card .card-title {
|
||||
font-weight: 600 !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
justify-content: space-between !important;
|
||||
margin-bottom: 16rpx !important;
|
||||
}
|
||||
|
||||
a.custom-card .card-title .title-text {
|
||||
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif !important;
|
||||
font-size: 32rpx !important;
|
||||
line-height: 1.4 !important;
|
||||
color: #333333 !important;
|
||||
max-width: calc(100% - 160rpx) !important;
|
||||
overflow: hidden !important;
|
||||
text-overflow: ellipsis !important;
|
||||
white-space: nowrap !important;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
a.custom-card .card-title .card-salary {
|
||||
font-family: DIN-Medium !important;
|
||||
font-size: 32rpx !important;
|
||||
color: #4C6EFB !important;
|
||||
line-height: 1.4 !important;
|
||||
font-weight: 500 !important;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
/* 公司信息样式 */
|
||||
a.custom-card .card-company {
|
||||
margin-bottom: 18rpx !important;
|
||||
font-size: 28rpx !important;
|
||||
color: #6C7282 !important;
|
||||
line-height: 1.4 !important;
|
||||
max-width: 100% !important;
|
||||
overflow: hidden !important;
|
||||
text-overflow: ellipsis !important;
|
||||
white-space: nowrap !important;
|
||||
margin-top: 0 !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
/* 标签容器样式 */
|
||||
a.custom-card .card-tags {
|
||||
display: flex !important;
|
||||
flex-wrap: wrap !important;
|
||||
margin-bottom: 24rpx !important;
|
||||
}
|
||||
|
||||
/* 单个标签样式 */
|
||||
a.custom-card .card-tag {
|
||||
font-weight: 400 !important;
|
||||
font-size: 24rpx !important;
|
||||
color: #6C7282 !important;
|
||||
width: fit-content !important;
|
||||
background: #F4F4F4 !important;
|
||||
border-radius: 4rpx !important;
|
||||
padding: 6rpx 20rpx !important;
|
||||
margin-right: 20rpx !important;
|
||||
margin-bottom: 14rpx !important;
|
||||
display: inline-flex !important;
|
||||
align-items: center !important;
|
||||
justify-content: center !important;
|
||||
height: 30rpx !important;
|
||||
line-height: 30rpx !important;
|
||||
}
|
||||
|
||||
/* 卡片底部样式 */
|
||||
a.custom-card .card-bottom {
|
||||
display: flex !important;
|
||||
justify-content: space-between !important;
|
||||
font-size: 24rpx !important;
|
||||
color: #6C7282 !important;
|
||||
margin-top: 0 !important;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
a.custom-card .card-bottom .info-item {
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
justify-content: center !important;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
/* 卡片信息区域样式 */
|
||||
a.custom-card .card-info {
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
justify-content: space-between !important;
|
||||
padding-right: 40rpx !important;
|
||||
}
|
||||
|
||||
a.custom-card .card-info .info-item {
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
}
|
||||
|
||||
a.custom-card .card-info .info-item:last-child {
|
||||
color: #256BFA !important;
|
||||
font-size: 28rpx !important;
|
||||
padding-right: 10rpx !important;
|
||||
position: relative !important;
|
||||
}
|
||||
|
||||
/* 查看详情箭头样式 */
|
||||
a.custom-card .position-nav {
|
||||
position: absolute !important;
|
||||
right: -10rpx !important;
|
||||
top: 50% !important;
|
||||
transform: translateY(-50%) !important;
|
||||
}
|
||||
|
||||
a.custom-card .position-nav::before {
|
||||
position: absolute !important;
|
||||
left: 0 !important;
|
||||
top: -4rpx !important;
|
||||
content: '' !important;
|
||||
width: 4rpx !important;
|
||||
height: 16rpx !important;
|
||||
border-radius: 2rpx !important;
|
||||
background: #256BFA !important;
|
||||
transform: translate(0, -50%) rotate(-45deg) !important;
|
||||
}
|
||||
|
||||
a.custom-card .position-nav::after {
|
||||
position: absolute !important;
|
||||
left: 0 !important;
|
||||
top: -4rpx !important;
|
||||
content: '' !important;
|
||||
width: 4rpx !important;
|
||||
height: 16rpx !important;
|
||||
border-radius: 2rpx !important;
|
||||
background: #256BFA !important;
|
||||
transform: rotate(45deg) !important;
|
||||
}
|
||||
|
||||
/* 查看更多按钮样式 */
|
||||
a.custom-more {
|
||||
display: flex !important;
|
||||
justify-content: center !important;
|
||||
align-items: center !important;
|
||||
color: #FFFFFF !important;
|
||||
background: linear-gradient(135deg, #256BFA 0%, #9E74FD 100%) !important;
|
||||
border-radius: 50rpx !important;
|
||||
padding: 20rpx 32rpx !important;
|
||||
margin: 20rpx 0 !important;
|
||||
font-size: 28rpx !important;
|
||||
font-weight: 600 !important;
|
||||
box-shadow: 0rpx 8rpx 24rpx rgba(37, 107, 250, 0.3) !important;
|
||||
transition: all 0.3s ease !important;
|
||||
position: relative !important;
|
||||
overflow: hidden !important;
|
||||
text-decoration: none !important;
|
||||
box-sizing: border-box !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
a.custom-more .more-icon {
|
||||
width: 32rpx !important;
|
||||
height: 32rpx !important;
|
||||
background: url('@/static/svg/seemore.svg') center center no-repeat !important;
|
||||
background-size: 100% 100% !important;
|
||||
margin-left: 12rpx !important;
|
||||
filter: brightness(0) invert(1) !important;
|
||||
}
|
||||
|
||||
a.custom-more::before {
|
||||
content: '' !important;
|
||||
position: absolute !important;
|
||||
top: 0 !important;
|
||||
left: -100% !important;
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent) !important;
|
||||
transition: left 0.5s ease !important;
|
||||
}
|
||||
|
||||
a.custom-more:active {
|
||||
transform: translateY(2rpx) !important;
|
||||
box-shadow: 0rpx 4rpx 16rpx rgba(37, 107, 250, 0.4) !important;
|
||||
}
|
||||
|
||||
a.custom-more:active::before {
|
||||
left: 100% !important;
|
||||
}
|
||||
}
|
||||
/* #endif */
|
||||
.custom-card
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0,0,0,0.04);
|
||||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||||
padding: 28rpx 24rpx;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
margin-bottom: 20rpx;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column
|
||||
.card-title
|
||||
font-weight: 600;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between
|
||||
.title-text
|
||||
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
|
||||
max-width: calc(100% - 160rpx);
|
||||
overflow: hidden
|
||||
text-overflow: ellipsis
|
||||
font-size: 30rpx
|
||||
.card-salary
|
||||
font-family: DIN-Medium;
|
||||
font-size: 28rpx;
|
||||
color: #FF6E1C;
|
||||
|
||||
.card-company
|
||||
margin-top: 16rpx;
|
||||
max-width: calc(100%);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis
|
||||
color: #6C7282;
|
||||
.card-info
|
||||
margin-top: 22rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-right: 40rpx;
|
||||
.info-item
|
||||
display: flex;
|
||||
position: relative;
|
||||
align-items: center;
|
||||
color: #256BFA;
|
||||
font-size: 28rpx;
|
||||
padding-right: 10rpx
|
||||
.position-nav
|
||||
position: absolute;
|
||||
right: -10rpx;
|
||||
top: 50%;
|
||||
.position-nav::before
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: -4rpx;
|
||||
content: '';
|
||||
width: 4rpx;
|
||||
height: 16rpx;
|
||||
border-radius: 2rpx
|
||||
background: #256BFA;
|
||||
transform: translate(0, -50%) rotate(-45deg) ;
|
||||
.position-nav::after
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: -4rpx;
|
||||
content: '';
|
||||
width: 4rpx;
|
||||
height: 16rpx;
|
||||
border-radius: 2rpx
|
||||
background: #256BFA;
|
||||
transform: rotate(45deg)
|
||||
.card-tag
|
||||
font-weight: 500;
|
||||
font-size: 24rpx;
|
||||
color: #333333;
|
||||
width: fit-content;
|
||||
background: #F4F4F4;
|
||||
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
||||
padding: 4rpx 20rpx;
|
||||
margin-right: 16rpx;
|
||||
</style>
|
||||
|
||||
@@ -77,7 +77,7 @@ function nextDetail(job) {
|
||||
const recordData = recommedIndexDb.JobParameter(job);
|
||||
recommedIndexDb.addRecord(recordData);
|
||||
}
|
||||
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(job.jobId)}`);
|
||||
navTo(`/packageA/pages/post/post?jobId=${btoa(job.jobId)}`);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { inject, computed, toRaw, ref } from 'vue';
|
||||
import { inject, computed, toRaw, ref, defineExpose } from 'vue';
|
||||
const { insertSortData, navTo, vacanciesTo } = inject('globalFunction');
|
||||
import { useRecommedIndexedDBStore } from '@/stores/useRecommedIndexedDBStore.js';
|
||||
const recommedIndexDb = useRecommedIndexedDBStore();
|
||||
@@ -103,7 +103,7 @@ function nextDetail(job) {
|
||||
const recordData = recommedIndexDb.JobParameter(job);
|
||||
recommedIndexDb.addRecord(recordData);
|
||||
}
|
||||
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(job.jobId)}`);
|
||||
navTo(`/packageA/pages/post/post?jobId=${btoa(job.jobId)}`);
|
||||
}
|
||||
|
||||
function toggleSelect(jobId) {
|
||||
@@ -122,7 +122,7 @@ function handleCardClick(job, e) {
|
||||
const recordData = recommedIndexDb.JobParameter(job);
|
||||
recommedIndexDb.addRecord(recordData);
|
||||
}
|
||||
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(job.jobId)}`);
|
||||
navTo(`/packageA/pages/post/post?jobId=${btoa(job.jobId)}`);
|
||||
}
|
||||
|
||||
// 新增:提供选中状态和切换方法给父组件
|
||||
|
||||
@@ -72,16 +72,6 @@ import { ref, reactive, nextTick, onBeforeMount } from 'vue';
|
||||
import useDictStore from '@/stores/useDictStore';
|
||||
const { getTransformChildren } = useDictStore();
|
||||
|
||||
// 岗位类型数据
|
||||
const getJobTypeData = () => {
|
||||
return [
|
||||
{ label: '常规岗位', value: 0, text: '常规岗位' },
|
||||
{ label: '就业见习岗位', value: 1, text: '就业见习岗位' },
|
||||
{ label: '实习实训岗位', value: 2, text: '实习实训岗位' },
|
||||
{ label: '社区实践岗位', value: 3, text: '社区实践岗位' }
|
||||
];
|
||||
};
|
||||
|
||||
const area = ref(true);
|
||||
const maskClick = ref(false);
|
||||
const maskClickFn = ref(null);
|
||||
@@ -174,12 +164,6 @@ function getoptions() {
|
||||
if (area.value) {
|
||||
arr.push(getTransformChildren('area', '区域'));
|
||||
}
|
||||
// 添加岗位类型选项
|
||||
arr.push({
|
||||
label: '岗位类型',
|
||||
key: 'jobType',
|
||||
options: getJobTypeData()
|
||||
});
|
||||
filterOptions.value = arr;
|
||||
activeTab.value = 'education';
|
||||
}
|
||||
@@ -201,12 +185,17 @@ defineExpose({
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.popup-fix {
|
||||
z-index: 9999 !important;
|
||||
position: fixed !important;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
top: 0;
|
||||
height: 100vh;
|
||||
z-index: 9999;
|
||||
}
|
||||
.popup-content {
|
||||
color: #000000;
|
||||
height: 80vh;
|
||||
padding-bottom: 90rpx;;
|
||||
}
|
||||
.popup-bottom {
|
||||
padding: 40rpx 28rpx 20rpx 28rpx;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
</view>
|
||||
<view class="popup-list">
|
||||
<expected-station
|
||||
style="height: 100%;"
|
||||
:search="false"
|
||||
@onChange="changeJobTitleId"
|
||||
:station="state.stations"
|
||||
@@ -33,7 +32,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, computed, inject, nextTick, onMounted } from 'vue';
|
||||
import { ref, reactive, computed, inject, nextTick, defineExpose, onMounted } from 'vue';
|
||||
const { $api, navTo, setCheckedNodes, cloneDeep } = inject('globalFunction');
|
||||
import useUserStore from '@/stores/useUserStore';
|
||||
import { storeToRefs } from 'pinia';
|
||||
@@ -126,12 +125,6 @@ const cleanup = () => {
|
||||
};
|
||||
|
||||
const changeJobTitleId = (e) => {
|
||||
if (!e.ids) {
|
||||
count.value = 0;
|
||||
JobsIdsValue.value = '';
|
||||
JobsLabelValue.value = '';
|
||||
return;
|
||||
}
|
||||
const ids = e.ids.split(',').map((id) => Number(id));
|
||||
count.value = ids.length;
|
||||
JobsIdsValue.value = e.ids;
|
||||
@@ -154,9 +147,9 @@ function serchforIt(defaultId) {
|
||||
if (state.stations.length) {
|
||||
const ids = defaultId
|
||||
? defaultId.split(',').map((id) => Number(id))
|
||||
: (userInfo.value.jobTitleId ? userInfo.value.jobTitleId.split(',').map((id) => Number(id)) : []);
|
||||
: userInfo.value.jobTitleId.split(',').map((id) => Number(id));
|
||||
count.value = ids.length;
|
||||
state.jobTitleId = defaultId ? defaultId : (userInfo.value.jobTitleId || '');
|
||||
state.jobTitleId = defaultId ? defaultId : userInfo.value.jobTitleId;
|
||||
setCheckedNodes(state.stations, ids);
|
||||
state.visible = true;
|
||||
return;
|
||||
@@ -167,7 +160,7 @@ function serchforIt(defaultId) {
|
||||
count.value = ids.length;
|
||||
setCheckedNodes(resData.data, ids);
|
||||
}
|
||||
state.jobTitleId = userInfo.value.jobTitleId || '';
|
||||
state.jobTitleId = userInfo.value.jobTitleId;
|
||||
state.stations = resData.data;
|
||||
state.visible = true;
|
||||
});
|
||||
@@ -195,8 +188,7 @@ defineExpose({
|
||||
<style lang="scss" scoped>
|
||||
.popup-content {
|
||||
color: #000000;
|
||||
height: 84vh;
|
||||
position: relative;
|
||||
height: 80vh;
|
||||
}
|
||||
.popup-bottom {
|
||||
padding: 40rpx 28rpx 20rpx 28rpx;
|
||||
|
||||
@@ -13,30 +13,7 @@
|
||||
<view class="btn-confirm" @click="confirm">确认</view>
|
||||
</view>
|
||||
<view class="popup-list">
|
||||
<!-- 多选模式 -->
|
||||
<view v-if="multiSelect" class="multi-select-list">
|
||||
<view v-if="!processedListData[0] || processedListData[0].length === 0" class="empty-tip">
|
||||
暂无数据
|
||||
</view>
|
||||
<view
|
||||
v-else
|
||||
class="skill-tags-container"
|
||||
>
|
||||
<view
|
||||
v-for="(item, index) in processedListData[0]"
|
||||
:key="index"
|
||||
class="skill-tag"
|
||||
:class="{ 'skill-tag-active': selectedValues.includes(item[this.rowKey]) }"
|
||||
@click.stop="toggleSelect(item)"
|
||||
@touchstart.stop="toggleSelect(item)"
|
||||
>
|
||||
<text class="skill-tag-text">{{ getLabel(item) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 单选模式 -->
|
||||
<picker-view
|
||||
v-else
|
||||
indicator-style="height: 84rpx;"
|
||||
:value="selectedIndex"
|
||||
@change="bindChange"
|
||||
@@ -77,8 +54,6 @@ export default {
|
||||
rowKey: 'value',
|
||||
selectedItems: [],
|
||||
unit: '',
|
||||
multiSelect: false,
|
||||
selectedValues: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -91,13 +66,6 @@ export default {
|
||||
});
|
||||
});
|
||||
},
|
||||
// 计算选中的项目
|
||||
computedSelectedItems() {
|
||||
if (!this.multiSelect) return this.selectedItems;
|
||||
return this.processedListData[0] ? this.processedListData[0].filter(item =>
|
||||
this.selectedValues.includes(item[this.rowKey])
|
||||
) : [];
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
open(newConfig = {}) {
|
||||
@@ -112,10 +80,7 @@ export default {
|
||||
rowKey = 'value',
|
||||
maskClick = false,
|
||||
defaultIndex = [],
|
||||
multiSelect = false,
|
||||
defaultValues = [],
|
||||
} = newConfig;
|
||||
|
||||
this.reset();
|
||||
if (title) this.title = title;
|
||||
if (typeof success === 'function') this.confirmCallback = success;
|
||||
@@ -127,16 +92,10 @@ export default {
|
||||
this.rowKey = rowKey;
|
||||
this.maskClick = maskClick;
|
||||
this.unit = unit;
|
||||
this.multiSelect = multiSelect;
|
||||
|
||||
if (multiSelect) {
|
||||
this.selectedValues = defaultValues || [];
|
||||
} else {
|
||||
this.selectedIndex =
|
||||
defaultIndex.length === this.listData.length ? defaultIndex : new Array(this.listData.length).fill(0);
|
||||
this.selectedItems = this.selectedIndex.map((val, index) => this.processedListData[index][val]);
|
||||
}
|
||||
|
||||
this.selectedIndex =
|
||||
defaultIndex.length === this.listData.length ? defaultIndex : new Array(this.listData.length).fill(0);
|
||||
this.selectedItems = this.selectedIndex.map((val, index) => this.processedListData[index][val]);
|
||||
this.$nextTick(() => {
|
||||
this.$refs.popup.open();
|
||||
});
|
||||
@@ -158,22 +117,6 @@ export default {
|
||||
getLabel(item) {
|
||||
return item?.[this.rowLabel] ?? '';
|
||||
},
|
||||
toggleSelect(item) {
|
||||
if (!item || !this.rowKey || !item[this.rowKey]) {
|
||||
return;
|
||||
}
|
||||
|
||||
const value = item[this.rowKey];
|
||||
const index = this.selectedValues.indexOf(value);
|
||||
|
||||
if (index > -1) {
|
||||
// 取消选中
|
||||
this.selectedValues.splice(index, 1);
|
||||
} else {
|
||||
// 选中
|
||||
this.selectedValues.push(value);
|
||||
}
|
||||
},
|
||||
setColunm(index, list) {
|
||||
if (index > this.listData.length) {
|
||||
return console.warn('最长' + this.listData.length);
|
||||
@@ -192,14 +135,7 @@ export default {
|
||||
}
|
||||
|
||||
try {
|
||||
let result;
|
||||
if (this.multiSelect) {
|
||||
// 多选模式:传递 selectedValues 和 selectedItems
|
||||
result = await callback(this.selectedValues, this.computedSelectedItems);
|
||||
} else {
|
||||
// 单选模式:传递 selectedIndex 和 selectedItems
|
||||
result = await callback(this.selectedIndex, this.selectedItems);
|
||||
}
|
||||
const result = await callback(this.selectedIndex, this.selectedItems); // 无论是 async 还是返回 Promise 的函数都可以 await
|
||||
if (result !== false) {
|
||||
this.$refs.popup.close();
|
||||
}
|
||||
@@ -218,8 +154,6 @@ export default {
|
||||
this.rowKey = 'value';
|
||||
this.selectedItems = [];
|
||||
this.unit = '';
|
||||
this.multiSelect = false;
|
||||
this.selectedValues = [];
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -290,83 +224,10 @@ export default {
|
||||
color: #666d7f;
|
||||
line-height: 38rpx;
|
||||
}
|
||||
.btn-confirm {
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
color: #256bfa;
|
||||
}
|
||||
}
|
||||
|
||||
.multi-select-list {
|
||||
padding: 20rpx 30rpx;
|
||||
max-height: calc(60vh - 120rpx);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
text-align: center;
|
||||
padding: 60rpx 0;
|
||||
color: #999999;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.skill-tags-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16rpx;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.skill-tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 12rpx 20rpx;
|
||||
border-radius: 20rpx;
|
||||
background-color: #f8f9fa;
|
||||
border: 2rpx solid #e8eaee;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
font-size: 24rpx;
|
||||
color: #333333;
|
||||
white-space: nowrap;
|
||||
user-select: none;
|
||||
|
||||
&:hover {
|
||||
background-color: #e9ecef;
|
||||
border-color: #d0d0d0;
|
||||
transform: translateY(-1rpx);
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
&:active {
|
||||
transform: translateY(0);
|
||||
background-color: #dee2e6;
|
||||
}
|
||||
|
||||
.skill-tag-text {
|
||||
font-size: 24rpx;
|
||||
color: inherit;
|
||||
line-height: 1.2;
|
||||
.btn-confirm {
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
&.skill-tag-active {
|
||||
background-color: #256bfa;
|
||||
border-color: #256bfa;
|
||||
color: #ffffff;
|
||||
box-shadow: 0 2rpx 8rpx rgba(37, 107, 250, 0.3);
|
||||
|
||||
.skill-tag-text {
|
||||
color: #ffffff;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: #1e5ce6;
|
||||
border-color: #1e5ce6;
|
||||
transform: translateY(-1rpx);
|
||||
box-shadow: 0 4rpx 12rpx rgba(37, 107, 250, 0.4);
|
||||
}
|
||||
font-size: 32rpx;
|
||||
color: #256bfa;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
>
|
||||
<image :src="currentItem == item.id ? item.selectedIconPath : item.iconPath"></image>
|
||||
</view>
|
||||
<view class="badge" v-if="item.badge && item.badge > 0">{{ item.badge }}</view>
|
||||
<view class="badge" v-if="item.badge">{{ item.badge }}</view>
|
||||
<view class="item-bottom" :class="[currentItem == item.id ? 'item-active' : '']">
|
||||
<text>{{ item.text }}</text>
|
||||
</view>
|
||||
@@ -19,11 +19,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, computed, watch, nextTick } from 'vue';
|
||||
import { ref, defineProps, onMounted, computed } from 'vue';
|
||||
import { useReadMsg } from '@/stores/useReadMsg';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import useUserStore from '@/stores/useUserStore';
|
||||
|
||||
const props = defineProps({
|
||||
currentpage: {
|
||||
type: Number,
|
||||
@@ -31,139 +28,65 @@ const props = defineProps({
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
|
||||
const readMsg = useReadMsg();
|
||||
const { userInfo } = storeToRefs(useUserStore());
|
||||
const currentItem = ref(0);
|
||||
|
||||
// 监听用户类型变化,重新生成tabbar配置
|
||||
watch(() => userInfo.value?.isCompanyUser, (newIsCompanyUser, oldIsCompanyUser) => {
|
||||
console.log('midell-box用户类型变化监听:', { newIsCompanyUser, oldIsCompanyUser, userInfo: userInfo.value });
|
||||
if (newIsCompanyUser !== oldIsCompanyUser) {
|
||||
console.log('用户类型发生变化,重新生成tabbar:', newIsCompanyUser);
|
||||
// tabbarList是computed,会自动重新计算
|
||||
// 强制触发响应式更新
|
||||
nextTick(() => {
|
||||
console.log('tabbar配置已更新:', tabbarList.value);
|
||||
});
|
||||
}
|
||||
}, { immediate: true });
|
||||
|
||||
// 监听用户信息变化(包括登录状态)
|
||||
watch(() => userInfo.value, (newUserInfo, oldUserInfo) => {
|
||||
console.log('midell-box用户信息变化监听:', { newUserInfo, oldUserInfo });
|
||||
if (newUserInfo !== oldUserInfo) {
|
||||
console.log('用户信息发生变化,重新生成tabbar');
|
||||
// 强制触发响应式更新
|
||||
nextTick(() => {
|
||||
console.log('tabbar配置已更新:', tabbarList.value);
|
||||
});
|
||||
}
|
||||
}, { immediate: true, deep: true });
|
||||
|
||||
// 生成tabbar配置的函数
|
||||
const generateTabbarList = () => {
|
||||
const baseItems = [
|
||||
{
|
||||
id: 0,
|
||||
text: '职位2',
|
||||
path: '/pages/index/index',
|
||||
iconPath: '../../static/tabbar/calendar.png',
|
||||
selectedIconPath: '../../static/tabbar/calendared.png',
|
||||
centerItem: false,
|
||||
badge: readMsg.badges[0]?.count || 0,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
text: 'AI+',
|
||||
path: '/pages/chat/chat',
|
||||
iconPath: '../../static/tabbar/logo3.png',
|
||||
selectedIconPath: '../../static/tabbar/logo3.png',
|
||||
centerItem: true,
|
||||
badge: readMsg.badges[2]?.count || 0,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
text: '消息2',
|
||||
path: '/pages/msglog/msglog',
|
||||
iconPath: '../../static/tabbar/chat4.png',
|
||||
selectedIconPath: '../../static/tabbar/chat4ed.png',
|
||||
centerItem: false,
|
||||
badge: readMsg.badges[3]?.count || 0,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
text: '我的',
|
||||
path: '/pages/mine/mine',
|
||||
iconPath: '../../static/tabbar/mine.png',
|
||||
selectedIconPath: '../../static/tabbar/mined.png',
|
||||
centerItem: false,
|
||||
badge: readMsg.badges[4]?.count || 0,
|
||||
},
|
||||
];
|
||||
|
||||
// 根据用户类型添加不同的导航项,未登录时默认为求职者
|
||||
const userType = userInfo.value?.isCompanyUser !== undefined ? userInfo.value.isCompanyUser : 1;
|
||||
|
||||
if (userType === 0) {
|
||||
// 企业用户:显示发布岗位,隐藏招聘会
|
||||
baseItems.splice(1, 0, {
|
||||
id: 1,
|
||||
text: '发布岗位',
|
||||
path: '/packageA/pages/job/publishJob',
|
||||
iconPath: '../../static/tabbar/post.png',
|
||||
selectedIconPath: '../../static/tabbar/posted.png',
|
||||
centerItem: false,
|
||||
badge: 0,
|
||||
});
|
||||
} else {
|
||||
// 求职者用户(包括未登录状态):显示招聘会
|
||||
baseItems.splice(1, 0, {
|
||||
id: 1,
|
||||
text: '招聘会',
|
||||
path: '/pages/careerfair/careerfair',
|
||||
iconPath: '../../static/tabbar/post.png',
|
||||
selectedIconPath: '../../static/tabbar/posted.png',
|
||||
centerItem: false,
|
||||
badge: readMsg.badges[1]?.count || 0,
|
||||
});
|
||||
}
|
||||
|
||||
return baseItems;
|
||||
};
|
||||
|
||||
// 根据用户类型生成不同的导航栏配置
|
||||
const tabbarList = computed(() => {
|
||||
return generateTabbarList();
|
||||
});
|
||||
const tabbarList = computed(() => [
|
||||
{
|
||||
id: 0,
|
||||
text: '首页',
|
||||
path: '/pages/index/index',
|
||||
iconPath: '../../static/tabbar/calendar.png',
|
||||
selectedIconPath: '../../static/tabbar/calendared.png',
|
||||
centerItem: false,
|
||||
badge: readMsg.badges[0].count,
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
text: '招聘会',
|
||||
path: '/pages/careerfair/careerfair',
|
||||
iconPath: '../../static/tabbar/post.png',
|
||||
selectedIconPath: '../../static/tabbar/posted.png',
|
||||
centerItem: false,
|
||||
badge: readMsg.badges[1].count,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
text: '',
|
||||
path: '/pages/chat/chat',
|
||||
iconPath: '../../static/tabbar/logo3.png',
|
||||
selectedIconPath: '../../static/tabbar/logo3.png',
|
||||
centerItem: true,
|
||||
badge: readMsg.badges[2].count,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
text: '消息',
|
||||
path: '/pages/msglog/msglog',
|
||||
iconPath: '../../static/tabbar/chat4.png',
|
||||
selectedIconPath: '../../static/tabbar/chat4ed.png',
|
||||
centerItem: false,
|
||||
badge: readMsg.badges[3].count,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
text: '我的',
|
||||
path: '/pages/mine/mine',
|
||||
iconPath: '../../static/tabbar/mine.png',
|
||||
selectedIconPath: '../../static/tabbar/mined.png',
|
||||
centerItem: false,
|
||||
badge: readMsg.badges[4].count,
|
||||
},
|
||||
]);
|
||||
|
||||
onMounted(() => {
|
||||
// 自定义TabBar不需要调用hideTabBar,因为已经在pages.json中设置了custom: true
|
||||
// uni.hideTabBar(); // 移除这行,避免在自定义TabBar模式下调用
|
||||
uni.hideTabBar();
|
||||
currentItem.value = props.currentpage;
|
||||
});
|
||||
|
||||
const changeItem = (item) => {
|
||||
// 判断是否为 TabBar 页面
|
||||
const tabBarPages = [
|
||||
'/pages/index/index',
|
||||
'/pages/careerfair/careerfair',
|
||||
'/pages/chat/chat',
|
||||
'/pages/msglog/msglog',
|
||||
'/pages/mine/mine'
|
||||
];
|
||||
|
||||
if (tabBarPages.includes(item.path)) {
|
||||
// TabBar 页面使用 redirectTo 避免页面栈溢出
|
||||
uni.redirectTo({
|
||||
url: item.path,
|
||||
});
|
||||
} else {
|
||||
// 非 TabBar 页面使用 navigateTo
|
||||
uni.navigateTo({
|
||||
url: item.path,
|
||||
});
|
||||
}
|
||||
uni.switchTab({
|
||||
url: item.path,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,511 +0,0 @@
|
||||
<template>
|
||||
<uni-popup ref="popup" type="center" :mask-click="false">
|
||||
<view class="auth-modal">
|
||||
<view class="modal-content">
|
||||
<!-- 关闭按钮 -->
|
||||
<view class="close-btn" @click="close">
|
||||
<uni-icons type="closeempty" size="24" color="#999"></uni-icons>
|
||||
</view>
|
||||
|
||||
<!-- Logo和标题 -->
|
||||
<view class="auth-header">
|
||||
<image class="auth-logo" src="@/static/logo2-S.png" mode="aspectFit"></image>
|
||||
<view class="auth-title">欢迎使用就业服务</view>
|
||||
</view>
|
||||
|
||||
<!-- 角色选择 -->
|
||||
<view class="role-select">
|
||||
<view class="role-title">请选择您的角色</view>
|
||||
<view class="role-options">
|
||||
<view
|
||||
class="role-item"
|
||||
:class="{ active: userType === 1 }"
|
||||
@click="selectRole(1)"
|
||||
>
|
||||
<view class="role-icon">
|
||||
<uni-icons type="person" size="32" :color="userType === 1 ? '#256BFA' : '#999'"></uni-icons>
|
||||
</view>
|
||||
<view class="role-text">个人</view>
|
||||
</view>
|
||||
<view
|
||||
class="role-item"
|
||||
:class="{ active: userType === 0 }"
|
||||
@click="selectRole(0)"
|
||||
>
|
||||
<view class="role-icon">
|
||||
<uni-icons type="shop" size="32" :color="userType === 0 ? '#256BFA' : '#999'"></uni-icons>
|
||||
</view>
|
||||
<view class="role-text">单位</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 授权说明 -->
|
||||
<view class="auth-tips">
|
||||
<view class="tip-item">
|
||||
<uni-icons type="checkmarkempty" size="16" color="#256BFA"></uni-icons>
|
||||
<text>保护您的个人信息安全</text>
|
||||
</view>
|
||||
<view class="tip-item">
|
||||
<uni-icons type="checkmarkempty" size="16" color="#256BFA"></uni-icons>
|
||||
<text>为您推荐更合适的岗位</text>
|
||||
</view>
|
||||
<view class="tip-item">
|
||||
<uni-icons type="checkmarkempty" size="16" color="#256BFA"></uni-icons>
|
||||
<text>享受完整的就业服务</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 授权按钮 -->
|
||||
<view class="auth-actions">
|
||||
<!-- 微信小程序使用 open-type="getPhoneNumber" -->
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<button
|
||||
class="auth-btn primary"
|
||||
open-type="getPhoneNumber"
|
||||
@getphonenumber="getPhoneNumber"
|
||||
>
|
||||
<uni-icons type="phone" size="20" color="#FFFFFF"></uni-icons>
|
||||
<text>手机号快捷登录</text>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- H5和App使用普通按钮 -->
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<button class="auth-btn primary" @click="wxLogin">
|
||||
<uni-icons type="phone" size="20" color="#FFFFFF"></uni-icons>
|
||||
<text>手机号快捷登录</text>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- 测试登录按钮(仅开发环境) -->
|
||||
<!-- #ifdef APP-PLUS || H5 -->
|
||||
<button class="auth-btn secondary" @click="testLogin">
|
||||
<text>测试账号登录</text>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
|
||||
<!-- 用户协议 -->
|
||||
<!-- <view class="auth-agreement">
|
||||
<text>登录即表示同意</text>
|
||||
<text class="link" @click="openAgreement('user')">《用户协议》</text>
|
||||
<text>和</text>
|
||||
<text class="link" @click="openAgreement('privacy')">《隐私政策》</text>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, inject } from 'vue';
|
||||
import useUserStore from '@/stores/useUserStore';
|
||||
import { tabbarManager } from '@/utils/tabbarManager';
|
||||
|
||||
const { $api } = inject('globalFunction');
|
||||
const { loginSetToken } = useUserStore();
|
||||
|
||||
const popup = ref(null);
|
||||
const userType = ref(null); // 用户角色:1-求职者,0-企业
|
||||
const emit = defineEmits(['success', 'cancel']);
|
||||
|
||||
// 打开弹窗
|
||||
const open = () => {
|
||||
popup.value?.open();
|
||||
userType.value = null; // 重置角色选择
|
||||
};
|
||||
|
||||
// 关闭弹窗
|
||||
const close = () => {
|
||||
popup.value?.close();
|
||||
emit('cancel');
|
||||
};
|
||||
|
||||
// 选择角色
|
||||
const selectRole = (type) => {
|
||||
userType.value = type;
|
||||
};
|
||||
|
||||
// 验证角色是否已选择
|
||||
const validateRole = () => {
|
||||
if (userType.value === null) {
|
||||
$api.msg('请先选择您的角色');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
const getPhoneNumber = (e) => {
|
||||
console.log('获取手机号:', e);
|
||||
console.log('userType.value', userType.value)
|
||||
// 验证角色是否已选择
|
||||
|
||||
|
||||
if (e.detail.errMsg === 'getPhoneNumber:ok') {
|
||||
if (userType.value === null) {
|
||||
$api.msg('请先选择您的角色');
|
||||
return true;
|
||||
}
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (loginRes) => {
|
||||
console.log('微信登录code获取成功:', loginRes.code);
|
||||
const { encryptedData, iv } = e.detail;
|
||||
const code = loginRes.code; // 使用wx.login返回的code
|
||||
|
||||
// 调用后端接口进行登录
|
||||
uni.showLoading({ title: '登录中...' });
|
||||
|
||||
$api.createRequest('/app/appLogin', {
|
||||
code,
|
||||
encryptedData,
|
||||
iv,
|
||||
userType: userType.value
|
||||
}, 'post').then((resData) => {
|
||||
uni.hideLoading();
|
||||
console.log(resData, 'resume.idCard');
|
||||
if (resData.token) {
|
||||
// 登录成功,存储token
|
||||
loginSetToken(resData.token).then((resume) => {
|
||||
// 更新用户类型到缓存
|
||||
if (resData.isCompanyUser !== undefined) {
|
||||
console.log(resData.isCompanyUser, 'resData.isCompanyUser');
|
||||
const userInfo = uni.getStorageSync('userInfo') || {};
|
||||
userInfo.isCompanyUser = Number(resData.isCompanyUser); // 0-企业用户,1-求职者
|
||||
uni.setStorageSync('userInfo', userInfo);
|
||||
}
|
||||
|
||||
$api.msg('登录成功');
|
||||
// 刷新tabbar以显示正确的用户类型
|
||||
tabbarManager.refreshTabBar();
|
||||
close();
|
||||
emit('success');
|
||||
|
||||
// 根据用户类型跳转到不同的信息补全页面
|
||||
if (!resume.jobTitleId) {
|
||||
console.log(resume, 'resume.idCard');
|
||||
if (userType.value === 1 && !resData.idCard) {
|
||||
// 求职者跳转到个人信息补全页面
|
||||
uni.navigateTo({
|
||||
url: '/packageA/pages/complete-info/complete-info?step=1'
|
||||
});
|
||||
} else if (userType.value === 0 && !resData.idCard) {
|
||||
// 招聘者跳转到企业信息补全页面
|
||||
uni.navigateTo({
|
||||
url: '/packageA/pages/complete-info/company-info'
|
||||
});
|
||||
}
|
||||
}
|
||||
}).catch(() => {
|
||||
$api.msg('获取用户信息失败');
|
||||
});
|
||||
} else {
|
||||
$api.msg('登录失败,请重试');
|
||||
}
|
||||
}).catch((err) => {
|
||||
uni.hideLoading();
|
||||
$api.msg(err.msg || '登录失败,请重试');
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('获取微信登录code失败:', err);
|
||||
$api.msg('获取登录信息失败,请重试');
|
||||
}
|
||||
});
|
||||
} else if (e.detail.errMsg === 'getPhoneNumber:fail user deny') {
|
||||
$api.msg('您取消了授权');
|
||||
} else {
|
||||
$api.msg('获取手机号失败');
|
||||
}
|
||||
};
|
||||
|
||||
// H5/App 微信登录
|
||||
const wxLogin = () => {
|
||||
// 验证角色是否已选择
|
||||
if (!validateRole()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// #ifdef H5
|
||||
// H5端跳转到H5登录页面
|
||||
close();
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/h5-login'
|
||||
});
|
||||
return;
|
||||
// #endif
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
// App微信登录逻辑
|
||||
uni.getProvider({
|
||||
service: 'oauth',
|
||||
success: (res) => {
|
||||
if (~res.provider.indexOf('weixin')) {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (loginRes) => {
|
||||
console.log('微信登录成功:', loginRes);
|
||||
|
||||
// 调用后端接口进行登录
|
||||
$api.createRequest('/app/appLogin', {
|
||||
code: loginRes.code,
|
||||
userType: userType.value
|
||||
}, 'post').then((resData) => {
|
||||
if (resData.token) {
|
||||
loginSetToken(resData.token).then((resume) => {
|
||||
// 更新用户类型到缓存
|
||||
if (resData.isCompanyUser !== undefined) {
|
||||
const userInfo = uni.getStorageSync('userInfo') || {};
|
||||
userInfo.isCompanyUser = resData.isCompanyUser ? 0 : 1; // 0-企业用户,1-求职者
|
||||
uni.setStorageSync('userInfo', userInfo);
|
||||
}
|
||||
|
||||
$api.msg('登录成功');
|
||||
// 刷新tabbar以显示正确的用户类型
|
||||
tabbarManager.refreshTabBar();
|
||||
close();
|
||||
emit('success');
|
||||
|
||||
if (!resume.data.jobTitleId) {
|
||||
if (userType.value === 1) {
|
||||
// 求职者跳转到个人信息补全页面
|
||||
uni.navigateTo({
|
||||
url: '/packageA/pages/complete-info/complete-info?step=1'
|
||||
});
|
||||
} else if (userType.value === 0) {
|
||||
// 招聘者跳转到企业信息补全页面
|
||||
uni.navigateTo({
|
||||
url: '/packageA/pages/complete-info/company-info'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('微信登录失败:', err);
|
||||
$api.msg('微信登录失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
};
|
||||
|
||||
// 测试账号登录(仅开发环境)
|
||||
const testLogin = () => {
|
||||
uni.showLoading({ title: '登录中...' });
|
||||
|
||||
const params = {
|
||||
username: 'test',
|
||||
password: 'test',
|
||||
};
|
||||
|
||||
$api.createRequest('/app/login', params, 'post').then((resData) => {
|
||||
uni.hideLoading();
|
||||
|
||||
loginSetToken(resData.token).then((resume) => {
|
||||
// 更新用户类型到缓存
|
||||
if (resData.isCompanyUser !== undefined) {
|
||||
const userInfo = uni.getStorageSync('userInfo') || {};
|
||||
userInfo.isCompanyUser = resData.isCompanyUser ? 0 : 1; // 0-企业用户,1-求职者
|
||||
uni.setStorageSync('userInfo', userInfo);
|
||||
}
|
||||
|
||||
$api.msg('测试登录成功');
|
||||
// 刷新tabbar以显示正确的用户类型
|
||||
tabbarManager.refreshTabBar();
|
||||
close();
|
||||
emit('success');
|
||||
|
||||
if (!resume.data.jobTitleId) {
|
||||
if (userType.value === 1) {
|
||||
// 求职者跳转到个人信息补全页面
|
||||
uni.navigateTo({
|
||||
url: '/packageA/pages/complete-info/complete-info?step=1'
|
||||
});
|
||||
} else if (userType.value === 0) {
|
||||
// 招聘者跳转到企业信息补全页面
|
||||
uni.navigateTo({
|
||||
url: '/packageA/pages/complete-info/company-info'
|
||||
});
|
||||
}
|
||||
}
|
||||
}).catch(() => {
|
||||
$api.msg('获取用户信息失败');
|
||||
});
|
||||
}).catch((err) => {
|
||||
uni.hideLoading();
|
||||
$api.msg(err.msg || '登录失败');
|
||||
});
|
||||
};
|
||||
|
||||
// 打开用户协议
|
||||
const openAgreement = (type) => {
|
||||
const urls = {
|
||||
user: '/pages/agreement/user',
|
||||
privacy: '/pages/agreement/privacy'
|
||||
};
|
||||
|
||||
if (urls[type]) {
|
||||
uni.navigateTo({
|
||||
url: urls[type]
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 暴露方法供父组件调用
|
||||
defineExpose({
|
||||
open,
|
||||
close
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.auth-modal
|
||||
width: 620rpx
|
||||
background: #FFFFFF
|
||||
border-radius: 24rpx
|
||||
overflow: hidden
|
||||
|
||||
.modal-content
|
||||
padding: 60rpx 40rpx 40rpx
|
||||
position: relative
|
||||
|
||||
.close-btn
|
||||
position: absolute
|
||||
right: 20rpx
|
||||
top: 20rpx
|
||||
width: 60rpx
|
||||
height: 60rpx
|
||||
display: flex
|
||||
align-items: center
|
||||
justify-content: center
|
||||
z-index: 10
|
||||
|
||||
.auth-header
|
||||
text-align: center
|
||||
margin-bottom: 40rpx
|
||||
|
||||
.auth-logo
|
||||
width: 120rpx
|
||||
height: 120rpx
|
||||
margin: 0 auto 24rpx
|
||||
|
||||
.auth-title
|
||||
font-size: 36rpx
|
||||
font-weight: 600
|
||||
color: #333333
|
||||
margin-bottom: 12rpx
|
||||
|
||||
.auth-subtitle
|
||||
font-size: 28rpx
|
||||
color: #666666
|
||||
|
||||
.role-select
|
||||
margin-bottom: 32rpx
|
||||
|
||||
.role-title
|
||||
font-size: 28rpx
|
||||
font-weight: 500
|
||||
color: #333333
|
||||
margin-bottom: 20rpx
|
||||
text-align: center
|
||||
|
||||
.role-options
|
||||
display: flex
|
||||
justify-content: space-between
|
||||
gap: 20rpx
|
||||
|
||||
.role-item
|
||||
flex: 1
|
||||
background: #F7F8FA
|
||||
border: 2rpx solid #E5E5E5
|
||||
border-radius: 16rpx
|
||||
padding: 32rpx 20rpx
|
||||
display: flex
|
||||
flex-direction: column
|
||||
align-items: center
|
||||
position: relative
|
||||
transition: all 0.3s ease
|
||||
cursor: pointer
|
||||
|
||||
&.active
|
||||
background: #F0F5FF
|
||||
border-color: #256BFA
|
||||
box-shadow: 0 4rpx 12rpx rgba(37, 107, 250, 0.15)
|
||||
|
||||
.role-icon
|
||||
margin-bottom: 16rpx
|
||||
|
||||
.role-text
|
||||
font-size: 28rpx
|
||||
color: #333333
|
||||
font-weight: 500
|
||||
|
||||
.auth-tips
|
||||
background: #F7F8FA
|
||||
border-radius: 16rpx
|
||||
padding: 24rpx
|
||||
margin-bottom: 40rpx
|
||||
|
||||
.tip-item
|
||||
display: flex
|
||||
align-items: center
|
||||
margin-bottom: 16rpx
|
||||
font-size: 26rpx
|
||||
color: #666666
|
||||
|
||||
&:last-child
|
||||
margin-bottom: 0
|
||||
|
||||
text
|
||||
margin-left: 12rpx
|
||||
|
||||
.auth-actions
|
||||
margin-bottom: 32rpx
|
||||
|
||||
.auth-btn
|
||||
width: 100%
|
||||
height: 88rpx
|
||||
border-radius: 44rpx
|
||||
display: flex
|
||||
align-items: center
|
||||
justify-content: center
|
||||
font-size: 32rpx
|
||||
font-weight: 500
|
||||
border: none
|
||||
margin-bottom: 20rpx
|
||||
|
||||
&:last-child
|
||||
margin-bottom: 0
|
||||
|
||||
&.primary
|
||||
background: linear-gradient(135deg, #256BFA 0%, #1E5BFF 100%)
|
||||
color: #FFFFFF
|
||||
box-shadow: 0 8rpx 20rpx rgba(37, 107, 250, 0.3)
|
||||
|
||||
&.secondary
|
||||
background: #F7F8FA
|
||||
color: #666666
|
||||
|
||||
text
|
||||
margin-left: 12rpx
|
||||
|
||||
.auth-agreement
|
||||
text-align: center
|
||||
font-size: 24rpx
|
||||
color: #999999
|
||||
line-height: 1.6
|
||||
|
||||
.link
|
||||
color: #256BFA
|
||||
text-decoration: underline
|
||||
|
||||
// 按钮重置样式
|
||||
button::after
|
||||
border: none
|
||||
</style>
|
||||
33
config.js
33
config.js
@@ -1,42 +1,25 @@
|
||||
/*
|
||||
* @Descripttion:
|
||||
* @Author: lip
|
||||
* @Date: 2025-12-04 13:40:08
|
||||
* @LastEditors: lip
|
||||
*/
|
||||
export default {
|
||||
// baseUrl: 'http://39.98.44.136:8080', // 测试
|
||||
baseUrl: 'https://www.xjksly.cn/api/ks', // 正式环境
|
||||
// baseUrl: 'http://ks.zhaopinzao8dian.com/api/ks', // 测试
|
||||
|
||||
// LCBaseUrl:'http://10.110.145.145:9100',//内网端口
|
||||
// LCBaseUrlInner:'http://10.110.145.145:10100',//招聘、培训、帮扶
|
||||
// imgBaseUrl:'http://10.110.145.145/images', //图片基础url
|
||||
// trainVideoImgUrl:'http://10.110.145.145:9100/file/file/minio',
|
||||
LCBaseUrl:'https://www.xjksly.cn/prod-api',//内网端口
|
||||
LCBaseUrlInner:'https://www.xjksly.cn/prod-psout-api',//招聘、培训、帮扶
|
||||
imgBaseUrl:'https://www.xjksly.cn/images', //图片基础url
|
||||
trainVideoImgUrl:'https://www.xjksly.cn/prod-api/file/file/minio',
|
||||
baseUrl: 'http://ks.zhaopinzao8dian.com/api/ks', // 测试
|
||||
// sseAI+
|
||||
// StreamBaseURl: 'http://39.98.44.136:8000',
|
||||
StreamBaseURl: 'https://www.xjksly.cn/api/ks/app/chat',
|
||||
StreamBaseURl: 'https://qd.zhaopinzao8dian.com/ai',
|
||||
// StreamBaseURl: 'https://qd.zhaopinzao8dian.com/ai/test',
|
||||
// 语音转文字
|
||||
vioceBaseURl: 'https://www.xjksly.cn/api/ks/app/speech/asr',
|
||||
// vioceBaseURl: 'wss://qd.zhaopinzao8dian.com/api/speech-recognition',
|
||||
// vioceBaseURl: 'ws://39.98.44.136:8080/speech-recognition',
|
||||
vioceBaseURl: 'wss://qd.zhaopinzao8dian.com/api/speech-recognition',
|
||||
// 语音合成
|
||||
speechSynthesis: 'https://www.xjksly.cn/api/ks/app/speech/tts',
|
||||
// speechSynthesis: 'wss://qd.zhaopinzao8dian.com/api/speech-synthesis',
|
||||
speechSynthesis: 'wss://qd.zhaopinzao8dian.com/api/speech-synthesis',
|
||||
// indexedDB
|
||||
DBversion: 2,
|
||||
// 只使用本地缓寸的数据
|
||||
OnlyUseCachedDB: true,
|
||||
// 使用模拟定位
|
||||
UsingSimulatedPositioning: false,
|
||||
UsingSimulatedPositioning: true,
|
||||
// 应用信息
|
||||
appInfo: {
|
||||
// 应用名称
|
||||
name: "喀什市就业服务",
|
||||
name: "青岛市就业服务",
|
||||
// 地区名
|
||||
areaName: '喀什',
|
||||
// AI名称
|
||||
@@ -87,4 +70,4 @@ export default {
|
||||
desc: '融合海量岗位、智能简历匹配、竞争力分析,助你精准锁定理想职位!',
|
||||
imgUrl: 'https://qd.zhaopinzao8dian.com/file/csn/qd_shareLogo.jpg',
|
||||
}
|
||||
}
|
||||
}
|
||||
102
config/icons.js
102
config/icons.js
@@ -1,102 +0,0 @@
|
||||
/**
|
||||
* 图标配置文件
|
||||
* 统一管理项目中使用的所有图标名称
|
||||
* 使用方式:import { ICONS } from '@/config/icons'
|
||||
*/
|
||||
|
||||
export const ICONS = {
|
||||
// 导航类
|
||||
HOME: 'home',
|
||||
SEARCH: 'search',
|
||||
USER: 'user',
|
||||
SETTING: 'setting',
|
||||
BACK: 'back',
|
||||
CLOSE: 'close',
|
||||
MENU: 'menu',
|
||||
MORE: 'more',
|
||||
|
||||
// 操作类
|
||||
ADD: 'add',
|
||||
EDIT: 'edit',
|
||||
DELETE: 'delete',
|
||||
SAVE: 'save',
|
||||
REFRESH: 'refresh',
|
||||
UPLOAD: 'upload',
|
||||
DOWNLOAD: 'download',
|
||||
SHARE: 'share',
|
||||
FILTER: 'filter',
|
||||
SORT: 'sort',
|
||||
|
||||
// 通讯类
|
||||
PHONE: 'phone',
|
||||
MESSAGE: 'message',
|
||||
EMAIL: 'email',
|
||||
CHAT: 'chat',
|
||||
NOTIFICATION: 'notification',
|
||||
|
||||
// 位置类
|
||||
LOCATION: 'location',
|
||||
MAP: 'map',
|
||||
NAVIGATE: 'navigate',
|
||||
|
||||
// 状态类
|
||||
SUCCESS: 'success',
|
||||
ERROR: 'error',
|
||||
WARNING: 'warning',
|
||||
INFO: 'info',
|
||||
LOADING: 'loading',
|
||||
|
||||
// 媒体类
|
||||
IMAGE: 'image',
|
||||
VIDEO: 'video',
|
||||
AUDIO: 'audio',
|
||||
FILE: 'file',
|
||||
CAMERA: 'camera',
|
||||
|
||||
// 交互类
|
||||
LIKE: 'like',
|
||||
STAR: 'star',
|
||||
COLLECT: 'collect',
|
||||
COMMENT: 'comment',
|
||||
EYE: 'eye',
|
||||
HEART: 'heart',
|
||||
|
||||
// 箭头类
|
||||
ARROW_UP: 'arrow-up',
|
||||
ARROW_DOWN: 'arrow-down',
|
||||
ARROW_LEFT: 'arrow-left',
|
||||
ARROW_RIGHT: 'arrow-right',
|
||||
|
||||
// 其他
|
||||
TIME: 'time',
|
||||
DATE: 'date',
|
||||
CALENDAR: 'calendar',
|
||||
LOCK: 'lock',
|
||||
UNLOCK: 'unlock',
|
||||
HELP: 'help',
|
||||
QUESTION: 'question',
|
||||
}
|
||||
|
||||
// 图标尺寸预设
|
||||
export const ICON_SIZES = {
|
||||
MINI: 24,
|
||||
SMALL: 28,
|
||||
NORMAL: 32,
|
||||
LARGE: 40,
|
||||
XLARGE: 48,
|
||||
}
|
||||
|
||||
// 图标颜色预设
|
||||
export const ICON_COLORS = {
|
||||
PRIMARY: '#13C57C',
|
||||
SECONDARY: '#256BFA',
|
||||
SUCCESS: '#13C57C',
|
||||
WARNING: '#FF9800',
|
||||
DANGER: '#F44336',
|
||||
INFO: '#2196F3',
|
||||
TEXT: '#333333',
|
||||
TEXT_SECONDARY: '#666666',
|
||||
TEXT_PLACEHOLDER: '#999999',
|
||||
WHITE: '#FFFFFF',
|
||||
}
|
||||
|
||||
237
docs/职业图谱接口说明.md
237
docs/职业图谱接口说明.md
@@ -1,237 +0,0 @@
|
||||
# 职业图谱功能接口说明
|
||||
|
||||
## 📋 目录
|
||||
- [一、职业路径相关接口](#一职业路径相关接口)
|
||||
- [二、职业技能相关接口](#二职业技能相关接口)
|
||||
- [三、职业推荐相关接口](#三职业推荐相关接口)
|
||||
- [四、接口使用场景](#四接口使用场景)
|
||||
|
||||
---
|
||||
|
||||
## 一、职业路径相关接口
|
||||
|
||||
### 1. `getJobPathPage` - 根据职业名称获取路径列表
|
||||
- **接口路径**: `/jobPath/getJobPathPage`
|
||||
- **请求方法**: `GET`
|
||||
- **接口类型**: `zytp`
|
||||
- **参数**:
|
||||
- `jobName` (可选): 职业名称,用于搜索
|
||||
- `pageNo`: 页码
|
||||
- `pageSize`: 每页数量
|
||||
- **返回数据**:
|
||||
```json
|
||||
{
|
||||
"code": 0,
|
||||
"data": {
|
||||
"list": [
|
||||
{
|
||||
"id": 1,
|
||||
"startJobId": 1,
|
||||
"startJob": "AI产品经理",
|
||||
"endJobId": 1,
|
||||
"endJob": "推荐算法",
|
||||
"jobOrder": "AI产品经理,AI训练师,图像识别,导航算法,推荐算法",
|
||||
"jobCount": 5
|
||||
}
|
||||
],
|
||||
"total": 16
|
||||
}
|
||||
}
|
||||
```
|
||||
- **使用场景**:
|
||||
- ✅ **CareerPath.vue**: 获取目标职业选项列表(下拉选择器)
|
||||
- ✅ **CareerRecommend.vue**: 通过 `jobName` 查询获取 `jobId`(当缺少 jobId 时)
|
||||
- ✅ **CareerPath.vue**: 查询时如果没有 jobPathId,通过 jobName 查找
|
||||
|
||||
---
|
||||
|
||||
### 2. `getJobPathById`- 根据职业路径ID获取详情
|
||||
- **接口路径**: `/jobPath/getJobPathById`
|
||||
- **请求方法**: `GET`
|
||||
- **接口类型**: `zytp`
|
||||
- **参数**:
|
||||
- `jobPathId`: 职业路径ID
|
||||
- **返回数据**:
|
||||
```json
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"name": "职位名称",
|
||||
"skillNameList": "技能1,技能2,技能3"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
- **使用场景**:
|
||||
- ✅ **CareerPath.vue**: 获取职业路径的详细信息(起点、中间步骤、终点及每个职位的技能列表)
|
||||
- 用于显示完整的职业发展路径时间线
|
||||
|
||||
---
|
||||
|
||||
### 3. `getJobPathNum` - 获取职业路径数量
|
||||
- **接口路径**: `/jobPath/getJobPathNum`
|
||||
- **请求方法**: `GET`
|
||||
- **接口类型**: `zytp`
|
||||
- **参数**: 无
|
||||
- **返回数据**:
|
||||
```json
|
||||
{
|
||||
"data": 16 // 路径总数
|
||||
}
|
||||
```
|
||||
- **使用场景**:
|
||||
- ✅ **CareerPath.vue**: 显示"系统已收录 X 条职业路径"
|
||||
|
||||
---
|
||||
|
||||
## 二、职业技能相关接口
|
||||
|
||||
### 4. `getJobSkillDetail` - 获取职位技能详情
|
||||
- **接口路径**: `/jobSkillDet/getJobSkillDet`
|
||||
- **请求方法**: `GET`
|
||||
- **接口类型**: `zytp`
|
||||
- **参数**:
|
||||
- `jobId` (必需): 职位ID
|
||||
- `jobName` (可选): 职位名称
|
||||
- **返回数据**:
|
||||
```json
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"skillName": "技能名称",
|
||||
"skillScore": "技能分数"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
- **使用场景**:
|
||||
- ✅ **career-planning.vue**: 点击推荐职位卡片时,获取该职位的技能详情(用于技能详情弹窗 `SkillDetailPopup`)
|
||||
- **调用位置**: `handleJobCardClick` 函数中
|
||||
|
||||
---
|
||||
|
||||
### 5. `getJobPathSkill` - 获取职业路径技能(已隐藏,暂未使用)
|
||||
- **接口路径**: `/jobSkillDet/getJobPathSkill`
|
||||
- **请求方法**: `POST`
|
||||
- **接口类型**: `zytp`
|
||||
- **参数**:
|
||||
- `pathId`: 路径ID
|
||||
- `currentJobName`: 当前职位名称
|
||||
- **返回数据**: `List<JobSkillDetVO>` (包含技能分数、类型等详细信息)
|
||||
- **使用场景**:
|
||||
- ❌ 暂未在代码中使用
|
||||
- 💡 **潜在使用场景**: 在 `CareerPath.vue` 中,如果用户点击路径中的某个职位,需要查看该职位在路径中的详细技能信息(包含技能分数、类型等)时,可以使用此接口
|
||||
- **当前状态**: 接口已注释隐藏,如需使用请取消注释
|
||||
|
||||
---
|
||||
|
||||
## 三、职业推荐相关接口
|
||||
|
||||
### 8. `recommendJob` - 推荐职位
|
||||
- **接口路径**: `/job/recommendJobByJobName`
|
||||
- **请求方法**: `GET`
|
||||
- **接口类型**: `zytp`
|
||||
- **参数**:
|
||||
- `jobName` (必需): 当前职位名称(从缓存中获取),通过 URL 参数传递,格式:`/job/recommendJobByJobName?jobName=职位名称`
|
||||
- **返回数据**:
|
||||
```json
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"jobId": 123,
|
||||
"jobName": "推荐职位名称",
|
||||
"skillList": [
|
||||
{
|
||||
"skillName": "技能名称"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
- **使用场景**:
|
||||
- ✅ **CareerRecommend.vue**: 根据当前职位名称(从缓存中获取),获取相似推荐职位列表(显示在"相似推荐职位"区域)
|
||||
|
||||
---
|
||||
|
||||
## 四、接口使用场景
|
||||
|
||||
### 📍 页面结构
|
||||
```
|
||||
career-planning.vue (主页面)
|
||||
├── Tab 0: 职业推荐 (CareerRecommend.vue)
|
||||
├── Tab 1: 职业路径 (CareerPath.vue)
|
||||
└── Tab 2: 技能发展 (SkillDevelopment.vue)
|
||||
```
|
||||
|
||||
### 📍 职业推荐 Tab (CareerRecommend.vue)
|
||||
1. **进入页面时**:
|
||||
- `getJobSkillDetail` - 获取当前职位的技能标签(需要 `jobId`,如果没有 `jobId` 则跳过)
|
||||
- `recommendJob` - 获取相似推荐职位(需要 `jobId`)
|
||||
|
||||
2. **点击职位卡片时**:
|
||||
- `getJobSkillDetail` - 获取该职位的技能详情(显示在技能详情弹窗中)
|
||||
|
||||
**注意**: `getJobPathPage` 接口**只在职业路径流程中使用**,不在职业推荐流程中使用。
|
||||
|
||||
### 📍 职业路径 Tab (CareerPath.vue)
|
||||
1. **进入页面时**:
|
||||
- `getJobPathPage` - 获取所有职业路径列表(填充目标职业下拉选择器)
|
||||
- `getJobPathNum` - 获取职业路径总数(显示"系统已收录 X 条职业路径")
|
||||
|
||||
2. **选择目标职业并点击查询时**:
|
||||
- `getJobPathPage` - 如果没有 `jobPathId`,通过 `jobName` 查找
|
||||
- `getJobPathDetail` (实际: `getJobPathById`) - 获取职业路径详情(显示完整路径时间线)
|
||||
|
||||
### 📍 技能发展 Tab (SkillDevelopment.vue)
|
||||
1. **进入页面时**:
|
||||
- 暂无接口调用
|
||||
|
||||
---
|
||||
|
||||
## 🔑 关键接口调用流程
|
||||
|
||||
### 流程1: 获取当前职位技能
|
||||
```
|
||||
CareerRecommend.vue
|
||||
└── getJobSkillDetail(jobId, jobName) → 获取技能列表
|
||||
(如果没有 jobId,则跳过获取技能)
|
||||
```
|
||||
|
||||
### 流程2: 查询职业路径
|
||||
```
|
||||
CareerPath.vue
|
||||
├── getJobPathPage() → 获取路径列表(填充下拉选择器)
|
||||
├── 用户选择目标职业
|
||||
└── getJobPathById(jobPathId) → 获取路径详情(显示时间线)
|
||||
```
|
||||
|
||||
### 流程3: 获取推荐职位
|
||||
```
|
||||
CareerRecommend.vue
|
||||
└── recommendJob(jobId) → 获取相似推荐职位列表
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 注意事项
|
||||
|
||||
1. **接口返回码**:
|
||||
- `code: 0` 和 `code: 200` 都表示成功
|
||||
- 已在 `request.js` 中处理
|
||||
|
||||
2. **参数要求**:
|
||||
- `getJobSkillDetail` 必须提供 `jobId`,如果没有 `jobId` 则跳过获取技能
|
||||
- `getJobPathPage` **只在职业路径流程中使用**,不在职业推荐流程中使用
|
||||
|
||||
3. **数据格式**:
|
||||
- `getJobPathPage` 返回的 `list` 在 `response.data.list` 中
|
||||
- `getJobPathById` 返回的详情在 `response.data` 中(数组格式)
|
||||
|
||||
4. **接口使用范围**:
|
||||
- `getJobPathPage` **只在职业路径流程(CareerPath.vue)中使用**
|
||||
- 职业推荐流程(CareerRecommend.vue)**不使用** `getJobPathPage` 接口
|
||||
|
||||
5. **接口前缀**:
|
||||
- 所有 `zytp` 类型的接口使用: `http://ks.zhaopinzao8dian.com/api/ks_zytp/admin-api/zytp`
|
||||
|
||||
@@ -19,66 +19,42 @@ export function useColumnCount(onChange = () => {}) {
|
||||
// columnCount.value = count < 2 ? 2 : count
|
||||
// }
|
||||
// }
|
||||
const calcColumn = () => {
|
||||
// 使用新的API替代已废弃的getSystemInfoSync
|
||||
let width
|
||||
// #ifdef MP-WEIXIN
|
||||
const mpSystemInfo = uni.getWindowInfo()
|
||||
width = mpSystemInfo.windowWidth
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
const otherSystemInfo = uni.getSystemInfoSync()
|
||||
width = otherSystemInfo.windowWidth
|
||||
// #endif
|
||||
|
||||
let count = 2
|
||||
if (width >= 1000) {
|
||||
// #ifdef H5
|
||||
count = 3 // H5端最多显示3列
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
count = 5
|
||||
// #endif
|
||||
} else if (width >= 750) {
|
||||
// #ifdef H5
|
||||
count = 3 // H5端最多显示3列
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
count = 4
|
||||
// #endif
|
||||
} else if (width >= 500) {
|
||||
count = 3
|
||||
} else {
|
||||
count = 2
|
||||
}
|
||||
|
||||
if (count !== columnCount.value) {
|
||||
columnCount.value = count
|
||||
}
|
||||
|
||||
// 计算间距:count=2 => 1,count=5 => 2,中间线性插值
|
||||
const spacing = 2 - (count - 2) * (1 / 3)
|
||||
// console.log('列数:', count, '间距:', spacing.toFixed(2))
|
||||
columnSpace.value = spacing
|
||||
const calcColumn = () => {
|
||||
const width = uni.getSystemInfoSync().windowWidth
|
||||
|
||||
let count = 2
|
||||
if (width >= 1000) {
|
||||
count = 5
|
||||
} else if (width >= 750) {
|
||||
count = 4
|
||||
} else if (width >= 500) {
|
||||
count = 3
|
||||
} else {
|
||||
count = 2
|
||||
}
|
||||
|
||||
if (count !== columnCount.value) {
|
||||
columnCount.value = count
|
||||
}
|
||||
|
||||
// 计算间距:count=2 => 1,count=5 => 2,中间线性插值
|
||||
const spacing = 2 - (count - 2) * (1 / 3)
|
||||
// console.log('列数:', count, '间距:', spacing.toFixed(2))
|
||||
columnSpace.value = spacing
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
columnCount.value = 2
|
||||
calcColumn()
|
||||
// 只在H5环境下添加resize监听器
|
||||
// #ifdef H5
|
||||
if (typeof window !== 'undefined') {
|
||||
window.addEventListener('resize', calcColumn)
|
||||
}
|
||||
// #endif
|
||||
// if (process.client) {
|
||||
window.addEventListener('resize', calcColumn)
|
||||
// }
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
// #ifdef H5
|
||||
if (typeof window !== 'undefined') {
|
||||
window.removeEventListener('resize', calcColumn)
|
||||
}
|
||||
// #endif
|
||||
// if (process.client) {
|
||||
window.removeEventListener('resize', calcColumn)
|
||||
// }
|
||||
})
|
||||
|
||||
// 列数变化时执行回调
|
||||
|
||||
@@ -1,174 +1,173 @@
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
watch,
|
||||
isRef,
|
||||
nextTick
|
||||
} from 'vue'
|
||||
|
||||
export function usePagination(
|
||||
requestFn,
|
||||
transformFn,
|
||||
options = {}
|
||||
) {
|
||||
const list = ref([])
|
||||
const loading = ref(false)
|
||||
const error = ref(false)
|
||||
const finished = ref(false)
|
||||
const firstLoading = ref(true)
|
||||
const empty = ref(false)
|
||||
|
||||
const {
|
||||
pageSize = 10,
|
||||
search = {},
|
||||
autoWatchSearch = false,
|
||||
debounceTime = 300,
|
||||
autoFetch = false,
|
||||
|
||||
// 字段映射
|
||||
dataKey = 'rows',
|
||||
totalKey = 'total',
|
||||
|
||||
// 分页字段名映射
|
||||
pageField = 'current',
|
||||
sizeField = 'pageSize',
|
||||
|
||||
onBeforeRequest,
|
||||
onAfterRequest
|
||||
} = options
|
||||
|
||||
const pageState = reactive({
|
||||
page: 1,
|
||||
pageSize: isRef(pageSize) ? pageSize.value : pageSize,
|
||||
total: 0,
|
||||
maxPage: 1,
|
||||
search: isRef(search) ? search.value : search
|
||||
})
|
||||
|
||||
let debounceTimer = null
|
||||
|
||||
const fetchData = async (type = 'refresh') => {
|
||||
if (loading.value) return Promise.resolve()
|
||||
console.log(type)
|
||||
loading.value = true
|
||||
error.value = false
|
||||
|
||||
if (typeof onBeforeRequest === 'function') {
|
||||
try {
|
||||
onBeforeRequest(type, pageState)
|
||||
} catch (err) {
|
||||
console.warn('onBeforeRequest 执行异常:', err)
|
||||
}
|
||||
}
|
||||
|
||||
if (type === 'refresh') {
|
||||
pageState.page = 1
|
||||
finished.value = false
|
||||
if (list.value.length === 0) {
|
||||
firstLoading.value = true
|
||||
}
|
||||
} else if (type === 'loadMore') {
|
||||
if (pageState.page >= pageState.maxPage) {
|
||||
loading.value = false
|
||||
finished.value = true
|
||||
return Promise.resolve('no more')
|
||||
}
|
||||
pageState.page += 1
|
||||
}
|
||||
|
||||
const params = {
|
||||
...pageState.search,
|
||||
[pageField]: pageState.page,
|
||||
[sizeField]: pageState.pageSize,
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await requestFn(params)
|
||||
|
||||
const rawData = res[dataKey]
|
||||
const total = res[totalKey] || 99999999
|
||||
console.log(total, rawData)
|
||||
const data = typeof transformFn === 'function' ? transformFn(rawData) : rawData
|
||||
|
||||
if (type === 'refresh') {
|
||||
list.value = data
|
||||
} else {
|
||||
list.value.push(...data)
|
||||
}
|
||||
|
||||
pageState.total = total
|
||||
pageState.maxPage = Math.ceil(total / pageState.pageSize)
|
||||
|
||||
finished.value = list.value.length >= total
|
||||
empty.value = list.value.length === 0
|
||||
} catch (err) {
|
||||
console.error('分页请求失败:', err)
|
||||
error.value = true
|
||||
} finally {
|
||||
loading.value = false
|
||||
firstLoading.value = false
|
||||
|
||||
if (typeof onAfterRequest === 'function') {
|
||||
try {
|
||||
onAfterRequest(type, pageState, {
|
||||
error: error.value
|
||||
})
|
||||
} catch (err) {
|
||||
console.warn('onAfterRequest 执行异常:', err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const refresh = () => fetchData('refresh')
|
||||
const loadMore = () => fetchData('loadMore')
|
||||
|
||||
const resetPagination = () => {
|
||||
list.value = []
|
||||
pageState.page = 1
|
||||
pageState.total = 0
|
||||
pageState.maxPage = 1
|
||||
finished.value = false
|
||||
error.value = false
|
||||
firstLoading.value = true
|
||||
empty.value = false
|
||||
}
|
||||
|
||||
if (autoWatchSearch && isRef(search)) {
|
||||
watch(search, (newVal) => {
|
||||
pageState.search = newVal
|
||||
clearTimeout(debounceTimer)
|
||||
debounceTimer = setTimeout(() => {
|
||||
refresh()
|
||||
}, debounceTime)
|
||||
}, {
|
||||
deep: true
|
||||
})
|
||||
}
|
||||
|
||||
watch(pageSize, (newVal) => {
|
||||
pageState.pageSize = newVal
|
||||
}, {
|
||||
deep: true
|
||||
})
|
||||
|
||||
if (autoFetch) {
|
||||
nextTick(() => {
|
||||
refresh()
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
list,
|
||||
loading,
|
||||
error,
|
||||
finished,
|
||||
firstLoading,
|
||||
empty,
|
||||
pageState,
|
||||
refresh,
|
||||
loadMore,
|
||||
resetPagination
|
||||
}
|
||||
}
|
||||
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
watch,
|
||||
isRef,
|
||||
nextTick
|
||||
} from 'vue'
|
||||
|
||||
export function usePagination(
|
||||
requestFn,
|
||||
transformFn,
|
||||
options = {}
|
||||
) {
|
||||
const list = ref([])
|
||||
const loading = ref(false)
|
||||
const error = ref(false)
|
||||
const finished = ref(false)
|
||||
const firstLoading = ref(true)
|
||||
const empty = ref(false)
|
||||
|
||||
const {
|
||||
pageSize = 10,
|
||||
search = {},
|
||||
autoWatchSearch = false,
|
||||
debounceTime = 300,
|
||||
autoFetch = false,
|
||||
|
||||
// 字段映射
|
||||
dataKey = 'rows',
|
||||
totalKey = 'total',
|
||||
|
||||
// 分页字段名映射
|
||||
pageField = 'current',
|
||||
sizeField = 'pageSize',
|
||||
|
||||
onBeforeRequest,
|
||||
onAfterRequest
|
||||
} = options
|
||||
|
||||
const pageState = reactive({
|
||||
page: 1,
|
||||
pageSize: isRef(pageSize) ? pageSize.value : pageSize,
|
||||
total: 0,
|
||||
maxPage: 1,
|
||||
search: isRef(search) ? search.value : search
|
||||
})
|
||||
|
||||
let debounceTimer = null
|
||||
|
||||
const fetchData = async (type = 'refresh') => {
|
||||
if (loading.value) return Promise.resolve()
|
||||
console.log(type)
|
||||
loading.value = true
|
||||
error.value = false
|
||||
|
||||
if (typeof onBeforeRequest === 'function') {
|
||||
try {
|
||||
onBeforeRequest(type, pageState)
|
||||
} catch (err) {
|
||||
console.warn('onBeforeRequest 执行异常:', err)
|
||||
}
|
||||
}
|
||||
|
||||
if (type === 'refresh') {
|
||||
pageState.page = 1
|
||||
finished.value = false
|
||||
if (list.value.length === 0) {
|
||||
firstLoading.value = true
|
||||
}
|
||||
} else if (type === 'loadMore') {
|
||||
if (pageState.page >= pageState.maxPage) {
|
||||
loading.value = false
|
||||
finished.value = true
|
||||
return Promise.resolve('no more')
|
||||
}
|
||||
pageState.page += 1
|
||||
}
|
||||
|
||||
const params = {
|
||||
...pageState.search,
|
||||
[pageField]: pageState.page,
|
||||
[sizeField]: pageState.pageSize,
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await requestFn(params)
|
||||
|
||||
const rawData = res[dataKey]
|
||||
const total = res[totalKey] || 99999999
|
||||
console.log(total, rawData)
|
||||
const data = typeof transformFn === 'function' ? transformFn(rawData) : rawData
|
||||
|
||||
if (type === 'refresh') {
|
||||
list.value = data
|
||||
} else {
|
||||
list.value.push(...data)
|
||||
}
|
||||
|
||||
pageState.total = total
|
||||
pageState.maxPage = Math.ceil(total / pageState.pageSize)
|
||||
|
||||
finished.value = list.value.length >= total
|
||||
empty.value = list.value.length === 0
|
||||
} catch (err) {
|
||||
console.error('分页请求失败:', err)
|
||||
error.value = true
|
||||
} finally {
|
||||
loading.value = false
|
||||
firstLoading.value = false
|
||||
|
||||
if (typeof onAfterRequest === 'function') {
|
||||
try {
|
||||
onAfterRequest(type, pageState, {
|
||||
error: error.value
|
||||
})
|
||||
} catch (err) {
|
||||
console.warn('onAfterRequest 执行异常:', err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const refresh = () => fetchData('refresh')
|
||||
const loadMore = () => fetchData('loadMore')
|
||||
|
||||
const resetPagination = () => {
|
||||
list.value = []
|
||||
pageState.page = 1
|
||||
pageState.total = 0
|
||||
pageState.maxPage = 1
|
||||
finished.value = false
|
||||
error.value = false
|
||||
firstLoading.value = true
|
||||
empty.value = false
|
||||
}
|
||||
|
||||
if (autoWatchSearch && isRef(search)) {
|
||||
watch(search, (newVal) => {
|
||||
pageState.search = newVal
|
||||
clearTimeout(debounceTimer)
|
||||
debounceTimer = setTimeout(() => {
|
||||
refresh()
|
||||
}, debounceTime)
|
||||
}, {
|
||||
deep: true
|
||||
})
|
||||
}
|
||||
|
||||
watch(pageSize, (newVal) => {
|
||||
pageState.pageSize = newVal
|
||||
}, {
|
||||
deep: true
|
||||
})
|
||||
|
||||
if (autoFetch) {
|
||||
nextTick(() => {
|
||||
refresh()
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
list,
|
||||
loading,
|
||||
error,
|
||||
finished,
|
||||
firstLoading,
|
||||
empty,
|
||||
pageState,
|
||||
refresh,
|
||||
loadMore,
|
||||
resetPagination
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,6 @@ export function useAudioRecorder() {
|
||||
|
||||
const recognizedText = ref('')
|
||||
const lastFinalText = ref('')
|
||||
const isRecognizing = ref(false) // 识别状态,暴露给外部
|
||||
|
||||
let audioStream = null
|
||||
let audioContext = null
|
||||
@@ -133,15 +132,11 @@ export function useAudioRecorder() {
|
||||
}
|
||||
case 'TranscriptionCompleted': {
|
||||
lastFinalText.value = ''
|
||||
isRecognizing.value = false // 识别完成,重置状态
|
||||
// console.log('识别全部完成')
|
||||
cleanup()
|
||||
break
|
||||
}
|
||||
case 'TaskFailed': {
|
||||
console.error('识别失败:', msg?.header?.status_text)
|
||||
isRecognizing.value = false // 识别失败,重置状态
|
||||
cleanup()
|
||||
break
|
||||
}
|
||||
default:
|
||||
@@ -154,119 +149,9 @@ export function useAudioRecorder() {
|
||||
|
||||
const startRecording = async () => {
|
||||
if (isRecording.value) return
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
try {
|
||||
recognizedText.value = ''
|
||||
lastFinalText.value = ''
|
||||
// 开始录音时不设置isRecognizing为true,只有在停止录音后才保持isRecognizing为true
|
||||
|
||||
const recorderManager = uni.getRecorderManager()
|
||||
|
||||
// 监听录音完成事件
|
||||
recorderManager.onStop(async (res) => {
|
||||
console.log('小程序录音完成:', res)
|
||||
try {
|
||||
// 停止录音后设置isRecognizing为true,显示loading
|
||||
isRecognizing.value = true
|
||||
|
||||
// 打印请求配置,便于调试
|
||||
console.log('准备上传语音识别请求配置:', {
|
||||
url: config.vioceBaseURl,
|
||||
name: 'file',
|
||||
method: 'POST',
|
||||
fileType: 'audio',
|
||||
filePath: res.tempFilePath
|
||||
})
|
||||
|
||||
// 上传录音文件到服务器进行语音识别
|
||||
const uploadResult = await uni.uploadFile({
|
||||
url: config.vioceBaseURl,
|
||||
filePath: res.tempFilePath,
|
||||
name: 'file',
|
||||
fileType: 'audio',
|
||||
method: 'POST' // 显式设置为POST请求
|
||||
})
|
||||
|
||||
console.log('语音识别上传结果:', uploadResult)
|
||||
|
||||
if (uploadResult.statusCode === 200) {
|
||||
try {
|
||||
const result = JSON.parse(uploadResult.data)
|
||||
console.log('语音识别结果:', result)
|
||||
if (result.code === 200 && result.data) {
|
||||
recognizedText.value = result.data
|
||||
console.log('语音识别成功,识别结果:', recognizedText.value)
|
||||
// 语音识别成功后,自动发送消息
|
||||
// 这里需要触发一个事件,让父组件知道识别成功
|
||||
// 或者直接调用发送消息的方法
|
||||
isRecognizing.value = false // 识别成功,重置状态
|
||||
} else {
|
||||
console.error('语音识别返回错误:', result.message || '未知错误')
|
||||
$api.msg('语音识别失败,请重试')
|
||||
isRecognizing.value = false // 识别失败,重置状态
|
||||
}
|
||||
} catch (parseErr) {
|
||||
console.error('语音识别结果解析失败:', parseErr)
|
||||
$api.msg('语音识别失败,请重试')
|
||||
isRecognizing.value = false // 解析失败,重置状态
|
||||
}
|
||||
} else {
|
||||
console.error('语音识别请求失败,状态码:', uploadResult.statusCode)
|
||||
$api.msg('语音识别失败,请重试')
|
||||
isRecognizing.value = false // 请求失败,重置状态
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('语音识别上传失败:', err)
|
||||
$api.msg('语音识别失败,请重试')
|
||||
isRecognizing.value = false // 上传失败,重置状态
|
||||
}
|
||||
})
|
||||
|
||||
// 监听录音错误事件
|
||||
recorderManager.onError((err) => {
|
||||
console.error('小程序录音错误:', err)
|
||||
$api.msg('录音失败,请重试');
|
||||
cleanup()
|
||||
})
|
||||
|
||||
// 微信小程序录音API
|
||||
await recorderManager.start({
|
||||
duration: 60000, // 最长录音60秒
|
||||
sampleRate: 16000,
|
||||
numberOfChannels: 1,
|
||||
encodeBitRate: 96000,
|
||||
format: 'mp3'
|
||||
})
|
||||
|
||||
isRecording.value = true
|
||||
recordingDuration.value = 0
|
||||
durationTimer = setInterval(() => recordingDuration.value++, 1000)
|
||||
|
||||
// 监听录音事件(可选)
|
||||
recorderManager.onFrameRecorded((res) => {
|
||||
// 更新音量显示
|
||||
volumeLevel.value = res.volume || 0
|
||||
audioDataForDisplay.value = Array(16).fill(volumeLevel.value)
|
||||
})
|
||||
} catch (err) {
|
||||
console.error('小程序录音启动失败:', err)
|
||||
$api.msg('录音启动失败,请重试');
|
||||
cleanup()
|
||||
}
|
||||
return;
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
try {
|
||||
if (typeof navigator === 'undefined' || !navigator.mediaDevices) {
|
||||
$api.msg('当前环境不支持录音功能');
|
||||
return;
|
||||
}
|
||||
|
||||
recognizedText.value = ''
|
||||
lastFinalText.value = ''
|
||||
// 开始录音时不设置isRecognizing为true,只有在停止录音后才保持isRecognizing为true
|
||||
await connectWebSocket()
|
||||
|
||||
audioStream = await navigator.mediaDevices.getUserMedia({
|
||||
@@ -304,22 +189,14 @@ export function useAudioRecorder() {
|
||||
durationTimer = setInterval(() => recordingDuration.value++, 1000)
|
||||
} catch (err) {
|
||||
console.error('启动失败:', err)
|
||||
isRecognizing.value = false // 启动失败,重置状态
|
||||
cleanup()
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
|
||||
const stopRecording = () => {
|
||||
if (!isRecording.value || isStopping.value) return
|
||||
isStopping.value = true
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.getRecorderManager().stop()
|
||||
// 小程序中录音停止后会触发onStop事件,在onStop事件中处理识别结果和状态重置
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
if (websocket?.readyState === WebSocket.OPEN) {
|
||||
websocket.send(JSON.stringify({
|
||||
header: {
|
||||
@@ -328,39 +205,18 @@ export function useAudioRecorder() {
|
||||
message_id: generateUUID()
|
||||
}
|
||||
}))
|
||||
// H5中不立即调用cleanup,等待识别完成
|
||||
websocket.close()
|
||||
}
|
||||
// #endif
|
||||
|
||||
// 只清理录音相关资源,不重置识别状态
|
||||
clearInterval(durationTimer)
|
||||
audioStream?.getTracks().forEach(track => track.stop())
|
||||
audioContext?.close()
|
||||
audioStream = null
|
||||
audioContext = null
|
||||
audioInput = null
|
||||
scriptProcessor = null
|
||||
|
||||
isRecording.value = false
|
||||
isSocketConnected.value = false
|
||||
cleanup()
|
||||
isStopping.value = false
|
||||
}
|
||||
|
||||
const cancelRecording = () => {
|
||||
if (!isRecording.value || isStopping.value) return
|
||||
isStopping.value = true
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.getRecorderManager().stop()
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
websocket?.close()
|
||||
// #endif
|
||||
|
||||
// 取消录音时重置所有状态
|
||||
cleanup()
|
||||
isRecognizing.value = false
|
||||
isStopping.value = false
|
||||
}
|
||||
|
||||
@@ -380,22 +236,16 @@ export function useAudioRecorder() {
|
||||
|
||||
isRecording.value = false
|
||||
isSocketConnected.value = false
|
||||
isRecognizing.value = false // 停止录音,重置识别状态
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
if (isRecording.value) stopRecording()
|
||||
})
|
||||
|
||||
const reset = () => {
|
||||
cleanup()
|
||||
}
|
||||
|
||||
return {
|
||||
isRecording,
|
||||
isStopping,
|
||||
isSocketConnected,
|
||||
isRecognizing,
|
||||
recordingDuration,
|
||||
audioDataForDisplay,
|
||||
volumeLevel,
|
||||
@@ -403,7 +253,6 @@ export function useAudioRecorder() {
|
||||
lastFinalText,
|
||||
startRecording,
|
||||
stopRecording,
|
||||
cancelRecording,
|
||||
reset
|
||||
cancelRecording
|
||||
}
|
||||
}
|
||||
@@ -4,69 +4,39 @@ import {
|
||||
|
||||
export function useScrollDirection(options = {}) {
|
||||
const {
|
||||
threshold = 50, // 滚动偏移阈值,降低以更敏感
|
||||
throttleTime = 16, // 节流时间(毫秒),约60fps
|
||||
onChange = null, // 滚动方向变化的回调
|
||||
hideThreshold = 100, // 隐藏区域的滚动阈值
|
||||
enablePerformanceMode = true // 启用性能优化模式
|
||||
threshold = 200, // 滚动偏移阈值
|
||||
throttleTime = 100, // 节流时间(毫秒)
|
||||
onChange = null // 滚动方向变化的回调
|
||||
} = options
|
||||
|
||||
const lastScrollTop = ref(0)
|
||||
const accumulatedScroll = ref(0)
|
||||
const isScrollingDown = ref(false)
|
||||
const shouldHideTop = ref(false) // 控制顶部区域隐藏
|
||||
const shouldStickyFilter = ref(false) // 控制筛选区域吸顶
|
||||
let lastInvoke = 0
|
||||
|
||||
function handleScroll(e) {
|
||||
const now = Date.now()
|
||||
if (enablePerformanceMode && now - lastInvoke < throttleTime) return
|
||||
if (now - lastInvoke < throttleTime) return
|
||||
lastInvoke = now
|
||||
|
||||
const scrollTop = e.detail.scrollTop
|
||||
const delta = scrollTop - lastScrollTop.value
|
||||
accumulatedScroll.value += delta
|
||||
|
||||
// 控制顶部区域隐藏
|
||||
if (scrollTop > hideThreshold) {
|
||||
if (!shouldHideTop.value) {
|
||||
shouldHideTop.value = true
|
||||
}
|
||||
} else {
|
||||
if (shouldHideTop.value) {
|
||||
shouldHideTop.value = false
|
||||
if (accumulatedScroll.value > threshold) {
|
||||
if (!isScrollingDown.value) {
|
||||
isScrollingDown.value = true
|
||||
onChange?.(true) // 通知变更为向下
|
||||
}
|
||||
accumulatedScroll.value = 0
|
||||
}
|
||||
|
||||
// 控制筛选区域吸顶(当顶部区域隐藏时)
|
||||
if (scrollTop > hideThreshold + 50) { // 稍微延迟吸顶
|
||||
if (!shouldStickyFilter.value) {
|
||||
shouldStickyFilter.value = true
|
||||
}
|
||||
} else {
|
||||
if (shouldStickyFilter.value) {
|
||||
shouldStickyFilter.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 滚动方向检测(仅在性能模式下使用阈值)
|
||||
if (!enablePerformanceMode || Math.abs(accumulatedScroll.value) > threshold) {
|
||||
if (accumulatedScroll.value > 0) {
|
||||
// 向下滚动
|
||||
if (!isScrollingDown.value) {
|
||||
isScrollingDown.value = true
|
||||
onChange?.(true) // 通知变更为向下
|
||||
}
|
||||
} else {
|
||||
// 向上滚动
|
||||
if (isScrollingDown.value) {
|
||||
isScrollingDown.value = false
|
||||
onChange?.(false) // 通知变更为向上
|
||||
}
|
||||
}
|
||||
if (enablePerformanceMode) {
|
||||
accumulatedScroll.value = 0
|
||||
if (accumulatedScroll.value < -threshold) {
|
||||
if (isScrollingDown.value) {
|
||||
isScrollingDown.value = false
|
||||
onChange?.(false) // 通知变更为向上
|
||||
}
|
||||
accumulatedScroll.value = 0
|
||||
}
|
||||
|
||||
lastScrollTop.value = scrollTop
|
||||
@@ -74,8 +44,6 @@ export function useScrollDirection(options = {}) {
|
||||
|
||||
return {
|
||||
isScrollingDown,
|
||||
shouldHideTop,
|
||||
shouldStickyFilter,
|
||||
handleScroll
|
||||
}
|
||||
}
|
||||
@@ -1,639 +1,336 @@
|
||||
import {
|
||||
ref,
|
||||
onUnmounted,
|
||||
onBeforeUnmount,
|
||||
onMounted
|
||||
} from 'vue'
|
||||
import {
|
||||
onHide,
|
||||
onUnload
|
||||
} from '@dcloudio/uni-app'
|
||||
|
||||
// 创建单例实例
|
||||
let ttsInstance = null
|
||||
|
||||
// 创建音频播放器类
|
||||
class TTSPlayer {
|
||||
constructor(httpUrl) {
|
||||
this.httpUrl = httpUrl
|
||||
this.isSpeaking = ref(false)
|
||||
this.isPaused = ref(false)
|
||||
this.isComplete = ref(false)
|
||||
|
||||
// #ifdef H5
|
||||
this.audioContext = null
|
||||
this.htmlAudioElement = null
|
||||
this.abortController = null
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
this.backgroundAudioManager = null
|
||||
this.innerAudioContext = null
|
||||
// #endif
|
||||
|
||||
this.currentAudioBuffer = null
|
||||
this.currentSource = null
|
||||
this.playTimeOffset = 0
|
||||
this.isProcessingRequest = false
|
||||
}
|
||||
|
||||
// 初始化微信小程序音频上下文
|
||||
initAudioManager() {
|
||||
try {
|
||||
console.log('📱 微信小程序:创建背景音频管理器')
|
||||
this.backgroundAudioManager = uni.getBackgroundAudioManager()
|
||||
|
||||
// 设置默认配置
|
||||
this.backgroundAudioManager.title = 'AI语音播报'
|
||||
this.backgroundAudioManager.singer = 'KS AI'
|
||||
this.backgroundAudioManager.coverImgUrl = '/static/icon/logo.png'
|
||||
this.backgroundAudioManager.volume = 1.0
|
||||
|
||||
this.backgroundAudioManager.onPlay(() => {
|
||||
console.log('🎵 微信小程序背景音频播放开始')
|
||||
this.isSpeaking.value = true
|
||||
this.isPaused.value = false
|
||||
})
|
||||
|
||||
this.backgroundAudioManager.onPause(() => {
|
||||
console.log('⏸️ 微信小程序背景音频播放暂停')
|
||||
this.isPaused.value = true
|
||||
})
|
||||
|
||||
this.backgroundAudioManager.onStop(() => {
|
||||
console.log('⏹️ 微信小程序背景音频播放停止')
|
||||
this.isSpeaking.value = false
|
||||
this.isComplete.value = true
|
||||
})
|
||||
|
||||
this.backgroundAudioManager.onEnded(() => {
|
||||
console.log('🎵 微信小程序背景音频播放结束')
|
||||
this.isSpeaking.value = false
|
||||
this.isComplete.value = true
|
||||
})
|
||||
|
||||
this.backgroundAudioManager.onError((res) => {
|
||||
console.error('❌ 微信小程序背景音频播放错误:', res.errMsg, '错误码:', res.errCode)
|
||||
this.isSpeaking.value = false
|
||||
this.isComplete.value = false
|
||||
})
|
||||
|
||||
this.backgroundAudioManager.onCanplay(() => {
|
||||
console.log('🎵 微信小程序背景音频可以播放了')
|
||||
})
|
||||
|
||||
console.log('✅ 微信小程序背景音频管理器初始化成功')
|
||||
return true
|
||||
} catch (e) {
|
||||
console.error('❌ 微信小程序背景音频管理器初始化失败:', e)
|
||||
// 降级使用InnerAudioContext
|
||||
console.log('🔄 微信小程序:背景音频不可用,降级使用InnerAudioContext')
|
||||
|
||||
if (!this.innerAudioContext) {
|
||||
this.innerAudioContext = uni.createInnerAudioContext()
|
||||
this.innerAudioContext.autoplay = false
|
||||
this.innerAudioContext.obeyMuteSwitch = false
|
||||
|
||||
this.innerAudioContext.onPlay(() => {
|
||||
console.log('🎵 微信小程序InnerAudioContext播放开始')
|
||||
this.isSpeaking.value = true
|
||||
this.isPaused.value = false
|
||||
})
|
||||
|
||||
this.innerAudioContext.onPause(() => {
|
||||
console.log('⏸️ 微信小程序InnerAudioContext播放暂停')
|
||||
this.isPaused.value = true
|
||||
})
|
||||
|
||||
this.innerAudioContext.onStop(() => {
|
||||
console.log('⏹️ 微信小程序InnerAudioContext播放停止')
|
||||
this.isSpeaking.value = false
|
||||
this.isComplete.value = true
|
||||
})
|
||||
|
||||
this.innerAudioContext.onEnded(() => {
|
||||
console.log('🎵 微信小程序InnerAudioContext播放结束')
|
||||
this.isSpeaking.value = false
|
||||
this.isComplete.value = true
|
||||
})
|
||||
|
||||
this.innerAudioContext.onError((res) => {
|
||||
console.error('❌ 微信小程序InnerAudioContext错误:', res.errMsg, '错误码:', res.errCode)
|
||||
this.isSpeaking.value = false
|
||||
this.isComplete.value = false
|
||||
})
|
||||
|
||||
this.innerAudioContext.onCanplay(() => {
|
||||
console.log('🎵 微信小程序InnerAudioContext可以播放了')
|
||||
if (this.isSpeaking.value && !this.isPaused.value) {
|
||||
this.innerAudioContext.play()
|
||||
}
|
||||
})
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// H5环境播放解码后的音频
|
||||
playDecodedAudio(decoded) {
|
||||
// #ifdef H5
|
||||
if (!this.audioContext) return;
|
||||
|
||||
// 创建音频源
|
||||
this.currentSource = this.audioContext.createBufferSource()
|
||||
this.currentSource.buffer = decoded
|
||||
this.currentSource.connect(this.audioContext.destination)
|
||||
|
||||
// 监听播放结束
|
||||
this.currentSource.onended = () => {
|
||||
console.log('🎵 Audio playback completed');
|
||||
this.isSpeaking.value = false
|
||||
this.isComplete.value = true
|
||||
}
|
||||
|
||||
// 开始播放
|
||||
this.currentSource.start()
|
||||
this.isSpeaking.value = true
|
||||
this.isPaused.value = false
|
||||
this.isComplete.value = false
|
||||
console.log('🎵 Audio playback started');
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 降级处理:创建一个简单的音频缓冲区
|
||||
createFallbackAudio(arrayBuffer) {
|
||||
// #ifdef H5
|
||||
console.log('🔄 使用降级方案创建音频');
|
||||
|
||||
// 创建一个简单的音频缓冲区,生成提示音
|
||||
const sampleRate = 44100
|
||||
const duration = 1 // 1秒
|
||||
const frameCount = sampleRate * duration
|
||||
|
||||
const audioBuffer = this.audioContext.createBuffer(1, frameCount, sampleRate)
|
||||
const channelData = audioBuffer.getChannelData(0)
|
||||
|
||||
// 生成一个简单的提示音(正弦波)
|
||||
for (let i = 0; i < frameCount; i++) {
|
||||
const t = i / sampleRate
|
||||
channelData[i] = Math.sin(2 * Math.PI * 440 * t) * 0.1 // 440Hz正弦波,音量0.1
|
||||
}
|
||||
|
||||
this.playDecodedAudio(audioBuffer)
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 暂停播放
|
||||
pause() {
|
||||
console.log('⏸️ TTS pause called');
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
// 优先使用背景音频管理器
|
||||
if (this.backgroundAudioManager) {
|
||||
try {
|
||||
this.backgroundAudioManager.pause()
|
||||
console.log('⏸️ 微信小程序背景音频暂停');
|
||||
return
|
||||
} catch (e) {
|
||||
console.error('❌ 微信小程序背景音频暂停失败:', e);
|
||||
}
|
||||
}
|
||||
|
||||
// 降级使用InnerAudioContext
|
||||
if (this.innerAudioContext && this.isSpeaking.value && !this.isPaused.value) {
|
||||
try {
|
||||
this.innerAudioContext.pause()
|
||||
console.log('⏸️ 微信小程序InnerAudioContext暂停');
|
||||
return
|
||||
} catch (e) {
|
||||
console.error('❌ 微信小程序InnerAudioContext暂停失败:', e);
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
if (this.audioContext && !this.isSpeaking.value || this.isPaused.value) {
|
||||
console.warn('⚠️ Cannot pause TTS playback');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.audioContext.state === 'running') {
|
||||
this.audioContext.suspend()
|
||||
this.isPaused.value = true
|
||||
// 保存当前播放位置
|
||||
this.playTimeOffset = this.audioContext.currentTime
|
||||
console.log('✅ H5 Audio paused successfully');
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 恢复播放
|
||||
resume() {
|
||||
console.log('▶️ TTS resume called');
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
// 优先使用背景音频管理器
|
||||
if (this.backgroundAudioManager) {
|
||||
try {
|
||||
this.backgroundAudioManager.play()
|
||||
console.log('▶️ 微信小程序背景音频恢复播放');
|
||||
return
|
||||
} catch (e) {
|
||||
console.error('❌ 微信小程序背景音频恢复失败:', e);
|
||||
}
|
||||
}
|
||||
|
||||
// 降级使用InnerAudioContext
|
||||
if (this.innerAudioContext && this.isSpeaking.value && this.isPaused.value) {
|
||||
try {
|
||||
this.innerAudioContext.play()
|
||||
console.log('▶️ 微信小程序InnerAudioContext恢复播放');
|
||||
return
|
||||
} catch (e) {
|
||||
console.error('❌ 微信小程序InnerAudioContext恢复失败:', e);
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
if (this.audioContext && !this.isSpeaking.value || !this.isPaused.value) {
|
||||
console.warn('⚠️ Cannot resume TTS playback');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.audioContext.state === 'suspended') {
|
||||
this.audioContext.resume()
|
||||
this.isPaused.value = false
|
||||
console.log('✅ H5 Audio resumed successfully');
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 停止播放
|
||||
stop() {
|
||||
console.log('⏹️ TTS stop called');
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
// 优先使用背景音频管理器
|
||||
if (this.backgroundAudioManager) {
|
||||
try {
|
||||
this.backgroundAudioManager.stop()
|
||||
console.log('✅ 微信小程序背景音频停止');
|
||||
} catch (e) {
|
||||
console.error('❌ 微信小程序背景音频停止失败:', e);
|
||||
}
|
||||
}
|
||||
|
||||
// 降级使用InnerAudioContext
|
||||
if (this.innerAudioContext) {
|
||||
try {
|
||||
this.innerAudioContext.stop()
|
||||
console.log('✅ 微信小程序InnerAudioContext停止');
|
||||
this.innerAudioContext.destroy()
|
||||
this.innerAudioContext = null
|
||||
} catch (e) {
|
||||
console.error('❌ 微信小程序InnerAudioContext停止错误:', e);
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
// 取消正在进行的fetch请求
|
||||
if (this.abortController) {
|
||||
try {
|
||||
this.abortController.abort();
|
||||
this.abortController = null;
|
||||
console.log('✅ H5 fetch request aborted');
|
||||
} catch (e) {
|
||||
console.error('❌ Error aborting H5 fetch request:', e);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.currentSource) {
|
||||
try {
|
||||
this.currentSource.stop()
|
||||
this.currentSource.disconnect()
|
||||
} catch (e) {
|
||||
console.error('❌ Error stopping H5 audio source:', e);
|
||||
}
|
||||
this.currentSource = null
|
||||
}
|
||||
|
||||
// 停止并清理HTML5 Audio元素
|
||||
if (this.htmlAudioElement) {
|
||||
try {
|
||||
this.htmlAudioElement.pause();
|
||||
this.htmlAudioElement.src = '';
|
||||
this.htmlAudioElement = null;
|
||||
console.log('✅ H5 HTML5 Audio element stopped and cleaned up');
|
||||
} catch (e) {
|
||||
console.error('❌ Error stopping H5 HTML5 Audio element:', e);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.audioContext && this.audioContext.state === 'running') {
|
||||
try {
|
||||
this.audioContext.suspend()
|
||||
} catch (e) {
|
||||
console.error('❌ Error suspending H5 audio context:', e);
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
|
||||
this.isSpeaking.value = false
|
||||
this.isPaused.value = false
|
||||
this.isComplete.value = false
|
||||
this.currentAudioBuffer = null
|
||||
this.playTimeOffset = 0
|
||||
this.isProcessingRequest = false
|
||||
|
||||
console.log('✅ TTS playback stopped');
|
||||
}
|
||||
|
||||
// 取消音频播放
|
||||
cancelAudio() {
|
||||
this.stop()
|
||||
}
|
||||
|
||||
// 合成并播放语音
|
||||
async speak(text) {
|
||||
// 停止当前播放和处理中的请求
|
||||
this.stop()
|
||||
|
||||
try {
|
||||
// 标记开始处理请求
|
||||
this.isProcessingRequest = true
|
||||
|
||||
// 提取要合成的文本
|
||||
const speechText = extractSpeechText(text)
|
||||
console.log('📤 Sending text to TTS server via GET:', speechText.substring(0, 100) + '...');
|
||||
|
||||
// 构建GET请求URL
|
||||
const url = `${this.httpUrl}?text=${encodeURIComponent(speechText)}`
|
||||
console.log('🔗 Final GET URL:', url);
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
// 微信小程序环境,使用背景音频管理器
|
||||
const isBackgroundAudioAvailable = this.initAudioManager()
|
||||
|
||||
// 重置音频状态,但不立即设置为正在播放,等待实际播放时再设置
|
||||
this.isPaused.value = false
|
||||
this.isComplete.value = false
|
||||
|
||||
if (isBackgroundAudioAvailable && this.backgroundAudioManager) {
|
||||
console.log('🎵 微信小程序:使用背景音频管理器播放,URL:', url);
|
||||
|
||||
// 设置背景音频参数
|
||||
this.backgroundAudioManager.title = 'AI语音播报'
|
||||
this.backgroundAudioManager.singer = 'KS AI'
|
||||
this.backgroundAudioManager.coverImgUrl = '/static/icon/logo.png'
|
||||
|
||||
// 直接设置src并播放
|
||||
this.backgroundAudioManager.src = url
|
||||
console.log('🎵 微信小程序背景音频开始加载');
|
||||
} else {
|
||||
// 降级方案:使用InnerAudioContext
|
||||
console.log('🔄 微信小程序:背景音频不可用,降级使用InnerAudioContext');
|
||||
|
||||
// 如果已有音频上下文,先销毁再重新创建
|
||||
if (this.innerAudioContext) {
|
||||
this.innerAudioContext.destroy()
|
||||
this.innerAudioContext = null
|
||||
}
|
||||
|
||||
this.innerAudioContext = uni.createInnerAudioContext()
|
||||
this.innerAudioContext.autoplay = true // 设置自动播放,等音频加载完成后自动开始
|
||||
this.innerAudioContext.obeyMuteSwitch = false
|
||||
this.innerAudioContext.volume = 1.0
|
||||
|
||||
this.innerAudioContext.onPlay(() => {
|
||||
console.log('🎵 微信小程序InnerAudioContext播放开始')
|
||||
this.isSpeaking.value = true
|
||||
this.isPaused.value = false
|
||||
})
|
||||
|
||||
this.innerAudioContext.onPause(() => {
|
||||
console.log('⏸️ 微信小程序InnerAudioContext播放暂停')
|
||||
this.isPaused.value = true
|
||||
})
|
||||
|
||||
this.innerAudioContext.onStop(() => {
|
||||
console.log('⏹️ 微信小程序InnerAudioContext播放停止')
|
||||
this.isSpeaking.value = false
|
||||
this.isComplete.value = true
|
||||
})
|
||||
|
||||
this.innerAudioContext.onEnded(() => {
|
||||
console.log('🎵 微信小程序InnerAudioContext播放结束')
|
||||
this.isSpeaking.value = false
|
||||
this.isComplete.value = true
|
||||
})
|
||||
|
||||
this.innerAudioContext.onError((res) => {
|
||||
console.error('❌ 微信小程序InnerAudioContext错误:', res.errMsg, '错误码:', res.errCode)
|
||||
this.isSpeaking.value = false
|
||||
this.isComplete.value = false
|
||||
})
|
||||
|
||||
this.innerAudioContext.onCanplay(() => {
|
||||
console.log('🎵 微信小程序InnerAudioContext可以播放了')
|
||||
// 不需要手动调用play,因为已经设置了autoplay
|
||||
})
|
||||
|
||||
this.innerAudioContext.src = url
|
||||
console.log('🎵 微信小程序InnerAudioContext开始加载');
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
// H5环境,使用 AudioContext
|
||||
try {
|
||||
// 创建新的AbortController,用于取消当前请求
|
||||
this.abortController = new AbortController();
|
||||
const signal = this.abortController.signal;
|
||||
|
||||
// 确保AudioContext已创建
|
||||
if (!this.audioContext) {
|
||||
console.log('🎵 H5: 创建新的AudioContext');
|
||||
this.audioContext = new (window.AudioContext || window.webkitAudioContext)();
|
||||
}
|
||||
|
||||
// 检查并恢复AudioContext状态(浏览器安全策略要求用户交互后才能播放音频)
|
||||
if (this.audioContext.state === 'suspended') {
|
||||
console.log('🎵 H5: 恢复挂起的AudioContext');
|
||||
await this.audioContext.resume();
|
||||
console.log('✅ H5: AudioContext已恢复,状态:', this.audioContext.state);
|
||||
}
|
||||
|
||||
// 发送GET请求获取语音数据,添加signal支持取消
|
||||
const response = await fetch(url, { signal })
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`)
|
||||
}
|
||||
|
||||
// 获取二进制数据
|
||||
const arrayBuffer = await response.arrayBuffer()
|
||||
console.log('✅ H5: Received audio data, size:', arrayBuffer.byteLength + ' bytes');
|
||||
|
||||
try {
|
||||
// 直接使用 audioContext.decodeAudioData 解码,不依赖外部库
|
||||
const decoded = await this.audioContext.decodeAudioData(arrayBuffer)
|
||||
console.log('✅ H5: Audio decoded, sampleRate:', decoded.sampleRate, 'channels:', decoded.numberOfChannels);
|
||||
|
||||
// 播放音频
|
||||
this.playDecodedAudio(decoded)
|
||||
} catch (decodeError) {
|
||||
console.error('❌ H5: AudioContext decodeAudioData failed:', decodeError);
|
||||
// 降级处理:创建一个简单的音频缓冲区
|
||||
this.createFallbackAudio(arrayBuffer)
|
||||
}
|
||||
} catch (h5Error) {
|
||||
// 检查是否是取消请求导致的错误
|
||||
if (h5Error.name === 'AbortError') {
|
||||
console.log('✅ H5: Fetch request aborted as requested');
|
||||
this.isSpeaking.value = false;
|
||||
this.isComplete.value = false;
|
||||
return;
|
||||
}
|
||||
|
||||
console.error('❌ H5: Audio playback failed:', h5Error);
|
||||
// 尝试使用HTML5 Audio元素作为最终降级方案
|
||||
try {
|
||||
console.log('🔄 H5: 尝试使用HTML5 Audio元素播放');
|
||||
|
||||
// 如果已有Audio元素,先停止并销毁
|
||||
if (this.htmlAudioElement) {
|
||||
this.htmlAudioElement.pause();
|
||||
this.htmlAudioElement.src = '';
|
||||
this.htmlAudioElement = null;
|
||||
}
|
||||
|
||||
const audio = new Audio(url);
|
||||
this.htmlAudioElement = audio;
|
||||
audio.play();
|
||||
console.log('✅ H5: HTML5 Audio元素开始播放');
|
||||
|
||||
// 设置音频状态
|
||||
this.isSpeaking.value = true;
|
||||
this.isPaused.value = false;
|
||||
this.isComplete.value = false;
|
||||
|
||||
// 监听播放结束
|
||||
audio.onended = () => {
|
||||
console.log('🎵 H5: HTML5 Audio播放结束');
|
||||
this.isSpeaking.value = false;
|
||||
this.isComplete.value = true;
|
||||
this.htmlAudioElement = null;
|
||||
};
|
||||
|
||||
// 监听播放错误
|
||||
audio.onerror = (error) => {
|
||||
console.error('❌ H5: HTML5 Audio播放错误:', error);
|
||||
this.isSpeaking.value = false;
|
||||
this.isComplete.value = false;
|
||||
this.htmlAudioElement = null;
|
||||
};
|
||||
} catch (audioError) {
|
||||
console.error('❌ H5: HTML5 Audio播放也失败了:', audioError);
|
||||
this.isSpeaking.value = false;
|
||||
this.isComplete.value = false;
|
||||
this.htmlAudioElement = null;
|
||||
}
|
||||
} finally {
|
||||
// 清除AbortController,因为请求已经完成(无论成功还是失败)
|
||||
this.abortController = null;
|
||||
}
|
||||
// #endif
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ TTS synthesis failed:', error);
|
||||
this.isSpeaking.value = false
|
||||
this.isComplete.value = false
|
||||
} finally {
|
||||
// 标记请求处理完成
|
||||
this.isProcessingRequest = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 导出单例hook
|
||||
export function useTTSPlayer(httpUrl) {
|
||||
// 如果已经有实例,直接返回
|
||||
if (!ttsInstance) {
|
||||
ttsInstance = new TTSPlayer(httpUrl)
|
||||
}
|
||||
|
||||
// 返回实例的方法和状态
|
||||
return {
|
||||
speak: ttsInstance.speak.bind(ttsInstance),
|
||||
pause: ttsInstance.pause.bind(ttsInstance),
|
||||
resume: ttsInstance.resume.bind(ttsInstance),
|
||||
cancelAudio: ttsInstance.cancelAudio.bind(ttsInstance),
|
||||
isSpeaking: ttsInstance.isSpeaking,
|
||||
isPaused: ttsInstance.isPaused,
|
||||
isComplete: ttsInstance.isComplete
|
||||
}
|
||||
}
|
||||
|
||||
function extractSpeechText(markdown) {
|
||||
console.log('🔍 extractSpeechText called');
|
||||
console.log('📝 Input markdown length:', markdown ? markdown.length : 0);
|
||||
console.log('📝 Input markdown preview:', markdown ? markdown.substring(0, 200) + '...' : 'No markdown');
|
||||
|
||||
const jobRegex = /``` job-json\s*({[\s\S]*?})\s*```/g;
|
||||
const jobs = [];
|
||||
let match;
|
||||
let lastJobEndIndex = 0;
|
||||
let firstJobStartIndex = -1;
|
||||
|
||||
// 提取岗位 json 数据及前后位置
|
||||
while ((match = jobRegex.exec(markdown)) !== null) {
|
||||
const jobStr = match[1];
|
||||
try {
|
||||
const job = JSON.parse(jobStr);
|
||||
jobs.push(job);
|
||||
if (firstJobStartIndex === -1) {
|
||||
firstJobStartIndex = match.index;
|
||||
}
|
||||
lastJobEndIndex = jobRegex.lastIndex;
|
||||
console.log('✅ Found job:', job.jobTitle);
|
||||
} catch (e) {
|
||||
console.warn('JSON 解析失败', e);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('📊 Jobs found:', jobs.length);
|
||||
console.log('📍 First job start index:', firstJobStartIndex);
|
||||
console.log('📍 Last job end index:', lastJobEndIndex);
|
||||
|
||||
// 提取引导语(第一个 job-json 之前的文字)
|
||||
const guideText = firstJobStartIndex > 0 ?
|
||||
markdown.slice(0, firstJobStartIndex).trim() :
|
||||
'';
|
||||
|
||||
// 提取结束语(最后一个 job-json 之后的文字)
|
||||
const endingText = lastJobEndIndex < markdown.length ?
|
||||
markdown.slice(lastJobEndIndex).trim() :
|
||||
'';
|
||||
|
||||
console.log('📝 Guide text:', guideText);
|
||||
console.log('📝 Ending text:', endingText);
|
||||
|
||||
// 岗位信息格式化为语音文本
|
||||
const jobTexts = jobs.map((job, index) => {
|
||||
return `第 ${index + 1} 个岗位,岗位名称是:${job.jobTitle},公司是:${job.companyName},薪资:${job.salary},地点:${job.location},学历要求:${job.education},经验要求:${job.experience}。`;
|
||||
});
|
||||
|
||||
// 拼接总语音内容
|
||||
const finalTextParts = [];
|
||||
if (guideText) finalTextParts.push(guideText);
|
||||
finalTextParts.push(...jobTexts);
|
||||
if (endingText) finalTextParts.push(endingText);
|
||||
|
||||
const finalText = finalTextParts.join('\n');
|
||||
console.log('🎤 Final TTS text length:', finalText.length);
|
||||
console.log('🎤 Final TTS text preview:', finalText.substring(0, 200) + '...');
|
||||
console.log('🎤 Final TTS text parts count:', finalTextParts.length);
|
||||
|
||||
return finalText;
|
||||
import {
|
||||
ref,
|
||||
onUnmounted,
|
||||
onBeforeUnmount,
|
||||
onMounted
|
||||
} from 'vue'
|
||||
import {
|
||||
onHide,
|
||||
onUnload
|
||||
} from '@dcloudio/uni-app'
|
||||
import WavDecoder from '@/lib/wav-decoder@1.3.0.js'
|
||||
|
||||
export function useTTSPlayer(wsUrl) {
|
||||
const isSpeaking = ref(false)
|
||||
const isPaused = ref(false)
|
||||
const isComplete = ref(false)
|
||||
|
||||
const audioContext = new(window.AudioContext || window.webkitAudioContext)()
|
||||
let playTime = audioContext.currentTime
|
||||
let sourceNodes = []
|
||||
let socket = null
|
||||
let sampleRate = 16000
|
||||
let numChannels = 1
|
||||
let isHeaderDecoded = false
|
||||
let pendingText = null
|
||||
|
||||
let currentPlayId = 0
|
||||
let activePlayId = 0
|
||||
|
||||
const speak = (text) => {
|
||||
console.log('🎤 TTS speak function called');
|
||||
console.log('📝 Text to synthesize:', text ? text.substring(0, 100) + '...' : 'No text');
|
||||
console.log('🔗 WebSocket URL:', wsUrl);
|
||||
|
||||
currentPlayId++
|
||||
const myPlayId = currentPlayId
|
||||
console.log('🆔 Play ID:', myPlayId);
|
||||
|
||||
reset()
|
||||
pendingText = text
|
||||
activePlayId = myPlayId
|
||||
|
||||
console.log('✅ Speak function setup complete');
|
||||
}
|
||||
|
||||
const pause = () => {
|
||||
console.log('⏸️ TTS pause called');
|
||||
console.log('🔊 AudioContext state:', audioContext.state);
|
||||
console.log('🔊 Is speaking before pause:', isSpeaking.value);
|
||||
console.log('⏸️ Is paused before pause:', isPaused.value);
|
||||
|
||||
if (audioContext.state === 'running') {
|
||||
audioContext.suspend()
|
||||
isPaused.value = true
|
||||
// 不要设置 isSpeaking.value = false,保持当前状态
|
||||
console.log('✅ Audio paused successfully');
|
||||
} else {
|
||||
console.log('⚠️ AudioContext is not running, cannot pause');
|
||||
}
|
||||
|
||||
console.log('🔊 Is speaking after pause:', isSpeaking.value);
|
||||
console.log('⏸️ Is paused after pause:', isPaused.value);
|
||||
}
|
||||
|
||||
const resume = () => {
|
||||
console.log('▶️ TTS resume called');
|
||||
console.log('🔊 AudioContext state:', audioContext.state);
|
||||
console.log('🔊 Is speaking before resume:', isSpeaking.value);
|
||||
console.log('⏸️ Is paused before resume:', isPaused.value);
|
||||
|
||||
if (audioContext.state === 'suspended') {
|
||||
audioContext.resume()
|
||||
isPaused.value = false
|
||||
isSpeaking.value = true
|
||||
console.log('✅ Audio resumed successfully');
|
||||
} else {
|
||||
console.log('⚠️ AudioContext is not suspended, cannot resume');
|
||||
}
|
||||
|
||||
console.log('🔊 Is speaking after resume:', isSpeaking.value);
|
||||
console.log('⏸️ Is paused after resume:', isPaused.value);
|
||||
}
|
||||
|
||||
const cancelAudio = () => {
|
||||
stop()
|
||||
}
|
||||
|
||||
const stop = () => {
|
||||
isSpeaking.value = false
|
||||
isPaused.value = false
|
||||
isComplete.value = false
|
||||
playTime = audioContext.currentTime
|
||||
|
||||
sourceNodes.forEach(node => {
|
||||
try {
|
||||
node.stop()
|
||||
node.disconnect()
|
||||
} catch (e) {}
|
||||
})
|
||||
sourceNodes = []
|
||||
|
||||
if (socket) {
|
||||
socket.close()
|
||||
socket = null
|
||||
}
|
||||
|
||||
isHeaderDecoded = false
|
||||
pendingText = null
|
||||
}
|
||||
|
||||
const reset = () => {
|
||||
stop()
|
||||
isSpeaking.value = false
|
||||
isPaused.value = false
|
||||
isComplete.value = false
|
||||
playTime = audioContext.currentTime
|
||||
initWebSocket()
|
||||
}
|
||||
|
||||
const initWebSocket = () => {
|
||||
const thisPlayId = currentPlayId
|
||||
console.log('🔌 Initializing WebSocket connection');
|
||||
console.log('🔗 WebSocket URL:', wsUrl);
|
||||
console.log('🆔 This play ID:', thisPlayId);
|
||||
|
||||
socket = new WebSocket(wsUrl)
|
||||
socket.binaryType = 'arraybuffer'
|
||||
|
||||
// 设置心跳检测,避免超时
|
||||
const heartbeatInterval = setInterval(() => {
|
||||
if (socket && socket.readyState === WebSocket.OPEN) {
|
||||
socket.send(JSON.stringify({ type: 'ping' }));
|
||||
}
|
||||
}, 30000); // 每30秒发送一次心跳
|
||||
|
||||
socket.onopen = () => {
|
||||
console.log('✅ WebSocket connection opened');
|
||||
if (pendingText && thisPlayId === activePlayId) {
|
||||
const seepdText = extractSpeechText(pendingText)
|
||||
console.log('📤 Sending text to TTS server:', seepdText.substring(0, 100) + '...');
|
||||
socket.send(seepdText)
|
||||
pendingText = null
|
||||
} else {
|
||||
console.log('❌ No pending text or play ID mismatch');
|
||||
console.log('📝 Pending text exists:', !!pendingText);
|
||||
console.log('🆔 Play ID match:', thisPlayId === activePlayId);
|
||||
}
|
||||
}
|
||||
|
||||
socket.onerror = (error) => {
|
||||
console.error('❌ WebSocket error:', error);
|
||||
}
|
||||
|
||||
socket.onclose = (event) => {
|
||||
console.log('🔌 WebSocket connection closed:', event.code, event.reason);
|
||||
clearInterval(heartbeatInterval);
|
||||
}
|
||||
|
||||
socket.onmessage = async (e) => {
|
||||
if (thisPlayId !== activePlayId) return // 忽略旧播放的消息
|
||||
|
||||
if (typeof e.data === 'string') {
|
||||
try {
|
||||
const msg = JSON.parse(e.data)
|
||||
console.log('📨 TTS server message:', msg);
|
||||
if (msg.status === 'complete') {
|
||||
console.log('✅ TTS synthesis completed');
|
||||
isComplete.value = true
|
||||
// 计算剩余播放时间,确保播放完整
|
||||
const remainingTime = Math.max(0, (playTime - audioContext.currentTime) * 1000);
|
||||
console.log('⏱️ Remaining play time:', remainingTime + 'ms');
|
||||
setTimeout(() => {
|
||||
if (thisPlayId === activePlayId) {
|
||||
console.log('🔇 TTS playback finished, setting isSpeaking to false');
|
||||
isSpeaking.value = false
|
||||
}
|
||||
}, remainingTime + 500) // 额外500ms缓冲时间
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('[TTSPlayer] 文本消息:', e.data)
|
||||
}
|
||||
} else if (e.data instanceof ArrayBuffer) {
|
||||
if (!isHeaderDecoded) {
|
||||
try {
|
||||
const decoded = await WavDecoder.decode(e.data)
|
||||
sampleRate = decoded.sampleRate
|
||||
numChannels = decoded.channelData.length
|
||||
decoded.channelData.forEach((channel, i) => {
|
||||
const audioBuffer = audioContext.createBuffer(1, channel.length,
|
||||
sampleRate)
|
||||
audioBuffer.copyToChannel(channel, 0)
|
||||
playBuffer(audioBuffer)
|
||||
})
|
||||
isHeaderDecoded = true
|
||||
} catch (err) {
|
||||
console.error('WAV 解码失败:', err)
|
||||
}
|
||||
} else {
|
||||
const pcm = new Int16Array(e.data)
|
||||
const audioBuffer = pcmToAudioBuffer(pcm, sampleRate, numChannels)
|
||||
playBuffer(audioBuffer)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const pcmToAudioBuffer = (pcm, sampleRate, numChannels) => {
|
||||
const length = pcm.length / numChannels
|
||||
const audioBuffer = audioContext.createBuffer(numChannels, length, sampleRate)
|
||||
for (let ch = 0; ch < numChannels; ch++) {
|
||||
const channelData = audioBuffer.getChannelData(ch)
|
||||
for (let i = 0; i < length; i++) {
|
||||
const sample = pcm[i * numChannels + ch]
|
||||
channelData[i] = sample / 32768
|
||||
}
|
||||
}
|
||||
return audioBuffer
|
||||
}
|
||||
|
||||
const playBuffer = (audioBuffer) => {
|
||||
console.log('🎵 playBuffer called, duration:', audioBuffer.duration + 's');
|
||||
if (!isSpeaking.value) {
|
||||
playTime = audioContext.currentTime
|
||||
console.log('🎵 Starting new audio playback at time:', playTime);
|
||||
}
|
||||
const source = audioContext.createBufferSource()
|
||||
source.buffer = audioBuffer
|
||||
source.connect(audioContext.destination)
|
||||
source.start(playTime)
|
||||
sourceNodes.push(source)
|
||||
playTime += audioBuffer.duration
|
||||
isSpeaking.value = true
|
||||
console.log('🎵 Audio scheduled, new playTime:', playTime);
|
||||
|
||||
// 添加音频播放结束监听
|
||||
source.onended = () => {
|
||||
console.log('🎵 Audio buffer finished playing');
|
||||
}
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
stop()
|
||||
})
|
||||
|
||||
// 页面刷新/关闭时
|
||||
onMounted(() => {
|
||||
if (typeof window !== 'undefined') {
|
||||
window.addEventListener('beforeunload', cancelAudio)
|
||||
}
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
cancelAudio()
|
||||
if (typeof window !== 'undefined') {
|
||||
window.removeEventListener('beforeunload', cancelAudio)
|
||||
}
|
||||
})
|
||||
|
||||
onHide(cancelAudio)
|
||||
onUnload(cancelAudio)
|
||||
|
||||
initWebSocket()
|
||||
|
||||
return {
|
||||
speak,
|
||||
pause,
|
||||
resume,
|
||||
cancelAudio,
|
||||
isSpeaking,
|
||||
isPaused,
|
||||
isComplete
|
||||
}
|
||||
}
|
||||
|
||||
function extractSpeechText(markdown) {
|
||||
console.log('🔍 extractSpeechText called');
|
||||
console.log('📝 Input markdown length:', markdown ? markdown.length : 0);
|
||||
console.log('📝 Input markdown preview:', markdown ? markdown.substring(0, 200) + '...' : 'No markdown');
|
||||
|
||||
const jobRegex = /``` job-json\s*({[\s\S]*?})\s*```/g;
|
||||
const jobs = [];
|
||||
let match;
|
||||
let lastJobEndIndex = 0;
|
||||
let firstJobStartIndex = -1;
|
||||
|
||||
// 提取岗位 json 数据及前后位置
|
||||
while ((match = jobRegex.exec(markdown)) !== null) {
|
||||
const jobStr = match[1];
|
||||
try {
|
||||
const job = JSON.parse(jobStr);
|
||||
jobs.push(job);
|
||||
if (firstJobStartIndex === -1) {
|
||||
firstJobStartIndex = match.index;
|
||||
}
|
||||
lastJobEndIndex = jobRegex.lastIndex;
|
||||
console.log('✅ Found job:', job.jobTitle);
|
||||
} catch (e) {
|
||||
console.warn('JSON 解析失败', e);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('📊 Jobs found:', jobs.length);
|
||||
console.log('📍 First job start index:', firstJobStartIndex);
|
||||
console.log('📍 Last job end index:', lastJobEndIndex);
|
||||
|
||||
// 提取引导语(第一个 job-json 之前的文字)
|
||||
const guideText = firstJobStartIndex > 0 ?
|
||||
markdown.slice(0, firstJobStartIndex).trim() :
|
||||
'';
|
||||
|
||||
// 提取结束语(最后一个 job-json 之后的文字)
|
||||
const endingText = lastJobEndIndex < markdown.length ?
|
||||
markdown.slice(lastJobEndIndex).trim() :
|
||||
'';
|
||||
|
||||
console.log('📝 Guide text:', guideText);
|
||||
console.log('📝 Ending text:', endingText);
|
||||
|
||||
// 岗位信息格式化为语音文本
|
||||
const jobTexts = jobs.map((job, index) => {
|
||||
return `第 ${index + 1} 个岗位,岗位名称是:${job.jobTitle},公司是:${job.companyName},薪资:${job.salary},地点:${job.location},学历要求:${job.education},经验要求:${job.experience}。`;
|
||||
});
|
||||
|
||||
// 拼接总语音内容
|
||||
const finalTextParts = [];
|
||||
if (guideText) finalTextParts.push(guideText);
|
||||
finalTextParts.push(...jobTexts);
|
||||
if (endingText) finalTextParts.push(endingText);
|
||||
|
||||
const finalText = finalTextParts.join('\n');
|
||||
console.log('🎤 Final TTS text length:', finalText.length);
|
||||
console.log('🎤 Final TTS text preview:', finalText.substring(0, 200) + '...');
|
||||
console.log('🎤 Final TTS text parts count:', finalTextParts.length);
|
||||
|
||||
return finalText;
|
||||
}
|
||||
@@ -17,7 +17,6 @@
|
||||
})();
|
||||
</script>
|
||||
<title></title>
|
||||
<link rel="icon" type="image/png" href="./static/logo2-S.png">
|
||||
<!-- vconsole -->
|
||||
<!-- <script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
|
||||
<script>
|
||||
@@ -29,4 +28,4 @@
|
||||
<div id="app"><!--app-html--></div>
|
||||
<script type="module" src="/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
31
main.js
31
main.js
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* @Date: 2025-11-03 10:52:09
|
||||
* @Date: 2025-10-23 14:48:48
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-11-04 11:14:21
|
||||
* @LastEditTime: 2025-10-23 15:02:07
|
||||
*/
|
||||
import App from '@/App'
|
||||
import * as Pinia from 'pinia'
|
||||
@@ -14,10 +14,10 @@ import AppLayout from './components/AppLayout/AppLayout.vue';
|
||||
import Empty from './components/empty/empty.vue';
|
||||
import NoBouncePage from '@/components/NoBouncePage/NoBouncePage.vue'
|
||||
import MsgTips from '@/components/MsgTips/MsgTips.vue'
|
||||
import SelectPopup from '@/components/selectPopup/selectPopup.vue'
|
||||
import SelectPopupPlugin from '@/components/selectPopup/selectPopupPlugin';
|
||||
import storeRc from './utilsRc/store/index.js'
|
||||
import {processFileUrl,} from '@/utilsRc/common.js'
|
||||
// iconfont.css 已在 App.vue 中通过 @import 引入,无需在此处重复引入
|
||||
import RenderJobs from '@/components/renderJobs/renderJobs.vue';
|
||||
import RenderCompanys from '@/components/renderCompanys/renderCompanys.vue';
|
||||
// import Tabbar from '@/components/tabbar/midell-box.vue'
|
||||
// 自动导入 directives 目录下所有指令
|
||||
const directives = import.meta.glob('./directives/*.js', {
|
||||
@@ -31,7 +31,6 @@ import {
|
||||
// const foldFeature = window.visualViewport && 'segments' in window.visualViewport
|
||||
// console.log('是否支持多段屏幕:', foldFeature)
|
||||
|
||||
import { getDict } from '@/apiRc/system/dict.js';
|
||||
// 全局组件
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
@@ -40,19 +39,9 @@ export function createApp() {
|
||||
app.component('Empty', Empty)
|
||||
app.component('NoBouncePage', NoBouncePage)
|
||||
app.component('MsgTips', MsgTips)
|
||||
|
||||
|
||||
app.config.globalProperties.$processFileUrl = processFileUrl;
|
||||
app.config.globalProperties.$getDict = getDict;
|
||||
app.config.globalProperties.$store = storeRc;
|
||||
app.config.globalProperties.$getDictSelectOption = async (dictType, isDigital = false, forceRefresh = false) => {
|
||||
const dictData = await getDict(dictType, forceRefresh);
|
||||
return dictData.map(item => ({
|
||||
value: isDigital ? Number(item.dictValue || item.dictvalue) : (item.dictValue || item.dictvalue),
|
||||
label: item.dictLabel || item.dictlabel,
|
||||
...item
|
||||
}));
|
||||
};
|
||||
app.component('SelectPopup', SelectPopup)
|
||||
app.component('RenderJobs', RenderJobs)
|
||||
app.component('RenderCompanys', RenderCompanys)
|
||||
// app.component('tabbar-custom', Tabbar)
|
||||
|
||||
for (const path in directives) {
|
||||
@@ -71,11 +60,9 @@ export function createApp() {
|
||||
|
||||
app.use(SelectPopupPlugin);
|
||||
app.use(Pinia.createPinia());
|
||||
// 注册vuex
|
||||
app.use(storeRc);
|
||||
|
||||
return {
|
||||
app,
|
||||
Pinia
|
||||
}
|
||||
}
|
||||
}
|
||||
209
manifest.json
209
manifest.json
@@ -1,107 +1,102 @@
|
||||
{
|
||||
"name" : "qingdao-employment-service",
|
||||
"appid" : "__UNI__F0ABFDF",
|
||||
"description" : "招聘",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "100",
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
"usingComponents" : true,
|
||||
"nvueStyleCompiler" : "uni-app",
|
||||
"compilerVersion" : 3,
|
||||
"splashscreen" : {
|
||||
"alwaysShowBeforeRender" : true,
|
||||
"waiting" : true,
|
||||
"autoclose" : true,
|
||||
"delay" : 0
|
||||
},
|
||||
/* 模块配置 */
|
||||
"modules" : {},
|
||||
/* 应用发布信息 */
|
||||
"distribute" : {
|
||||
/* android打包配置 */
|
||||
"android" : {
|
||||
"permissions" : [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
]
|
||||
},
|
||||
/* ios打包配置 */
|
||||
"ios" : {},
|
||||
/* SDK配置 */
|
||||
"sdkConfigs" : {}
|
||||
}
|
||||
},
|
||||
/* 快应用特有相关 */
|
||||
"quickapp" : {},
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin" : {
|
||||
"appid" : "wx4aa34488b965a331",
|
||||
"setting" : {
|
||||
"urlCheck" : false,
|
||||
"es6" : true,
|
||||
"postcss" : true,
|
||||
"minified" : true
|
||||
},
|
||||
"usingComponents" : true,
|
||||
"permission" : {
|
||||
"scope.userLocation" : {
|
||||
"desc" : "用于用户选择地图查看位置"
|
||||
}
|
||||
},
|
||||
"lazyCodeLoading" : "requiredComponents",
|
||||
"libVersion" : "3.5.7",
|
||||
"optimization" : {
|
||||
"subPackages" : true
|
||||
}
|
||||
},
|
||||
"mp-alipay" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-baidu" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-toutiao" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"uniStatistics" : {
|
||||
"enable" : false
|
||||
},
|
||||
"vueVersion" : "3",
|
||||
"locale" : "zh-Hans",
|
||||
"h5" : {
|
||||
"router" : {
|
||||
"base" : "/ks_app/",
|
||||
"mode" : "hash"
|
||||
},
|
||||
"title" : "青岛智慧就业服务",
|
||||
"optimization" : {
|
||||
"treeShaking" : {
|
||||
"enable" : true
|
||||
}
|
||||
},
|
||||
"sdkConfigs" : {
|
||||
"maps" : {
|
||||
"amap" : {
|
||||
"key" : "9cfc9370bd8a941951da1cea0308e9e3",
|
||||
"securityJsCode" : "7b16386c7f744c3ca05595965f2b037f",
|
||||
"serviceHost" : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
"name": "qingdao-employment-service",
|
||||
"appid": "__UNI__C939371",
|
||||
"description": "招聘",
|
||||
"versionName": "1.0.0",
|
||||
"versionCode": "100",
|
||||
"transformPx": false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus": {
|
||||
"usingComponents": true,
|
||||
"nvueStyleCompiler": "uni-app",
|
||||
"compilerVersion": 3,
|
||||
"splashscreen": {
|
||||
"alwaysShowBeforeRender": true,
|
||||
"waiting": true,
|
||||
"autoclose": true,
|
||||
"delay": 0
|
||||
},
|
||||
/* 模块配置 */
|
||||
"modules": {},
|
||||
/* 应用发布信息 */
|
||||
"distribute": {
|
||||
/* android打包配置 */
|
||||
"android": {
|
||||
"permissions": [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
]
|
||||
},
|
||||
/* ios打包配置 */
|
||||
"ios": {},
|
||||
/* SDK配置 */
|
||||
"sdkConfigs": {}
|
||||
}
|
||||
},
|
||||
/* 快应用特有相关 */
|
||||
"quickapp": {},
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin": {
|
||||
"appid": "",
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
"es6": true,
|
||||
"postcss": true,
|
||||
"minified": true
|
||||
},
|
||||
"usingComponents": true,
|
||||
"permission": {
|
||||
"scope.userLocation": {
|
||||
"desc": "用于用户选择地图查看位置"
|
||||
}
|
||||
}
|
||||
},
|
||||
"mp-alipay": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-baidu": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-toutiao": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"uniStatistics": {
|
||||
"enable": false
|
||||
},
|
||||
"vueVersion": "3",
|
||||
"locale": "zh-Hans",
|
||||
"h5": {
|
||||
"router": {
|
||||
"base": "/ks_app/",
|
||||
"mode": "hash"
|
||||
},
|
||||
"title": "青岛智慧就业服务",
|
||||
"optimization": {
|
||||
"treeShaking": {
|
||||
"enable": true
|
||||
}
|
||||
},
|
||||
"sdkConfigs": {
|
||||
"maps": {
|
||||
"amap": {
|
||||
"key": "9cfc9370bd8a941951da1cea0308e9e3",
|
||||
"securityJsCode": "7b16386c7f744c3ca05595965f2b037f",
|
||||
"serviceHost": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
37
package-lock.json
generated
37
package-lock.json
generated
@@ -1,37 +0,0 @@
|
||||
{
|
||||
"name": "ks-app-employment-service",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"@dcloudio/uni-ui": "^1.5.11",
|
||||
"dayjs": "^1.11.19",
|
||||
"sm-crypto": "^0.3.13"
|
||||
}
|
||||
},
|
||||
"node_modules/@dcloudio/uni-ui": {
|
||||
"version": "1.5.11",
|
||||
"resolved": "https://registry.npmjs.org/@dcloudio/uni-ui/-/uni-ui-1.5.11.tgz",
|
||||
"integrity": "sha512-DBtk046ofmeFd82zRI7d89SoEwrAxYzUN3WVPm1DIBkpLPG5F5QDNkHMnZGu2wNrMEmGBjBpUh3vqEY1L3jaMw=="
|
||||
},
|
||||
"node_modules/dayjs": {
|
||||
"version": "1.11.19",
|
||||
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.19.tgz",
|
||||
"integrity": "sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw=="
|
||||
},
|
||||
"node_modules/jsbn": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz",
|
||||
"integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A=="
|
||||
},
|
||||
"node_modules/sm-crypto": {
|
||||
"version": "0.3.13",
|
||||
"resolved": "https://registry.npmmirror.com/sm-crypto/-/sm-crypto-0.3.13.tgz",
|
||||
"integrity": "sha512-ztNF+pZq6viCPMA1A6KKu3bgpkmYti5avykRHbcFIdSipFdkVmfUw2CnpM2kBJyppIalqvczLNM3wR8OQ0pT5w==",
|
||||
"dependencies": {
|
||||
"jsbn": "^1.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@dcloudio/uni-ui": "^1.5.11",
|
||||
"dayjs": "^1.11.19",
|
||||
"sm-crypto": "^0.3.13"
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ const pageState = reactive({
|
||||
onLoad(() => {
|
||||
console.log('onLoad');
|
||||
// $api.sleep(2000).then(() => {
|
||||
// navTo('/pages/complete-info/complete-info');
|
||||
// navTo('/pages/login/login');
|
||||
// });
|
||||
getJobList();
|
||||
});
|
||||
@@ -42,7 +42,7 @@ onReachBottom(() => {
|
||||
});
|
||||
|
||||
function navToPost(jobId) {
|
||||
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(jobId)}`);
|
||||
navTo(`/packageA/pages/post/post?jobId=${btoa(jobId)}`);
|
||||
}
|
||||
|
||||
function getJobList(type = 'add') {
|
||||
|
||||
@@ -1,686 +1,320 @@
|
||||
<template>
|
||||
<AppLayout title="" :use-scroll-view="false">
|
||||
<template #headerleft>
|
||||
<view class="btnback">
|
||||
<image src="@/static/icon/back.png" @click="navBack"></image>
|
||||
</view>
|
||||
</template>
|
||||
<template #headerright>
|
||||
<view class="btn mar_ri10">
|
||||
<image src="@/static/icon/collect3.png" v-if="!companyInfo?.isCollection"></image>
|
||||
<image src="@/static/icon/collect2.png" v-else></image>
|
||||
</view>
|
||||
</template>
|
||||
<view class="content">
|
||||
<view class="content-top">
|
||||
<view class="companyinfo-left">
|
||||
<image src="@/static/icon/companyIcon.png" mode=""></image>
|
||||
</view>
|
||||
<view class="companyinfo-right">
|
||||
<view class="row1">{{ companyInfo?.name || '未知公司' }}</view>
|
||||
<view class="row2">
|
||||
{{ getScaleLabel(companyInfo?.scale) }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="conetent-info" :class="{ expanded: isExpanded }">
|
||||
<view class="info-title">公司介绍</view>
|
||||
<view class="info-desirption" v-html="companyInfo?.description"></view>
|
||||
<!-- <view class="info-title title2">公司地址</view>
|
||||
<AppLayout title="" :use-scroll-view="false">
|
||||
<template #headerleft>
|
||||
<view class="btnback">
|
||||
<image src="@/static/icon/back.png" @click="navBack"></image>
|
||||
</view>
|
||||
</template>
|
||||
<template #headerright>
|
||||
<view class="btn mar_ri10">
|
||||
<image
|
||||
src="@/static/icon/collect3.png"
|
||||
v-if="!companyInfo.isCollection"
|
||||
@click="companyCollection"
|
||||
></image>
|
||||
<image src="@/static/icon/collect2.png" v-else @click="companyCollection"></image>
|
||||
</view>
|
||||
</template>
|
||||
<view class="content">
|
||||
<view class="content-top">
|
||||
<view class="companyinfo-left">
|
||||
<image src="@/static/icon/companyIcon.png" mode=""></image>
|
||||
</view>
|
||||
<view class="companyinfo-right">
|
||||
<view class="row1">{{ companyInfo?.name }}</view>
|
||||
<view class="row2">
|
||||
<dict-tree-Label
|
||||
v-if="companyInfo?.industry"
|
||||
dictType="industry"
|
||||
:value="companyInfo?.industry"
|
||||
></dict-tree-Label>
|
||||
<span v-if="companyInfo?.industry"> </span>
|
||||
<dict-Label dictType="scale" :value="companyInfo?.scale"></dict-Label>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="conetent-info" :class="{ expanded: isExpanded }">
|
||||
<view class="info-title">公司介绍</view>
|
||||
<view class="info-desirption">{{ companyInfo.description }}</view>
|
||||
<!-- <view class="info-title title2">公司地址</view>
|
||||
<view class="locationCompany"></view> -->
|
||||
</view>
|
||||
<view class="expand" @click="expand">
|
||||
<text>{{ isExpanded ? "收起" : "展开" }}</text>
|
||||
<image class="expand-img" :class="{ 'expand-img-active': !isExpanded }" src="@/static/icon/downs.png">
|
||||
</image>
|
||||
</view>
|
||||
<scroll-view scroll-y class="Detailscroll-view">
|
||||
<view class="views">
|
||||
<view class="Detail-title"><text class="title">在招职位</text></view>
|
||||
<template v-if="jobInfoList && jobInfoList.length != 0">
|
||||
<view v-for="job in jobInfoList" :key="job.jobId">
|
||||
<view class="cards" @click="navToJobDetail(job.jobId)">
|
||||
<view class="card-company">
|
||||
<text class="company">{{ job.jobTitle }}</text>
|
||||
<view class="salary"> ¥{{ job.minSalary }}-{{ job.maxSalary }}/月 </view>
|
||||
</view>
|
||||
<view class="card-tags">
|
||||
<view class="tag jy">
|
||||
{{ getExperienceLabel(job.experience) }}
|
||||
</view>
|
||||
<view class="tag xl">
|
||||
{{ getEducationLabel(job.education) }}
|
||||
</view>
|
||||
<view class="tag yd" v-if="job.vacancies">
|
||||
招聘{{ job.vacancies }}人
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-info">
|
||||
<view class="company-address" v-if="job.jobLocation">
|
||||
<image class="point3" src="/static/icon/point3.png"></image>
|
||||
{{ job.jobLocation }}
|
||||
</view>
|
||||
<view class="push-time" v-if="job.postingDate">
|
||||
{{ formatPublishTime(job.postingDate) }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<empty v-else pdTop="200"></empty>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</AppLayout>
|
||||
</view>
|
||||
<view class="expand" @click="expand">
|
||||
<text>{{ isExpanded ? '收起' : '展开' }}</text>
|
||||
<image
|
||||
class="expand-img"
|
||||
:class="{ 'expand-img-active': !isExpanded }"
|
||||
src="@/static/icon/downs.png"
|
||||
></image>
|
||||
</view>
|
||||
<scroll-view scroll-y class="Detailscroll-view" @scrolltolower="getJobsList('add')">
|
||||
<view class="views">
|
||||
<view class="Detail-title"><text class="title">在招职位</text></view>
|
||||
<renderJobs
|
||||
v-if="pageState.list.length"
|
||||
:list="pageState.list"
|
||||
:longitude="longitudeVal"
|
||||
:latitude="latitudeVal"
|
||||
></renderJobs>
|
||||
<empty v-else pdTop="200"></empty>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
inject,
|
||||
watch,
|
||||
ref,
|
||||
onMounted,
|
||||
computed
|
||||
} from "vue";
|
||||
import {
|
||||
onLoad,
|
||||
onShow
|
||||
} from "@dcloudio/uni-app";
|
||||
import dictLabel from "@/components/dict-Label/dict-Label.vue";
|
||||
import config from "@/config.js";
|
||||
import { storeToRefs } from "pinia";
|
||||
import useDictStore from '@/stores/useDictStore';
|
||||
const dictStore = useDictStore();
|
||||
import useLocationStore from "@/stores/useLocationStore";
|
||||
const {
|
||||
longitudeVal,
|
||||
latitudeVal
|
||||
} = storeToRefs(useLocationStore());
|
||||
const {
|
||||
$api,
|
||||
navTo,
|
||||
vacanciesTo,
|
||||
navBack
|
||||
} = inject("globalFunction");
|
||||
const isExpanded = ref(false);
|
||||
const pageState = reactive({
|
||||
page: 0,
|
||||
list: [],
|
||||
total: 0,
|
||||
maxPage: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
const companyInfo = ref({
|
||||
jobList: [],
|
||||
});
|
||||
const jobInfoList = ref([]);
|
||||
const baseUrl = config.imgBaseUrl;
|
||||
const getItemBackgroundStyle = (imageName) => ({
|
||||
backgroundImage: `url(${baseUrl}/jobfair/${imageName})`,
|
||||
backgroundSize: "100% 100%", // 覆盖整个容器
|
||||
backgroundPosition: "center", // 居中
|
||||
backgroundRepeat: "no-repeat",
|
||||
});
|
||||
import point from '@/static/icon/point.png';
|
||||
import { reactive, inject, watch, ref, onMounted, computed } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import dictLabel from '@/components/dict-Label/dict-Label.vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import useLocationStore from '@/stores/useLocationStore';
|
||||
const { longitudeVal, latitudeVal } = storeToRefs(useLocationStore());
|
||||
const { $api, navTo, vacanciesTo, navBack } = inject('globalFunction');
|
||||
|
||||
// 已移除重复的onLoad函数,保留下面的async版本
|
||||
|
||||
// 根据公司ID获取公司详情
|
||||
function getCompanyDetailsById(companyId) {
|
||||
// 使用全局注入的$api调用接口
|
||||
$api.createRequest('/app/company/' + companyId).then((resData) => {
|
||||
if (resData && resData.code === 200 && resData.data) {
|
||||
console.log('Company details:', resData.data);
|
||||
// 确保数据格式符合页面需求,并为关键字段提供默认值
|
||||
companyInfo.value = {
|
||||
...resData.data,
|
||||
name: resData.data.name || '未知公司',
|
||||
scale: resData.data.scale || '未知规模',
|
||||
description: resData.data.description || '暂无公司介绍',
|
||||
isCollection: resData.data.isCollection || 0,
|
||||
jobList: resData.data.jobList || [] // 使用正确的jobList字段
|
||||
};
|
||||
// 将职位列表数据赋值给jobInfoList,用于页面渲染
|
||||
jobInfoList.value = resData.data.jobList || [];
|
||||
console.log('Company details loaded successfully');
|
||||
} else {
|
||||
console.error('Failed to load company details:', resData?.msg || 'Unknown error');
|
||||
// 设置默认值,避免页面白屏
|
||||
companyInfo.value = {
|
||||
name: '加载失败',
|
||||
scale: '-',
|
||||
description: '无法获取公司信息,请稍后重试',
|
||||
isCollection: 0,
|
||||
jobList: []
|
||||
};
|
||||
jobInfoList.value = [];
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.error('API error when fetching company details:', error);
|
||||
// 错误情况下也设置默认值
|
||||
companyInfo.value = {
|
||||
name: '请求失败',
|
||||
scale: '-',
|
||||
description: '网络请求失败,请检查网络连接',
|
||||
isCollection: 0,
|
||||
jobList: []
|
||||
};
|
||||
jobInfoList.value = [];
|
||||
});
|
||||
}
|
||||
const isExpanded = ref(false);
|
||||
const pageState = reactive({
|
||||
page: 0,
|
||||
list: [],
|
||||
total: 0,
|
||||
maxPage: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
const companyInfo = ref({});
|
||||
|
||||
function expand() {
|
||||
isExpanded.value = !isExpanded.value;
|
||||
}
|
||||
onLoad((options) => {
|
||||
console.log(options);
|
||||
getCompanyInfo(options.companyId || options.bussinessId);
|
||||
});
|
||||
|
||||
function deliverResume(job) {
|
||||
const raw = uni.getStorageSync("Padmin-Token");
|
||||
const token = typeof raw === "string" ? raw.trim() : "";
|
||||
const headers = token ? {
|
||||
Authorization: raw.startsWith("Bearer ") ? raw : `Bearer ${token}`
|
||||
} : {};
|
||||
function companyCollection() {
|
||||
const companyId = companyInfo.value.companyId;
|
||||
if (companyInfo.value.isCollection) {
|
||||
$api.createRequest(`/app/company/collection/${companyId}`, {}, 'DELETE').then((resData) => {
|
||||
getCompanyInfo(companyId);
|
||||
$api.msg('取消收藏成功');
|
||||
});
|
||||
} else {
|
||||
$api.createRequest(`/app/company/collection/${companyId}`, {}, 'POST').then((resData) => {
|
||||
getCompanyInfo(companyId);
|
||||
$api.msg('收藏成功');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$api.myRequest("/dashboard/auth/heart", {}, "POST", 10100, headers).then((resData1) => {
|
||||
if (resData1.code == 200) {
|
||||
$api.myRequest("/system/user/login/user/info", {}, "GET", 10100, headers).then((resData) => {
|
||||
$api.myRequest("/jobfair/public/job-fair-person-job/insert", {
|
||||
jobFairId: companyInfo.value?.jobFairId, // 招聘会id
|
||||
personId: resData.info.userId, // 当前登录用户id
|
||||
enterpriseId: companyInfo.value?.companyId, // 企业id
|
||||
jobId: job.jobId, // 岗位id
|
||||
idCard:resData.info.personCardNo
|
||||
}, "post", 9100, {
|
||||
"Content-Type": "application/json"
|
||||
}).then((data) => {
|
||||
if (data && data.code === 200) {
|
||||
$api.msg("简历投递成功");
|
||||
} else {
|
||||
$api.msg((data && data.msg) || "简历投递失败");
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
$api.msg('请先登录')
|
||||
}
|
||||
});
|
||||
function getCompanyInfo(id) {
|
||||
$api.createRequest(`/app/company/${id}`).then((resData) => {
|
||||
companyInfo.value = resData.data;
|
||||
getJobsList();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 获取企业规模字典数据
|
||||
onLoad(async (options) => {
|
||||
// 初始化companyInfo
|
||||
companyInfo.value = { jobList: [] };
|
||||
// 加载字典数据
|
||||
await dictStore.getDictData();
|
||||
|
||||
if (options.job && typeof options.job === 'string') {
|
||||
try {
|
||||
const job=JSON.parse(options.job)
|
||||
if(job.jobInfoList.length > 0){
|
||||
jobInfoList.value = job.jobInfoList
|
||||
}
|
||||
companyInfo.value = JSON.parse(options.job);
|
||||
} catch (error) {
|
||||
console.error('Error parsing job data:', error);
|
||||
companyInfo.value = { jobList: [] };
|
||||
}
|
||||
// 处理companyId参数
|
||||
} else if (options.companyId) {
|
||||
console.log('Getting company details by companyId:', options.companyId);
|
||||
// 调用API获取公司详情
|
||||
getCompanyDetailsById(options.companyId);
|
||||
// 处理bussinessId参数(如果需要)
|
||||
} else if (options.bussinessId) {
|
||||
console.log('Handling bussinessId:', options.bussinessId);
|
||||
// 这里可以根据需要处理bussinessId
|
||||
// 目前先作为companyId处理
|
||||
getCompanyDetailsById(options.bussinessId);
|
||||
} else {
|
||||
console.warn('No valid parameters provided');
|
||||
companyInfo.value = { jobList: [] };
|
||||
}
|
||||
});
|
||||
|
||||
// 根据scale值获取对应的文本
|
||||
function getScaleLabel(scale) {
|
||||
// 处理空值、undefined、null等情况
|
||||
if (scale === undefined || scale === null || scale === '') return '-';
|
||||
|
||||
try {
|
||||
// 调试日志,追踪scale值处理
|
||||
console.log('Processing scale value:', scale);
|
||||
// 确保scale是字符串类型
|
||||
const scaleStr = String(scale);
|
||||
// 使用dictStore获取企业规模标签
|
||||
const label = dictStore.dictLabel('scale', scaleStr);
|
||||
console.log('Retrieved scale label:', label, 'for scale:', scaleStr);
|
||||
// 如果字典中没有找到对应标签,使用预设的默认映射
|
||||
if (!label) {
|
||||
const defaultScaleMap = {
|
||||
'1': '少于50人',
|
||||
'2': '50-100人',
|
||||
'3': '100-500人',
|
||||
'4': '500-1000人',
|
||||
'5': '1000人以上'
|
||||
};
|
||||
const defaultLabel = defaultScaleMap[scaleStr];
|
||||
console.log('Using default label:', defaultLabel, 'for scale:', scaleStr);
|
||||
return defaultLabel || '-';
|
||||
}
|
||||
return label;
|
||||
} catch (error) {
|
||||
console.error('获取企业规模标签失败:', error);
|
||||
return '-';
|
||||
}
|
||||
}
|
||||
function getJobsList(type = 'add') {
|
||||
if (type === 'refresh') {
|
||||
pageState.page = 1;
|
||||
pageState.maxPage = 1;
|
||||
}
|
||||
if (type === 'add' && pageState.page < pageState.maxPage) {
|
||||
pageState.page += 1;
|
||||
}
|
||||
let params = {
|
||||
current: pageState.page,
|
||||
pageSize: pageState.pageSize,
|
||||
};
|
||||
$api.createRequest(`/app/company/job/${companyInfo.value.companyId}`, params).then((resData) => {
|
||||
const { rows, total } = resData;
|
||||
if (type === 'add') {
|
||||
const str = pageState.pageSize * (pageState.page - 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);
|
||||
});
|
||||
}
|
||||
|
||||
// 根据experience值获取对应的文本
|
||||
function getExperienceLabel(experience) {
|
||||
if (experience === undefined || experience === null || experience === '') return '经验不限';
|
||||
|
||||
try {
|
||||
const experienceStr = String(experience);
|
||||
const label = dictStore.dictLabel('experience', experienceStr);
|
||||
if (!label) {
|
||||
const defaultExperienceMap = {
|
||||
'0': '经验不限',
|
||||
'1': '1年以内',
|
||||
'2': '1-3年',
|
||||
'3': '3-5年',
|
||||
'4': '5-10年',
|
||||
'5': '10年以上'
|
||||
};
|
||||
return defaultExperienceMap[experienceStr] || '经验不限';
|
||||
}
|
||||
return label;
|
||||
} catch (error) {
|
||||
console.error('获取经验标签失败:', error);
|
||||
return '经验不限';
|
||||
}
|
||||
}
|
||||
|
||||
// 根据education值获取对应的文本
|
||||
function getEducationLabel(education) {
|
||||
if (education === undefined || education === null || education === '') return '学历不限';
|
||||
|
||||
try {
|
||||
const educationStr = String(education);
|
||||
const label = dictStore.dictLabel('education', educationStr);
|
||||
if (!label) {
|
||||
const defaultEducationMap = {
|
||||
'-1': '学历不限',
|
||||
'1': '初中及以下',
|
||||
'2': '高中',
|
||||
'3': '中专',
|
||||
'4': '大专',
|
||||
'5': '本科',
|
||||
'6': '硕士',
|
||||
'7': '博士'
|
||||
};
|
||||
return defaultEducationMap[educationStr] || '学历不限';
|
||||
}
|
||||
return label;
|
||||
} catch (error) {
|
||||
console.error('获取学历标签失败:', error);
|
||||
return '学历不限';
|
||||
}
|
||||
}
|
||||
|
||||
// 格式化发布时间为相对时间
|
||||
function formatPublishTime(publishTime) {
|
||||
if (!publishTime) return '';
|
||||
|
||||
try {
|
||||
const date = new Date(publishTime);
|
||||
const now = new Date();
|
||||
const diffTime = Math.abs(now - date);
|
||||
const diffSeconds = Math.floor(diffTime / 1000);
|
||||
const diffMinutes = Math.floor(diffSeconds / 60);
|
||||
const diffHours = Math.floor(diffMinutes / 60);
|
||||
const diffDays = Math.floor(diffHours / 24);
|
||||
const diffWeeks = Math.floor(diffDays / 7);
|
||||
const diffMonths = Math.floor(diffDays / 30);
|
||||
const diffYears = Math.floor(diffDays / 365);
|
||||
|
||||
if (diffSeconds < 60) {
|
||||
return '刚刚发布';
|
||||
} else if (diffMinutes < 60) {
|
||||
return `${diffMinutes}分钟前`;
|
||||
} else if (diffHours < 24) {
|
||||
return `${diffHours}小时前`;
|
||||
} else if (diffDays === 1) {
|
||||
return '昨天发布';
|
||||
} else if (diffDays < 7) {
|
||||
return `${diffDays}天前`;
|
||||
} else if (diffWeeks < 4) {
|
||||
return `${diffWeeks}周前`;
|
||||
} else if (diffMonths < 12) {
|
||||
return `${diffMonths}个月前`;
|
||||
} else {
|
||||
return `${diffYears}年前`;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('格式化发布时间失败:', error);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
// 跳转到职位详情页面
|
||||
function navToJobDetail(jobId) {
|
||||
return
|
||||
if (jobId) {
|
||||
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(jobId)}`);
|
||||
}
|
||||
}
|
||||
function expand() {
|
||||
isExpanded.value = !isExpanded.value;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.btnback {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
.btnback{
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
.btn {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 52rpx;
|
||||
height: 52rpx;
|
||||
}
|
||||
image {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.content{
|
||||
height: 100%
|
||||
display: flex;
|
||||
flex-direction: column
|
||||
.content-top{
|
||||
padding: 28rpx
|
||||
padding-top: 50rpx
|
||||
display: flex
|
||||
flex-direction: row
|
||||
flex-wrap: nowrap
|
||||
.companyinfo-left{
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
margin-right: 24rpx
|
||||
}
|
||||
.companyinfo-right{
|
||||
|
||||
.btn {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 52rpx;
|
||||
height: 52rpx;
|
||||
}
|
||||
|
||||
image {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.content {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.content-top {
|
||||
padding: 28rpx;
|
||||
padding-top: 50rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
|
||||
.companyinfo-left {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
|
||||
.companyinfo-right {
|
||||
.row1 {
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.row2 {
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #6C7282;
|
||||
line-height: 45rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.conetent-info {
|
||||
padding: 0 28rpx;
|
||||
overflow: hidden;
|
||||
max-height: 0rpx;
|
||||
transition: max-height 0.3s ease;
|
||||
|
||||
.info-title {
|
||||
font-weight: 600;
|
||||
font-size: 28rpx;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.info-desirption {
|
||||
margin-top: 12rpx;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #495265;
|
||||
text-align: justified;
|
||||
:deep(span) {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
:deep(p > span) {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
}
|
||||
.title2 {
|
||||
margin-top: 48rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.expanded {
|
||||
max-height: 1000rpx; // 足够显示完整内容
|
||||
}
|
||||
|
||||
.expand {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
white-space: nowrap;
|
||||
justify-content: center;
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: 28rpx;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #256BFA;
|
||||
|
||||
.expand-img {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.expand-img-active {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.Detailscroll-view {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
background: #F4F4F4;
|
||||
|
||||
.views {
|
||||
padding: 28rpx;
|
||||
|
||||
.Detail-title {
|
||||
font-weight: 600;
|
||||
font-size: 32rpx;
|
||||
color: #000000;
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.title {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
|
||||
.Detail-title::before {
|
||||
position: absolute;
|
||||
content: '';
|
||||
left: -14rpx;
|
||||
bottom: 0;
|
||||
height: 16rpx;
|
||||
width: 108rpx;
|
||||
background: linear-gradient(to right, #CBDEFF, #FFFFFF);
|
||||
border-radius: 8rpx;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.cards {
|
||||
padding: 32rpx;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.04);
|
||||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||||
margin-top: 22rpx;
|
||||
padding-bottom: 18rpx;
|
||||
background: #FFFFFF;
|
||||
|
||||
.card-company {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
|
||||
.company {
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.salary {
|
||||
// font-weight: 600;
|
||||
font-size: 28rpx;
|
||||
color: #1677FF;
|
||||
white-space: nowrap;
|
||||
line-height: 48rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.deliver-box {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
margin-top: 5rpx;
|
||||
|
||||
.deliver-btn {
|
||||
padding: 10rpx 25rpx;
|
||||
background: #53ACFF;
|
||||
width: max-content;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.card-companyName {
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
margin-top: 23rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
image {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.card-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin: 25rpx 0 20rpx;
|
||||
|
||||
image {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.jy {
|
||||
background: #F5F5F5;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.xl {
|
||||
background: #F5F5F5;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.yd {
|
||||
background: #F5F5F5;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.tag {
|
||||
width: fit-content;
|
||||
height: 30rpx;
|
||||
border-radius: 4rpx;
|
||||
padding: 6rpx 20rpx;
|
||||
line-height: 30rpx;
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
margin-right: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.card-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20rpx;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.point3 {
|
||||
width: 12rpx;
|
||||
height: 12rpx;
|
||||
}
|
||||
|
||||
.company-address {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #6C7282;
|
||||
line-height: 34rpx;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin-right: 20rpx;
|
||||
|
||||
image {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
margin-right: 8rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
text {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.push-time {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #6C7282;
|
||||
line-height: 34rpx;
|
||||
flex-shrink: 0;
|
||||
white-space: nowrap;
|
||||
|
||||
image {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
margin-right: 8rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card-bottom {
|
||||
margin-top: 32rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 28rpx;
|
||||
color: #6C7282;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.row1{
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.row2{
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #6C7282;
|
||||
line-height: 45rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.conetent-info{
|
||||
padding: 0 28rpx
|
||||
overflow: hidden;
|
||||
max-height: 0rpx;
|
||||
transition: max-height 0.3s ease;
|
||||
.info-title{
|
||||
font-weight: 600;
|
||||
font-size: 28rpx;
|
||||
color: #000000;
|
||||
}
|
||||
.info-desirption{
|
||||
margin-top: 12rpx
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #495265;
|
||||
text-align: justified;
|
||||
}
|
||||
.title2{
|
||||
margin-top: 48rpx
|
||||
}
|
||||
}
|
||||
.expanded {
|
||||
max-height: 1000rpx; // 足够显示完整内容
|
||||
}
|
||||
.expand{
|
||||
display: flex
|
||||
flex-wrap: nowrap
|
||||
white-space: nowrap
|
||||
justify-content: center
|
||||
margin-top: 20rpx
|
||||
margin-bottom: 28rpx
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #256BFA;
|
||||
.expand-img{
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
.expand-img-active{
|
||||
transform: rotate(180deg)
|
||||
}
|
||||
}
|
||||
}
|
||||
.Detailscroll-view{
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
background: #F4F4F4;
|
||||
.views{
|
||||
padding: 28rpx
|
||||
.Detail-title{
|
||||
font-weight: 600;
|
||||
font-size: 32rpx;
|
||||
color: #000000;
|
||||
position: relative;
|
||||
display: flex
|
||||
justify-content: space-between
|
||||
.title{
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
.Detail-title::before{
|
||||
position: absolute
|
||||
content: '';
|
||||
left: -14rpx
|
||||
bottom: 0
|
||||
height: 16rpx;
|
||||
width: 108rpx;
|
||||
background: linear-gradient(to right, #CBDEFF, #FFFFFF);
|
||||
border-radius: 8rpx;
|
||||
z-index: 1;
|
||||
}
|
||||
.cards{
|
||||
padding: 32rpx;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0,0,0,0.04);
|
||||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||||
margin-top: 22rpx;
|
||||
.card-company{
|
||||
display: flex
|
||||
justify-content: space-between
|
||||
align-items: flex-start
|
||||
.company{
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.salary{
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
color: #4C6EFB;
|
||||
white-space: nowrap
|
||||
line-height: 48rpx
|
||||
}
|
||||
}
|
||||
.card-companyName{
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #6C7282;
|
||||
}
|
||||
.card-tags{
|
||||
display: flex
|
||||
flex-wrap: wrap
|
||||
.tag{
|
||||
width: fit-content;
|
||||
height: 30rpx;
|
||||
background: #F4F4F4;
|
||||
border-radius: 4rpx;
|
||||
padding: 6rpx 20rpx;
|
||||
line-height: 30rpx;
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #6C7282;
|
||||
text-align: center;
|
||||
margin-top: 14rpx;
|
||||
white-space: nowrap
|
||||
margin-right: 20rpx
|
||||
}
|
||||
}
|
||||
.card-bottom{
|
||||
margin-top: 32rpx
|
||||
display: flex
|
||||
justify-content: space-between
|
||||
font-size: 28rpx;
|
||||
color: #6C7282;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
<template>
|
||||
<view class="page-container">
|
||||
<AppLayout
|
||||
title="添加工作经历"
|
||||
border
|
||||
back-gorund-color="#ffffff"
|
||||
:show-bg-image="false"
|
||||
>
|
||||
<template #headerleft>
|
||||
<view class="btn mar_le20 button-click" @click="navBack">取消</view>
|
||||
</template>
|
||||
<template #headerright>
|
||||
<view class="btn mar_ri20 button-click" @click="handleConfirm">确认</view>
|
||||
</template>
|
||||
<view class="content">
|
||||
<view class="content-input">
|
||||
<view class="input-titile">公司名称</view>
|
||||
@@ -33,12 +44,8 @@
|
||||
<textarea class="textarea-con" v-model="formData.description" placeholder-style="font-size: 16px" maxlength="500" placeholder="请输入工作描述"/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部确认按钮 -->
|
||||
<view class="bottom-confirm-btn">
|
||||
<view class="confirm-btn" @click="handleConfirm">确认</view>
|
||||
</view>
|
||||
</view>
|
||||
</AppLayout>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -199,6 +206,7 @@
|
||||
console.log('页面类型:', pageType.value);
|
||||
|
||||
let resData;
|
||||
alert(editData.value.id)
|
||||
// 根据页面类型调用不同的接口
|
||||
if (pageType.value === 'edit' && editData.value?.id) {
|
||||
// 编辑模式:调用更新接口
|
||||
@@ -226,18 +234,12 @@
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.page-container {
|
||||
min-height: 100vh;
|
||||
background-color: #ffffff;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.content{
|
||||
padding: 28rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
padding-bottom: 120rpx;
|
||||
justify-content: flex-start
|
||||
height: calc(100% - 120rpx)
|
||||
}
|
||||
.content-input
|
||||
margin-bottom: 52rpx
|
||||
@@ -326,30 +328,6 @@
|
||||
line-height: 20rpx
|
||||
display: flex
|
||||
align-items: center
|
||||
|
||||
// 底部确认按钮样式
|
||||
.bottom-confirm-btn
|
||||
position: fixed
|
||||
bottom: 0
|
||||
left: 0
|
||||
right: 0
|
||||
background-color: #ffffff
|
||||
padding: 20rpx 28rpx
|
||||
border-top: 2rpx solid #EBEBEB
|
||||
z-index: 999
|
||||
|
||||
.confirm-btn
|
||||
width: 100%
|
||||
height: 90rpx
|
||||
background: #256BFA
|
||||
border-radius: 12rpx
|
||||
font-weight: 500
|
||||
font-size: 32rpx
|
||||
color: #FFFFFF
|
||||
text-align: center
|
||||
line-height: 90rpx
|
||||
button-click: true
|
||||
|
||||
// .content-sex
|
||||
// height: 110rpx;
|
||||
// display: flex
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<template>
|
||||
<AppLayout title="我的浏览" :show-bg-image="false" :use-scroll-view="false">
|
||||
<template #headerleft>
|
||||
<view class="btnback">
|
||||
<image src="@/static/icon/back.png" @click="navBack"></image>
|
||||
</view>
|
||||
</template>
|
||||
<view class="collection-content">
|
||||
<view class="collection-search">
|
||||
<view class="search-content">
|
||||
@@ -84,7 +89,7 @@ function toSelectDate() {
|
||||
}
|
||||
|
||||
function navToPost(jobId) {
|
||||
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(jobId)}`);
|
||||
navTo(`/packageA/pages/post/post?jobId=${btoa(jobId)}`);
|
||||
}
|
||||
|
||||
function searchCollection(e) {
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<template>
|
||||
<AppLayout title="我的收藏" :show-bg-image="false" :use-scroll-view="false">
|
||||
<template #headerleft>
|
||||
<view class="btn">
|
||||
<image src="@/static/icon/back.png" @click="navBack"></image>
|
||||
</view>
|
||||
</template>
|
||||
<view class="collection-content">
|
||||
<view class="header">
|
||||
<view class="button-click" :class="{ active: type === 0 }" @click="changeType(0)">工作职位</view>
|
||||
|
||||
@@ -2,83 +2,82 @@
|
||||
<view class="job-comparison-container">
|
||||
<scroll-view class="horizontal-scroll" scroll-x="true">
|
||||
<view class="comparison-table">
|
||||
<view class="table-row table-header">
|
||||
<view class="table-cell fixed-column"></view>
|
||||
<view v-for="(job, index) in jobs" :key="index" class="table-cell job-title-cell">
|
||||
<text>{{ job?.jobTitle || '' }}</text>
|
||||
<text class="company">{{ job?.company || '' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="table-row">
|
||||
<view class="table-cell fixed-column detail-label">
|
||||
<text>薪资</text>
|
||||
</view>
|
||||
<view v-for="(job, index) in jobs" :key="index" class="table-cell detail-content">
|
||||
<view>
|
||||
<Salary-Expectation
|
||||
v-if="job"
|
||||
:max-salary="job.maxSalary"
|
||||
:min-salary="job.minSalary"
|
||||
:is-month="true"
|
||||
></Salary-Expectation>
|
||||
<view class="table-row table-header">
|
||||
<view class="table-cell fixed-column"></view>
|
||||
<view v-for="(job, index) in jobs" :key="index" class="table-cell job-title-cell">
|
||||
<text>{{ job.jobTitle }}</text>
|
||||
<text class="company">{{ job.company }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="table-row">
|
||||
<view class="table-cell fixed-column detail-label">
|
||||
<text>公司名称</text>
|
||||
<view class="table-row">
|
||||
<view class="table-cell fixed-column detail-label">
|
||||
<text>薪资</text>
|
||||
</view>
|
||||
<view v-for="(job, index) in jobs" :key="index" class="table-cell detail-content">
|
||||
<view>
|
||||
<Salary-Expectation
|
||||
:max-salary="job.maxSalary"
|
||||
:min-salary="job.minSalary"
|
||||
:is-month="true"
|
||||
></Salary-Expectation>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-for="(job, index) in jobs" :key="index" class="table-cell detail-content">
|
||||
<view>{{ job?.companyName || '' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="table-row">
|
||||
<view class="table-cell fixed-column detail-label">
|
||||
<text>学历</text>
|
||||
<view class="table-row">
|
||||
<view class="table-cell fixed-column detail-label">
|
||||
<text>公司名称</text>
|
||||
</view>
|
||||
<view v-for="(job, index) in jobs" :key="index" class="table-cell detail-content">
|
||||
<view>{{ job.companyName }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-for="(job, index) in jobs" :key="index" class="table-cell detail-content">
|
||||
<view><dict-Label dictType="education" :value="job?.education"></dict-Label></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="table-row">
|
||||
<view class="table-cell fixed-column detail-label">
|
||||
<text>经验</text>
|
||||
<view class="table-row">
|
||||
<view class="table-cell fixed-column detail-label">
|
||||
<text>学历</text>
|
||||
</view>
|
||||
<view v-for="(job, index) in jobs" :key="index" class="table-cell detail-content">
|
||||
<view><dict-Label dictType="education" :value="job.education"></dict-Label></view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-for="(job, index) in jobs" :key="index" class="table-cell detail-content">
|
||||
<view><dict-Label dictType="experience" :value="job?.experience"></dict-Label></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="table-row">
|
||||
<view class="table-cell fixed-column detail-label">
|
||||
<text>工作地点</text>
|
||||
<view class="table-row">
|
||||
<view class="table-cell fixed-column detail-label">
|
||||
<text>经验</text>
|
||||
</view>
|
||||
<view v-for="(job, index) in jobs" :key="index" class="table-cell detail-content">
|
||||
<view><dict-Label dictType="experience" :value="job.experience"></dict-Label></view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-for="(job, index) in jobs" :key="index" class="table-cell detail-content">
|
||||
<view>{{ job?.jobLocation || '' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="table-row">
|
||||
<view class="table-cell fixed-column detail-label">
|
||||
<text>来源</text>
|
||||
<view class="table-row">
|
||||
<view class="table-cell fixed-column detail-label">
|
||||
<text>工作地点</text>
|
||||
</view>
|
||||
<view v-for="(job, index) in jobs" :key="index" class="table-cell detail-content">
|
||||
<view>{{ job.jobLocation }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-for="(job, index) in jobs" :key="index" class="table-cell detail-content">
|
||||
<view>{{ job?.dataSource || '' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="table-row">
|
||||
<view class="table-cell fixed-column detail-label">
|
||||
<text>职位描述</text>
|
||||
<view class="table-row">
|
||||
<view class="table-cell fixed-column detail-label">
|
||||
<text>来源</text>
|
||||
</view>
|
||||
<view v-for="(job, index) in jobs" :key="index" class="table-cell detail-content">
|
||||
<view>{{ job.dataSource }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-for="(job, index) in jobs" :key="index" class="table-cell detail-content">
|
||||
<view>{{ job?.description || '' }}</view>
|
||||
|
||||
<view class="table-row">
|
||||
<view class="table-cell fixed-column detail-label">
|
||||
<text>职位描述</text>
|
||||
</view>
|
||||
<view v-for="(job, index) in jobs" :key="index" class="table-cell detail-content">
|
||||
<view>{{ job.description }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="table-row">
|
||||
<view class="table-cell fixed-column detail-label">
|
||||
<text>工业</text>
|
||||
@@ -86,9 +85,9 @@
|
||||
<view v-for="(job, index) in jobs" :key="index" class="table-cell detail-content">
|
||||
<view>
|
||||
<dict-tree-Label
|
||||
v-if="job.company && job.company.industry"
|
||||
v-if="jobInfo.company && jobInfo.company.industry"
|
||||
dictType="industry"
|
||||
:value="job.company.industry"
|
||||
:value="jobInfo.company.industry"
|
||||
></dict-tree-Label>
|
||||
</view>
|
||||
</view>
|
||||
@@ -99,7 +98,7 @@
|
||||
</view>
|
||||
<view v-for="(job, index) in jobs" :key="index" class="table-cell detail-content">
|
||||
<view>
|
||||
<dict-Label dictType="scale" :value="job.company?.scale"></dict-Label>
|
||||
<dict-Label dictType="scale" :value="jobInfo.company?.scale"></dict-Label>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -109,7 +108,7 @@
|
||||
</view>
|
||||
<view v-for="(job, index) in jobs" :key="index" class="table-cell detail-content">
|
||||
<view>
|
||||
{{ job?.isHot ? '是' : '否' }}
|
||||
{{ job.isHot ? '是' : '否' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -126,7 +125,7 @@ const jobs = ref([]);
|
||||
|
||||
onLoad(() => {
|
||||
let compareData = uni.getStorageSync('compare');
|
||||
jobs.value = Array.isArray(compareData) ? compareData : [];
|
||||
jobs.value = compareData;
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,820 +0,0 @@
|
||||
<template>
|
||||
<AppLayout title="选择地址" :showBack="true">
|
||||
<view class="map-container">
|
||||
<!-- 搜索框 -->
|
||||
<view class="search-box">
|
||||
<view class="search-input-wrapper">
|
||||
<uni-icons type="search" size="20" color="#999"></uni-icons>
|
||||
<input
|
||||
class="search-input"
|
||||
v-model="searchKeyword"
|
||||
placeholder="输入关键词搜索地址(支持模糊搜索)"
|
||||
@input="onSearchInput"
|
||||
@confirm="searchLocation"
|
||||
/>
|
||||
<uni-icons
|
||||
v-if="searchKeyword"
|
||||
type="clear"
|
||||
size="18"
|
||||
color="#999"
|
||||
@click="clearSearch"
|
||||
></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 搜索结果列表 -->
|
||||
<view class="search-results" v-if="showSearchResults">
|
||||
<scroll-view scroll-y class="results-scroll" v-if="searchResults.length > 0">
|
||||
<view
|
||||
class="result-item"
|
||||
v-for="(item, index) in searchResults"
|
||||
:key="index"
|
||||
@click="selectSearchResult(item)"
|
||||
>
|
||||
<view class="result-name">{{ item.name }}</view>
|
||||
<view class="result-address">{{ item.address }}</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="empty-results" v-else-if="isSearching">
|
||||
<view class="loading-icon">
|
||||
<uni-icons type="loop" size="40" color="#999"></uni-icons>
|
||||
</view>
|
||||
<text>搜索中...</text>
|
||||
</view>
|
||||
<view class="empty-results" v-else>
|
||||
<uni-icons type="info" size="40" color="#999"></uni-icons>
|
||||
<text>未找到相关地址,请尝试其他关键词</text>
|
||||
<view class="search-tips">
|
||||
<text class="tip-title">搜索建议:</text>
|
||||
<text class="tip-item">• 输入具体地址名称</text>
|
||||
<text class="tip-item">• 输入地标建筑名称</text>
|
||||
<text class="tip-item">• 输入街道或区域名称</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 地图 -->
|
||||
<view class="map-wrapper" v-show="!showSearchResults">
|
||||
<!-- #ifdef H5 -->
|
||||
<view id="amap-container" class="amap-container"></view>
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- #ifndef H5 -->
|
||||
<map
|
||||
id="map"
|
||||
class="map"
|
||||
:latitude="latitude"
|
||||
:longitude="longitude"
|
||||
:markers="markers"
|
||||
:show-location="true"
|
||||
@markertap="onMarkerTap"
|
||||
@regionchange="onRegionChange"
|
||||
@tap="onMapTap"
|
||||
>
|
||||
<cover-view class="map-center-marker">
|
||||
<cover-image src="/static/icon/Location.png" class="marker-icon"></cover-image>
|
||||
</cover-view>
|
||||
</map>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
|
||||
<!-- 当前位置信息 -->
|
||||
<view class="location-info" v-if="currentAddress && !showSearchResults">
|
||||
<view class="info-title">当前选择位置</view>
|
||||
<view class="info-name">{{ currentAddress.name }}</view>
|
||||
<view class="info-address">{{ currentAddress.address }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<view class="bottom-actions">
|
||||
<button class="locate-btn" @click="getCurrentLocation" :disabled="isLocating">
|
||||
<uni-icons type="location-filled" size="20" color="#256BFA"></uni-icons>
|
||||
<text>{{ isLocating ? '定位中...' : '定位' }}</text>
|
||||
</button>
|
||||
<button class="confirm-btn" @click="confirmLocation">确认选择</button>
|
||||
</view>
|
||||
</view>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, inject, onMounted } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
|
||||
const { $api } = inject('globalFunction')
|
||||
|
||||
// 搜索相关
|
||||
const searchKeyword = ref('')
|
||||
const searchResults = ref([])
|
||||
const showSearchResults = ref(false)
|
||||
const isSearching = ref(false)
|
||||
const isLocating = ref(false)
|
||||
let searchTimer = null
|
||||
|
||||
// 地图相关
|
||||
const latitude = ref(36.066938)
|
||||
const longitude = ref(120.382665)
|
||||
const markers = ref([])
|
||||
const currentAddress = ref(null)
|
||||
|
||||
// H5地图实例
|
||||
let map = null
|
||||
let AMap = null
|
||||
let geocoder = null
|
||||
let placeSearch = null
|
||||
|
||||
onLoad((options) => {
|
||||
// 可以接收初始位置参数
|
||||
if (options.latitude && options.longitude) {
|
||||
latitude.value = parseFloat(options.latitude)
|
||||
longitude.value = parseFloat(options.longitude)
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
// #ifdef H5
|
||||
initAmapH5()
|
||||
// #endif
|
||||
|
||||
// #ifndef H5
|
||||
// 先设置默认位置,避免地图显示空白
|
||||
markers.value = [{
|
||||
id: 1,
|
||||
latitude: latitude.value,
|
||||
longitude: longitude.value,
|
||||
iconPath: '/static/icon/Location.png',
|
||||
width: 30,
|
||||
height: 30
|
||||
}]
|
||||
|
||||
// 延迟执行定位,避免页面加载时立即定位失败
|
||||
setTimeout(() => {
|
||||
getCurrentLocation()
|
||||
}, 1000)
|
||||
// #endif
|
||||
})
|
||||
|
||||
// H5端初始化高德地图
|
||||
const initAmapH5 = () => {
|
||||
// #ifdef H5
|
||||
if (window.AMap) {
|
||||
AMap = window.AMap
|
||||
initMap()
|
||||
} else {
|
||||
const script = document.createElement('script')
|
||||
script.src = 'https://webapi.amap.com/maps?v=2.0&key=9cfc9370bd8a941951da1cea0308e9e3&plugin=AMap.Geocoder,AMap.PlaceSearch'
|
||||
script.onload = () => {
|
||||
AMap = window.AMap
|
||||
initMap()
|
||||
}
|
||||
document.head.appendChild(script)
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 初始化地图
|
||||
const initMap = () => {
|
||||
// #ifdef H5
|
||||
map = new AMap.Map('amap-container', {
|
||||
zoom: 15,
|
||||
center: [longitude.value, latitude.value],
|
||||
resizeEnable: true
|
||||
})
|
||||
|
||||
// 创建标记
|
||||
const marker = new AMap.Marker({
|
||||
position: [longitude.value, latitude.value],
|
||||
draggable: true
|
||||
})
|
||||
|
||||
marker.on('dragend', (e) => {
|
||||
const position = e.target.getPosition()
|
||||
longitude.value = position.lng
|
||||
latitude.value = position.lat
|
||||
reverseGeocode(position.lng, position.lat)
|
||||
})
|
||||
|
||||
map.add(marker)
|
||||
|
||||
// 初始化地理编码
|
||||
geocoder = new AMap.Geocoder({
|
||||
city: '全国'
|
||||
})
|
||||
|
||||
// 初始化地点搜索
|
||||
placeSearch = new AMap.PlaceSearch({
|
||||
city: '全国',
|
||||
pageSize: 10
|
||||
})
|
||||
|
||||
// 地图点击事件
|
||||
map.on('click', (e) => {
|
||||
const { lng, lat } = e.lnglat
|
||||
longitude.value = lng
|
||||
latitude.value = lat
|
||||
marker.setPosition([lng, lat])
|
||||
reverseGeocode(lng, lat)
|
||||
})
|
||||
|
||||
// 获取当前位置信息
|
||||
reverseGeocode(longitude.value, latitude.value)
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 搜索输入
|
||||
const onSearchInput = () => {
|
||||
if (searchTimer) {
|
||||
clearTimeout(searchTimer)
|
||||
}
|
||||
|
||||
if (!searchKeyword.value.trim()) {
|
||||
showSearchResults.value = false
|
||||
searchResults.value = []
|
||||
isSearching.value = false
|
||||
return
|
||||
}
|
||||
|
||||
showSearchResults.value = true
|
||||
isSearching.value = true
|
||||
|
||||
searchTimer = setTimeout(() => {
|
||||
if (searchKeyword.value.trim()) {
|
||||
searchLocation()
|
||||
}
|
||||
}, 300) // 优化防抖时间从500ms改为300ms
|
||||
}
|
||||
|
||||
// 搜索地点
|
||||
const searchLocation = () => {
|
||||
if (!searchKeyword.value.trim()) {
|
||||
return
|
||||
}
|
||||
|
||||
showSearchResults.value = true
|
||||
isSearching.value = true
|
||||
|
||||
// #ifdef H5
|
||||
if (placeSearch) {
|
||||
placeSearch.search(searchKeyword.value, (status, result) => {
|
||||
isSearching.value = false
|
||||
if (status === 'complete' && result.poiList) {
|
||||
searchResults.value = result.poiList.pois.map(poi => ({
|
||||
name: poi.name,
|
||||
address: poi.address || poi.pname + poi.cityname + poi.adname,
|
||||
location: poi.location,
|
||||
lng: poi.location.lng,
|
||||
lat: poi.location.lat
|
||||
}))
|
||||
} else {
|
||||
searchResults.value = []
|
||||
}
|
||||
})
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifndef H5
|
||||
// 小程序端使用uni.request调用高德API
|
||||
uni.request({
|
||||
url: 'https://restapi.amap.com/v3/place/text',
|
||||
data: {
|
||||
key: '9cfc9370bd8a941951da1cea0308e9e3',
|
||||
keywords: searchKeyword.value,
|
||||
city: '全国',
|
||||
offset: 20,
|
||||
citylimit: false, // 不限制城市,支持全国搜索
|
||||
extensions: 'all' // 返回详细信息
|
||||
},
|
||||
success: (res) => {
|
||||
isSearching.value = false
|
||||
console.log('搜索响应:', res.data) // 调试日志
|
||||
|
||||
if (res.data.status === '1' && res.data.pois && res.data.pois.length > 0) {
|
||||
searchResults.value = res.data.pois.map(poi => {
|
||||
const [lng, lat] = poi.location.split(',')
|
||||
return {
|
||||
name: poi.name,
|
||||
address: poi.address || `${poi.pname || ''}${poi.cityname || ''}${poi.adname || ''}`,
|
||||
lng: parseFloat(lng),
|
||||
lat: parseFloat(lat)
|
||||
}
|
||||
})
|
||||
console.log('搜索结果:', searchResults.value) // 调试日志
|
||||
} else {
|
||||
// 如果第一次搜索没有结果,尝试更宽泛的搜索
|
||||
if (searchKeyword.value.length > 2) {
|
||||
tryAlternativeSearch()
|
||||
} else {
|
||||
searchResults.value = []
|
||||
console.log('搜索无结果:', res.data) // 调试日志
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
isSearching.value = false
|
||||
searchResults.value = []
|
||||
console.error('搜索请求失败:', err) // 调试日志
|
||||
$api.msg('搜索失败,请检查网络连接')
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 备用搜索策略
|
||||
const tryAlternativeSearch = () => {
|
||||
// 尝试使用地理编码API搜索
|
||||
uni.request({
|
||||
url: 'https://restapi.amap.com/v3/geocode/geo',
|
||||
data: {
|
||||
key: '9cfc9370bd8a941951da1cea0308e9e3',
|
||||
address: searchKeyword.value,
|
||||
city: '全国'
|
||||
},
|
||||
success: (res) => {
|
||||
isSearching.value = false
|
||||
console.log('备用搜索响应:', res.data) // 调试日志
|
||||
|
||||
if (res.data.status === '1' && res.data.geocodes && res.data.geocodes.length > 0) {
|
||||
searchResults.value = res.data.geocodes.map(geo => {
|
||||
const [lng, lat] = geo.location.split(',')
|
||||
return {
|
||||
name: geo.formatted_address,
|
||||
address: geo.formatted_address,
|
||||
lng: parseFloat(lng),
|
||||
lat: parseFloat(lat)
|
||||
}
|
||||
})
|
||||
console.log('备用搜索结果:', searchResults.value) // 调试日志
|
||||
} else {
|
||||
searchResults.value = []
|
||||
console.log('备用搜索也无结果:', res.data) // 调试日志
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
isSearching.value = false
|
||||
searchResults.value = []
|
||||
console.error('备用搜索失败:', err) // 调试日志
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 选择搜索结果
|
||||
const selectSearchResult = (item) => {
|
||||
longitude.value = item.lng
|
||||
latitude.value = item.lat
|
||||
currentAddress.value = {
|
||||
name: item.name,
|
||||
address: item.address,
|
||||
longitude: item.lng,
|
||||
latitude: item.lat
|
||||
}
|
||||
|
||||
// #ifdef H5
|
||||
if (map) {
|
||||
map.setCenter([item.lng, item.lat])
|
||||
const marker = map.getAllOverlays('marker')[0]
|
||||
if (marker) {
|
||||
marker.setPosition([item.lng, item.lat])
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifndef H5
|
||||
markers.value = [{
|
||||
id: 1,
|
||||
latitude: item.lat,
|
||||
longitude: item.lng,
|
||||
iconPath: '/static/icon/Location.png',
|
||||
width: 30,
|
||||
height: 30
|
||||
}]
|
||||
// #endif
|
||||
|
||||
showSearchResults.value = false
|
||||
searchKeyword.value = ''
|
||||
}
|
||||
|
||||
// 清除搜索
|
||||
const clearSearch = () => {
|
||||
searchKeyword.value = ''
|
||||
searchResults.value = []
|
||||
showSearchResults.value = false
|
||||
isSearching.value = false
|
||||
if (searchTimer) {
|
||||
clearTimeout(searchTimer)
|
||||
}
|
||||
}
|
||||
|
||||
// 逆地理编码(根据坐标获取地址)
|
||||
const reverseGeocode = (lng, lat) => {
|
||||
// #ifdef H5
|
||||
if (geocoder) {
|
||||
geocoder.getAddress([lng, lat], (status, result) => {
|
||||
if (status === 'complete' && result.regeocode) {
|
||||
const addressComponent = result.regeocode.addressComponent
|
||||
const formattedAddress = result.regeocode.formattedAddress
|
||||
currentAddress.value = {
|
||||
name: addressComponent.building || addressComponent.township,
|
||||
address: formattedAddress,
|
||||
longitude: lng,
|
||||
latitude: lat
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifndef H5
|
||||
uni.request({
|
||||
url: 'https://restapi.amap.com/v3/geocode/regeo',
|
||||
data: {
|
||||
key: '9cfc9370bd8a941951da1cea0308e9e3',
|
||||
location: `${lng},${lat}`
|
||||
},
|
||||
success: (res) => {
|
||||
if (res.data.status === '1' && res.data.regeocode) {
|
||||
const addressComponent = res.data.regeocode.addressComponent
|
||||
const formattedAddress = res.data.regeocode.formatted_address
|
||||
currentAddress.value = {
|
||||
name: addressComponent.building || addressComponent.township || '选择的位置',
|
||||
address: formattedAddress,
|
||||
longitude: lng,
|
||||
latitude: lat
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 获取当前定位
|
||||
const getCurrentLocation = () => {
|
||||
if (isLocating.value) return // 防止重复定位
|
||||
|
||||
isLocating.value = true
|
||||
uni.showLoading({ title: '定位中...' })
|
||||
|
||||
// 先检查定位权限
|
||||
uni.getSetting({
|
||||
success: (settingRes) => {
|
||||
if (settingRes.authSetting['scope.userLocation'] === false) {
|
||||
// 用户拒绝了定位权限,引导用户开启
|
||||
isLocating.value = false
|
||||
uni.hideLoading()
|
||||
uni.showModal({
|
||||
title: '定位权限',
|
||||
content: '需要获取您的位置信息来提供更好的服务,请在设置中开启定位权限',
|
||||
confirmText: '去设置',
|
||||
success: (modalRes) => {
|
||||
if (modalRes.confirm) {
|
||||
uni.openSetting()
|
||||
}
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 执行定位
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
altitude: false,
|
||||
success: (res) => {
|
||||
console.log('定位成功:', res) // 调试日志
|
||||
longitude.value = res.longitude
|
||||
latitude.value = res.latitude
|
||||
|
||||
// #ifdef H5
|
||||
if (map) {
|
||||
map.setCenter([res.longitude, res.latitude])
|
||||
const marker = map.getAllOverlays('marker')[0]
|
||||
if (marker) {
|
||||
marker.setPosition([res.longitude, res.latitude])
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifndef H5
|
||||
// 更新小程序端标记
|
||||
markers.value = [{
|
||||
id: 1,
|
||||
latitude: res.latitude,
|
||||
longitude: res.longitude,
|
||||
iconPath: '/static/icon/Location.png',
|
||||
width: 30,
|
||||
height: 30
|
||||
}]
|
||||
// #endif
|
||||
|
||||
reverseGeocode(res.longitude, res.latitude)
|
||||
uni.hideLoading()
|
||||
isLocating.value = false
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('定位失败:', err) // 调试日志
|
||||
uni.hideLoading()
|
||||
isLocating.value = false
|
||||
|
||||
// 根据错误类型给出不同提示
|
||||
// let errorMsg = '定位失败'
|
||||
// if (err.errMsg.includes('auth deny')) {
|
||||
// errorMsg = '定位权限被拒绝,请在设置中开启'
|
||||
// } else if (err.errMsg.includes('timeout')) {
|
||||
// errorMsg = '定位超时,请重试'
|
||||
// } else if (err.errMsg.includes('network')) {
|
||||
// errorMsg = '网络异常,请检查网络连接'
|
||||
// }
|
||||
|
||||
// uni.showModal({
|
||||
// title: '定位失败',
|
||||
// content: errorMsg + ',是否使用默认位置?',
|
||||
// confirmText: '使用默认位置',
|
||||
// cancelText: '重试',
|
||||
// success: (modalRes) => {
|
||||
// if (modalRes.confirm) {
|
||||
// // 使用默认位置(北京)
|
||||
// longitude.value = 116.397428
|
||||
// latitude.value = 39.90923
|
||||
// reverseGeocode(longitude.value, latitude.value)
|
||||
// } else {
|
||||
// // 重试定位
|
||||
// setTimeout(() => {
|
||||
// getCurrentLocation()
|
||||
// }, 2000)
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading()
|
||||
isLocating.value = false
|
||||
$api.msg('无法获取定位权限设置')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 地图区域变化(小程序端)
|
||||
const onRegionChange = (e) => {
|
||||
// #ifndef H5
|
||||
// 只有在用户手动拖动地图结束时才更新位置
|
||||
if (e.type === 'end' && e.causedBy === 'drag') {
|
||||
const mapContext = uni.createMapContext('map')
|
||||
mapContext.getCenterLocation({
|
||||
success: (res) => {
|
||||
longitude.value = res.longitude
|
||||
latitude.value = res.latitude
|
||||
reverseGeocode(res.longitude, res.latitude)
|
||||
}
|
||||
})
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 地图点击事件(小程序端)
|
||||
const onMapTap = (e) => {
|
||||
// #ifndef H5
|
||||
const { latitude: lat, longitude: lng } = e.detail
|
||||
longitude.value = lng
|
||||
latitude.value = lat
|
||||
|
||||
// 更新标记
|
||||
markers.value = [{
|
||||
id: 1,
|
||||
latitude: lat,
|
||||
longitude: lng,
|
||||
iconPath: '/static/icon/Location.png',
|
||||
width: 30,
|
||||
height: 30
|
||||
}]
|
||||
|
||||
reverseGeocode(lng, lat)
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 确认选择
|
||||
const confirmLocation = () => {
|
||||
if (!currentAddress.value) {
|
||||
$api.msg('请选择地址')
|
||||
return
|
||||
}
|
||||
|
||||
// 返回上一页并传递数据
|
||||
const pages = getCurrentPages()
|
||||
const prevPage = pages[pages.length - 2]
|
||||
|
||||
if (prevPage) {
|
||||
prevPage.$vm.handleLocationSelected({
|
||||
address: currentAddress.value.address,
|
||||
name: currentAddress.value.name,
|
||||
longitude: currentAddress.value.longitude,
|
||||
latitude: currentAddress.value.latitude
|
||||
})
|
||||
}
|
||||
|
||||
uni.navigateBack()
|
||||
}
|
||||
|
||||
const onMarkerTap = (e) => {
|
||||
console.log('marker点击', e)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.map-container
|
||||
width: 100%
|
||||
height: 100vh
|
||||
position: relative
|
||||
display: flex
|
||||
flex-direction: column
|
||||
|
||||
.search-box
|
||||
position: absolute
|
||||
top: 20rpx
|
||||
left: 32rpx
|
||||
right: 32rpx
|
||||
z-index: 10
|
||||
|
||||
.search-input-wrapper
|
||||
background: #fff
|
||||
border-radius: 40rpx
|
||||
padding: 20rpx 30rpx
|
||||
display: flex
|
||||
align-items: center
|
||||
box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.1)
|
||||
|
||||
.search-input
|
||||
flex: 1
|
||||
margin: 0 20rpx
|
||||
font-size: 28rpx
|
||||
|
||||
uni-icons
|
||||
flex-shrink: 0
|
||||
|
||||
.search-results
|
||||
position: absolute
|
||||
top: 100rpx
|
||||
left: 32rpx
|
||||
right: 32rpx
|
||||
bottom: 180rpx
|
||||
background: #fff
|
||||
border-radius: 20rpx
|
||||
box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.1)
|
||||
z-index: 9
|
||||
overflow: hidden
|
||||
|
||||
.results-scroll
|
||||
height: 100%
|
||||
|
||||
.result-item
|
||||
padding: 30rpx
|
||||
border-bottom: 1rpx solid #f0f0f0
|
||||
|
||||
&:active
|
||||
background: #f5f5f5
|
||||
|
||||
.result-name
|
||||
font-size: 32rpx
|
||||
color: #333
|
||||
font-weight: 500
|
||||
margin-bottom: 10rpx
|
||||
|
||||
.result-address
|
||||
font-size: 26rpx
|
||||
color: #999
|
||||
|
||||
.empty-results
|
||||
height: 100%
|
||||
display: flex
|
||||
flex-direction: column
|
||||
align-items: center
|
||||
justify-content: center
|
||||
color: #999
|
||||
font-size: 28rpx
|
||||
|
||||
.loading-icon
|
||||
animation: rotate 1s linear infinite
|
||||
margin-bottom: 20rpx
|
||||
|
||||
uni-icons
|
||||
margin-bottom: 20rpx
|
||||
|
||||
text
|
||||
padding: 0 60rpx
|
||||
text-align: center
|
||||
line-height: 1.5
|
||||
|
||||
.search-tips
|
||||
margin-top: 40rpx
|
||||
padding: 0 40rpx
|
||||
|
||||
.tip-title
|
||||
font-size: 26rpx
|
||||
color: #666
|
||||
font-weight: 500
|
||||
margin-bottom: 20rpx
|
||||
display: block
|
||||
|
||||
.tip-item
|
||||
font-size: 24rpx
|
||||
color: #999
|
||||
line-height: 1.8
|
||||
display: block
|
||||
margin-bottom: 8rpx
|
||||
|
||||
@keyframes rotate
|
||||
from
|
||||
transform: rotate(0deg)
|
||||
to
|
||||
transform: rotate(360deg)
|
||||
|
||||
.map-wrapper
|
||||
flex: 1
|
||||
position: relative
|
||||
|
||||
.map, .amap-container
|
||||
width: 100%
|
||||
height: 100%
|
||||
|
||||
.map-center-marker
|
||||
position: absolute
|
||||
left: 50%
|
||||
top: 50%
|
||||
transform: translate(-50%, -100%)
|
||||
z-index: 5
|
||||
|
||||
.marker-icon
|
||||
width: 60rpx
|
||||
height: 80rpx
|
||||
|
||||
.location-info
|
||||
position: absolute
|
||||
bottom: 180rpx
|
||||
left: 32rpx
|
||||
right: 32rpx
|
||||
background: #fff
|
||||
border-radius: 20rpx
|
||||
padding: 30rpx
|
||||
box-shadow: 0 -4rpx 12rpx rgba(0,0,0,0.1)
|
||||
z-index: 10
|
||||
|
||||
.info-title
|
||||
font-size: 24rpx
|
||||
color: #999
|
||||
margin-bottom: 10rpx
|
||||
|
||||
.info-name
|
||||
font-size: 32rpx
|
||||
color: #333
|
||||
font-weight: 500
|
||||
margin-bottom: 10rpx
|
||||
|
||||
.info-address
|
||||
font-size: 28rpx
|
||||
color: #666
|
||||
|
||||
.bottom-actions
|
||||
position: absolute
|
||||
bottom: 0
|
||||
left: 0
|
||||
right: 0
|
||||
background: #fff
|
||||
padding: 20rpx 32rpx
|
||||
display: flex
|
||||
gap: 20rpx
|
||||
box-shadow: 0 -2rpx 10rpx rgba(0,0,0,0.1)
|
||||
z-index: 11
|
||||
|
||||
.locate-btn
|
||||
width: 120rpx
|
||||
height: 80rpx
|
||||
background: #fff
|
||||
border: 2rpx solid #256BFA
|
||||
border-radius: 40rpx
|
||||
display: flex
|
||||
flex-direction: column
|
||||
align-items: center
|
||||
justify-content: center
|
||||
font-size: 24rpx
|
||||
color: #256BFA
|
||||
|
||||
&:disabled
|
||||
opacity: 0.5
|
||||
color: #999
|
||||
border-color: #999
|
||||
|
||||
text
|
||||
margin-top: 4rpx
|
||||
|
||||
.confirm-btn
|
||||
flex: 1
|
||||
height: 80rpx
|
||||
background: #256BFA
|
||||
color: #fff
|
||||
border-radius: 40rpx
|
||||
font-size: 32rpx
|
||||
border: none
|
||||
|
||||
button::after
|
||||
border: none
|
||||
</style>
|
||||
|
||||
@@ -1,377 +0,0 @@
|
||||
<template>
|
||||
<AppLayout>
|
||||
<view class="skill-search-container">
|
||||
<!-- 固定顶部区域 -->
|
||||
<view class="fixed-header">
|
||||
<!-- 搜索框 -->
|
||||
<view class="search-box">
|
||||
<input
|
||||
class="search-input"
|
||||
v-model="searchKeyword"
|
||||
placeholder="请输入技能名称进行搜索"
|
||||
@input="handleSearch"
|
||||
confirm-type="search"
|
||||
/>
|
||||
<view class="search-icon" @click="handleSearch">搜索</view>
|
||||
</view>
|
||||
|
||||
<!-- 已选技能提示 -->
|
||||
<view class="selected-tip" v-if="selectedSkill">
|
||||
已选择技能:{{ selectedSkill }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 可滚动内容区域 -->
|
||||
<scroll-view class="scroll-content" scroll-y>
|
||||
<view class="scroll-inner">
|
||||
<!-- 搜索结果列表 -->
|
||||
<view class="result-list" v-if="searchResults.length > 0">
|
||||
<view
|
||||
class="result-item"
|
||||
v-for="(item, index) in searchResults"
|
||||
:key="index"
|
||||
@click="toggleSelect(item)"
|
||||
>
|
||||
<view class="item-content">
|
||||
<text class="item-name">{{ item.name }}</text>
|
||||
</view>
|
||||
<view
|
||||
class="item-checkbox"
|
||||
:class="{ 'checked': isSelected(item) }"
|
||||
>
|
||||
<text v-if="isSelected(item)" class="check-icon">✓</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<view class="empty-state" v-if="!isSearching && searchResults.length === 0 && searchKeyword">
|
||||
<text class="empty-text">未找到相关技能</text>
|
||||
</view>
|
||||
|
||||
<!-- 初始提示 -->
|
||||
<view class="empty-state" v-if="!isSearching && searchResults.length === 0 && !searchKeyword">
|
||||
<text class="empty-text">请输入技能名称进行搜索</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 固定底部操作栏 -->
|
||||
<view class="bottom-bar">
|
||||
<view class="selected-skills" v-if="selectedSkill">
|
||||
<view class="skill-tag">
|
||||
<text class="tag-text">{{ selectedSkill }}</text>
|
||||
<text class="tag-close" @click.stop="removeSkill">×</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="action-buttons">
|
||||
<button class="btn-cancel" @click="handleCancel">取消</button>
|
||||
<button
|
||||
class="btn-confirm"
|
||||
:class="{ 'disabled': !selectedSkill }"
|
||||
@click="handleConfirm"
|
||||
:disabled="!selectedSkill"
|
||||
>
|
||||
确定
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, onUnmounted } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { inject } from 'vue';
|
||||
|
||||
const { $api } = inject('globalFunction');
|
||||
|
||||
const searchKeyword = ref('');
|
||||
const searchResults = ref([]);
|
||||
const selectedSkill = ref(''); // 改为单选,存储单个技能名称
|
||||
const isSearching = ref(false);
|
||||
let searchTimer = null;
|
||||
|
||||
onLoad((options) => {
|
||||
// 接收已选中的技能(单选模式,只接收单个技能)
|
||||
if (options.selected) {
|
||||
try {
|
||||
const skills = JSON.parse(decodeURIComponent(options.selected));
|
||||
if (Array.isArray(skills) && skills.length > 0) {
|
||||
selectedSkill.value = skills[0]; // 只取第一个技能
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('解析已选技能失败:', e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 搜索处理(防抖)
|
||||
function handleSearch() {
|
||||
const keyword = searchKeyword.value.trim();
|
||||
|
||||
if (!keyword) {
|
||||
searchResults.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
// 清除之前的定时器
|
||||
if (searchTimer) {
|
||||
clearTimeout(searchTimer);
|
||||
}
|
||||
|
||||
// 防抖处理,500ms后执行搜索
|
||||
searchTimer = setTimeout(() => {
|
||||
performSearch(keyword);
|
||||
}, 500);
|
||||
}
|
||||
|
||||
// 执行搜索
|
||||
async function performSearch(keyword) {
|
||||
if (!keyword.trim()) {
|
||||
searchResults.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
isSearching.value = true;
|
||||
|
||||
try {
|
||||
const response = await $api.createRequest('/cms/dict/jobCategory', { name: keyword }, 'GET');
|
||||
|
||||
// 处理接口返回的数据,支持多种可能的返回格式
|
||||
let results = [];
|
||||
if (response) {
|
||||
if (Array.isArray(response)) {
|
||||
// 如果直接返回数组
|
||||
results = response;
|
||||
} else if (response.data) {
|
||||
// 如果返回 { data: [...] }
|
||||
results = Array.isArray(response.data) ? response.data : [];
|
||||
} else if (response.list) {
|
||||
// 如果返回 { list: [...] }
|
||||
results = Array.isArray(response.list) ? response.list : [];
|
||||
}
|
||||
}
|
||||
|
||||
// 确保每个结果都有name字段
|
||||
searchResults.value = results.map(item => {
|
||||
if (typeof item === 'string') {
|
||||
return { name: item };
|
||||
}
|
||||
return item;
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('搜索技能失败:', error);
|
||||
$api.msg('搜索失败,请稍后重试');
|
||||
searchResults.value = [];
|
||||
} finally {
|
||||
isSearching.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// 判断技能是否已选中
|
||||
function isSelected(item) {
|
||||
return selectedSkill.value === item.name;
|
||||
}
|
||||
|
||||
// 切换技能选择状态(单选模式)
|
||||
function toggleSelect(item) {
|
||||
const skillName = item.name;
|
||||
|
||||
if (selectedSkill.value === skillName) {
|
||||
// 已选中,取消选择
|
||||
selectedSkill.value = '';
|
||||
} else {
|
||||
// 选择新的技能
|
||||
selectedSkill.value = skillName;
|
||||
}
|
||||
}
|
||||
|
||||
// 移除技能(单选模式,直接清空)
|
||||
function removeSkill() {
|
||||
selectedSkill.value = '';
|
||||
}
|
||||
|
||||
// 取消操作
|
||||
function handleCancel() {
|
||||
uni.navigateBack();
|
||||
}
|
||||
|
||||
// 确定操作
|
||||
function handleConfirm() {
|
||||
if (!selectedSkill.value) {
|
||||
$api.msg('请选择一个技能');
|
||||
return;
|
||||
}
|
||||
|
||||
// 通过事件总线传递选中的技能(单选模式,传递单个技能名称)
|
||||
uni.$emit('skillSelected', selectedSkill.value);
|
||||
|
||||
// 返回上一页
|
||||
uni.navigateBack();
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
// 清理定时器
|
||||
if (searchTimer) {
|
||||
clearTimeout(searchTimer);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.skill-search-container
|
||||
display: flex
|
||||
flex-direction: column
|
||||
height: 100%
|
||||
background-color: #f5f5f5
|
||||
|
||||
.fixed-header
|
||||
flex-shrink: 0
|
||||
background-color: #fff
|
||||
border-bottom: 2rpx solid #ebebeb
|
||||
|
||||
.search-box
|
||||
display: flex
|
||||
align-items: center
|
||||
padding: 24rpx
|
||||
background-color: #fff
|
||||
|
||||
.search-input
|
||||
flex: 1
|
||||
height: 72rpx
|
||||
padding: 0 24rpx
|
||||
background-color: #f5f5f5
|
||||
border-radius: 36rpx
|
||||
font-size: 28rpx
|
||||
color: #333
|
||||
|
||||
.search-icon
|
||||
margin-left: 24rpx
|
||||
padding: 16rpx 32rpx
|
||||
background-color: #256bfa
|
||||
color: #fff
|
||||
border-radius: 36rpx
|
||||
font-size: 28rpx
|
||||
|
||||
.selected-tip
|
||||
padding: 16rpx 24rpx
|
||||
background-color: #fff3cd
|
||||
color: #856404
|
||||
font-size: 24rpx
|
||||
text-align: center
|
||||
|
||||
.scroll-content
|
||||
flex: 1
|
||||
overflow: hidden
|
||||
height: 0 // 关键:让flex布局正确计算高度
|
||||
background-color: #fff
|
||||
|
||||
.scroll-inner
|
||||
padding-bottom: 40rpx
|
||||
|
||||
.result-list
|
||||
background-color: #fff
|
||||
padding: 0 24rpx
|
||||
|
||||
.result-item
|
||||
display: flex
|
||||
align-items: center
|
||||
justify-content: space-between
|
||||
padding: 32rpx 0
|
||||
border-bottom: 2rpx solid #ebebeb
|
||||
|
||||
.item-content
|
||||
flex: 1
|
||||
|
||||
.item-name
|
||||
font-size: 32rpx
|
||||
color: #333
|
||||
|
||||
.item-checkbox
|
||||
width: 48rpx
|
||||
height: 48rpx
|
||||
border: 2rpx solid #ddd
|
||||
border-radius: 50%
|
||||
display: flex
|
||||
align-items: center
|
||||
justify-content: center
|
||||
margin-left: 24rpx
|
||||
|
||||
&.checked
|
||||
background-color: #256bfa
|
||||
border-color: #256bfa
|
||||
|
||||
.check-icon
|
||||
color: #fff
|
||||
font-size: 32rpx
|
||||
font-weight: bold
|
||||
|
||||
.empty-state
|
||||
display: flex
|
||||
align-items: center
|
||||
justify-content: center
|
||||
min-height: 400rpx
|
||||
|
||||
.empty-text
|
||||
font-size: 28rpx
|
||||
color: #999
|
||||
|
||||
.bottom-bar
|
||||
flex-shrink: 0
|
||||
background-color: #fff
|
||||
border-top: 2rpx solid #ebebeb
|
||||
padding: 24rpx
|
||||
box-shadow: 0 -4rpx 12rpx rgba(0, 0, 0, 0.05) // 添加阴影,让底部栏更明显
|
||||
|
||||
.selected-skills
|
||||
display: flex
|
||||
flex-wrap: wrap
|
||||
margin-bottom: 24rpx
|
||||
min-height: 60rpx
|
||||
|
||||
.skill-tag
|
||||
display: inline-flex
|
||||
align-items: center
|
||||
padding: 12rpx 24rpx
|
||||
margin-right: 16rpx
|
||||
margin-bottom: 16rpx
|
||||
background-color: #e8f4ff
|
||||
border-radius: 32rpx
|
||||
border: 2rpx solid #256bfa
|
||||
|
||||
.tag-text
|
||||
font-size: 26rpx
|
||||
color: #256bfa
|
||||
margin-right: 12rpx
|
||||
|
||||
.tag-close
|
||||
font-size: 32rpx
|
||||
color: #256bfa
|
||||
line-height: 1
|
||||
cursor: pointer
|
||||
|
||||
.action-buttons
|
||||
display: flex
|
||||
gap: 24rpx
|
||||
|
||||
.btn-cancel, .btn-confirm
|
||||
flex: 1
|
||||
height: 88rpx
|
||||
border-radius: 12rpx
|
||||
font-size: 32rpx
|
||||
border: none
|
||||
|
||||
.btn-cancel
|
||||
background-color: #f5f5f5
|
||||
color: #666
|
||||
|
||||
.btn-confirm
|
||||
background-color: #256bfa
|
||||
color: #fff
|
||||
|
||||
&.disabled
|
||||
background-color: #ccc
|
||||
color: #999
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,474 +0,0 @@
|
||||
<template>
|
||||
<view class="company-search-page">
|
||||
<!-- 头部导航 -->
|
||||
<view class="header">
|
||||
<view class="header-left" @click="goBack">
|
||||
<view class="back-arrow"><uni-icons type="search" size="32" color="#FFFFFF"></uni-icons>‹</view>
|
||||
</view>
|
||||
<view class="header-title">选择企业</view>
|
||||
<view class="header-right"></view>
|
||||
</view>
|
||||
|
||||
<!-- 搜索框 -->
|
||||
<view class="search-container">
|
||||
<view class="search-box">
|
||||
<view class="search-icon">🔍</view>
|
||||
<input
|
||||
class="search-input"
|
||||
placeholder="请输入企业名称进行搜索"
|
||||
v-model="searchKeyword"
|
||||
@input="onSearchInput"
|
||||
/>
|
||||
<view class="clear-btn" v-if="searchKeyword" @click="clearSearch">
|
||||
<view class="clear-icon">✕</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 搜索结果 -->
|
||||
<scroll-view class="content" scroll-y="true" :style="{ height: scrollViewHeight }">
|
||||
<!-- 搜索提示 -->
|
||||
<view class="search-tip" v-if="!searchKeyword">
|
||||
<text class="tip-text">请输入企业名称进行搜索</text>
|
||||
</view>
|
||||
|
||||
<!-- 加载中 -->
|
||||
<view class="loading-container" v-if="loading">
|
||||
<view class="loading-text">搜索中...</view>
|
||||
</view>
|
||||
|
||||
<!-- 搜索结果列表 -->
|
||||
<view class="result-list" v-if="searchResults.length > 0">
|
||||
<view
|
||||
class="result-item"
|
||||
v-for="(company, index) in searchResults"
|
||||
:key="company.companyId"
|
||||
@click="selectCompany(company)"
|
||||
>
|
||||
<view class="company-info">
|
||||
<view class="company-name">{{ company.name }}</view>
|
||||
<view class="company-location" v-if="company.location">
|
||||
<text class="location-icon">📍</text>
|
||||
<text class="location-text">{{ company.location }}</text>
|
||||
</view>
|
||||
<view class="company-scale" v-if="company.scale">
|
||||
<text class="scale-label">规模:</text>
|
||||
<text class="scale-text">{{ getScaleText(company.scale) }}</text>
|
||||
</view>
|
||||
<view class="company-nature" v-if="company.nature">
|
||||
<text class="nature-label">性质:</text>
|
||||
<text class="nature-text">{{ getNatureText(company.nature) }}</text>
|
||||
</view>
|
||||
<view class="company-description" v-if="company.description">
|
||||
<text class="desc-text">{{ company.description }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="select-icon">
|
||||
<view class="arrow-icon">›</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 无结果提示 -->
|
||||
<view class="no-result" v-if="searchKeyword && !loading && searchResults.length === 0">
|
||||
<view class="empty-icon">📭</view>
|
||||
<view class="no-result-text">未找到相关企业</view>
|
||||
<view class="no-result-tip">请尝试其他关键词</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部安全区域 -->
|
||||
<view class="bottom-safe-area"></view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { createRequest } from '@/utils/request';
|
||||
|
||||
// 搜索关键词
|
||||
const searchKeyword = ref('');
|
||||
// 搜索结果
|
||||
const searchResults = ref([]);
|
||||
// 加载状态
|
||||
const loading = ref(false);
|
||||
// 防抖定时器
|
||||
let debounceTimer = null;
|
||||
|
||||
// 滚动视图高度
|
||||
const scrollViewHeight = ref('calc(100vh - 200rpx)');
|
||||
|
||||
// 计算滚动视图高度
|
||||
const calculateScrollViewHeight = () => {
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
const windowHeight = systemInfo.windowHeight;
|
||||
const headerHeight = 100; // 头部高度
|
||||
const searchHeight = 120; // 搜索框高度
|
||||
const scrollHeight = windowHeight - headerHeight - searchHeight;
|
||||
scrollViewHeight.value = `${scrollHeight}px`;
|
||||
};
|
||||
|
||||
// 页面加载时计算高度
|
||||
onMounted(() => {
|
||||
calculateScrollViewHeight();
|
||||
});
|
||||
|
||||
// 搜索输入处理(防抖)
|
||||
const onSearchInput = () => {
|
||||
// 清除之前的定时器
|
||||
if (debounceTimer) {
|
||||
clearTimeout(debounceTimer);
|
||||
}
|
||||
|
||||
// 设置新的定时器
|
||||
debounceTimer = setTimeout(() => {
|
||||
if (searchKeyword.value.trim()) {
|
||||
searchCompanies();
|
||||
} else {
|
||||
searchResults.value = [];
|
||||
}
|
||||
}, 500); // 500ms 防抖延迟
|
||||
};
|
||||
|
||||
// 搜索企业
|
||||
const searchCompanies = async () => {
|
||||
if (!searchKeyword.value.trim()) {
|
||||
searchResults.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
|
||||
const response = await createRequest('/app/company/likeList', {
|
||||
name: searchKeyword.value.trim()
|
||||
}, 'get', false);
|
||||
|
||||
if (response.code === 200) {
|
||||
searchResults.value = response.rows || [];
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: response.msg || '搜索失败',
|
||||
icon: 'none'
|
||||
});
|
||||
searchResults.value = [];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('搜索企业失败:', error);
|
||||
uni.showToast({
|
||||
title: '搜索失败,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
searchResults.value = [];
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 清除搜索
|
||||
const clearSearch = () => {
|
||||
searchKeyword.value = '';
|
||||
searchResults.value = [];
|
||||
if (debounceTimer) {
|
||||
clearTimeout(debounceTimer);
|
||||
}
|
||||
};
|
||||
|
||||
// 获取企业规模文本
|
||||
const getScaleText = (scale) => {
|
||||
const scaleMap = {
|
||||
'1': '1-20人',
|
||||
'2': '21-50人',
|
||||
'3': '51-100人',
|
||||
'4': '101-200人',
|
||||
'5': '201-500人',
|
||||
'6': '500人以上'
|
||||
};
|
||||
return scaleMap[scale] || '未知';
|
||||
};
|
||||
|
||||
// 获取企业性质文本
|
||||
const getNatureText = (nature) => {
|
||||
const natureMap = {
|
||||
'1': '有限责任公司',
|
||||
'2': '股份有限公司',
|
||||
'3': '个人独资企业',
|
||||
'4': '合伙企业',
|
||||
'5': '外商投资企业',
|
||||
'6': '其他'
|
||||
};
|
||||
return natureMap[nature] || '未知';
|
||||
};
|
||||
|
||||
// 选择企业
|
||||
const selectCompany = (company) => {
|
||||
// 返回上一页并传递选中的企业信息
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
success: () => {
|
||||
// 通过事件总线或全局状态传递数据
|
||||
uni.$emit('companySelected', {
|
||||
id: company.companyId,
|
||||
name: company.name,
|
||||
address: company.location
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 返回上一页
|
||||
const goBack = () => {
|
||||
uni.navigateBack();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.company-search-page {
|
||||
height: 100vh;
|
||||
background-color: #f5f5f5;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 20rpx 30rpx;
|
||||
background: #fff;
|
||||
border-bottom: 1rpx solid #eee;
|
||||
|
||||
.header-left {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.back-arrow {
|
||||
font-size: 40rpx;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.header-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
width: 60rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.search-container {
|
||||
padding: 20rpx 30rpx;
|
||||
background: #fff;
|
||||
border-bottom: 1rpx solid #eee;
|
||||
|
||||
.search-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: #f5f5f5;
|
||||
border-radius: 12rpx;
|
||||
padding: 0 20rpx;
|
||||
height: 80rpx;
|
||||
|
||||
.search-icon {
|
||||
font-size: 32rpx;
|
||||
margin-right: 20rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
background: transparent;
|
||||
border: none;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
line-height: 1.4;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&::placeholder {
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
line-height: 1.4;
|
||||
}
|
||||
}
|
||||
|
||||
.clear-btn {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-left: 20rpx;
|
||||
|
||||
.clear-icon {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.search-tip {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 400rpx;
|
||||
|
||||
.tip-text {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.loading-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 200rpx;
|
||||
|
||||
.loading-text {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
|
||||
.result-list {
|
||||
background: #fff;
|
||||
|
||||
.result-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 30rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: #f8f8f8;
|
||||
}
|
||||
|
||||
.company-info {
|
||||
flex: 1;
|
||||
|
||||
.company-name {
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
margin-bottom: 15rpx;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.company-location {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 10rpx;
|
||||
|
||||
.location-icon {
|
||||
font-size: 20rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.location-text {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.company-scale, .company-nature {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 8rpx;
|
||||
|
||||
.scale-label, .nature-label {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.scale-text, .nature-text {
|
||||
font-size: 22rpx;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
|
||||
.company-description {
|
||||
margin-top: 10rpx;
|
||||
|
||||
.desc-text {
|
||||
font-size: 22rpx;
|
||||
color: #888;
|
||||
line-height: 1.4;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
line-clamp: 2;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.select-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.arrow-icon {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.no-result {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 400rpx;
|
||||
|
||||
.empty-icon {
|
||||
font-size: 120rpx;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.no-result-text {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.no-result-tip {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.bottom-safe-area {
|
||||
height: 120rpx;
|
||||
background: transparent;
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -31,7 +31,7 @@
|
||||
<input
|
||||
class="input-con triangle"
|
||||
disabled
|
||||
v-if="!state.jobsText || !state.jobsText.length"
|
||||
v-if="!state.jobsText.length"
|
||||
placeholder="请选择您的求职岗位"
|
||||
/>
|
||||
<view class="input-nx" @click="changeJobs" v-else>
|
||||
@@ -40,7 +40,6 @@
|
||||
</view>
|
||||
</view>
|
||||
<SelectJobs ref="selectJobsModel"></SelectJobs>
|
||||
<SelectPopup ref="selectPopupRef"></SelectPopup>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
||||
@@ -48,28 +47,20 @@
|
||||
import { reactive, inject, watch, ref, onMounted, computed } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import SelectJobs from '@/components/selectJobs/selectJobs.vue';
|
||||
import SelectPopup from '@/components/selectPopup/selectPopup.vue';
|
||||
const { $api, navTo, navBack, config } = inject('globalFunction');
|
||||
|
||||
// 创建本地的 openSelectPopup 函数
|
||||
const openSelectPopup = (config) => {
|
||||
if (selectPopupRef.value) {
|
||||
selectPopupRef.value.open(config);
|
||||
}
|
||||
};
|
||||
const openSelectPopup = inject('openSelectPopup');
|
||||
import { storeToRefs } from 'pinia';
|
||||
import useUserStore from '@/stores/useUserStore';
|
||||
import useDictStore from '@/stores/useDictStore';
|
||||
const { userInfo } = storeToRefs(useUserStore());
|
||||
const { getUserResume } = useUserStore();
|
||||
const { dictLabel, oneDictData, getDictData } = useDictStore();
|
||||
const { dictLabel, oneDictData } = useDictStore();
|
||||
|
||||
const selectJobsModel = ref();
|
||||
const selectPopupRef = ref();
|
||||
const percent = ref('0%');
|
||||
const salay = [2000, 5000, 10000, 15000, 20000, 25000, 30000, 50000, 80000, 100000];
|
||||
const salay = [2, 5, 10, 15, 20, 25, 30, 50, 80, 100];
|
||||
const state = reactive({
|
||||
lfsalay: [2000, 5000, 10000, 15000, 20000, 25000, 30000, 50000],
|
||||
lfsalay: [2, 5, 10, 15, 20, 25, 30, 50],
|
||||
risalay: JSON.parse(JSON.stringify(salay)),
|
||||
salayText: '',
|
||||
areaText: '',
|
||||
@@ -81,16 +72,8 @@ const fromValue = reactive({
|
||||
area: '',
|
||||
jobTitleId: [],
|
||||
});
|
||||
const needSkill = ref(false);
|
||||
|
||||
onLoad(async (options) => {
|
||||
// 初始化字典数据
|
||||
await getDictData();
|
||||
onLoad(() => {
|
||||
initLoad();
|
||||
// 检查是否需要继续跳转到技能页面
|
||||
if (options && options.needSkill === 'true') {
|
||||
needSkill.value = true;
|
||||
}
|
||||
});
|
||||
const confirm = () => {
|
||||
if (!fromValue.jobTitleId) {
|
||||
@@ -100,12 +83,7 @@ const confirm = () => {
|
||||
$api.msg('完成');
|
||||
state.disbleDate = true;
|
||||
getUserResume().then(() => {
|
||||
// 如果需要继续跳转到技能页面,则跳转到个人信息页面(携带 needSkill 标记,便于返回两级)
|
||||
if (needSkill.value) {
|
||||
navTo('/packageA/pages/personalInfo/personalInfo?needSkill=true');
|
||||
} else {
|
||||
navBack();
|
||||
}
|
||||
navBack();
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -121,12 +99,8 @@ function initLoad() {
|
||||
fromValue.jobTitleId = userInfo.value.jobTitleId;
|
||||
// 回显
|
||||
state.areaText = dictLabel('area', Number(userInfo.value.area));
|
||||
if (userInfo.value.salaryMin && userInfo.value.salaryMax) {
|
||||
state.salayText = `${userInfo.value.salaryMin}-${userInfo.value.salaryMax}`;
|
||||
} else {
|
||||
state.salayText = '';
|
||||
}
|
||||
state.jobsText = userInfo.value.jobTitle || [];
|
||||
state.salayText = `${userInfo.value.salaryMin}-${userInfo.value.salaryMax}`;
|
||||
state.jobsText = userInfo.value.jobTitle;
|
||||
const result = getFormCompletionPercent(fromValue);
|
||||
percent.value = result;
|
||||
}
|
||||
@@ -137,10 +111,10 @@ const changeSalary = () => {
|
||||
title: '薪资',
|
||||
maskClick: true,
|
||||
data: [state.lfsalay, state.risalay],
|
||||
unit: '元',
|
||||
unit: 'k',
|
||||
success: (_, [min, max]) => {
|
||||
fromValue.salaryMin = min.value;
|
||||
fromValue.salaryMax = max.value;
|
||||
fromValue.salaryMin = min.value * 1000;
|
||||
fromValue.salaryMax = max.value * 1000;
|
||||
state.salayText = `${fromValue.salaryMin}-${fromValue.salaryMax}`;
|
||||
},
|
||||
change(e) {
|
||||
@@ -149,8 +123,7 @@ const changeSalary = () => {
|
||||
const copyri = JSON.parse(JSON.stringify(salay));
|
||||
const [lf, ri] = e.detail.value;
|
||||
const risalay = copyri.slice(lf, copyri.length);
|
||||
// 更新右侧选项
|
||||
state.risalay = risalay;
|
||||
this.setColunm(1, risalay);
|
||||
leftIndex = salayData[0];
|
||||
}
|
||||
},
|
||||
|
||||
@@ -13,7 +13,7 @@ import useUserStore from '@/stores/useUserStore';
|
||||
const { $api, navTo, navBack, vacanciesTo } = inject('globalFunction');
|
||||
import { storeToRefs } from 'pinia';
|
||||
import useLocationStore from '@/stores/useLocationStore';
|
||||
import { usePagination } from '@/packageA/hook/usePagination';
|
||||
import { usePagination } from '@/hook/usePagination';
|
||||
import { jobMoreMap } from '@/utils/markdownParser';
|
||||
const { longitudeVal, latitudeVal } = storeToRefs(useLocationStore());
|
||||
const loadmoreRef = ref(null);
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
</view>
|
||||
<view class="mys-text">
|
||||
<text>期望薪资:</text>
|
||||
<text>{{ userInfo.salaryMin }}元-{{ userInfo.salaryMax }}元</text>
|
||||
<text>{{ userInfo.salaryMin / 1000 }}k-{{ userInfo.salaryMax / 1000 }}k</text>
|
||||
</view>
|
||||
<view class="mys-text">
|
||||
<text>期望工作地:</text>
|
||||
@@ -123,16 +123,21 @@
|
||||
|
||||
<!-- 4. 新增:简历上传区域(固定在页面底部) -->
|
||||
<view class="resume-upload-section">
|
||||
<!-- 上传按钮 -->
|
||||
<button class="upload-btn" @click="handleResumeUpload" :loading="isUploading" :disabled="isUploading">
|
||||
<uni-icons type="cloud-upload" size="20"></uni-icons>
|
||||
<!-- <image class="upload-icon" src="/static/icons/upload-file.png" mode="widthFix"></image> -->
|
||||
<text class="upload-text">
|
||||
{{ uploadedResumeName || '上传简历' }}
|
||||
</text>
|
||||
<!-- 已上传时显示“重新上传”文字 -->
|
||||
<text class="reupload-text" v-if="uploadedResumeName">(重新上传)</text>
|
||||
</button>
|
||||
|
||||
<!-- 上传说明 -->
|
||||
<text class="upload-tip">支持 PDF、Word 格式,文件大小不超过 20MB</text>
|
||||
|
||||
<!-- 已上传文件信息(可选) -->
|
||||
<view class="uploaded-file-info" v-if="uploadedResumeName">
|
||||
<image class="file-icon" src="/static/icons/file-icon.png" mode="widthFix"></image>
|
||||
<text class="file-name">{{ uploadedResumeName }}</text>
|
||||
@@ -267,202 +272,12 @@ const handleDeleteItem = async (item, index) => {
|
||||
};
|
||||
|
||||
// 简历上传核心逻辑
|
||||
const handleResumeUpload = () => {
|
||||
// 从缓存获取用户ID(参考首页实现方式)
|
||||
// 优先从store获取,如果为空则从缓存获取
|
||||
const storeUserId = userInfo.value?.userId;
|
||||
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
|
||||
const cachedUserId = cachedUserInfo.userId;
|
||||
|
||||
// 获取用户ID:优先使用store中的userId,如果store中没有,使用缓存中的userId
|
||||
const userId = storeUserId || cachedUserId;
|
||||
|
||||
if (!userId) {
|
||||
$api.msg('请先登录');
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查是否正在上传
|
||||
if (isUploading.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 选择文件(微信小程序使用 wx.chooseMessageFile,uni-app 中对应 uni.chooseMessageFile)
|
||||
uni.chooseMessageFile({
|
||||
count: 1, // 只能选择一个文件
|
||||
type: 'file', // 选择任意文件类型
|
||||
success: (res) => {
|
||||
// 注意:文件路径在 res.tempFiles[0].path
|
||||
const file = res.tempFiles[0];
|
||||
const tempFilePath = file.path; // 获取临时文件路径
|
||||
const fileName = file.name; // 获取文件名
|
||||
|
||||
// 检查文件大小(20MB = 20 * 1024 * 1024 字节)
|
||||
const maxSize = 20 * 1024 * 1024;
|
||||
if (file.size > maxSize) {
|
||||
$api.msg('文件大小不能超过 20MB');
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查文件类型
|
||||
const allowedTypes = ['pdf', 'doc', 'docx'];
|
||||
const fileExtension = fileName.split('.').pop()?.toLowerCase();
|
||||
if (!fileExtension || !allowedTypes.includes(fileExtension)) {
|
||||
$api.msg('仅支持 PDF、Word 格式');
|
||||
return;
|
||||
}
|
||||
|
||||
// 开始上传
|
||||
uploadResumeFile(tempFilePath, fileName, userId);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('选择文件失败:', err);
|
||||
// 用户取消选择不提示错误
|
||||
if (err.errMsg && !err.errMsg.includes('cancel')) {
|
||||
$api.msg('选择文件失败,请重试');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 上传简历文件到服务器(使用 wx.uploadFile,uni-app 中对应 uni.uploadFile)
|
||||
const uploadResumeFile = (filePath, fileName, userId) => {
|
||||
// 确保 userId 存在且有效
|
||||
if (!userId) {
|
||||
// 如果传入的userId为空,尝试从缓存再次获取
|
||||
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
|
||||
const cachedUserId = cachedUserInfo.userId;
|
||||
|
||||
if (!cachedUserId) {
|
||||
$api.msg('用户ID不存在,无法上传');
|
||||
return;
|
||||
}
|
||||
|
||||
// 使用缓存中的userId
|
||||
userId = cachedUserId;
|
||||
}
|
||||
|
||||
isUploading.value = true;
|
||||
|
||||
// 获取token(从缓存获取,参考首页实现方式)
|
||||
let Authorization = '';
|
||||
const tokenValue = uni.getStorageSync('token') || '';
|
||||
if (tokenValue) {
|
||||
Authorization = tokenValue;
|
||||
} else {
|
||||
// 如果缓存中没有token,尝试从store获取
|
||||
const userStore = useUserStore();
|
||||
if (userStore.token) {
|
||||
Authorization = userStore.token;
|
||||
}
|
||||
}
|
||||
|
||||
// 根据接口文档,bussinessId 应该作为 Query 参数传递,而不是 formData
|
||||
// 将 bussinessId 拼接到 URL 上作为查询参数
|
||||
const uploadUrl = `${config.baseUrl}/app/file/upload?bussinessId=${encodeURIComponent(String(userId))}`;
|
||||
|
||||
// 打印调试信息
|
||||
console.log('上传文件参数:', {
|
||||
url: uploadUrl,
|
||||
fileName: fileName,
|
||||
bussinessId: userId,
|
||||
userId: userId,
|
||||
token: Authorization ? '已获取' : '未获取'
|
||||
});
|
||||
|
||||
// 上传文件(参考微信小程序 wx.uploadFile API)
|
||||
uni.uploadFile({
|
||||
url: uploadUrl, // 开发者服务器的上传接口(必须是 HTTPS),bussinessId 作为 Query 参数
|
||||
filePath: filePath, // 本地文件路径(临时路径)
|
||||
name: 'file', // 服务器端接收文件的字段名(需与后端一致)
|
||||
// 注意:根据接口文档,bussinessId 通过 Query 参数传递,不需要 formData
|
||||
header: {
|
||||
'Authorization': encodeURIComponent(Authorization)
|
||||
},
|
||||
success: (uploadRes) => {
|
||||
try {
|
||||
// 注意:res.data 是字符串,需转为 JSON(如果后端返回 JSON)
|
||||
// 参考方案:const result = JSON.parse(data);
|
||||
let resData;
|
||||
if (typeof uploadRes.data === 'string') {
|
||||
resData = JSON.parse(uploadRes.data);
|
||||
} else {
|
||||
resData = uploadRes.data;
|
||||
}
|
||||
|
||||
// 判断上传是否成功
|
||||
if (uploadRes.statusCode === 200 && resData.code === 200) {
|
||||
// 上传成功,处理返回结果
|
||||
uploadedResumeName.value = fileName;
|
||||
uploadedResumeUrl.value = resData.data || resData.msg || resData.url || '';
|
||||
$api.msg('简历上传成功');
|
||||
console.log('上传成功', resData);
|
||||
|
||||
// 可以在这里保存简历信息到后端(如果需要)
|
||||
// saveResumeInfo(userId, uploadedResumeUrl.value, fileName);
|
||||
} else {
|
||||
// 上传失败
|
||||
const errorMsg = resData.msg || resData.message || '上传失败,请重试';
|
||||
$api.msg(errorMsg);
|
||||
console.error('上传失败:', resData);
|
||||
}
|
||||
} catch (error) {
|
||||
// 解析响应数据失败
|
||||
console.error('解析上传响应失败:', error);
|
||||
console.error('原始响应数据:', uploadRes.data);
|
||||
$api.msg('上传失败,请重试');
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
// 上传失败
|
||||
console.error('上传文件失败:', err);
|
||||
$api.msg('上传失败,请检查网络连接');
|
||||
},
|
||||
// 上传进度监听(可选)
|
||||
progress: (res) => {
|
||||
const progress = res.progress; // 上传进度(0-100)
|
||||
console.log('上传进度:', progress + '%');
|
||||
// 可以在这里更新进度条 UI(如果需要)
|
||||
},
|
||||
complete: () => {
|
||||
// 上传完成(无论成功或失败)
|
||||
isUploading.value = false;
|
||||
}
|
||||
});
|
||||
};
|
||||
const handleResumeUpload = () => {};
|
||||
|
||||
// 删除已上传的简历
|
||||
const handleDeleteResume = () => {
|
||||
if (!uploadedResumeName.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showModal({
|
||||
title: '确认删除',
|
||||
content: '确定要删除已上传的简历吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// 清除本地数据
|
||||
uploadedResumeName.value = '';
|
||||
uploadedResumeUrl.value = '';
|
||||
$api.msg('已删除');
|
||||
|
||||
// 如果需要,可以调用后端接口删除服务器上的文件
|
||||
// deleteResumeFile(userId);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
const handleDeleteResume = () => {};
|
||||
</script>
|
||||
|
||||
<style lang="stylus">
|
||||
/* 修复页面滚动问题:覆盖全局的 overflow: hidden */
|
||||
page {
|
||||
overflow-y: auto !important;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
image{
|
||||
width: 100%;
|
||||
|
||||
@@ -17,19 +17,6 @@
|
||||
<view class="input-titile">姓名</view>
|
||||
<input class="input-con" v-model="fromValue.name" placeholder="请输入您的姓名" />
|
||||
</view>
|
||||
<view class="content-input" :class="{ 'input-error': passwordError }">
|
||||
<view class="input-titile">设置密码</view>
|
||||
<input
|
||||
class="input-con"
|
||||
v-model="fromValue.ytjPassword"
|
||||
placeholder="请输入密码"
|
||||
type="password"
|
||||
maxlength="8"
|
||||
@input="validatePassword"
|
||||
/>
|
||||
<view v-if="passwordError" class="error-message">{{ passwordError }}</view>
|
||||
<view v-if="fromValue.ytjPassword && !passwordError" class="success-message">✓ 密码格式正确</view>
|
||||
</view>
|
||||
<view class="content-sex">
|
||||
<view class="sex-titile">性别</view>
|
||||
<view class="sext-ri">
|
||||
@@ -65,298 +52,67 @@
|
||||
</view>
|
||||
<view class="content-input">
|
||||
<view class="input-titile">身份证</view>
|
||||
<input class="input-con" v-model="fromValue.idCard" placeholder="请输入身份证号码" />
|
||||
<input class="input-con" v-model="fromValue.idcard" placeholder="空" />
|
||||
</view>
|
||||
<view class="content-input">
|
||||
<view class="input-titile">手机号码</view>
|
||||
<input class="input-con" v-model="fromValue.phone" placeholder="请输入您的手机号码" />
|
||||
</view>
|
||||
<view class="content-skills">
|
||||
<view class="skills-header">
|
||||
<view class="input-titile">技能信息</view>
|
||||
<view
|
||||
class="add-skill-btn"
|
||||
@click="addSkill"
|
||||
:class="{ 'disabled': state.skills.length >= 3 }"
|
||||
>
|
||||
+ 添加技能
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="skills-list">
|
||||
<view class="skill-item" v-for="(skill, index) in state.skills" :key="index">
|
||||
<view class="skill-header">
|
||||
<view class="skill-number">技能 {{ index + 1 }}</view>
|
||||
<view class="skill-actions" v-if="state.skills.length > 1">
|
||||
<view class="action-btn delete-btn" @click="removeSkill(index)">删除</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="skill-fields">
|
||||
<view class="skill-field" @click="changeSkillName(index)">
|
||||
<view class="field-label">技能名称</view>
|
||||
<input
|
||||
class="field-input triangle"
|
||||
disabled
|
||||
:value="skill.name"
|
||||
placeholder="请选择技能名称"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="skill-field" @click="changeSkillLevel(index)">
|
||||
<view class="field-label">技能等级</view>
|
||||
<input
|
||||
class="field-input triangle"
|
||||
disabled
|
||||
:value="getSkillLevelText(skill.level)"
|
||||
placeholder="请选择技能等级"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="empty-skills" v-if="state.skills.length === 0">
|
||||
<text class="empty-text">暂无技能信息,点击上方按钮添加</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<SelectPopup ref="selectPopupRef"></SelectPopup>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, inject, watch, ref, onMounted, onUnmounted } from 'vue';
|
||||
import { reactive, inject, watch, ref, onMounted } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
const { $api, navTo, navBack, checkingPhoneRegExp } = inject('globalFunction');
|
||||
import { storeToRefs } from 'pinia';
|
||||
import useUserStore from '@/stores/useUserStore';
|
||||
import useDictStore from '@/stores/useDictStore';
|
||||
import SelectPopup from '@/components/selectPopup/selectPopup.vue';
|
||||
|
||||
const { userInfo } = storeToRefs(useUserStore());
|
||||
const { getUserResume } = useUserStore();
|
||||
const dictStore = useDictStore();
|
||||
const { dictLabel, oneDictData, complete: dictComplete, getDictSelectOption } = dictStore;
|
||||
|
||||
// #ifdef H5
|
||||
const injectedOpenSelectPopup = inject('openSelectPopup', null);
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
const selectPopupRef = ref();
|
||||
// #endif
|
||||
|
||||
// 创建本地的 openSelectPopup 函数,兼容 H5 和微信小程序
|
||||
const openSelectPopup = (config) => {
|
||||
// #ifdef MP-WEIXIN
|
||||
if (selectPopupRef.value) {
|
||||
selectPopupRef.value.open(config);
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
if (injectedOpenSelectPopup) {
|
||||
injectedOpenSelectPopup(config);
|
||||
}
|
||||
// #endif
|
||||
};
|
||||
const { dictLabel, oneDictData } = useDictStore();
|
||||
const openSelectPopup = inject('openSelectPopup');
|
||||
|
||||
const percent = ref('0%');
|
||||
// 当从“先职位后技能”链路进入时,提交后需直接返回职业规划页
|
||||
const needGoBackTwoStep = ref(false);
|
||||
const state = reactive({
|
||||
educationText: '',
|
||||
politicalAffiliationText: '',
|
||||
skills: [], // 新的技能数据结构,包含id字段
|
||||
currentEditingSkillIndex: -1 // 当前正在编辑的技能索引
|
||||
});
|
||||
const fromValue = reactive({
|
||||
name: '',
|
||||
ytjPassword: '', // 新增密码字段
|
||||
sex: 0,
|
||||
birthDate: '',
|
||||
education: '',
|
||||
politicalAffiliation: '',
|
||||
idCard: '',
|
||||
phone: ''
|
||||
idcard: '',
|
||||
});
|
||||
|
||||
// 输入校验相关
|
||||
const passwordError = ref('');
|
||||
// 移除重复的onLoad定义,已在上方实现
|
||||
|
||||
// 在onLoad中初始化数据,确保页面加载时就能获取技能信息
|
||||
onLoad((options = {}) => {
|
||||
if (options.needSkill === 'true') {
|
||||
needGoBackTwoStep.value = true;
|
||||
}
|
||||
// 初始化页面数据
|
||||
onLoad(() => {
|
||||
initLoad();
|
||||
// setTimeout(() => {
|
||||
// const { age, birthDate } = useUserStore().userInfo;
|
||||
// const newAge = calculateAge(birthDate);
|
||||
// // 计算年龄是否对等
|
||||
// if (age != newAge) {
|
||||
// completeResume();
|
||||
// }
|
||||
// }, 1000);
|
||||
});
|
||||
|
||||
// 监听页面显示,接收从技能查询页面返回的数据
|
||||
onShow(() => {
|
||||
// 通过事件总线接收技能选择结果
|
||||
uni.$on('skillSelected', handleSkillSelected);
|
||||
});
|
||||
|
||||
// 页面卸载时移除事件监听
|
||||
onUnmounted(() => {
|
||||
uni.$off('skillSelected', handleSkillSelected);
|
||||
});
|
||||
|
||||
// 监听 userInfo 变化,确保数据及时更新
|
||||
watch(() => userInfo.value, (newVal) => {
|
||||
if (newVal && Object.keys(newVal).length > 0) {
|
||||
initLoad();
|
||||
}
|
||||
}, { deep: true, immediate: false });
|
||||
|
||||
// 监听字典数据加载完成,自动更新学历显示
|
||||
watch(() => dictComplete.value, (newVal) => {
|
||||
if (newVal) {
|
||||
console.log('字典数据加载完成,更新学历显示');
|
||||
// 确保有学历值(如果没有则使用默认值"4"本科)
|
||||
if (!fromValue.education) {
|
||||
fromValue.education = '4';
|
||||
}
|
||||
|
||||
// 直接遍历字典数据查找对应标签
|
||||
const eduValue = String(fromValue.education);
|
||||
const eduItem = dictStore.state.education.find(item => String(item.value) === eduValue);
|
||||
if (eduItem && eduItem.label) {
|
||||
console.log('从字典数据中找到学历标签:', eduItem.label);
|
||||
state.educationText = eduItem.label;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 监听学历字典数据变化
|
||||
watch(() => dictStore.state.education, (newVal) => {
|
||||
if (newVal && newVal.length > 0) {
|
||||
console.log('学历字典数据变化,更新显示');
|
||||
// 确保有学历值(如果没有则使用默认值"4"本科)
|
||||
if (!fromValue.education) {
|
||||
fromValue.education = '4';
|
||||
}
|
||||
|
||||
// 直接遍历字典数据查找对应标签
|
||||
const eduValue = String(fromValue.education);
|
||||
const eduItem = newVal.find(item => String(item.value) === eduValue);
|
||||
if (eduItem && eduItem.label) {
|
||||
console.log('从字典数据中找到学历标签:', eduItem.label);
|
||||
state.educationText = eduItem.label;
|
||||
}
|
||||
}
|
||||
}, { deep: true });
|
||||
|
||||
function initLoad() {
|
||||
// 优先从 store 获取,如果没有则从本地缓存获取
|
||||
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
|
||||
const currentUserInfo = userInfo.value && Object.keys(userInfo.value).length > 0 ? userInfo.value : cachedUserInfo;
|
||||
|
||||
fromValue.name = currentUserInfo.name || '';
|
||||
fromValue.ytjPassword = ''; // 密码输入框默认为空,不加载已有密码
|
||||
fromValue.sex = currentUserInfo.sex !== undefined ? Number(currentUserInfo.sex) : 0;
|
||||
fromValue.phone = currentUserInfo.phone || '';
|
||||
fromValue.birthDate = currentUserInfo.birthDate || '';
|
||||
// 将学历转换为字符串类型,确保类型一致
|
||||
// 如果没有学历值,默认设置为本科(值为"4")
|
||||
fromValue.education = currentUserInfo.education ? String(currentUserInfo.education) : '4';
|
||||
fromValue.politicalAffiliation = currentUserInfo.politicalAffiliation || '';
|
||||
fromValue.idCard = currentUserInfo.idCard || '';
|
||||
|
||||
// 初始化技能数据 - 从appSkillsList获取,保留原始id
|
||||
if (currentUserInfo.appSkillsList && Array.isArray(currentUserInfo.appSkillsList)) {
|
||||
// 过滤掉name为空的技能项
|
||||
const validSkills = currentUserInfo.appSkillsList.filter(item => item.name && item.name.trim() !== '');
|
||||
if (validSkills.length > 0) {
|
||||
// 将appSkillsList转换为新的技能数据结构,保留原始id
|
||||
state.skills = validSkills.map(skill => ({
|
||||
id: skill.id, // 保留服务器返回的原始id
|
||||
name: skill.name,
|
||||
level: skill.levels || ''
|
||||
}));
|
||||
} else {
|
||||
state.skills = [];
|
||||
}
|
||||
} else {
|
||||
state.skills = [];
|
||||
}
|
||||
|
||||
// 初始化学历显示文本(需要等待字典数据加载完成)
|
||||
initEducationText();
|
||||
|
||||
// 回显政治面貌
|
||||
if (currentUserInfo.politicalAffiliation) {
|
||||
state.politicalAffiliationText = dictLabel('affiliation', currentUserInfo.politicalAffiliation);
|
||||
}
|
||||
fromValue.name = userInfo.value.name;
|
||||
fromValue.sex = Number(userInfo.value.sex);
|
||||
fromValue.phone = userInfo.value.phone;
|
||||
fromValue.birthDate = userInfo.value.birthDate;
|
||||
fromValue.education = userInfo.value.education;
|
||||
fromValue.politicalAffiliation = userInfo.value.politicalAffiliation;
|
||||
fromValue.idcard = userInfo.value.idcard;
|
||||
// 回显
|
||||
state.educationText = dictLabel('education', userInfo.value.education);
|
||||
state.politicalAffiliationText = dictLabel('affiliation', userInfo.value.politicalAffiliation);
|
||||
const result = getFormCompletionPercent(fromValue);
|
||||
percent.value = result;
|
||||
}
|
||||
|
||||
// 初始化学历显示文本
|
||||
function initEducationText() {
|
||||
// 确保有学历值(如果没有则使用默认值"4"本科)
|
||||
if (!fromValue.education) {
|
||||
fromValue.education = '4';
|
||||
}
|
||||
|
||||
console.log('初始化学历显示,当前学历值:', fromValue.education);
|
||||
|
||||
// 直接遍历字典数据查找对应标签(不依赖dictLabel函数,确保准确性)
|
||||
const findLabelFromDict = () => {
|
||||
if (dictStore.state.education && dictStore.state.education.length > 0) {
|
||||
const eduValue = String(fromValue.education);
|
||||
const eduItem = dictStore.state.education.find(item => String(item.value) === eduValue);
|
||||
if (eduItem && eduItem.label) {
|
||||
console.log('从字典数据中找到学历标签:', eduItem.label);
|
||||
state.educationText = eduItem.label;
|
||||
return true;
|
||||
} else {
|
||||
console.log('字典数据中未找到匹配的学历标签');
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// 立即尝试查找
|
||||
if (!findLabelFromDict() && dictComplete.value) {
|
||||
// 如果字典数据已加载完成但未找到标签,尝试重新获取字典数据
|
||||
loadEducationDictAndUpdate();
|
||||
}
|
||||
|
||||
// 等待字典数据加载完成
|
||||
const checkDictData = () => {
|
||||
if (dictComplete.value && dictStore.state.education && dictStore.state.education.length > 0) {
|
||||
findLabelFromDict();
|
||||
} else {
|
||||
// 如果字典数据未加载,等待一段时间后重试
|
||||
setTimeout(() => {
|
||||
if (dictComplete.value && dictStore.state.education && dictStore.state.education.length > 0) {
|
||||
findLabelFromDict();
|
||||
} else {
|
||||
// 尝试主动加载字典数据
|
||||
loadEducationDictAndUpdate();
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
};
|
||||
|
||||
// 主动加载学历字典数据并更新显示
|
||||
function loadEducationDictAndUpdate() {
|
||||
getDictSelectOption('education').then((data) => {
|
||||
console.log('主动加载学历字典数据:', data);
|
||||
dictStore.state.education = data;
|
||||
findLabelFromDict();
|
||||
}).catch((error) => {
|
||||
console.error('加载学历字典数据失败:', error);
|
||||
});
|
||||
}
|
||||
|
||||
checkDictData();
|
||||
}
|
||||
const confirm = () => {
|
||||
if (!fromValue.name) {
|
||||
return $api.msg('请输入姓名');
|
||||
@@ -373,156 +129,19 @@ const confirm = () => {
|
||||
if (!checkingPhoneRegExp(fromValue.phone)) {
|
||||
return $api.msg('请输入正确手机号');
|
||||
}
|
||||
|
||||
// 密码校验
|
||||
validatePassword();
|
||||
if (fromValue.ytjPassword && passwordError.value) {
|
||||
return $api.msg(passwordError.value);
|
||||
}
|
||||
|
||||
// 构建appSkillsList数据结构 - 使用新的技能数据结构,包含id字段
|
||||
const appSkillsList = state.skills
|
||||
.filter(skill => skill.name && skill.name.trim() !== '')
|
||||
.map(skill => ({
|
||||
id: skill.id, // 包含技能id,用于更新操作
|
||||
name: skill.name,
|
||||
levels: skill.level || ''
|
||||
}));
|
||||
|
||||
const params = {
|
||||
...fromValue,
|
||||
age: calculateAge(fromValue.birthDate),
|
||||
appSkillsList: appSkillsList
|
||||
};
|
||||
|
||||
$api.createRequest('/app/user/resume', params, 'post').then((resData) => {
|
||||
$api.msg('完成');
|
||||
state.disbleDate = true;
|
||||
getUserResume().then(() => {
|
||||
// 如果从“缺职位+技能”链路进入,回退两层直接返回职业规划页
|
||||
if (needGoBackTwoStep.value) {
|
||||
navBack({ delta: 2 });
|
||||
} else {
|
||||
navBack();
|
||||
}
|
||||
navBack();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// 添加技能
|
||||
function addSkill() {
|
||||
if (state.skills.length >= 3) {
|
||||
$api.msg('最多只能添加3个技能');
|
||||
return;
|
||||
}
|
||||
|
||||
// 添加新的技能对象,新增技能不需要id,后端会自动生成
|
||||
state.skills.push({
|
||||
name: '',
|
||||
level: ''
|
||||
});
|
||||
|
||||
// 更新完成度
|
||||
const result = getFormCompletionPercent(fromValue);
|
||||
percent.value = result;
|
||||
}
|
||||
|
||||
// 删除技能
|
||||
function removeSkill(index) {
|
||||
const skill = state.skills[index];
|
||||
|
||||
// 如果有技能id,调用删除接口
|
||||
if (skill && skill.id) {
|
||||
$api.createRequest(`/app/appskill/${skill.id}`, {}, 'DELETE').then(() => {
|
||||
// 接口调用成功,从本地数组中移除
|
||||
state.skills.splice(index, 1);
|
||||
|
||||
// 更新完成度
|
||||
const result = getFormCompletionPercent(fromValue);
|
||||
percent.value = result;
|
||||
|
||||
$api.msg('删除成功');
|
||||
}).catch((err) => {
|
||||
console.error('删除技能失败:', err);
|
||||
$api.msg('删除失败,请重试');
|
||||
});
|
||||
} else {
|
||||
// 没有id的技能(新增的),直接从本地数组中移除
|
||||
state.skills.splice(index, 1);
|
||||
|
||||
// 更新完成度
|
||||
const result = getFormCompletionPercent(fromValue);
|
||||
percent.value = result;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取技能等级文本
|
||||
function getSkillLevelText(level) {
|
||||
const levelMap = {
|
||||
'1': '初级',
|
||||
'2': '中级',
|
||||
'3': '高级'
|
||||
};
|
||||
return levelMap[level] || '';
|
||||
}
|
||||
|
||||
// 选择技能名称
|
||||
function changeSkillName(index) {
|
||||
state.currentEditingSkillIndex = index;
|
||||
|
||||
// 将当前已选中的技能名称传递给查询页面
|
||||
const selectedSkills = state.skills.map(skill => skill.name).filter(name => name);
|
||||
uni.navigateTo({
|
||||
url: `/packageA/pages/complete-info/skill-search?selected=${encodeURIComponent(JSON.stringify(selectedSkills))}`
|
||||
});
|
||||
}
|
||||
|
||||
// 选择技能等级
|
||||
function changeSkillLevel(index) {
|
||||
const skillLevels = [
|
||||
{ label: '初级', value: '1' },
|
||||
{ label: '中级', value: '2' },
|
||||
{ label: '高级', value: '3' }
|
||||
];
|
||||
|
||||
// 查找当前技能等级在数据中的索引
|
||||
let defaultIndex = [0];
|
||||
const currentSkill = state.skills[index];
|
||||
if (currentSkill && currentSkill.level) {
|
||||
const index = skillLevels.findIndex(item => item.value === currentSkill.level);
|
||||
if (index >= 0) {
|
||||
defaultIndex = [index];
|
||||
}
|
||||
}
|
||||
|
||||
openSelectPopup({
|
||||
title: '技能等级',
|
||||
maskClick: true,
|
||||
data: [skillLevels],
|
||||
defaultIndex: defaultIndex,
|
||||
success: (_, [value]) => {
|
||||
state.skills[index].level = value.value;
|
||||
// 更新完成度
|
||||
const result = getFormCompletionPercent(fromValue);
|
||||
percent.value = result;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 技能选择回调函数
|
||||
const handleSkillSelected = (skillName) => {
|
||||
if (skillName && state.currentEditingSkillIndex >= 0) {
|
||||
// 更新当前编辑的技能名称
|
||||
state.skills[state.currentEditingSkillIndex].name = skillName;
|
||||
|
||||
// 重置当前编辑索引
|
||||
state.currentEditingSkillIndex = -1;
|
||||
|
||||
// 更新完成度
|
||||
const result = getFormCompletionPercent(fromValue);
|
||||
percent.value = result;
|
||||
}
|
||||
};
|
||||
|
||||
const changeDateBirt = () => {
|
||||
const datearray = generateDatePickerArrays();
|
||||
const defaultIndex = getDatePickerIndexes(fromValue.birthDate);
|
||||
@@ -542,149 +161,21 @@ const changeDateBirt = () => {
|
||||
},
|
||||
});
|
||||
};
|
||||
async function changeEducation() {
|
||||
// 确保字典数据已加载
|
||||
if (!dictComplete.value || !dictStore.state.education || dictStore.state.education.length === 0) {
|
||||
// 如果字典数据未加载,先加载数据
|
||||
try {
|
||||
await getDictSelectOption('education').then((data) => {
|
||||
dictStore.state.education = data;
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('加载学历字典数据失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 等待数据加载完成后再获取数据
|
||||
let educationData = oneDictData('education');
|
||||
|
||||
// 如果数据还是为空,等待一下再试
|
||||
if (!educationData || educationData.length === 0) {
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
educationData = oneDictData('education');
|
||||
if (!educationData || educationData.length === 0) {
|
||||
$api.msg('学历数据加载中,请稍后再试');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 确保有默认值
|
||||
if (!fromValue.education) {
|
||||
fromValue.education = '4'; // 默认设置为本科
|
||||
}
|
||||
|
||||
// 将当前学历值转换为字符串,用于查找默认索引
|
||||
const currentEducation = String(fromValue.education);
|
||||
// 查找当前学历在数据中的索引
|
||||
let defaultIndex = [0];
|
||||
if (currentEducation && educationData && educationData.length > 0) {
|
||||
// 同时支持字符串和数字类型的匹配
|
||||
const index = educationData.findIndex(item => {
|
||||
const itemValue = String(item.value);
|
||||
return itemValue === currentEducation;
|
||||
});
|
||||
if (index >= 0) {
|
||||
defaultIndex = [index];
|
||||
console.log('找到学历默认索引:', index, '当前值:', currentEducation);
|
||||
} else {
|
||||
// 如果字符串匹配失败,尝试数字匹配
|
||||
const currentNum = Number(currentEducation);
|
||||
if (!isNaN(currentNum)) {
|
||||
const numIndex = educationData.findIndex(item => {
|
||||
const itemValue = Number(item.value);
|
||||
return !isNaN(itemValue) && itemValue === currentNum;
|
||||
});
|
||||
if (numIndex >= 0) {
|
||||
defaultIndex = [numIndex];
|
||||
console.log('通过数字匹配找到学历默认索引:', numIndex, '当前值:', currentNum);
|
||||
} else {
|
||||
console.warn('未找到匹配的学历值:', currentEducation, '可用值:', educationData.map(item => item.value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const changeEducation = () => {
|
||||
openSelectPopup({
|
||||
title: '学历',
|
||||
maskClick: true,
|
||||
data: [educationData],
|
||||
defaultIndex: defaultIndex,
|
||||
data: [oneDictData('education')],
|
||||
success: (_, [value]) => {
|
||||
console.log('切换学历选择,新值:', value.value);
|
||||
fromValue.education = String(value.value); // 确保存储为字符串
|
||||
|
||||
// 使用相同的字典数据查找逻辑
|
||||
const eduValue = String(value.value);
|
||||
const eduItem = dictStore.state.education.find(item => String(item.value) === eduValue);
|
||||
if (eduItem && eduItem.label) {
|
||||
console.log('从字典数据中找到学历标签:', eduItem.label);
|
||||
state.educationText = eduItem.label;
|
||||
} else {
|
||||
// 如果没找到,尝试重新加载字典数据
|
||||
console.log('字典中未找到对应标签,尝试重新加载字典数据');
|
||||
getDictSelectOption('education').then((data) => {
|
||||
dictStore.state.education = data;
|
||||
const newEduItem = data.find(item => String(item.value) === eduValue);
|
||||
if (newEduItem && newEduItem.label) {
|
||||
state.educationText = newEduItem.label;
|
||||
}
|
||||
});
|
||||
}
|
||||
fromValue.education = value.value;
|
||||
state.educationText = value.label;
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
const changeSex = (sex) => {
|
||||
fromValue.sex = sex;
|
||||
};
|
||||
|
||||
// 密码实时校验
|
||||
const validatePassword = () => {
|
||||
const password = (fromValue.ytjPassword || '').trim();
|
||||
|
||||
// 如果为空,清除错误信息
|
||||
if (!password) {
|
||||
passwordError.value = '';
|
||||
return;
|
||||
}
|
||||
|
||||
// 校验规则:长度8位,包含大小写字母和数字,至少各有一个
|
||||
if (password.length !== 8) {
|
||||
passwordError.value = '密码长度必须为8位';
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查是否包含大写字母
|
||||
const hasUpperCase = /[A-Z]/.test(password);
|
||||
// 检查是否包含小写字母
|
||||
const hasLowerCase = /[a-z]/.test(password);
|
||||
// 检查是否包含数字
|
||||
const hasNumber = /[0-9]/.test(password);
|
||||
|
||||
if (!hasUpperCase) {
|
||||
passwordError.value = '密码必须包含至少一个大写字母';
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasLowerCase) {
|
||||
passwordError.value = '密码必须包含至少一个小写字母';
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasNumber) {
|
||||
passwordError.value = '密码必须包含至少一个数字';
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查是否只包含字母和数字
|
||||
if (!/^[A-Za-z0-9]+$/.test(password)) {
|
||||
passwordError.value = '密码只能包含大小写字母和数字';
|
||||
return;
|
||||
}
|
||||
|
||||
// 校验通过
|
||||
passwordError.value = '';
|
||||
};
|
||||
|
||||
const changePoliticalAffiliation = () => {
|
||||
openSelectPopup({
|
||||
title: '政治面貌',
|
||||
@@ -697,7 +188,6 @@ const changePoliticalAffiliation = () => {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
function generateDatePickerArrays(startYear = 1975, endYear = new Date().getFullYear()) {
|
||||
const years = [];
|
||||
const months = [];
|
||||
@@ -717,39 +207,14 @@ function generateDatePickerArrays(startYear = 1975, endYear = new Date().getFull
|
||||
}
|
||||
|
||||
function isValidDate(dateString) {
|
||||
// 添加空值检查
|
||||
if (!dateString || typeof dateString !== 'string' || dateString.trim() === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
const dateParts = dateString.split('-');
|
||||
if (dateParts.length !== 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const [year, month, day] = dateParts.map(Number);
|
||||
|
||||
// 检查是否为有效数字
|
||||
if (isNaN(year) || isNaN(month) || isNaN(day)) {
|
||||
return false;
|
||||
}
|
||||
const [year, month, day] = dateString.split('-').map(Number);
|
||||
|
||||
const date = new Date(year, month - 1, day); // 月份从0开始
|
||||
return date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day;
|
||||
}
|
||||
|
||||
const calculateAge = (birthDate) => {
|
||||
// 添加空值检查
|
||||
if (!birthDate) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const birth = new Date(birthDate);
|
||||
// 检查日期是否有效
|
||||
if (isNaN(birth.getTime())) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const today = new Date();
|
||||
let age = today.getFullYear() - birth.getFullYear();
|
||||
const monthDiff = today.getMonth() - birth.getMonth();
|
||||
@@ -784,33 +249,13 @@ function getFormCompletionPercent(form) {
|
||||
}
|
||||
// 主函数
|
||||
function getDatePickerIndexes(dateStr) {
|
||||
// 添加空值检查,如果dateStr为空或null,返回默认值(当前日期)
|
||||
if (!dateStr || typeof dateStr !== 'string' || dateStr.trim() === '') {
|
||||
const today = new Date();
|
||||
const year = today.getFullYear().toString();
|
||||
const month = (today.getMonth() + 1).toString().padStart(2, '0');
|
||||
const day = today.getDate().toString().padStart(2, '0');
|
||||
dateStr = `${year}-${month}-${day}`;
|
||||
}
|
||||
|
||||
let dateParts = dateStr.split('-');
|
||||
if (dateParts.length !== 3) {
|
||||
// 如果分割后不是3部分,使用当前日期作为默认值
|
||||
const today = new Date();
|
||||
const year = today.getFullYear().toString();
|
||||
const month = (today.getMonth() + 1).toString().padStart(2, '0');
|
||||
const day = today.getDate().toString().padStart(2, '0');
|
||||
dateStr = `${year}-${month}-${day}`;
|
||||
dateParts = dateStr.split('-');
|
||||
}
|
||||
|
||||
const [year, month, day] = dateParts;
|
||||
const [year, month, day] = dateStr.split('-');
|
||||
|
||||
const [years, months, days] = generateDatePickerArrays();
|
||||
|
||||
const yearIndex = years.indexOf(year) >= 0 ? years.indexOf(year) : 0;
|
||||
const monthIndex = months.indexOf(month) >= 0 ? months.indexOf(month) : 0;
|
||||
const dayIndex = days.indexOf(day) >= 0 ? days.indexOf(day) : 0;
|
||||
const yearIndex = years.indexOf(year);
|
||||
const monthIndex = months.indexOf(month);
|
||||
const dayIndex = days.indexOf(day);
|
||||
|
||||
return [yearIndex, monthIndex, dayIndex];
|
||||
}
|
||||
@@ -842,19 +287,6 @@ function getDatePickerIndexes(dateStr) {
|
||||
height: 80rpx;
|
||||
border-bottom: 2rpx solid #EBEBEB
|
||||
position: relative;
|
||||
.error-message
|
||||
color: #ff4757;
|
||||
font-size: 24rpx;
|
||||
margin-top: 10rpx;
|
||||
line-height: 1.4;
|
||||
.success-message
|
||||
color: #2ed573;
|
||||
font-size: 24rpx;
|
||||
margin-top: 10rpx;
|
||||
line-height: 1.4;
|
||||
.input-error
|
||||
.input-con
|
||||
border-bottom-color: #ff4757;
|
||||
.triangle::before
|
||||
position: absolute;
|
||||
right: 20rpx;
|
||||
@@ -875,28 +307,6 @@ function getDatePickerIndexes(dateStr) {
|
||||
border-radius: 2rpx
|
||||
background: #697279;
|
||||
transform: rotate(45deg)
|
||||
.input-nx
|
||||
position: relative
|
||||
border-bottom: 2rpx solid #EBEBEB
|
||||
padding-bottom: 30rpx
|
||||
display: flex
|
||||
flex-wrap: wrap
|
||||
.nx-item
|
||||
padding: 16rpx 24rpx
|
||||
width: fit-content
|
||||
border-radius: 20rpx
|
||||
border: 2rpx solid #E8EAEE
|
||||
background-color: #f8f9fa
|
||||
margin-right: 16rpx
|
||||
margin-top: 16rpx
|
||||
font-size: 28rpx
|
||||
color: #333333
|
||||
transition: all 0.2s ease
|
||||
|
||||
&:hover
|
||||
background-color: #e9ecef
|
||||
border-color: #256bfa
|
||||
color: #256bfa
|
||||
.content-sex
|
||||
height: 110rpx;
|
||||
display: flex
|
||||
@@ -933,130 +343,4 @@ function getDatePickerIndexes(dateStr) {
|
||||
color: #FFFFFF;
|
||||
text-align: center;
|
||||
line-height: 90rpx
|
||||
|
||||
// 技能信息样式
|
||||
.content-skills
|
||||
margin-bottom: 52rpx
|
||||
|
||||
.skills-header
|
||||
display: flex
|
||||
justify-content: space-between
|
||||
align-items: center
|
||||
margin-bottom: 32rpx
|
||||
|
||||
.input-titile
|
||||
font-weight: 400
|
||||
font-size: 28rpx
|
||||
color: #6A6A6A
|
||||
|
||||
.add-skill-btn
|
||||
padding: 16rpx 32rpx
|
||||
background: #256BFA
|
||||
color: #FFFFFF
|
||||
border-radius: 8rpx
|
||||
font-size: 26rpx
|
||||
font-weight: 500
|
||||
transition: all 0.3s ease
|
||||
|
||||
&:active
|
||||
background: #1a5cd9
|
||||
transform: scale(0.98)
|
||||
|
||||
&.disabled
|
||||
background: #CCCCCC
|
||||
color: #999999
|
||||
cursor: not-allowed
|
||||
|
||||
&:active
|
||||
background: #CCCCCC
|
||||
transform: none
|
||||
|
||||
.skills-list
|
||||
.skill-item
|
||||
background: #FFFFFF
|
||||
border: 2rpx solid #E8EAEE
|
||||
border-radius: 12rpx
|
||||
padding: 24rpx
|
||||
margin-bottom: 24rpx
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05)
|
||||
transition: all 0.3s ease
|
||||
|
||||
&:hover
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.1)
|
||||
border-color: #256BFA
|
||||
|
||||
.skill-header
|
||||
display: flex
|
||||
justify-content: space-between
|
||||
align-items: center
|
||||
margin-bottom: 20rpx
|
||||
|
||||
.skill-number
|
||||
font-weight: 500
|
||||
font-size: 28rpx
|
||||
color: #333333
|
||||
|
||||
.skill-actions
|
||||
.action-btn
|
||||
padding: 8rpx 16rpx
|
||||
border-radius: 6rpx
|
||||
font-size: 24rpx
|
||||
font-weight: 400
|
||||
transition: all 0.2s ease
|
||||
|
||||
&.delete-btn
|
||||
background: #FF4D4F
|
||||
color: #FFFFFF
|
||||
|
||||
&:active
|
||||
background: #D9363E
|
||||
transform: scale(0.95)
|
||||
|
||||
.skill-fields
|
||||
display: flex
|
||||
flex-direction: column
|
||||
gap: 20rpx
|
||||
|
||||
.skill-field
|
||||
.field-label
|
||||
font-weight: 400
|
||||
font-size: 26rpx
|
||||
color: #6A6A6A
|
||||
margin-bottom: 8rpx
|
||||
|
||||
.field-input
|
||||
font-weight: 400
|
||||
font-size: 28rpx
|
||||
color: #333333
|
||||
line-height: 72rpx
|
||||
height: 72rpx
|
||||
border: 2rpx solid #E8EAEE
|
||||
border-radius: 8rpx
|
||||
padding: 0 20rpx
|
||||
background: #F8F9FA
|
||||
transition: all 0.3s ease
|
||||
|
||||
&:focus
|
||||
border-color: #256BFA
|
||||
background: #FFFFFF
|
||||
|
||||
&.triangle::before
|
||||
right: 30rpx
|
||||
top: calc(50% - 2rpx)
|
||||
|
||||
&.triangle::after
|
||||
right: 30rpx
|
||||
top: 50%
|
||||
|
||||
.empty-skills
|
||||
text-align: center
|
||||
padding: 60rpx 0
|
||||
background: #F8F9FA
|
||||
border-radius: 12rpx
|
||||
border: 2rpx dashed #E8EAEE
|
||||
|
||||
.empty-text
|
||||
font-size: 28rpx
|
||||
color: #999999
|
||||
font-weight: 400
|
||||
</style>
|
||||
|
||||
@@ -16,52 +16,25 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
// 获取雷达图数据
|
||||
function getRadarData() {
|
||||
if (!props.value || !props.value.radarChart) {
|
||||
// 如果没有数据,使用默认值0
|
||||
const defaultRadarChart = {
|
||||
skill: 0,
|
||||
experience: 0,
|
||||
education: 0,
|
||||
salary: 0,
|
||||
age: 0,
|
||||
location: 0
|
||||
};
|
||||
const labels = ['学历', '年龄', '工作地', '技能', '工作经验', '期望薪资'];
|
||||
const data = [defaultRadarChart.education, defaultRadarChart.age, defaultRadarChart.location,
|
||||
defaultRadarChart.skill, defaultRadarChart.experience, defaultRadarChart.salary].map((item) => item * 0.05);
|
||||
return { labels, data };
|
||||
}
|
||||
|
||||
const { skill, experience, education, salary, age, location } = props.value.radarChart;
|
||||
const labels = ['学历', '年龄', '工作地', '技能', '工作经验', '期望薪资'];
|
||||
const data = [education, age, location, skill, experience, salary].map((item) => item * 0.05);
|
||||
return { labels, data };
|
||||
}
|
||||
|
||||
// 监听页面初始化
|
||||
onMounted(() => {
|
||||
// 延迟执行,确保 canvas 已经渲染
|
||||
setTimeout(() => {
|
||||
const { labels, data } = getRadarData();
|
||||
rawRadarChart(labels, data);
|
||||
}, 100);
|
||||
if (Object.keys(props.value).length > 0) {
|
||||
rawRadarChart();
|
||||
}
|
||||
});
|
||||
|
||||
// 监听 props.value 变化
|
||||
watch(
|
||||
() => props.value,
|
||||
(newVal) => {
|
||||
if (newVal) {
|
||||
// 延迟执行,确保数据更新完成
|
||||
setTimeout(() => {
|
||||
const { labels, data } = getRadarData();
|
||||
rawRadarChart(labels, data);
|
||||
}, 50);
|
||||
if (newVal && Object.keys(newVal).length > 0) {
|
||||
const { skill, experience, education, salary, age, location } = newVal.radarChart;
|
||||
const labels = ['学历', '年龄', '工作地', '技能', '工作经验', '期望薪资'];
|
||||
const data = [education, age, location, skill, experience, salary].map((item) => item * 0.05);
|
||||
rawRadarChart(labels, data);
|
||||
}
|
||||
},
|
||||
{ deep: true, immediate: true } // deep 递归监听对象内部变化,immediate 立即执行一次
|
||||
{ deep: true, immediate: false } // deep 递归监听对象内部变化
|
||||
);
|
||||
|
||||
function rawRadarChart(labels, data) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<AppLayout backGorundColor="#F4F4F4">
|
||||
<AppLayout title="" backGorundColor="#F4F4F4">
|
||||
<template #headerleft>
|
||||
<view class="btnback">
|
||||
<image src="@/static/icon/back.png" @click="navBack"></image>
|
||||
@@ -10,45 +10,33 @@
|
||||
<image src="@/static/icon/share.png" @click="shareJob"></image>
|
||||
</view> -->
|
||||
<view class="btn mar_ri10">
|
||||
<image src="@/static/icon/collect3.png" v-if="jobInfo.isCollection!==0" @click="jobCollection"></image>
|
||||
<image src="@/static/icon/collect3.png" v-if="!jobInfo.isCollection" @click="jobCollection"></image>
|
||||
<image src="@/static/icon/collect2.png" v-else @click="jobCollection"></image>
|
||||
</view>
|
||||
</template>
|
||||
<view class="content" v-show="!isEmptyObject(jobInfo)">
|
||||
|
||||
<view class="content-top btn-feel">
|
||||
<view style="background: #ffffff;padding: 24rpx;box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0,0,0,0.04);border-radius: 20rpx 20rpx 20rpx 20rpx;position: relative;overflow: hidden;">
|
||||
<view class="top-salary">
|
||||
<Salary-Expectation
|
||||
:max-salary="jobInfo.maxSalary"
|
||||
:min-salary="jobInfo.minSalary"
|
||||
:is-month="true"
|
||||
></Salary-Expectation>
|
||||
<view class="top-salary">
|
||||
<Salary-Expectation
|
||||
:max-salary="jobInfo.maxSalary"
|
||||
:min-salary="jobInfo.minSalary"
|
||||
:is-month="true"
|
||||
></Salary-Expectation>
|
||||
</view>
|
||||
<view class="top-name">{{ jobInfo.jobTitle }}</view>
|
||||
<view class="top-info">
|
||||
<view class="info-img"><image src="/static/icon/post12.png"></image></view>
|
||||
<view class="info-text">
|
||||
<dict-Label dictType="experience" :value="jobInfo.experience"></dict-Label>
|
||||
</view>
|
||||
<view class="top-name">{{ jobInfo.jobTitle }}</view>
|
||||
<view class="top-info">
|
||||
<view class="info-img"><image src="/static/icon/post12.png"></image></view>
|
||||
<view class="info-text">
|
||||
<dict-Label dictType="experience" :value="jobInfo.experience"></dict-Label>
|
||||
</view>
|
||||
<view class="info-img mar_le20"><image src="/static/icon/post13.png"></image></view>
|
||||
<view class="info-text">
|
||||
<dict-Label dictType="education" :value="jobInfo.education"></dict-Label>
|
||||
</view>
|
||||
<view class="info-img mar_le20"><image src="/static/icon/post13.png"></image></view>
|
||||
<view class="info-text">
|
||||
<dict-Label dictType="education" :value="jobInfo.education"></dict-Label>
|
||||
</view>
|
||||
<!-- <view class="position-source">
|
||||
<text>来源 </text>
|
||||
{{ jobInfo.dataSource }}
|
||||
</view> -->
|
||||
<view class="position-source">
|
||||
<view class="btn">
|
||||
<image src="@/static/icon/collect3.png" v-if="jobInfo.isCollection!==0" @click="jobCollection"></image>
|
||||
<image src="@/static/icon/collect2.png" v-else @click="jobCollection"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="publish-time" v-if="jobInfo.postingDate">
|
||||
{{ formatPublishTime(jobInfo.postingDate) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="position-source">
|
||||
<text>来源 </text>
|
||||
{{ jobInfo.dataSource }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="ai-explain" v-if="jobInfo.isExplain">
|
||||
@@ -68,46 +56,13 @@
|
||||
{{ jobInfo.description }}
|
||||
</view>
|
||||
</view>
|
||||
<!-- 职位图片 -->
|
||||
<view class="content-card" v-if="jobInfo.filesList && jobInfo.filesList.length > 0">
|
||||
<view class="card-title">
|
||||
<text class="title">职位图片</text>
|
||||
</view>
|
||||
<view class="job-images">
|
||||
<view class="image-item" v-for="(file, index) in jobInfo.filesList" :key="file.id">
|
||||
<image :src="file.fileUrl" mode="aspectFit" @click="previewImage(file.fileUrl, index)"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 联系人信息 -->
|
||||
<view class="content-card" v-if="jobInfo.jobContactList && jobInfo.jobContactList.length > 0">
|
||||
<view class="card-title">
|
||||
<text class="title">联系人信息</text>
|
||||
</view>
|
||||
<view class="contact-list">
|
||||
<view class="contact-item" v-for="(contact, index) in jobInfo.jobContactList" :key="index">
|
||||
<view class="contact-info">
|
||||
<view class="contact-label">联系人:</view>
|
||||
<view class="contact-value">{{ contact.contactPerson }}</view>
|
||||
</view>
|
||||
<view class="contact-info">
|
||||
<view class="contact-label">职位:</view>
|
||||
<view class="contact-value">{{ contact.position }}</view>
|
||||
</view>
|
||||
<view class="contact-info">
|
||||
<view class="contact-label">电话:</view>
|
||||
<view class="contact-value">{{ contact.contactPersonPhone }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 公司信息 -->
|
||||
<view class="content-card">
|
||||
<view class="card-title">
|
||||
<text class="title">公司信息</text>
|
||||
<text
|
||||
class="btntext button-click"
|
||||
@click="handleCompanyDetailClick"
|
||||
@click="navTo(`/packageA/pages/UnitDetails/UnitDetails?companyId=${jobInfo.company.companyId}`)"
|
||||
>
|
||||
单位详情
|
||||
</text>
|
||||
@@ -143,7 +98,7 @@
|
||||
></map>
|
||||
</view>
|
||||
</view>
|
||||
<view class="content-card" v-if="currentUserType !== 0">
|
||||
<view class="content-card" v-if="!userInfo.isCompanyUser">
|
||||
<view class="card-title">
|
||||
<text class="title">竞争力分析</text>
|
||||
</view>
|
||||
@@ -171,15 +126,16 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="content-card" v-if="currentUserType === 0">
|
||||
<view class="content-card" v-else>
|
||||
<view class="card-title">
|
||||
<view class="title">申请人列表</view>
|
||||
</view>
|
||||
<view class="applicant-list">
|
||||
<view v-for="applicant in jobInfo.applyUsers" :key="applicant.userId" class="applicant-item">
|
||||
<view v-for="applicant in applicants" :key="applicant.userId" class="applicant-item">
|
||||
<view class="item-header">
|
||||
<view class="name">{{ applicant.name }}</view>
|
||||
<view class="right-header">
|
||||
<view class="matching-degree">匹配度:{{ applicant.matchingDegree }}</view>
|
||||
<button class="resume-button" @click="viewResume(applicant.userId)">查看简历</button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -204,8 +160,8 @@
|
||||
期望薪资:
|
||||
<Salary-Expectation
|
||||
style="display: inline-block"
|
||||
:max-salary="applicant.salaryMax"
|
||||
:min-salary="applicant.salaryMin"
|
||||
:max-salary="applicant.maxSalary"
|
||||
:min-salary="applicant.minSalary"
|
||||
:is-month="true"
|
||||
></Salary-Expectation>
|
||||
</view>
|
||||
@@ -218,7 +174,7 @@
|
||||
<view style="height: 34px"></view>
|
||||
<template #footer>
|
||||
<view class="footer">
|
||||
<view class="btn-wq button-click" @click="jobApply">投递简历</view>
|
||||
<view class="btn-wq button-click" @click="jobApply">立即前往</view>
|
||||
</view>
|
||||
</template>
|
||||
<VideoPlayer ref="videoPalyerRef" />
|
||||
@@ -235,12 +191,6 @@ import RadarMap from './component/radarMap.vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import useUserStore from '@/stores/useUserStore';
|
||||
const { userInfo } = storeToRefs(useUserStore());
|
||||
// 与首页一致的用户类型获取:优先store,兜底缓存
|
||||
const currentUserType = computed(() => {
|
||||
const storeIsCompanyUser = userInfo.value?.isCompanyUser;
|
||||
const cachedIsCompanyUser = (uni.getStorageSync('userInfo') || {}).isCompanyUser;
|
||||
return Number(storeIsCompanyUser !== undefined ? storeIsCompanyUser : cachedIsCompanyUser);
|
||||
});
|
||||
const { $api, navTo, getLenPx, parseQueryParams, navBack, isEmptyObject } = inject('globalFunction');
|
||||
import config from '@/config.js';
|
||||
const matchingDegree = ref(['一般', '良好', '优秀', '极好']);
|
||||
@@ -250,47 +200,52 @@ const jobInfo = ref({});
|
||||
const state = reactive({});
|
||||
const mapCovers = ref([]);
|
||||
const jobIdRef = ref();
|
||||
// 竞争力分析数据,初始化为包含默认值的完整结构,确保雷达图能正常渲染
|
||||
const raderData = ref({
|
||||
matchScore: 0,
|
||||
rank: 0,
|
||||
percentile: 0,
|
||||
radarChart: {
|
||||
skill: 0,
|
||||
experience: 0,
|
||||
education: 0,
|
||||
salary: 0,
|
||||
age: 0,
|
||||
location: 0
|
||||
}
|
||||
});
|
||||
const raderData = ref({});
|
||||
const videoPalyerRef = ref(null);
|
||||
const explainUrlRef = ref('');
|
||||
|
||||
// 申请人列表直接使用接口返回的applyUsers数组
|
||||
const applicants = ref([
|
||||
{
|
||||
createTime: null,
|
||||
userId: 1,
|
||||
name: '青岛测试账号331',
|
||||
age: '28', // 假设年龄有值
|
||||
sex: '1',
|
||||
birthDate: null,
|
||||
education: '4',
|
||||
politicalAffiliation: '',
|
||||
phone: '',
|
||||
avatar: '',
|
||||
salaryMin: '10000',
|
||||
salaryMax: '15000',
|
||||
area: '3',
|
||||
status: '0',
|
||||
loginIp: '',
|
||||
loginDate: null,
|
||||
jobTitleId: '157,233,373',
|
||||
experience: '3',
|
||||
isRecommend: 1,
|
||||
jobTitle: ['人力资源专员/助理', 'Java', '运维工程师'],
|
||||
applyDate: '2025-09-26',
|
||||
matchingDegree: 1,
|
||||
},
|
||||
]);
|
||||
|
||||
onLoad((option) => {
|
||||
console.log(option, 'option');
|
||||
if (option.jobId) {
|
||||
initLoad(option);
|
||||
}
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
// 仅在 H5 环境中从 URL 获取参数(小程序环境中 onShow 不会传递 URL 参数)
|
||||
// #ifdef H5
|
||||
try {
|
||||
const option = parseQueryParams(); // 兼容微信内置浏览器
|
||||
if (option.jobId) {
|
||||
initLoad(option);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('onShow 中解析 URL 参数失败:', e);
|
||||
const option = parseQueryParams(); // 兼容微信内置浏览器
|
||||
if (option.jobId) {
|
||||
initLoad(option);
|
||||
}
|
||||
// #endif
|
||||
});
|
||||
|
||||
function initLoad(option) {
|
||||
const jobId = decodeURIComponent(option.jobId);
|
||||
const jobId = atob(option.jobId);
|
||||
if (jobId !== jobIdRef.value) {
|
||||
jobIdRef.value = jobId;
|
||||
getDetail(jobId);
|
||||
@@ -308,11 +263,11 @@ function seeExplain() {
|
||||
function getDetail(jobId) {
|
||||
return new Promise((reslove, reject) => {
|
||||
$api.createRequest(`/app/job/${jobId}`).then((resData) => {
|
||||
const { latitude, longitude, companyName, companyId } = resData.data;
|
||||
const { latitude, longitude, companyName, companyId, isCompanyUser } = resData.data;
|
||||
jobInfo.value = resData.data;
|
||||
reslove(resData.data);
|
||||
getCompanyIsAJobs(companyId);
|
||||
if (currentUserType.value !== 0) {
|
||||
if (isCompanyUser) {
|
||||
getCompetivetuveness(jobId);
|
||||
}
|
||||
// getCompetivetuveness(jobId);
|
||||
@@ -340,14 +295,9 @@ function getDetail(jobId) {
|
||||
}
|
||||
|
||||
function getCompanyIsAJobs(companyId) {
|
||||
if (companyId) {
|
||||
$api.createRequest(`/app/company/count/${companyId}`).then((resData) => {
|
||||
companyCount.value = resData.data;
|
||||
});
|
||||
}
|
||||
// $api.createRequest(`/app/company/count/${companyId}`).then((resData) => {
|
||||
// companyCount.value = resData.data;
|
||||
// });
|
||||
$api.createRequest(`/app/company/count/${companyId}`).then((resData) => {
|
||||
companyCount.value = resData.data;
|
||||
});
|
||||
}
|
||||
|
||||
function getTextWidth(text, size = 12) {
|
||||
@@ -359,87 +309,25 @@ function getTextWidth(text, size = 12) {
|
||||
|
||||
function getCompetivetuveness(jobId) {
|
||||
$api.createRequest(`/app/job/competitiveness/${jobId}`, {}, 'GET').then((resData) => {
|
||||
// 如果接口返回的数据为 null 或空,使用默认值0
|
||||
if (resData && resData.data) {
|
||||
// 确保 radarChart 字段存在,如果不存在则使用默认值
|
||||
const radarChart = resData.data.radarChart || {
|
||||
skill: 0,
|
||||
experience: 0,
|
||||
education: 0,
|
||||
salary: 0,
|
||||
age: 0,
|
||||
location: 0
|
||||
};
|
||||
|
||||
raderData.value = {
|
||||
matchScore: resData.data.matchScore || 0,
|
||||
rank: resData.data.rank || 0,
|
||||
percentile: resData.data.percentile || 0,
|
||||
radarChart: radarChart
|
||||
};
|
||||
currentStep.value = (resData.data.matchScore || 0) * 0.04;
|
||||
} else {
|
||||
// 接口返回 null 或空数据时,使用默认值0
|
||||
raderData.value = {
|
||||
matchScore: 0,
|
||||
rank: 0,
|
||||
percentile: 0,
|
||||
radarChart: {
|
||||
skill: 0,
|
||||
experience: 0,
|
||||
education: 0,
|
||||
salary: 0,
|
||||
age: 0,
|
||||
location: 0
|
||||
}
|
||||
};
|
||||
currentStep.value = 0;
|
||||
}
|
||||
}).catch((error) => {
|
||||
// 接口请求失败时,使用默认值0
|
||||
console.error('获取竞争力分析失败:', error);
|
||||
raderData.value = {
|
||||
matchScore: 0,
|
||||
rank: 0,
|
||||
percentile: 0,
|
||||
radarChart: {
|
||||
skill: 0,
|
||||
experience: 0,
|
||||
education: 0,
|
||||
salary: 0,
|
||||
age: 0,
|
||||
location: 0
|
||||
}
|
||||
};
|
||||
currentStep.value = 0;
|
||||
raderData.value = resData.data;
|
||||
currentStep.value = resData.data.matchScore * 0.04;
|
||||
});
|
||||
}
|
||||
|
||||
// 申请岗位
|
||||
function jobApply() {
|
||||
const tokenValue = uni.getStorageSync('token') || '';
|
||||
if (!tokenValue) {
|
||||
$api.msg('请您先登录');
|
||||
return;
|
||||
}
|
||||
const jobId = jobInfo.value.jobId;
|
||||
$api.createRequest(`/app/job/apply/${jobId}`, {}, 'GET').then((resData) => {
|
||||
if (jobInfo.value.isApply) {
|
||||
const jobUrl = jobInfo.value.jobUrl;
|
||||
return window.open(jobUrl);
|
||||
} else {
|
||||
$api.createRequest(`/app/job/apply/${jobId}`, {}, 'GET').then((resData) => {
|
||||
getDetail(jobId);
|
||||
$api.msg('申请成功');
|
||||
const jobUrl = jobInfo.value.jobUrl;
|
||||
// return window.open(jobUrl);
|
||||
return window.open(jobUrl);
|
||||
});
|
||||
// if (jobInfo.value.isApply) {
|
||||
// const jobUrl = jobInfo.value.jobUrl;
|
||||
// return window.open(jobUrl);
|
||||
// } else {
|
||||
// $api.createRequest(`/app/job/apply/${jobId}`, {}, 'GET').then((resData) => {
|
||||
// getDetail(jobId);
|
||||
// $api.msg('申请成功');
|
||||
// const jobUrl = jobInfo.value.jobUrl;
|
||||
// return window.open(jobUrl);
|
||||
// });
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
// 取消/收藏岗位
|
||||
@@ -472,58 +360,6 @@ function getClass(index) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
// 格式化发布时间
|
||||
function formatPublishTime(dateString) {
|
||||
if (!dateString) return '';
|
||||
|
||||
const date = new Date(dateString);
|
||||
const now = new Date();
|
||||
const diffTime = Math.abs(now - date);
|
||||
const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24));
|
||||
|
||||
if (diffDays === 0) {
|
||||
return '今天发布';
|
||||
} else if (diffDays === 1) {
|
||||
return '昨天发布';
|
||||
} else if (diffDays < 7) {
|
||||
return `${diffDays}天前发布`;
|
||||
} else if (diffDays < 30) {
|
||||
const weeks = Math.floor(diffDays / 7);
|
||||
return `${weeks}周前发布`;
|
||||
} else {
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth() + 1;
|
||||
const day = date.getDate();
|
||||
return `${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
|
||||
}
|
||||
}
|
||||
|
||||
// 预览图片
|
||||
function previewImage(url, index) {
|
||||
// 获取所有图片的URL列表
|
||||
const allImageUrls = jobInfo.value.filesList.map(file => file.fileUrl);
|
||||
uni.previewImage({
|
||||
urls: allImageUrls,
|
||||
current: index
|
||||
});
|
||||
}
|
||||
|
||||
// 查看简历
|
||||
function viewResume(userId) {
|
||||
navTo(`/packageA/pages/resumeDetail/resumeDetail?userId=${userId}`);
|
||||
}
|
||||
|
||||
// 处理查看单位详情
|
||||
function handleCompanyDetailClick() {
|
||||
// console.log('----企业ID--', jobInfo.value.company?.companyId)
|
||||
// console.log('----企业data--', jobInfo.value)
|
||||
if (jobInfo.value.company?.companyId) {
|
||||
navTo(`/packageA/pages/UnitDetails/UnitDetails?companyId=${jobInfo.value.company.companyId}`);
|
||||
} else {
|
||||
$api.msg('没有企业信息');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
@@ -625,55 +461,6 @@ for i in 0..100
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 职位图片样式
|
||||
.job-images{
|
||||
margin-top: 30rpx
|
||||
display: flex
|
||||
flex-wrap: wrap
|
||||
gap: 20rpx
|
||||
.image-item{
|
||||
width: calc(50% - 10rpx)
|
||||
height: 300rpx
|
||||
border-radius: 12rpx
|
||||
overflow: hidden
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1)
|
||||
image{
|
||||
width: 100%
|
||||
height: 100%
|
||||
object-fit: cover
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 联系人信息样式
|
||||
.contact-list{
|
||||
margin-top: 30rpx
|
||||
.contact-item{
|
||||
padding: 20rpx
|
||||
background-color: #f8f9fa
|
||||
border-radius: 12rpx
|
||||
.contact-info{
|
||||
display: flex
|
||||
align-items: center
|
||||
margin-bottom: 15rpx
|
||||
&:last-child{
|
||||
margin-bottom: 0
|
||||
}
|
||||
.contact-label{
|
||||
font-weight: 500
|
||||
font-size: 28rpx
|
||||
color: #333333
|
||||
width: 120rpx
|
||||
}
|
||||
.contact-value{
|
||||
font-weight: 400
|
||||
font-size: 28rpx
|
||||
color: #495265
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// ai
|
||||
.ai-explain{
|
||||
margin-top: 28rpx
|
||||
@@ -716,11 +503,11 @@ for i in 0..100
|
||||
.content{
|
||||
padding: 0 28rpx
|
||||
height: 100%
|
||||
padding-top: 28rpx
|
||||
.content-top{
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0,0,0,0.04);
|
||||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||||
padding: 24rpx
|
||||
padding: 52rpx 32rpx 34rpx 32rpx
|
||||
position: relative
|
||||
overflow: hidden
|
||||
.top-salary{
|
||||
@@ -754,7 +541,7 @@ for i in 0..100
|
||||
top: 0
|
||||
right: 0
|
||||
width: fit-content;
|
||||
height: 65rpx;
|
||||
height: 76rpx;
|
||||
padding: 0 24rpx
|
||||
background: rgba(37,107,250,0.1);
|
||||
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0,0,0,0.04);
|
||||
@@ -840,20 +627,6 @@ for i in 0..100
|
||||
}
|
||||
}
|
||||
}
|
||||
/* #ifdef H5 */
|
||||
.footer{
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
padding: 20rpx 0!important
|
||||
z-index: 1000;
|
||||
.btn-wq{
|
||||
display: block;
|
||||
width: 94%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
/* #endif */
|
||||
.footer{
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0rpx -4rpx 24rpx 0rpx rgba(11,44,112,0.12);
|
||||
|
||||
@@ -1,385 +0,0 @@
|
||||
<template>
|
||||
<AppLayout backGorundColor="#F4F4F4">
|
||||
<template #headerleft>
|
||||
<view class="btnback">
|
||||
<image src="@/static/icon/back.png" @click="navBack"></image>
|
||||
</view>
|
||||
</template>
|
||||
<template #header>
|
||||
<view class="title">简历详情</view>
|
||||
</template>
|
||||
<view class="mys-container">
|
||||
<!-- 个人信息 -->
|
||||
<view class="mys-tops btn-feel">
|
||||
<view class="tops-left">
|
||||
<view class="name">
|
||||
<text>{{ userInfo.name || '暂无姓名' }}</text>
|
||||
</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.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>
|
||||
<view class="mys-info">
|
||||
<view class="mys-h4">
|
||||
<text>求职期望</text>
|
||||
</view>
|
||||
<view class="mys-text">
|
||||
<text>期望薪资:</text>
|
||||
<text>{{ userInfo.salaryMin / 1000 }}k-{{ userInfo.salaryMax / 1000 }}k</text>
|
||||
</view>
|
||||
<view class="mys-text">
|
||||
<text>期望工作地:</text>
|
||||
<dict-Label dictType="area" :value="Number(userInfo.area)"></dict-Label>
|
||||
</view>
|
||||
<view class="mys-list">
|
||||
<view class="cards" v-for="(title, index) in userInfo.jobTitle" :key="index">
|
||||
{{ title }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 技能列表 -->
|
||||
<view class="work-experience-container">
|
||||
<view class="exp-header">
|
||||
<text class="exp-title">技能</text>
|
||||
</view>
|
||||
<view class="exp-list" v-if="userInfo.appSkillsList && userInfo.appSkillsList.length > 0">
|
||||
<view class="exp-item" v-for="(skill, index) in userInfo.appSkillsList" :key="skill.id">
|
||||
<view class="exp-company-row">
|
||||
<text class="exp-company">{{ skill.name }}</text>
|
||||
<text class="exp-position">{{ getSkillLevelText(skill.levels) }}</text>
|
||||
</view>
|
||||
<view class="exp-divider" v-if="index !== userInfo.appSkillsList.length - 1"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="exp-empty" v-else>
|
||||
<image class="empty-img" src="/static/icons/empty-work.png" mode="widthFix"></image>
|
||||
<text class="empty-text">暂无技能信息</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 工作经历 -->
|
||||
<view class="work-experience-container">
|
||||
<!-- 标题栏:仅显示标题 -->
|
||||
<view class="exp-header">
|
||||
<text class="exp-title">工作经历</text>
|
||||
</view>
|
||||
|
||||
<!-- 工作经历列表 -->
|
||||
<view class="exp-list" v-if="workExperiences.length > 0">
|
||||
<view class="exp-item" v-for="(item, index) in workExperiences" :key="item.id">
|
||||
<!-- 公司名称 + 职位 -->
|
||||
<view class="exp-company-row">
|
||||
<text class="exp-company">{{ item.companyName }}</text>
|
||||
<text class="exp-position">{{ item.position }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 工作时间 -->
|
||||
<view class="exp-date-row">
|
||||
<text class="exp-label">工作时间:</text>
|
||||
<text class="exp-date">{{ item.startDate }} - {{ item.endDate || '至今' }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 工作描述(支持多行) -->
|
||||
<view class="exp-desc-row" v-if="item.description">
|
||||
<text class="exp-label">工作描述:</text>
|
||||
<text class="exp-desc">{{ item.description }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 分隔线(最后一项不显示) -->
|
||||
<view class="exp-divider" v-if="index !== workExperiences.length - 1"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 空状态提示(无工作经历时显示) -->
|
||||
<view class="exp-empty" v-else>
|
||||
<image class="empty-img" src="/static/icons/empty-work.png" mode="widthFix"></image>
|
||||
<text class="empty-text">暂无工作经历</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, inject, ref, onMounted } from 'vue';
|
||||
const { $api, navTo, navBack, config } = inject('globalFunction');
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import useDictStore from '@/stores/useDictStore';
|
||||
const { getDictData } = useDictStore();
|
||||
|
||||
const userInfo = ref({});
|
||||
const workExperiences = ref([]);
|
||||
const isLoading = ref(false);
|
||||
|
||||
// 获取技能等级文本
|
||||
const getSkillLevelText = (level) => {
|
||||
const levelMap = {
|
||||
'1': '初级',
|
||||
'2': '中级',
|
||||
'3': '高级'
|
||||
};
|
||||
return levelMap[level] || level || '暂无等级';
|
||||
};
|
||||
|
||||
// 页面加载时获取数据
|
||||
onLoad((option) => {
|
||||
const { userId } = option;
|
||||
if (userId) {
|
||||
getResumeDetail(userId);
|
||||
}
|
||||
});
|
||||
|
||||
// 获取简历详情
|
||||
const getResumeDetail = async (userId) => {
|
||||
try {
|
||||
isLoading.value = true;
|
||||
const resData = await $api.createRequest(`/app/user/userResume/${userId}`);
|
||||
if (resData.code === 200) {
|
||||
userInfo.value = resData.data;
|
||||
// 从简历详情中获取工作经历,而不是单独请求
|
||||
workExperiences.value = resData.data.experiencesList || [];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取简历详情失败:', error);
|
||||
$api.msg('获取简历详情失败');
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
image{
|
||||
width: 100%;
|
||||
height: 100%
|
||||
}
|
||||
.mys-container{
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
.mys-tops{
|
||||
display: flex
|
||||
justify-content: space-between
|
||||
padding: 52rpx 48rpx
|
||||
.tops-left{
|
||||
.name{
|
||||
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
|
||||
font-weight: 600;
|
||||
font-size: 44rpx;
|
||||
color: #333333;
|
||||
display: flex
|
||||
align-items: center
|
||||
justify-content: flex-start
|
||||
}
|
||||
.subName{
|
||||
margin-top: 12rpx
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
}
|
||||
.tops-right{
|
||||
position: relative
|
||||
.right-imghead{
|
||||
width: 136rpx;
|
||||
height: 136rpx;
|
||||
border-radius: 50%;
|
||||
background: #e8e8e8
|
||||
overflow: hidden
|
||||
}
|
||||
.right-sex{
|
||||
position: absolute
|
||||
right: -10rpx
|
||||
top: -10rpx
|
||||
width: 50rpx
|
||||
height: 50rpx
|
||||
}
|
||||
}
|
||||
}
|
||||
.mys-line{
|
||||
margin: 0 28rpx
|
||||
height: 0rpx;
|
||||
border-radius: 0rpx 0rpx 0rpx 0rpx;
|
||||
border: 2rpx dashed #000000;
|
||||
opacity: 0.16;
|
||||
}
|
||||
.mys-info{
|
||||
padding: 28rpx
|
||||
.mys-h4{
|
||||
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
|
||||
font-weight: 600;
|
||||
font-size: 32rpx;
|
||||
color: #000000;
|
||||
margin-bottom: 8rpx
|
||||
display: flex;
|
||||
justify-content: space-between
|
||||
align-items: center
|
||||
}
|
||||
.mys-text{
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
margin-top: 16rpx
|
||||
}
|
||||
.mys-list{
|
||||
display: flex
|
||||
align-items: center
|
||||
flex-wrap: wrap;
|
||||
.cards{
|
||||
margin: 28rpx 28rpx 0 0
|
||||
height: 80rpx;
|
||||
padding: 0 38rpx;
|
||||
width: fit-content
|
||||
display: flex
|
||||
align-items: center
|
||||
justify-content: center
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
border: 2rpx solid #E8EAEE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 容器样式(适配多端,用rpx做单位) */
|
||||
.work-experience-container {
|
||||
padding: 20rpx 30rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 16rpx;
|
||||
margin: 20rpx;
|
||||
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
/* 标题栏:两端对齐 */
|
||||
.exp-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 25rpx;
|
||||
}
|
||||
|
||||
.exp-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* 经历列表容器 */
|
||||
.exp-list {
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
/* 单个经历卡片 */
|
||||
.exp-item {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
/* 公司名称 + 职位(横向排列,职位右对齐) */
|
||||
.exp-company-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 15rpx;
|
||||
}
|
||||
|
||||
.exp-company {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.exp-position {
|
||||
font-size: 24rpx;
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* 工作时间/描述:标签+内容横向排列 */
|
||||
.exp-date-row, .exp-desc-row {
|
||||
display: flex;
|
||||
margin-bottom: 12rpx;
|
||||
line-height: 1.6;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* 标签样式(固定宽度,统一对齐) */
|
||||
.exp-label {
|
||||
font-size: 26rpx;
|
||||
color: #000;
|
||||
min-width: 160rpx;
|
||||
}
|
||||
|
||||
/* 内容样式 */
|
||||
.exp-date, .exp-desc {
|
||||
font-size: 26rpx;
|
||||
color: #000000;
|
||||
flex: 1; /* 内容占满剩余宽度,支持换行 */
|
||||
}
|
||||
|
||||
/* 工作描述(支持多行换行) */
|
||||
.exp-desc {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
/* 分隔线 */
|
||||
.exp-divider {
|
||||
height: 1rpx;
|
||||
background-color: #f5f5f5;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
/* 空状态样式 */
|
||||
.exp-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 80rpx 0;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.empty-img {
|
||||
width: 140rpx;
|
||||
height: auto;
|
||||
margin-bottom: 25rpx;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 26rpx;
|
||||
text-align: center;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.btnback{
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #000000;
|
||||
text-align: center;
|
||||
margin-right: 64rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -50,8 +50,7 @@ const { $api, navTo, navBack } = inject('globalFunction');
|
||||
const weekMap = ['日', '一', '二', '三', '四', '五', '六'];
|
||||
const calendarData = ref([]);
|
||||
const current = ref({});
|
||||
import lunarModule from '@/packageA/lib/lunar-javascript@1.7.2.js';
|
||||
const { Solar, Lunar } = lunarModule;
|
||||
import { Solar, Lunar } from '@/lib/lunar-javascript@1.7.2.js';
|
||||
|
||||
const isRecord = ref(false);
|
||||
const recordNum = ref(4);
|
||||
|
||||
@@ -53,7 +53,7 @@ function nextDetail() {
|
||||
recommedIndexDb.addRecord(recordData);
|
||||
}
|
||||
console.log(job.jobId);
|
||||
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(job.jobId)}`);
|
||||
navTo(`/packageA/pages/post/post?jobId=${btoa(job.jobId)}`);
|
||||
}
|
||||
|
||||
function getNextVideoSrc(num) {
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import request from "@/utilsRc/request";
|
||||
//政策列表
|
||||
export function getPolicyList(queryParams) {
|
||||
return request({
|
||||
url: "/portal/policyInfo/portalList",
|
||||
method: "get",
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
@@ -1,364 +0,0 @@
|
||||
<template>
|
||||
<div class="app-box">
|
||||
<div class="con-box">
|
||||
<!-- <view class="collection-search">
|
||||
<view class="search-content">
|
||||
<view class="header-input button-click">
|
||||
<uni-icons class="iconsearch" color="#6A6A6A" type="search" size="22"></uni-icons>
|
||||
<input
|
||||
class="input"
|
||||
v-model="searchKeyword"
|
||||
@confirm="searchVideo"
|
||||
placeholder="输入考试名称"
|
||||
placeholder-class="inputplace"
|
||||
/>
|
||||
<uni-icons
|
||||
v-if="searchKeyword"
|
||||
class="clear-icon"
|
||||
type="clear"
|
||||
size="24"
|
||||
color="#999"
|
||||
@click="clearSearch"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<scroll-view scroll-y class="main-scroll" @scrolltolower="handleScrollToLower">
|
||||
<div class="cards" v-for="(item,index) in dataList" :key="item.examPaperId">
|
||||
<div class="cardHead">
|
||||
<div class="cardHeadLeft">
|
||||
<div class="cardTitle">{{item.organName}}</div>
|
||||
</div>
|
||||
<div class="rightBtn" @click="handleOperation(item)">机构详情</div>
|
||||
</div>
|
||||
<div class="heng"></div>
|
||||
<div class="cardCon">
|
||||
<div class="conten">机构联系人:{{item.contactName}}</div>
|
||||
<div class="conten">联系方式:{{item.contactPhone}}</div>
|
||||
<div class="conten">机构地址:{{item.address}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</scroll-view>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { inject, ref, reactive } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
const { $api, navTo, navBack,urls } = inject('globalFunction');
|
||||
import config from "@/config.js"
|
||||
const userInfo = ref({});
|
||||
const Authorization = ref('');
|
||||
const searchKeyword = ref('');
|
||||
const dataList=ref([])
|
||||
const pageSize=ref(10)
|
||||
const pageNum=ref(1)
|
||||
const totalNum=ref(0)
|
||||
const baseUrl = config.imgBaseUrl
|
||||
const handleScrollToLower = () => {
|
||||
getDataList('add');
|
||||
};
|
||||
onLoad(() => {
|
||||
|
||||
});
|
||||
onShow(()=>{
|
||||
Authorization.value=uni.getStorageSync('Padmin-Token')||''
|
||||
getDataList('refresh');
|
||||
})
|
||||
// 搜索视频
|
||||
function searchVideo() {
|
||||
getDataList('refresh');
|
||||
}
|
||||
|
||||
// 清除搜索内容
|
||||
function clearSearch() {
|
||||
searchKeyword.value = '';
|
||||
getDataList('refresh');
|
||||
}
|
||||
// 获取考试列表
|
||||
function getDataList(type = 'add') {
|
||||
let maxPage=Math.ceil(totalNum.value/pageSize.value)
|
||||
let params={}
|
||||
if (type === 'refresh') {
|
||||
pageNum.value = 1;
|
||||
params={
|
||||
address:"",
|
||||
pageSize:pageSize.value,
|
||||
pageNum:pageNum.value,
|
||||
}
|
||||
$api.myRequest('/train/public/rate/organ/table', params).then((resData) => {
|
||||
if(resData.code==200){
|
||||
dataList.value=resData.rows
|
||||
totalNum.value=resData.total
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
if (type === 'add' && pageNum.value < maxPage) {
|
||||
pageNum.value += 1;
|
||||
params={
|
||||
address:"",
|
||||
pageSize:pageSize.value,
|
||||
pageNum:pageNum.value,
|
||||
}
|
||||
$api.myRequest('/train/public/rate/organ/table', params).then((resData) => {
|
||||
if(resData.code==200){
|
||||
dataList.value=dataList.value.concat(resData.rows)
|
||||
totalNum.value=resData.total
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function handleOperation(row) {
|
||||
navTo(`/packageB/institution/evaluationAgencyDetail?organId=${row.organId}`);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.app-box{
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
position: relative;
|
||||
.con-box{
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top:0;
|
||||
z-index: 10;
|
||||
padding: 20rpx 28rpx;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
.collection-search{
|
||||
padding: 10rpx 20rpx;
|
||||
.search-content{
|
||||
position: relative
|
||||
display: flex
|
||||
align-items: center
|
||||
padding: 14rpx 0
|
||||
.header-input{
|
||||
padding: 0
|
||||
width: calc(100%);
|
||||
position: relative
|
||||
.iconsearch{
|
||||
position: absolute
|
||||
left: 30rpx;
|
||||
top: 50%
|
||||
transform: translate(0, -50%)
|
||||
z-index: 1
|
||||
}
|
||||
.input{
|
||||
padding: 0 80rpx 0 80rpx
|
||||
height: 80rpx;
|
||||
background: #FFFFFF;
|
||||
border-radius: 75rpx 75rpx 75rpx 75rpx;
|
||||
border: 2rpx solid #ECECEC
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.clear-icon{
|
||||
position: absolute
|
||||
right: 30rpx;
|
||||
top: 50%
|
||||
transform: translate(0, -50%)
|
||||
z-index: 1
|
||||
cursor: pointer
|
||||
}
|
||||
.inputplace{
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #B5B5B5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.main-scroll {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.cards{
|
||||
width: 100%;
|
||||
min-height: 260rpx;
|
||||
height: auto;
|
||||
background: linear-gradient(0deg, #E3EFFF 0%, #FBFDFF 100%);
|
||||
// box-shadow: 0px 0px 6px 0px rgba(0,71,200,0.32);
|
||||
border-radius: 12rpx;
|
||||
border: 2px solid #EDF5FF;
|
||||
margin-bottom: 30rpx;
|
||||
padding: 30rpx 40rpx 0;
|
||||
box-sizing: border-box
|
||||
.cardHead{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.cardHeadLeft{
|
||||
display: flex;
|
||||
align-items: center
|
||||
width: 70%;
|
||||
.cardTitle{
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #0069CB;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.titleType{
|
||||
border-radius: 4px;
|
||||
font-size: 22rpx;
|
||||
color: #157EFF;
|
||||
width: 100rpx;
|
||||
height: 38rpx;
|
||||
text-align: center;
|
||||
line-height: 38rpx;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
.heng{
|
||||
width: 30%;
|
||||
height: 4rpx;
|
||||
background: linear-gradient(88deg, #015EEA 0%, #00C0FA 100%);
|
||||
margin: 10rpx 0 20rpx;
|
||||
}
|
||||
.cardCon{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
.conten{
|
||||
width: 100%;
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
display: flex;
|
||||
align-items: center
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.status-tags{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
.flooter{
|
||||
border-top: 1px solid #ccc;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
view{
|
||||
font-size: 28rpx;
|
||||
margin-left: 30rpx;
|
||||
color: #2175F3;
|
||||
padding-top: 14rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.cards2{
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
background-color: rgba(0,0,0,0.5);
|
||||
z-index: 10000;
|
||||
padding: 100rpx 50rpx;
|
||||
box-sizing: border-box;
|
||||
.cardCon{
|
||||
height: 70%;
|
||||
background-color: #fff;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
.cardHead{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
.titleType{
|
||||
display: inline-block
|
||||
border-radius: 4px;
|
||||
font-size: 22rpx;
|
||||
color: #157EFF;
|
||||
width: 100rpx;
|
||||
height: 38rpx;
|
||||
text-align: center;
|
||||
line-height: 38rpx;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.primary{
|
||||
border: 1px solid #157EFF!important;
|
||||
color: #157EFF!important
|
||||
}
|
||||
.success{
|
||||
border: 1px solid #05A636!important;
|
||||
color: #05A636!important
|
||||
}
|
||||
.info{
|
||||
border: 1px solid #898989!important;
|
||||
color: #898989!important
|
||||
}
|
||||
.tertiary{
|
||||
border: 1px solid #E6A340!important;
|
||||
color: #E6A340!important
|
||||
}
|
||||
.primary2{
|
||||
border: 1px solid #F56C6C!important;
|
||||
color: #F56C6C!important
|
||||
}
|
||||
.rightBtn{
|
||||
width: 140rpx;
|
||||
height: 44rpx;
|
||||
line-height: 44rpx;
|
||||
background: linear-gradient(90deg, #00C0FA 0%, #1271FF 100%);
|
||||
border-radius: 4px;
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.detailTitle{
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
margin: 30rpx 0;
|
||||
}
|
||||
.detailCon{
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
.exam-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 35rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
font-family: 'D-DIN-Medium';
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
color: #409EFF;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.info-divider {
|
||||
width: 2px;
|
||||
background-color: #C3E1FF;
|
||||
}
|
||||
</style>
|
||||
@@ -1,256 +0,0 @@
|
||||
<template>
|
||||
<div class="app-box">
|
||||
<div class="con-box">
|
||||
<div class="cards">
|
||||
<div class="cardHead">
|
||||
<div class="cardHeadLeft">
|
||||
<div class="cardTitle">{{organ.organName}}</div>
|
||||
</div>
|
||||
<div class="rightBtn" @click="handleOperation()"></div>
|
||||
</div>
|
||||
<div class="heng"></div>
|
||||
<div class="cardCon">
|
||||
<div class="conten">机构联系人:{{organ.contactName}}</div>
|
||||
<div class="conten">联系方式:{{organ.contactPhone}}</div>
|
||||
<div class="conten">机构地址:{{organ.address}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 100%;margin-bottom: 40rpx;">
|
||||
<div class="title">
|
||||
<div></div>
|
||||
<div>评价流程说明</div>
|
||||
</div>
|
||||
<div class="kcCon">
|
||||
<div class="kcIntroduction" v-if="organ.processDescription">{{organ.processDescription}}</div>
|
||||
<div v-else style="text-align: center;line-height: 100rpx;">暂无数据</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 100%;margin-bottom: 40rpx;">
|
||||
<div class="title">
|
||||
<div></div>
|
||||
<div>评价项目</div>
|
||||
</div>
|
||||
<div class="kcCon">
|
||||
<div class="kcIntroduction" v-if="organ.organContent">{{organ.organContent}}</div>
|
||||
<div v-else style="text-align: center;line-height: 100rpx;">暂无数据</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 100%;margin-bottom: 30rpx;">
|
||||
<div class="title">
|
||||
<div></div>
|
||||
<div>资质证书</div>
|
||||
</div>
|
||||
<div class="kcCon">
|
||||
<div v-for="(item, index) in certs":key = "index" style="width: 100%;">
|
||||
<div v-for="(url, index2) in item" :key = "index2" style="width: 100%;">
|
||||
<image :src="url" mode="" style="width: 100%;"></image>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="certs.length==0" style="text-align: center;line-height: 100rpx;">暂无数据</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { inject, ref, reactive } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
const { $api, navTo, navBack,urls } = inject('globalFunction');
|
||||
import config from "@/config.js"
|
||||
const organ = ref({});
|
||||
const courses = ref([]);
|
||||
const certs = ref([]);
|
||||
const certs2 = ref([]);
|
||||
const teams=ref([])
|
||||
const certIndex=ref(1)
|
||||
const organId=ref('')
|
||||
const Authorization=ref('')
|
||||
onLoad((options) => {
|
||||
organId.value=options.organId
|
||||
});
|
||||
onShow(()=>{
|
||||
Authorization.value=uni.getStorageSync('Padmin-Token')||''
|
||||
let params={
|
||||
organId:organId.value
|
||||
}
|
||||
$api.myRequest('/train/public/rate/organ/model', params).then((resData) => {
|
||||
if(resData.code==200){
|
||||
organ.value = (resData.data ? resData.data :{});
|
||||
certs2.value = (resData ? JSON.parse(resData.data.zhengshu):[]);
|
||||
for(var i =0;i<certs2.value.length;i++){
|
||||
certs2.value[i].url =config.LCBaseUrl + "/file/minio" + certs2.value[i].url;
|
||||
}
|
||||
var certsArr = [];var flag = 0;
|
||||
for(var i =0;i<certs2.value.length;i++){
|
||||
flag ++
|
||||
certsArr.push(certs2.value[i])
|
||||
if(flag == 3){
|
||||
var arrs = [];
|
||||
for(var j =0;j<3;j++){
|
||||
arrs.push(certsArr[j].url)
|
||||
}
|
||||
certs.value.push(arrs);
|
||||
certsArr = [];
|
||||
flag = 0;
|
||||
}else{
|
||||
if(i == certs2.value.length -1){
|
||||
var arrs = [];
|
||||
for(var j =0;j<certsArr.length;j++){
|
||||
arrs.push(certsArr[j].url)
|
||||
}
|
||||
certs.value.push(arrs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.app-box{
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
position: relative;
|
||||
.con-box{
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top:0;
|
||||
z-index: 10;
|
||||
padding: 20rpx 28rpx;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
.cards{
|
||||
width: 100%;
|
||||
min-height: 260rpx;
|
||||
height: auto;
|
||||
background: linear-gradient(0deg, #D4E3FE 0%, #EBF1FF 100%);
|
||||
border-radius: 12rpx;
|
||||
border: 2px solid #EDF5FF;
|
||||
margin-bottom: 40rpx;
|
||||
padding: 20rpx 30rpx 0;
|
||||
box-sizing: border-box
|
||||
.cardHead{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.cardHeadLeft{
|
||||
display: flex;
|
||||
align-items: center
|
||||
width: 100%;
|
||||
.cardTitle{
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #0069CB;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.titleType{
|
||||
border-radius: 4px;
|
||||
font-size: 22rpx;
|
||||
color: #157EFF;
|
||||
width: 100rpx;
|
||||
height: 38rpx;
|
||||
text-align: center;
|
||||
line-height: 38rpx;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
.heng{
|
||||
width: 30%;
|
||||
height: 4rpx;
|
||||
background: linear-gradient(88deg, #015EEA 0%, #00C0FA 100%);
|
||||
margin: 10rpx 0 20rpx;
|
||||
}
|
||||
.cardCon{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
.conten{
|
||||
width: 100%;
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
display: flex;
|
||||
align-items: center
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.status-tags{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
.flooter{
|
||||
border-top: 1px solid #ccc;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
view{
|
||||
font-size: 28rpx;
|
||||
margin-left: 30rpx;
|
||||
color: #2175F3;
|
||||
padding-top: 14rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.title{
|
||||
width: 100%
|
||||
display: flex
|
||||
align-items: center
|
||||
font-size: 32rpx
|
||||
font-weight: 600
|
||||
}
|
||||
.title>view:first-child{
|
||||
width: 10rpx;
|
||||
height: 46rpx;
|
||||
background-color: #FD7565;
|
||||
margin-right: 20rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.kcCon{
|
||||
margin-top: 20rpx;
|
||||
width: 100%
|
||||
}
|
||||
.kcIntroduction{
|
||||
background: rgba(20,136,245,0.1);
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.faculty{
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 10rpx;
|
||||
padding: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
box-sizing: border-box;
|
||||
.facultyHead{
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
border-radius: 10rpx;
|
||||
color: #fff;
|
||||
font-size: 30rpx;
|
||||
background: linear-gradient(88deg, #3E8BFF 0%, #0DB5FB 100%);
|
||||
display: flex;
|
||||
align-items: center
|
||||
padding: 0 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.facultyCon{
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
padding: 20rpx 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,364 +0,0 @@
|
||||
<template>
|
||||
<div class="app-box">
|
||||
<div class="con-box">
|
||||
<!-- <view class="collection-search">
|
||||
<view class="search-content">
|
||||
<view class="header-input button-click">
|
||||
<uni-icons class="iconsearch" color="#6A6A6A" type="search" size="22"></uni-icons>
|
||||
<input
|
||||
class="input"
|
||||
v-model="searchKeyword"
|
||||
@confirm="searchVideo"
|
||||
placeholder="输入考试名称"
|
||||
placeholder-class="inputplace"
|
||||
/>
|
||||
<uni-icons
|
||||
v-if="searchKeyword"
|
||||
class="clear-icon"
|
||||
type="clear"
|
||||
size="24"
|
||||
color="#999"
|
||||
@click="clearSearch"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<scroll-view scroll-y class="main-scroll" @scrolltolower="handleScrollToLower">
|
||||
<div class="cards" v-for="(item,index) in dataList" :key="item.examPaperId">
|
||||
<div class="cardHead">
|
||||
<div class="cardHeadLeft">
|
||||
<div class="cardTitle">{{item.organName}}</div>
|
||||
</div>
|
||||
<div class="rightBtn" @click="handleOperation(item)">机构详情</div>
|
||||
</div>
|
||||
<div class="heng"></div>
|
||||
<div class="cardCon">
|
||||
<div class="conten">机构联系人:{{item.contactName}}</div>
|
||||
<div class="conten">联系方式:{{item.contactPhone}}</div>
|
||||
<div class="conten">机构地址:{{item.address}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</scroll-view>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { inject, ref, reactive } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
const { $api, navTo, navBack,urls } = inject('globalFunction');
|
||||
import config from "@/config.js"
|
||||
const userInfo = ref({});
|
||||
const Authorization = ref('');
|
||||
const searchKeyword = ref('');
|
||||
const dataList=ref([])
|
||||
const pageSize=ref(10)
|
||||
const pageNum=ref(1)
|
||||
const totalNum=ref(0)
|
||||
const baseUrl = config.imgBaseUrl
|
||||
const handleScrollToLower = () => {
|
||||
getDataList('add');
|
||||
};
|
||||
onLoad(() => {
|
||||
|
||||
});
|
||||
onShow(()=>{
|
||||
Authorization.value=uni.getStorageSync('Padmin-Token')||''
|
||||
getDataList('refresh');
|
||||
})
|
||||
// 搜索视频
|
||||
function searchVideo() {
|
||||
getDataList('refresh');
|
||||
}
|
||||
|
||||
// 清除搜索内容
|
||||
function clearSearch() {
|
||||
searchKeyword.value = '';
|
||||
getDataList('refresh');
|
||||
}
|
||||
// 获取考试列表
|
||||
function getDataList(type = 'add') {
|
||||
let maxPage=Math.ceil(totalNum.value/pageSize.value)
|
||||
let params={}
|
||||
if (type === 'refresh') {
|
||||
pageNum.value = 1;
|
||||
params={
|
||||
address:"",
|
||||
pageSize:pageSize.value,
|
||||
pageNum:pageNum.value,
|
||||
}
|
||||
$api.myRequest('/train/public/train/organ/table', params).then((resData) => {
|
||||
if(resData.code==200){
|
||||
dataList.value=resData.rows
|
||||
totalNum.value=resData.total
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
if (type === 'add' && pageNum.value < maxPage) {
|
||||
pageNum.value += 1;
|
||||
params={
|
||||
address:"",
|
||||
pageSize:pageSize.value,
|
||||
pageNum:pageNum.value,
|
||||
}
|
||||
$api.myRequest('/train/public/train/organ/table', params).then((resData) => {
|
||||
if(resData.code==200){
|
||||
dataList.value=dataList.value.concat(resData.rows)
|
||||
totalNum.value=resData.total
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function handleOperation(row) {
|
||||
navTo(`/packageB/institution/trainingInstitutionDetail?organId=${row.organId}`);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.app-box{
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
position: relative;
|
||||
.con-box{
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top:0;
|
||||
z-index: 10;
|
||||
padding: 20rpx 28rpx;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
.collection-search{
|
||||
padding: 10rpx 20rpx;
|
||||
.search-content{
|
||||
position: relative
|
||||
display: flex
|
||||
align-items: center
|
||||
padding: 14rpx 0
|
||||
.header-input{
|
||||
padding: 0
|
||||
width: calc(100%);
|
||||
position: relative
|
||||
.iconsearch{
|
||||
position: absolute
|
||||
left: 30rpx;
|
||||
top: 50%
|
||||
transform: translate(0, -50%)
|
||||
z-index: 1
|
||||
}
|
||||
.input{
|
||||
padding: 0 80rpx 0 80rpx
|
||||
height: 80rpx;
|
||||
background: #FFFFFF;
|
||||
border-radius: 75rpx 75rpx 75rpx 75rpx;
|
||||
border: 2rpx solid #ECECEC
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.clear-icon{
|
||||
position: absolute
|
||||
right: 30rpx;
|
||||
top: 50%
|
||||
transform: translate(0, -50%)
|
||||
z-index: 1
|
||||
cursor: pointer
|
||||
}
|
||||
.inputplace{
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #B5B5B5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.main-scroll {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.cards{
|
||||
width: 100%;
|
||||
min-height: 260rpx;
|
||||
height: auto;
|
||||
background: linear-gradient(0deg, #E3EFFF 0%, #FBFDFF 100%);
|
||||
// box-shadow: 0px 0px 6px 0px rgba(0,71,200,0.32);
|
||||
border-radius: 12rpx;
|
||||
border: 2px solid #EDF5FF;
|
||||
margin-bottom: 30rpx;
|
||||
padding: 30rpx 40rpx 0;
|
||||
box-sizing: border-box
|
||||
.cardHead{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.cardHeadLeft{
|
||||
display: flex;
|
||||
align-items: center
|
||||
width: 70%;
|
||||
.cardTitle{
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #0069CB;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.titleType{
|
||||
border-radius: 4px;
|
||||
font-size: 22rpx;
|
||||
color: #157EFF;
|
||||
width: 100rpx;
|
||||
height: 38rpx;
|
||||
text-align: center;
|
||||
line-height: 38rpx;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
.heng{
|
||||
width: 30%;
|
||||
height: 4rpx;
|
||||
background: linear-gradient(88deg, #015EEA 0%, #00C0FA 100%);
|
||||
margin: 10rpx 0 20rpx;
|
||||
}
|
||||
.cardCon{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
.conten{
|
||||
width: 100%;
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
display: flex;
|
||||
align-items: center
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.status-tags{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
.flooter{
|
||||
border-top: 1px solid #ccc;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
view{
|
||||
font-size: 28rpx;
|
||||
margin-left: 30rpx;
|
||||
color: #2175F3;
|
||||
padding-top: 14rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.cards2{
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
background-color: rgba(0,0,0,0.5);
|
||||
z-index: 10000;
|
||||
padding: 100rpx 50rpx;
|
||||
box-sizing: border-box;
|
||||
.cardCon{
|
||||
height: 70%;
|
||||
background-color: #fff;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
.cardHead{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
.titleType{
|
||||
display: inline-block
|
||||
border-radius: 4px;
|
||||
font-size: 22rpx;
|
||||
color: #157EFF;
|
||||
width: 100rpx;
|
||||
height: 38rpx;
|
||||
text-align: center;
|
||||
line-height: 38rpx;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.primary{
|
||||
border: 1px solid #157EFF!important;
|
||||
color: #157EFF!important
|
||||
}
|
||||
.success{
|
||||
border: 1px solid #05A636!important;
|
||||
color: #05A636!important
|
||||
}
|
||||
.info{
|
||||
border: 1px solid #898989!important;
|
||||
color: #898989!important
|
||||
}
|
||||
.tertiary{
|
||||
border: 1px solid #E6A340!important;
|
||||
color: #E6A340!important
|
||||
}
|
||||
.primary2{
|
||||
border: 1px solid #F56C6C!important;
|
||||
color: #F56C6C!important
|
||||
}
|
||||
.rightBtn{
|
||||
width: 140rpx;
|
||||
height: 44rpx;
|
||||
line-height: 44rpx;
|
||||
background: linear-gradient(90deg, #00C0FA 0%, #1271FF 100%);
|
||||
border-radius: 4px;
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.detailTitle{
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
margin: 30rpx 0;
|
||||
}
|
||||
.detailCon{
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
.exam-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 35rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
font-family: 'D-DIN-Medium';
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
color: #409EFF;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.info-divider {
|
||||
width: 2px;
|
||||
background-color: #C3E1FF;
|
||||
}
|
||||
</style>
|
||||
@@ -1,267 +0,0 @@
|
||||
<template>
|
||||
<div class="app-box">
|
||||
<div class="con-box">
|
||||
<div class="cards">
|
||||
<div class="cardHead">
|
||||
<div class="cardHeadLeft">
|
||||
<div class="cardTitle">{{trainOrgan.organName}}</div>
|
||||
</div>
|
||||
<div class="rightBtn" @click="handleOperation()"></div>
|
||||
</div>
|
||||
<div class="heng"></div>
|
||||
<div class="cardCon">
|
||||
<div class="conten">机构联系人:{{trainOrgan.contactName}}</div>
|
||||
<div class="conten">联系方式:{{trainOrgan.contactPhone}}</div>
|
||||
<div class="conten">机构地址:{{trainOrgan.address}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 100%;margin-bottom: 40rpx;">
|
||||
<div class="title">
|
||||
<div></div>
|
||||
<div>课程介绍</div>
|
||||
</div>
|
||||
<div class="kcCon">
|
||||
<div class="kcIntroduction" v-for="(item, index) in courses" :key="index">{{item}}</div>
|
||||
<div v-if="courses.length==0" style="text-align: center;line-height: 100rpx;">暂无数据</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 100%;margin-bottom: 40rpx;">
|
||||
<div class="title">
|
||||
<div></div>
|
||||
<div>师资团队</div>
|
||||
</div>
|
||||
<div class="kcCon">
|
||||
<div class="faculty" v-for="(item, index) in teams" :key = "index">
|
||||
<div class="facultyHead">{{item.tramName}}</div>
|
||||
<div class="facultyCon">老师介绍:{{item.tramContent}}</div>
|
||||
</div>
|
||||
<div v-if="teams.length==0" style="text-align: center;line-height: 100rpx;">暂无数据</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 100%;margin-bottom: 30rpx;">
|
||||
<div class="title">
|
||||
<div></div>
|
||||
<div>资质证书</div>
|
||||
</div>
|
||||
<div class="kcCon">
|
||||
<div v-for="(item, index) in certs":key = "index" style="width: 100%;">
|
||||
<div v-for="(url, index2) in item" :key = "index2" style="width: 100%;">
|
||||
<image :src="url" mode="" style="width: 100%;"></image>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="certs.length==0" style="text-align: center;line-height: 100rpx;">暂无数据</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { inject, ref, reactive } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
const { $api, navTo, navBack,urls } = inject('globalFunction');
|
||||
import config from "@/config.js"
|
||||
const trainOrgan = ref({});
|
||||
const courses = ref([]);
|
||||
const certs = ref([]);
|
||||
const certs2 = ref([]);
|
||||
const teams=ref([])
|
||||
const certIndex=ref(1)
|
||||
const organId=ref('')
|
||||
const Authorization=ref('')
|
||||
onLoad((options) => {
|
||||
organId.value=options.organId
|
||||
});
|
||||
onShow(()=>{
|
||||
Authorization.value=uni.getStorageSync('Padmin-Token')||''
|
||||
let params={
|
||||
organId:organId.value
|
||||
}
|
||||
$api.myRequest('/train/public/train/organ/model', params).then((resData) => {
|
||||
if(resData.code==200){
|
||||
trainOrgan.value = (resData.data ? resData.data :{});
|
||||
courses.value = (resData ? (resData.data.course ? (resData.data.course + "").split(",") :[]) :[]);
|
||||
certs2.value = (resData ? JSON.parse(resData.data.zhengshu):[]);
|
||||
list()
|
||||
}
|
||||
|
||||
});
|
||||
})
|
||||
function list(){
|
||||
$api.myRequest('/train/public/train/organ/team/list', {organId:organId.value}).then((res) => {
|
||||
if(res.code==200){
|
||||
teams.value=res.data;
|
||||
for(var i =0;i<certs2.value.length;i++){
|
||||
certs2.value[i].url =config.LCBaseUrl + "/file/minio" + certs2.value[i].url;
|
||||
}
|
||||
var certsArr = [];var flag = 0;
|
||||
for(var i =0;i<certs2.value.length;i++){
|
||||
flag ++
|
||||
certsArr.push(certs2.value[i])
|
||||
if(flag == 3){
|
||||
var arrs = [];
|
||||
for(var j =0;j<3;j++){
|
||||
arrs.push(certsArr[j].url)
|
||||
}
|
||||
certs.value.push(arrs);
|
||||
certsArr = [];
|
||||
flag = 0;
|
||||
}else{
|
||||
if(i == certs2.value.length -1){
|
||||
var arrs = [];
|
||||
for(var j =0;j<certsArr.length;j++){
|
||||
arrs.push(certsArr[j].url)
|
||||
}
|
||||
certs.value.push(arrs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.app-box{
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
position: relative;
|
||||
.con-box{
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top:0;
|
||||
z-index: 10;
|
||||
padding: 20rpx 28rpx;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
.cards{
|
||||
width: 100%;
|
||||
min-height: 260rpx;
|
||||
height: auto;
|
||||
background: linear-gradient(0deg, #D4E3FE 0%, #EBF1FF 100%);
|
||||
border-radius: 12rpx;
|
||||
border: 2px solid #EDF5FF;
|
||||
margin-bottom: 40rpx;
|
||||
padding: 20rpx 30rpx 0;
|
||||
box-sizing: border-box
|
||||
.cardHead{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.cardHeadLeft{
|
||||
display: flex;
|
||||
align-items: center
|
||||
width: 100%;
|
||||
.cardTitle{
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #0069CB;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.titleType{
|
||||
border-radius: 4px;
|
||||
font-size: 22rpx;
|
||||
color: #157EFF;
|
||||
width: 100rpx;
|
||||
height: 38rpx;
|
||||
text-align: center;
|
||||
line-height: 38rpx;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
.heng{
|
||||
width: 30%;
|
||||
height: 4rpx;
|
||||
background: linear-gradient(88deg, #015EEA 0%, #00C0FA 100%);
|
||||
margin: 10rpx 0 20rpx;
|
||||
}
|
||||
.cardCon{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
.conten{
|
||||
width: 100%;
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
display: flex;
|
||||
align-items: center
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.status-tags{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
.flooter{
|
||||
border-top: 1px solid #ccc;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
view{
|
||||
font-size: 28rpx;
|
||||
margin-left: 30rpx;
|
||||
color: #2175F3;
|
||||
padding-top: 14rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.title{
|
||||
width: 100%
|
||||
display: flex
|
||||
align-items: center
|
||||
font-size: 32rpx
|
||||
font-weight: 600
|
||||
}
|
||||
.title>view:first-child{
|
||||
width: 10rpx;
|
||||
height: 46rpx;
|
||||
background-color: #FD7565;
|
||||
margin-right: 20rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.kcCon{
|
||||
margin-top: 20rpx;
|
||||
width: 100%
|
||||
}
|
||||
.kcIntroduction{
|
||||
background: rgba(20,136,245,0.1);
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.faculty{
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 10rpx;
|
||||
padding: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
box-sizing: border-box;
|
||||
.facultyHead{
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
border-radius: 10rpx;
|
||||
color: #fff;
|
||||
font-size: 30rpx;
|
||||
background: linear-gradient(88deg, #3E8BFF 0%, #0DB5FB 100%);
|
||||
display: flex;
|
||||
align-items: center
|
||||
padding: 0 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.facultyCon{
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
padding: 20rpx 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user