merge: 合并 main 分支最新代码到 careermap
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,5 @@
|
|||||||
/unpackage/
|
/unpackage/
|
||||||
/node_modules/
|
/node_modules/
|
||||||
/docs/
|
/docs/
|
||||||
|
/.qoder/
|
||||||
|
/.idea/
|
||||||
@@ -18,9 +18,6 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="companyinfo-right">
|
<view class="companyinfo-right">
|
||||||
<view class="row1">{{ companyInfo?.name || '未知公司' }}</view>
|
<view class="row1">{{ companyInfo?.name || '未知公司' }}</view>
|
||||||
<view class="row2">
|
|
||||||
互联网
|
|
||||||
</view>
|
|
||||||
<view class="row2">
|
<view class="row2">
|
||||||
{{ getScaleLabel(companyInfo?.scale) }}
|
{{ getScaleLabel(companyInfo?.scale) }}
|
||||||
</view>
|
</view>
|
||||||
@@ -41,41 +38,41 @@
|
|||||||
</view>
|
</view>
|
||||||
<scroll-view scroll-y class="Detailscroll-view">
|
<scroll-view scroll-y class="Detailscroll-view">
|
||||||
<view class="views">
|
<view class="views">
|
||||||
<view class="Detail-title"><text class="title">在招职位</text></view>
|
<view class="Detail-title"><text class="title">在招职位</text></view>
|
||||||
<template v-if="companyInfo.jobInfoList.length != 0">
|
<template v-if="companyInfo.jobList && companyInfo.jobList.length != 0">
|
||||||
<view v-for="job in companyInfo.jobInfoList" :key="job.id">
|
<view v-for="job in companyInfo.jobList" :key="job.jobId">
|
||||||
<!-- @click="navTo(`/packageA/pages/post/post?jobId=${JSON.stringify(job)}`)" -->
|
<view class="cards" @click="navToJobDetail(job.jobId)">
|
||||||
<!-- :style="getItemBackgroundStyle('bj2.png')" -->
|
<view class="card-company">
|
||||||
<view class="cards">
|
<text class="company">{{ job.jobTitle }}</text>
|
||||||
<view class="card-company">
|
<view class="salary"> ¥{{ job.minSalary }}-{{ job.maxSalary }}/月 </view>
|
||||||
<text class="company">{{ job.jobTitle }}</text>
|
</view>
|
||||||
<view class="salary"> ¥{{ job.salaryRange }}/月 </view>
|
<view class="card-tags">
|
||||||
|
<view class="tag jy">
|
||||||
|
<image :src="`${baseUrl}/jobfair/jy.png`" mode=""></image>
|
||||||
|
{{ getExperienceLabel(job.experience) }}
|
||||||
</view>
|
</view>
|
||||||
<view class="card-tags">
|
<view class="tag xl">
|
||||||
<view class="tag jy">
|
<image :src="`${baseUrl}/jobfair/xx.png`" mode=""></image>
|
||||||
<image :src="`${baseUrl}/jobfair/jy.png`" mode=""></image>
|
{{ getEducationLabel(job.education) }}
|
||||||
{{ job.experienceRequirement }}
|
|
||||||
</view>
|
|
||||||
<view class="tag xl">
|
|
||||||
<image :src="`${baseUrl}/jobfair/xx.png`" mode=""></image>
|
|
||||||
{{ job.educationRequirement }}
|
|
||||||
</view>
|
|
||||||
<view class="tag yd" v-if="job.jobRequirement">
|
|
||||||
<image :src="`${baseUrl}/jobfair/lx-1.png`" mode=""></image>
|
|
||||||
{{ job.jobRequirement }}
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="card-companyName">
|
<view class="tag yd" v-if="job.vacancies">
|
||||||
{{ job.jobDescription }}
|
<image :src="`${baseUrl}/jobfair/lx-1.png`" mode=""></image>
|
||||||
|
招聘{{ job.vacancies }}人
|
||||||
</view>
|
</view>
|
||||||
<view class="deliver-box">
|
</view>
|
||||||
<view class="deliver-btn" @click="deliverResume(job)">
|
<view class="card-info">
|
||||||
简历投递
|
<view class="company-address" v-if="job.jobLocation">
|
||||||
</view>
|
<image class="point3" src="/static/icon/point3.png"></image>
|
||||||
|
{{ job.jobLocation }}
|
||||||
|
</view>
|
||||||
|
<view class="push-time" v-if="job.postingDate">
|
||||||
|
<image class="point3" src="/static/icon/point3.png"></image>
|
||||||
|
{{ job.postingDate.split(' ')[0] }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</view>
|
||||||
|
</template>
|
||||||
<empty v-else pdTop="200"></empty>
|
<empty v-else pdTop="200"></empty>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
@@ -121,7 +118,7 @@
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
});
|
});
|
||||||
const companyInfo = ref({
|
const companyInfo = ref({
|
||||||
jobInfoList: [],
|
jobList: [],
|
||||||
});
|
});
|
||||||
const baseUrl = config.imgBaseUrl;
|
const baseUrl = config.imgBaseUrl;
|
||||||
const getItemBackgroundStyle = (imageName) => ({
|
const getItemBackgroundStyle = (imageName) => ({
|
||||||
@@ -146,7 +143,7 @@
|
|||||||
scale: resData.data.scale || '未知规模',
|
scale: resData.data.scale || '未知规模',
|
||||||
description: resData.data.description || '暂无公司介绍',
|
description: resData.data.description || '暂无公司介绍',
|
||||||
isCollection: resData.data.isCollection || 0,
|
isCollection: resData.data.isCollection || 0,
|
||||||
jobInfoList: [] // 新数据格式中没有岗位列表,初始化为空数组
|
jobList: resData.data.jobList || [] // 使用正确的jobList字段
|
||||||
};
|
};
|
||||||
console.log('Company details loaded successfully');
|
console.log('Company details loaded successfully');
|
||||||
} else {
|
} else {
|
||||||
@@ -157,7 +154,7 @@
|
|||||||
scale: '-',
|
scale: '-',
|
||||||
description: '无法获取公司信息,请稍后重试',
|
description: '无法获取公司信息,请稍后重试',
|
||||||
isCollection: 0,
|
isCollection: 0,
|
||||||
jobInfoList: []
|
jobList: []
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
@@ -168,7 +165,7 @@
|
|||||||
scale: '-',
|
scale: '-',
|
||||||
description: '网络请求失败,请检查网络连接',
|
description: '网络请求失败,请检查网络连接',
|
||||||
isCollection: 0,
|
isCollection: 0,
|
||||||
jobInfoList: []
|
jobList: []
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -213,7 +210,7 @@
|
|||||||
// 获取企业规模字典数据
|
// 获取企业规模字典数据
|
||||||
onLoad(async (options) => {
|
onLoad(async (options) => {
|
||||||
// 初始化companyInfo
|
// 初始化companyInfo
|
||||||
companyInfo.value = { jobInfoList: [] };
|
companyInfo.value = { jobList: [] };
|
||||||
// 加载字典数据
|
// 加载字典数据
|
||||||
await dictStore.getDictData();
|
await dictStore.getDictData();
|
||||||
|
|
||||||
@@ -222,7 +219,7 @@
|
|||||||
companyInfo.value = JSON.parse(options.job);
|
companyInfo.value = JSON.parse(options.job);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error parsing job data:', error);
|
console.error('Error parsing job data:', error);
|
||||||
companyInfo.value = { jobInfoList: [] };
|
companyInfo.value = { jobList: [] };
|
||||||
}
|
}
|
||||||
// 处理companyId参数
|
// 处理companyId参数
|
||||||
} else if (options.companyId) {
|
} else if (options.companyId) {
|
||||||
@@ -237,7 +234,7 @@
|
|||||||
getCompanyDetailsById(options.bussinessId);
|
getCompanyDetailsById(options.bussinessId);
|
||||||
} else {
|
} else {
|
||||||
console.warn('No valid parameters provided');
|
console.warn('No valid parameters provided');
|
||||||
companyInfo.value = { jobInfoList: [] };
|
companyInfo.value = { jobList: [] };
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -273,6 +270,91 @@
|
|||||||
return '-';
|
return '-';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据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 diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
||||||
|
|
||||||
|
if (diffDays === 1) {
|
||||||
|
return '今天发布';
|
||||||
|
} else if (diffDays <= 7) {
|
||||||
|
return `${diffDays}天前发布`;
|
||||||
|
} else {
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
|
return `${year}-${month}-${day}发布`;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('格式化发布时间失败:', error);
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 跳转到职位详情页面
|
||||||
|
function navToJobDetail(jobId) {
|
||||||
|
if (jobId) {
|
||||||
|
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(jobId)}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="stylus" scoped>
|
<style lang="stylus" scoped>
|
||||||
@@ -420,24 +502,23 @@
|
|||||||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||||||
margin-top: 22rpx;
|
margin-top: 22rpx;
|
||||||
padding-bottom: 18rpx;
|
padding-bottom: 18rpx;
|
||||||
background: #f2f8fc;
|
background: #FFFFFF;
|
||||||
|
|
||||||
.card-company {
|
.card-company {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
border-bottom: 1rpx solid #c2d7ea;
|
|
||||||
|
|
||||||
.company {
|
.company {
|
||||||
font-weight: 600;
|
font-weight: 400;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #207AC7;
|
color: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.salary {
|
.salary {
|
||||||
font-weight: 600;
|
// font-weight: 600;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #F83A3C;
|
color: #1677FF;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
line-height: 48rpx;
|
line-height: 48rpx;
|
||||||
}
|
}
|
||||||
@@ -475,7 +556,7 @@
|
|||||||
.card-tags {
|
.card-tags {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
margin: 25rpx 0 35rpx;
|
margin: 25rpx 0 20rpx;
|
||||||
|
|
||||||
image {
|
image {
|
||||||
width: 24rpx;
|
width: 24rpx;
|
||||||
@@ -484,18 +565,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.jy {
|
.jy {
|
||||||
background: #D9EDFF;
|
background: #F5F5F5;
|
||||||
color: #0086FF;
|
color: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.xl {
|
.xl {
|
||||||
background: #FFF1D5;
|
background: #F5F5F5;
|
||||||
color: #FF7F01;
|
color: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.yd {
|
.yd {
|
||||||
background: #FFD8D8;
|
background: #F5F5F5;
|
||||||
color: #F83A3C;
|
color: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag {
|
.tag {
|
||||||
@@ -514,6 +595,62 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.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 {
|
.card-bottom {
|
||||||
margin-top: 32rpx;
|
margin-top: 32rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
48
pages.json
48
pages.json
@@ -465,8 +465,7 @@
|
|||||||
{
|
{
|
||||||
"path": "search/search",
|
"path": "search/search",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "生涯规划",
|
"navigationBarTitleText": "生涯规划"
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -502,36 +501,31 @@
|
|||||||
{
|
{
|
||||||
"path": "userCenter/professionPath",
|
"path": "userCenter/professionPath",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "职业路径",
|
"navigationBarTitleText": "职业路径"
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "userCenter/personDocument",
|
"path": "userCenter/personDocument",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "生涯档案",
|
"navigationBarTitleText": "生涯档案"
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "userCenter/careerCompass",
|
"path": "userCenter/careerCompass",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "生涯罗盘",
|
"navigationBarTitleText": "生涯罗盘"
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "userCenter/learningPlan",
|
"path": "userCenter/learningPlan",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "学业规划",
|
"navigationBarTitleText": "学业规划"
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "userCenter/smartTarget",
|
"path": "userCenter/smartTarget",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "学业规划",
|
"navigationBarTitleText": "学业规划"
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -543,71 +537,61 @@
|
|||||||
{
|
{
|
||||||
"path": "pagesTest/testList",
|
"path": "pagesTest/testList",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "生涯测评",
|
"navigationBarTitleText": "生涯测评"
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pagesTest/customTestTitle",
|
"path": "pagesTest/customTestTitle",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "自定义测评",
|
"navigationBarTitleText": "自定义测评"
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pagesTest/interestTestTitle",
|
"path": "pagesTest/interestTestTitle",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "职业兴趣测评",
|
"navigationBarTitleText": "职业兴趣测评"
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pagesTest/workValuesTestTitle",
|
"path": "pagesTest/workValuesTestTitle",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "工作价值观测评",
|
"navigationBarTitleText": "工作价值观测评"
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pagesTest/personalTestTitle",
|
"path": "pagesTest/personalTestTitle",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "人格测评",
|
"navigationBarTitleText": "人格测评"
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "testReport/workValuesTestReport",
|
"path": "testReport/workValuesTestReport",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "工作价值观测评报告",
|
"navigationBarTitleText": "工作价值观测评报告"
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "testReport/multipleAbilityTestReport",
|
"path": "testReport/multipleAbilityTestReport",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "多元能力测评报告",
|
"navigationBarTitleText": "多元能力测评报告"
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "testReport/generalCareerTestReport",
|
"path": "testReport/generalCareerTestReport",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "通用职业能力测评报告",
|
"navigationBarTitleText": "通用职业能力测评报告"
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "testReport/personalTestReport",
|
"path": "testReport/personalTestReport",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "人格测评报告",
|
"navigationBarTitleText": "人格测评报告"
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "testReport/interestTestReport",
|
"path": "testReport/interestTestReport",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "职业兴趣测评报告",
|
"navigationBarTitleText": "职业兴趣测评报告"
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -709,7 +709,31 @@ const handleServiceClick = (serviceType) => {
|
|||||||
|
|
||||||
// 处理直播按钮点击
|
// 处理直播按钮点击
|
||||||
const handleLiveClick = () => {
|
const handleLiveClick = () => {
|
||||||
$api.msg('该功能正在开发中');
|
// #ifdef MP-WEIXIN
|
||||||
|
const feedId = "sphKH1AEeLfTJJE";
|
||||||
|
|
||||||
|
// 使用微信原生 API 打开视频号主页
|
||||||
|
if (typeof wx !== "undefined" && wx.openChannelsUserProfile) {
|
||||||
|
wx.openChannelsUserProfile({
|
||||||
|
finderUserName: feedId,
|
||||||
|
success: (res) => {
|
||||||
|
console.log("打开视频号成功", res);
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error("打开视频号失败", err);
|
||||||
|
$api.msg(err.errMsg || "无法打开直播,请稍后重试");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 如果 API 不存在,提示用户更新微信版本
|
||||||
|
$api.msg("请更新微信版本以使用该功能");
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifndef MP-WEIXIN
|
||||||
|
// 非微信小程序环境提示
|
||||||
|
$api.msg("该功能仅在微信小程序中可用");
|
||||||
|
// #endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// 跳转到测试页面
|
// 跳转到测试页面
|
||||||
|
|||||||
Reference in New Issue
Block a user