feat: 调整登录逻辑

This commit is contained in:
duanshuwen
2025-09-12 22:20:01 +08:00
parent 07752394eb
commit c03a4200be
12 changed files with 248 additions and 175 deletions

View File

@@ -97,12 +97,18 @@
/>
<ActivityListComponent
v-if="mainPageDataModel.activityList && mainPageDataModel.activityList.length > 0"
v-if="
mainPageDataModel.activityList &&
mainPageDataModel.activityList.length > 0
"
:activityList="mainPageDataModel.activityList"
/>
<RecommendPostsComponent
v-if="mainPageDataModel.recommendTheme && mainPageDataModel.recommendTheme.length > 0"
v-if="
mainPageDataModel.recommendTheme &&
mainPageDataModel.recommendTheme.length > 0
"
:recommendThemeList="mainPageDataModel.recommendTheme"
/>
</ChatCardOther>
@@ -165,6 +171,7 @@ import WebSocketManager from "@/utils/WebSocketManager";
import TypewriterManager from "@/utils/TypewriterManager";
import { IdUtils } from "@/utils";
import { useAppStore } from "@/store";
import { checkToken } from "@/hooks/useGoLogin";
const appStore = useAppStore();
/// 导航栏相关
@@ -346,14 +353,18 @@ onLoad(() => {
});
});
onMounted(async () => {
onMounted(() => {
try {
getMainPageData();
await loadRecentConversation();
loadConversationMsgList();
addNoticeListener();
initTypewriterManager();
initWebSocket();
// 有token时加载最近会话、最近消息、初始化socket
checkToken().then(async () => {
await loadRecentConversation();
loadConversationMsgList();
initWebSocket();
});
} catch (error) {
console.error("页面初始化错误:", error);
}

View File

@@ -6,9 +6,14 @@
v-for="(item, index) in itemList"
:key="index"
>
<text class="more-tips-item-title" @click="sendReply(item)">{{
item
}}</text>
<button
class="reset-btn more-tips-item-title"
open-type="getPhoneNumber"
@getphonenumber="onLogin"
@click="sendReply(item)"
>
{{ item }}
</button>
</view>
</view>
</view>
@@ -16,6 +21,8 @@
<script setup>
import { defineProps } from "vue";
import { onLogin, checkToken } from "@/hooks/useGoLogin";
const emits = defineEmits(["replySent"]);
defineProps({
@@ -34,7 +41,9 @@ defineProps({
});
const sendReply = (text) => {
emits("replySent", text); // 向父组件传递数据
checkToken().then(() => {
emits("replySent", text); // 向父组件传递数据
});
};
</script>