🔥 移除无用启动器登录扫码调用

This commit is contained in:
BTMuli
2026-02-22 16:46:06 +08:00
parent a1fe5823da
commit eb4061748e
4 changed files with 9 additions and 64 deletions

View File

@@ -351,7 +351,7 @@
</v-list>
</v-navigation-drawer>
<vp-overlay-follow v-model="showFollow" />
<ToGameLogin v-model="showLoginQr" :launcher="false" @success="tryGetTokens" />
<ToGameLogin v-model="showLoginQr" @success="tryGetTokens" />
</template>
<script lang="ts" setup>
import showDialog from "@comp/func/dialog.js";

View File

@@ -1,5 +1,4 @@
<template>
<ToGameLogin v-model="showLoginQr" v-model:launcher="isLauncherQr" @success="tryGetTokens" />
<v-card class="tcu-box">
<template #prepend>
<v-avatar :image="userInfo.avatar" />
@@ -96,20 +95,13 @@
<v-list-item-title>验证码登录推荐</v-list-item-title>
<v-list-item-subtitle>使用手机号登录</v-list-item-subtitle>
</v-list-item>
<v-list-item @click="tryCodeLogin(false)">
<v-list-item @click="tryCodeLogin()">
<v-list-item-title>扫码登录推荐</v-list-item-title>
<v-list-item-subtitle>使用米游社扫码登录</v-list-item-subtitle>
<template #append>
<img alt="launcher" class="menu-icon" src="/platforms/mhy/mys.webp" />
</template>
</v-list-item>
<v-list-item v-show="false" @click="tryCodeLogin(true)">
<v-list-item-title>扫码登录(启动器)</v-list-item-title>
<v-list-item-subtitle>使用米游社扫码登录</v-list-item-subtitle>
<template #append>
<img alt="launcher" class="menu-icon" src="/platforms/mhy/launcher.webp" />
</template>
</v-list-item>
<v-list-item append-icon="mdi-account-plus" @click="addByCookie()">
<v-list-item-title>手动添加</v-list-item-title>
<v-list-item-subtitle>手动输入Cookie</v-list-item-subtitle>
@@ -118,6 +110,7 @@
</v-menu>
</template>
</v-card>
<ToGameLogin v-model="showLoginQr" @success="tryGetTokens" />
</template>
<script lang="ts" setup>
import showDialog from "@comp/func/dialog.js";
@@ -139,7 +132,6 @@ const { isLogin } = storeToRefs(useAppStore());
const { uid, briefInfo, cookie, account } = storeToRefs(useUserStore());
const showLoginQr = ref<boolean>(false);
const isLauncherQr = ref<boolean>(true);
const accounts = shallowRef<Array<TGApp.App.Account.User>>([]);
const gameAccounts = shallowRef<Array<TGApp.Sqlite.Account.Game>>([]);
const userInfo = computed<TGApp.App.Account.BriefInfo>(() => {
@@ -256,8 +248,7 @@ async function tryCaptchaLogin(): Promise<void> {
await tryGetTokens(ck);
}
async function tryCodeLogin(isLauncher: boolean): Promise<void> {
isLauncherQr.value = isLauncher;
async function tryCodeLogin(): Promise<void> {
showLoginQr.value = true;
}

View File

@@ -3,7 +3,7 @@
<div class="tog-box">
<div class="tog-top">
<div class="tog-title">请使用米游社进行扫码操作</div>
<div class="tog-select" v-if="!isLauncherCode">
<div class="tog-select">
<div
class="tog-select-item"
v-for="item in selects"
@@ -28,8 +28,7 @@
/>
</div>
<div class="tog-bottom" @click="share()">
<img src="/platforms/mhy/launcher.webp" alt="icon" v-if="isLauncherCode" />
<img src="/platforms/mhy/mys.webp" alt="icon" v-else />
<img src="/platforms/mhy/mys.webp" alt="icon" />
</div>
</div>
</TOverlay>
@@ -39,8 +38,6 @@ import TOverlay from "@comp/app/t-overlay.vue";
import showLoading from "@comp/func/loading.js";
import showSnackbar from "@comp/func/snackbar.js";
import hk4eReq from "@req/hk4eReq.js";
import PassportReq from "@req/passportReq.js";
import passportReq from "@req/passportReq.js";
import takumiReq from "@req/takumiReq.js";
import { generateShareImg } from "@utils/TGShare.js";
import QrcodeVue from "qrcode.vue";
@@ -76,7 +73,6 @@ const selects: Array<ToGameLoginSelect> = [
let cycleTimer: NodeJS.Timeout | null = null;
const model = defineModel<boolean>({ default: false });
const isLauncherCode = defineModel<boolean>("launcher", { default: true });
const emits = defineEmits<ToGameLoginEmits>();
const codeGid = ref<number>(7);
const codeUrl = ref<string>();
@@ -91,8 +87,7 @@ watch(
clearInterval(cycleTimer);
cycleTimer = null;
}
if (isLauncherCode.value) cycleTimer = setInterval(cycleGetDataLauncher, 1000);
else cycleTimer = setInterval(cycleGetDataGame, 1000);
cycleTimer = setInterval(cycleGetDataGame, 1000);
} else {
if (cycleTimer) clearInterval(cycleTimer);
cycleTimer = null;
@@ -103,7 +98,6 @@ watch(
watch(
() => codeGid.value,
async () => {
if (isLauncherCode.value) return;
await freshQr();
if (cycleTimer) clearInterval(cycleTimer);
cycleTimer = setInterval(cycleGetDataGame, 1000);
@@ -120,16 +114,6 @@ async function share(): Promise<void> {
}
async function freshQr(): Promise<void> {
if (isLauncherCode.value) {
const resp = await passportReq.qrLogin.create();
if ("retcode" in resp) {
showSnackbar.error(`[${resp.retcode}] ${resp.message}`);
return;
}
codeUrl.value = resp.url;
codeTicket.value = resp.ticket;
return;
}
const resp = await hk4eReq.loginQr.create(codeGid.value);
if ("retcode" in resp) {
showSnackbar.error(`[${resp.retcode}] ${resp.message}`);
@@ -139,38 +123,6 @@ async function freshQr(): Promise<void> {
codeTicket.value = new URL(codeUrl.value).searchParams.get("ticket") || "";
}
async function cycleGetDataLauncher(): Promise<void> {
const res = await PassportReq.qrLogin.query(codeTicket.value);
console.log(res);
if ("retcode" in res) {
showSnackbar.error(`[${res.retcode}] ${res.message}`);
if (res.retcode === -106) {
await freshQr();
} else {
if (cycleTimer) clearInterval(cycleTimer);
cycleTimer = null;
model.value = false;
}
return;
}
if (res.status === "Created" || res.status === "Scanned") return;
if (res.status === "Confirmed") {
if (cycleTimer) clearInterval(cycleTimer);
cycleTimer = null;
const ck: TGApp.App.Account.Cookie = {
account_id: res.user_info.aid,
ltuid: res.user_info.aid,
stuid: res.user_info.aid,
mid: res.user_info.mid,
cookie_token: "",
stoken: res.tokens[0].token,
ltoken: "",
};
emits("success", ck);
model.value = false;
}
}
async function cycleGetDataGame(): Promise<void> {
const res = await hk4eReq.loginQr.state(codeTicket.value, codeGid.value);
console.log(res);

View File

@@ -110,6 +110,7 @@ async function createLoginCaptcha(
/**
* 创建登录二维码
* @since Beta v0.6.8
* @deprecated 返回数据不符合要求
* @returns 二维码URL
*/
async function createQrLogin(): Promise<
@@ -214,6 +215,7 @@ async function loginByMobileCaptcha(
/**
* 获取登录状态
* @since Beta v0.6.8
* @deprecated 返回数据不符合要求
* @param ticket - 二维码 ticket
* @returns 登录状态
*/