feat: 优化登录逻辑

This commit is contained in:
2026-01-06 19:42:10 +08:00
parent 7e02429f6e
commit 9c658e9f9f
6 changed files with 30 additions and 30 deletions

View File

@@ -602,9 +602,6 @@ const sendChat = (message, isInstruct = false) => {
const messageContent = isInstruct ? commonType : message;
currentSessionMessageId = IdUtils.generateMessageId();
// 重置消息状态,为新消息做准备
resetMessageState();
// 插入AI消息
const aiMsg = {
msgId: `msg_${chatMsgList.value.length}`,
@@ -627,8 +624,10 @@ const sendChat = (message, isInstruct = false) => {
chatMsgList.value[aiMsgIndex].msg = "发送消息失败,请重试";
chatMsgList.value[aiMsgIndex].isLoading = false;
isSessionActive.value = false;
resetMessageState();
}
// 重置消息状态,为新消息做准备
resetMessageState();
};
// 停止请求函数

View File

@@ -52,7 +52,6 @@ import CheckBox from "@/components/CheckBox/index.vue";
import AgreePopup from "./components/AgreePopup/index.vue";
import { zniconsMap } from "@/static/fonts/znicons";
import { getCurrentConfig } from "@/constant/base";
import { NOTICE_EVENT_LOGIN_SUCCESS } from "@/constant/constant";
// 是否需要微信手机号授权登录
const needWxAuthLogin = ref(false);
@@ -79,7 +78,7 @@ const handleAgreeAndGetPhone = () => {
return;
}
refreshToken(true).then(() => loginSuccess());
refreshToken().then(() => loginSuccess());
};
/// 获取授权后绑定手机号登录
@@ -92,13 +91,16 @@ const getPhoneNumber = (e) => {
return;
}
onLogin(e).then(() => loginSuccess())
.catch(() => { });
.catch(() => {
uni.showToast({
title: "获取登录手机号失败",
icon: "none",
});
});
};
/// 登录成功返回上一页
const loginSuccess = () => {
// 登录成功后,触发登录成功事件
uni.$emit(NOTICE_EVENT_LOGIN_SUCCESS);
uni.showToast({
title: "登录成功",
icon: "success",