mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
✨ 深渊上传支持胡桃账户设置
This commit is contained in:
@@ -26,7 +26,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #append>
|
<template #append>
|
||||||
<div class="uat-right">
|
<div class="uat-hutao">
|
||||||
|
<span>胡桃云账号:</span>
|
||||||
|
<span @click="editHutaoEmail()">{{ hutaoEmail ?? "未设置" }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #extension>
|
||||||
|
<div class="uat-acts">
|
||||||
<v-btn
|
<v-btn
|
||||||
class="ua-btn"
|
class="ua-btn"
|
||||||
@click="shareAbyss()"
|
@click="shareAbyss()"
|
||||||
@@ -115,7 +121,7 @@ import { generateShareImg } from "@/utils/TGShare.js";
|
|||||||
import TakumiRecordGenshinApi from "@/web/request/recordReq.js";
|
import TakumiRecordGenshinApi from "@/web/request/recordReq.js";
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { account, cookie } = storeToRefs(useUserStore());
|
const { account, cookie, hutaoEmail } = storeToRefs(useUserStore());
|
||||||
const userTab = ref<number>(0);
|
const userTab = ref<number>(0);
|
||||||
const version = ref<string>();
|
const version = ref<string>();
|
||||||
const uidCur = ref<string>();
|
const uidCur = ref<string>();
|
||||||
@@ -148,6 +154,29 @@ async function toWiki(): Promise<void> {
|
|||||||
await router.push({ name: "深渊数据库" });
|
await router.push({ name: "深渊数据库" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function editHutaoEmail(): Promise<void> {
|
||||||
|
if (hutaoEmail.value) {
|
||||||
|
const chgCheck = await showDialog.check("是否更改胡桃云账号", `当前账号:${hutaoEmail.value}`);
|
||||||
|
if (!chgCheck) {
|
||||||
|
showSnackbar.cancel("已取消更改胡桃云账号");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const newEmail = await showDialog.input("请输入胡桃云账号", "胡桃云账号", hutaoEmail.value);
|
||||||
|
if (!newEmail) {
|
||||||
|
showSnackbar.cancel("已取消设置胡桃云账号");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 简单验证邮箱格式
|
||||||
|
const mailReg = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
|
||||||
|
if (!mailReg.test(newEmail)) {
|
||||||
|
showSnackbar.error("邮箱格式错误");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
hutaoEmail.value = newEmail;
|
||||||
|
showSnackbar.success("已设置胡桃云账号");
|
||||||
|
}
|
||||||
|
|
||||||
async function loadAbyss(): Promise<void> {
|
async function loadAbyss(): Promise<void> {
|
||||||
localAbyss.value = [];
|
localAbyss.value = [];
|
||||||
if (uidCur.value === undefined || uidCur.value === "") return;
|
if (uidCur.value === undefined || uidCur.value === "") return;
|
||||||
@@ -256,6 +285,7 @@ async function uploadAbyss(): Promise<void> {
|
|||||||
try {
|
try {
|
||||||
await showLoading.start(`正在上传${account.value.gameUid}的深渊数据`, `期数:${abyssData.id}`);
|
await showLoading.start(`正在上传${account.value.gameUid}的深渊数据`, `期数:${abyssData.id}`);
|
||||||
const transAbyss = Hutao.Abyss.utils.transData(abyssData);
|
const transAbyss = Hutao.Abyss.utils.transData(abyssData);
|
||||||
|
if (hutaoEmail.value) transAbyss.ReservedUserName = hutaoEmail.value;
|
||||||
await showLoading.update("正在获取角色数据");
|
await showLoading.update("正在获取角色数据");
|
||||||
const roles = await TSUserAvatar.getAvatars(Number(account.value.gameUid));
|
const roles = await TSUserAvatar.getAvatars(Number(account.value.gameUid));
|
||||||
if (!roles) {
|
if (!roles) {
|
||||||
@@ -329,9 +359,23 @@ async function deleteAbyss(): Promise<void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.uat-right {
|
.uat-hutao {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 10px;
|
||||||
|
font-family: var(--font-text);
|
||||||
|
font-size: 16px;
|
||||||
|
|
||||||
|
:last-child {
|
||||||
|
color: var(--tgc-pink-1);
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.uat-acts {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file store/modules/user.ts
|
* @file store/modules/user.ts
|
||||||
* @description 用户信息模块
|
* @description 用户信息模块
|
||||||
* @since Beta v0.6.0
|
* @since Beta v0.6.8
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import showSnackbar from "@comp/func/snackbar.js";
|
import showSnackbar from "@comp/func/snackbar.js";
|
||||||
@@ -34,6 +34,9 @@ export const useUserStore = defineStore(
|
|||||||
const cookie = ref<TGApp.App.Account.Cookie>();
|
const cookie = ref<TGApp.App.Account.Cookie>();
|
||||||
const propMap = ref<TGApp.Game.Avatar.PropMap>();
|
const propMap = ref<TGApp.Game.Avatar.PropMap>();
|
||||||
|
|
||||||
|
// 胡桃账号(邮箱),用于上传深渊记录
|
||||||
|
const hutaoEmail = ref<string>();
|
||||||
|
|
||||||
function getProp(prop: number): TGApp.Game.Avatar.PropMapItem | false {
|
function getProp(prop: number): TGApp.Game.Avatar.PropMapItem | false {
|
||||||
if (!propMap.value) return false;
|
if (!propMap.value) return false;
|
||||||
return propMap.value[prop.toString()] || false;
|
return propMap.value[prop.toString()] || false;
|
||||||
@@ -66,6 +69,7 @@ export const useUserStore = defineStore(
|
|||||||
briefInfo,
|
briefInfo,
|
||||||
account,
|
account,
|
||||||
propMap,
|
propMap,
|
||||||
|
hutaoEmail,
|
||||||
getProp,
|
getProp,
|
||||||
switchGameAccount,
|
switchGameAccount,
|
||||||
};
|
};
|
||||||
@@ -77,11 +81,8 @@ export const useUserStore = defineStore(
|
|||||||
storage: window.localStorage,
|
storage: window.localStorage,
|
||||||
pick: ["uid", "briefInfo", "cookie", "account"],
|
pick: ["uid", "briefInfo", "cookie", "account"],
|
||||||
},
|
},
|
||||||
{
|
{ key: "propMap", storage: window.localStorage, pick: ["propMap"] },
|
||||||
key: "propMap",
|
{ key: "hutaoAccount", storage: window.localStorage, pick: ["hutaoEmail"] },
|
||||||
storage: window.localStorage,
|
|
||||||
pick: ["propMap"],
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user