给token区分环境

This commit is contained in:
kron
2025-09-12 17:49:26 +08:00
parent 24b776f327
commit 0a151de3c9
6 changed files with 36 additions and 15 deletions

View File

@@ -61,7 +61,9 @@ onShow(async () => {
const rankList = await getRankListAPI();
console.log("排行数据", rankList);
updateRank(rankList);
const token = uni.getStorageSync("token");
const token = uni.getStorageSync(
`${uni.getAccountInfoSync().miniProgram.envVersion}_token`
);
if (token) {
const result = await getHomeData();
console.log("首页数据:", result);
@@ -100,16 +102,18 @@ const comingSoon = () => {
onShareAppMessage(() => {
return {
title: "快来和我一起玩射箭", // 分享卡片的标题
title: "智能真弓:实时捕捉+毫秒级同步,弓箭选手全球竞技", // 分享卡片的标题
path: "/pages/index", // 用户点击分享卡片后跳转的页面路径
imageUrl: "/static/share-bg.png", // 分享卡片的配图,可以是本地或网络图片
imageUrl:
"https://static.shelingxingqiu.com/attachment/2025-09-12/dcqoz26q0268wxmzjg.png", // 分享卡片的配图,可以是本地或网络图片
};
});
onShareTimeline(() => {
return {
title: "我发现了一个超好玩的射箭小程序,一起来玩吧", // 分享到朋友圈的标题
title: "智能真弓:实时捕捉+毫秒级同步,弓箭选手全球竞技", // 分享到朋友圈的标题
query: "from=timeline", // 用户通过朋友圈点击后,在页面 onShow 的 options 中可以获取到的参数
imageUrl: "/static/share-bg.png", // 分享到朋友圈的配图
imageUrl:
"https://static.shelingxingqiu.com/attachment/2025-09-12/dcqoz26q0268wxmzjg.png", // 分享到朋友圈的配图
};
});
</script>

View File

@@ -55,7 +55,9 @@ const toAboutUsPage = () => {
const showLogout = ref(false);
const logout = () => {
uni.removeStorageSync("token");
uni.removeStorageSync(
`${uni.getAccountInfoSync().miniProgram.envVersion}_token`
);
uni.navigateBack();
updateUser();
};