fix: not login

This commit is contained in:
zzc
2026-06-10 00:41:11 +08:00
parent 0383ad6be2
commit d325329af4
4 changed files with 115 additions and 20 deletions

View File

@@ -52,7 +52,10 @@
<view class="action-buttons">
<button class="btn-primary" @tap="navTo('profile')">编辑资料</button>
<button class="btn-secondary" open-type="share">
<button v-if="isLoggedIn" class="btn-secondary" open-type="share">
<text class="share-icon-btn"></text> 分享主页
</button>
<button v-else class="btn-secondary" @tap="openLoginPopup('请先登录后再分享主页')">
<text class="share-icon-btn"></text> 分享主页
</button>
</view>
@@ -175,7 +178,7 @@ onShareTimeline(async () => {
const handleUserClick = () => {
if (!isLoggedIn.value) {
loginPopupRef.value.open();
openLoginPopup("请先登录");
} else {
uni.navigateTo({
url: "/pages/mine/profile",
@@ -187,10 +190,16 @@ const handleLogind = async () => {
loadUserStats();
};
const openLoginPopup = (message = "请先登录") => {
loginPopupRef.value.open();
if (message) {
uni.showToast({ title: message, icon: "none" });
}
};
const navTo = (page) => {
if (!isLoggedIn.value) {
loginPopupRef.value.open();
uni.showToast({ title: "请先登录", icon: "none" });
openLoginPopup("请先登录");
return;
}