使用微信小程序原生头部导航

This commit is contained in:
冯辉
2025-11-13 10:51:14 +08:00
parent 2e9a1106d7
commit cd59ed6696
2 changed files with 41 additions and 33 deletions

View File

@@ -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"
} }
} }
] ]

View File

@@ -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
}; };
// 跳转到测试页面 // 跳转到测试页面