mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-15 09:48:14 +08:00
🐛 修复用户数据获取异常
This commit is contained in:
@@ -50,7 +50,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<template #append>
|
<template #append>
|
||||||
<v-btn class="config-btn" @click="confirmScanLogin">扫码登录</v-btn>
|
<v-btn class="config-btn" @click="confirmScanLogin">扫码登录</v-btn>
|
||||||
<v-btn class="config-btn" @click="confirmRefreshUser"> 刷新数据 </v-btn>
|
<v-btn class="config-btn" @click="confirmRefreshUser"> 刷新数据</v-btn>
|
||||||
</template>
|
</template>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
<v-list-subheader :inset="true" class="config-header">系统信息</v-list-subheader>
|
<v-list-subheader :inset="true" class="config-header">系统信息</v-list-subheader>
|
||||||
@@ -186,7 +186,13 @@ const buildTime = computed(() => appStore.buildTime);
|
|||||||
// About OS
|
// About OS
|
||||||
const osPlatform = ref<string>("");
|
const osPlatform = ref<string>("");
|
||||||
const osVersion = ref<string>("");
|
const osVersion = ref<string>("");
|
||||||
const dbInfo = ref<Array<{ key: string; value: string; updated: string }>>([]);
|
const dbInfo = ref<
|
||||||
|
Array<{
|
||||||
|
key: string;
|
||||||
|
value: string;
|
||||||
|
updated: string;
|
||||||
|
}>
|
||||||
|
>([]);
|
||||||
|
|
||||||
// loading
|
// loading
|
||||||
const loading = ref<boolean>(true);
|
const loading = ref<boolean>(true);
|
||||||
@@ -295,13 +301,13 @@ async function confirmRefreshUser(): Promise<void> {
|
|||||||
}
|
}
|
||||||
await TGSqlite.saveAppData("cookie", JSON.stringify(ck));
|
await TGSqlite.saveAppData("cookie", JSON.stringify(ck));
|
||||||
const infoRes = await TGRequest.User.byCookie.getUserInfo(ck.cookie_token, ck.account_id);
|
const infoRes = await TGRequest.User.byCookie.getUserInfo(ck.cookie_token, ck.account_id);
|
||||||
if ("nickname" in infoRes) {
|
if ("retcode" in infoRes) {
|
||||||
userStore.setBriefInfo(infoRes);
|
|
||||||
loadingTitle.value = "获取成功!正在获取用户游戏账号信息";
|
|
||||||
} else {
|
|
||||||
console.error(infoRes);
|
console.error(infoRes);
|
||||||
loadingTitle.value = "获取失败!正在获取用户游戏账号信息";
|
loadingTitle.value = "获取失败!正在获取用户游戏账号信息";
|
||||||
failCount++;
|
failCount++;
|
||||||
|
} else {
|
||||||
|
userStore.setBriefInfo(infoRes);
|
||||||
|
loadingTitle.value = "获取成功!正在获取用户游戏账号信息";
|
||||||
}
|
}
|
||||||
const accountRes = await TGRequest.User.byCookie.getAccounts(ck.cookie_token, ck.account_id);
|
const accountRes = await TGRequest.User.byCookie.getAccounts(ck.cookie_token, ck.account_id);
|
||||||
if (Array.isArray(accountRes)) {
|
if (Array.isArray(accountRes)) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @file web request getUserInfo.ts
|
* @file web request getUserInfo.ts
|
||||||
* @description 获取用户信息请求
|
* @description 获取用户信息请求
|
||||||
* @author BTMuli<bt-muli@outlook.com>
|
* @author BTMuli<bt-muli@outlook.com>
|
||||||
* @since Alpha v0.2.2
|
* @since Beta v0.3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// tauri
|
// tauri
|
||||||
@@ -14,7 +14,7 @@ import TGUtils from "../utils/TGUtils";
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 根据 cookie 获取用户信息
|
* @description 根据 cookie 获取用户信息
|
||||||
* @since Alpha v0.2.2
|
* @since Beta v0.3.0
|
||||||
* @param {string} cookie_token cookie token
|
* @param {string} cookie_token cookie token
|
||||||
* @param {string} account_id 用户 account_id
|
* @param {string} account_id 用户 account_id
|
||||||
* @returns {Promise<TGApp.App.Account.BriefInfo | TGApp.BBS.Response.Base>}
|
* @returns {Promise<TGApp.App.Account.BriefInfo | TGApp.BBS.Response.Base>}
|
||||||
@@ -29,7 +29,7 @@ export async function getUserInfoByCookie(
|
|||||||
};
|
};
|
||||||
const url = TGApi.GameData.byCookie.getUserInfo;
|
const url = TGApi.GameData.byCookie.getUserInfo;
|
||||||
const params = { gids: "2" };
|
const params = { gids: "2" };
|
||||||
const header = TGUtils.User.getSignHeader(cookie, "GET", {}, "common");
|
const header = TGUtils.User.getHeader(cookie, "GET", {}, "common", true);
|
||||||
return await http
|
return await http
|
||||||
.fetch<TGApp.Plugins.Mys.User.HomeResponse>(url, {
|
.fetch<TGApp.Plugins.Mys.User.HomeResponse>(url, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
|||||||
Reference in New Issue
Block a user