Skip to content

Commit

Permalink
🐛 修复用户登录状态异常
Browse files Browse the repository at this point in the history
  • Loading branch information
BTMuli committed Oct 26, 2024
1 parent 5f1d079 commit 6701464
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,12 @@ async function checkUserLoad(): Promise<void> {
await mkdir(appStore.userDir, { recursive: true });
// 检测用户数据
const uidDB = await TSUserAccount.account.getAllUid();
if (uidDB.length === 0) {
if (uidDB.length === 0 && appStore.isLogin) {
showSnackbar({ text: "未检测到可用UID,请重新登录!", color: "warn" });
appStore.isLogin = false;
return;
}
if (!appStore.isLogin) appStore.isLogin = true;
// 然后获取最近的UID
if (userStore.uid.value === undefined || !uidDB.includes(userStore.uid.value)) {
userStore.uid.value = uidDB[0];
Expand Down
3 changes: 3 additions & 0 deletions src/components/config/tc-userBadge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ import { computed, ref } from "vue";
import Mys from "../../plugins/Mys/index.js";
import TSUserAccount from "../../plugins/Sqlite/modules/userAccount.js";
import { useAppStore } from "../../store/modules/app.js";
import { useUserStore } from "../../store/modules/user.js";
import TGLogger from "../../utils/TGLogger.js";
import TGRequest from "../../web/request/TGRequest.js";
Expand All @@ -121,6 +122,7 @@ interface TcUserBadgeEmits {
const emits = defineEmits<TcUserBadgeEmits>();
const userStore = storeToRefs(useUserStore());
const appStore = storeToRefs(useAppStore());
const loading = ref<boolean>(false);
const accounts = ref<TGApp.App.Account.User[]>([]);
Expand Down Expand Up @@ -219,6 +221,7 @@ async function tryCaptchaLogin(): Promise<void> {
userStore.uid.value = briefInfo.uid;
userStore.briefInfo.value = briefInfo;
userStore.cookie.value = ck;
appStore.isLogin.value = true;
emits("loadOuter", { show: true, title: "正在获取游戏账号" });
const gameRes = await TGRequest.User.bySToken.getAccounts(ck.stoken, ck.stuid);
if (!Array.isArray(gameRes)) {
Expand Down

0 comments on commit 6701464

Please sign in to comment.