🚸 一些优化

This commit is contained in:
目棃
2025-03-10 13:39:50 +08:00
parent 6302f171e9
commit 1cad9891dc
5 changed files with 40 additions and 29 deletions

View File

@@ -4,7 +4,7 @@
<TMiImg alt="navIcon" :src="navItem.icon" :ori="true" />
<span>{{ navItem.name }}</span>
</div>
<div v-if="props.modelValue === 2 && hasNav" class="tgn-nav">
<div v-if="hasNav" class="tgn-nav">
<v-btn size="25" @click="tryGetCode" title="查看兑换码" icon="mdi-code-tags-check"></v-btn>
</div>
<ToLivecode v-model="showOverlay" :data="codeData" v-model:actId="actId" />
@@ -37,7 +37,6 @@ const showOverlay = ref<boolean>(false);
const actId = ref<string>();
const hasNav = computed<TGApp.BBS.Navigator.Navigator | undefined>(() => {
if (props.modelValue !== 2) return undefined;
return nav.value.find((item) => item.name === "前瞻直播" || item.name === "直播兑换码");
});
@@ -81,6 +80,7 @@ async function toNav(item: TGApp.BBS.Navigator.Navigator): Promise<void> {
await TGLogger.Info(`[TGameNav][toNav] ${item.app_path}`);
const link = new URL(item.app_path);
const mysList = [
"https://ys.mihoyo.com",
"https://act.mihoyo.com",
"https://webstatic.mihoyo.com",
"https://bbs.mihoyo.com",
@@ -96,7 +96,7 @@ async function toNav(item: TGApp.BBS.Navigator.Navigator): Promise<void> {
window.open(item.app_path);
return;
}
if (item.name === "签到福利") {
if (item.name === "签到福利" || item.name === "每日签到") {
await TGClient.open("web_act_thin", item.app_path);
return;
}

View File

@@ -22,11 +22,10 @@
<span title="开放时间">{{ timestampToDate(Number(item.to_get_time) * 1000) }}</span>
</template>
<template #prepend>
<img
:src="item.img === '' ? '/source/UI/empty.webp' : item.img"
alt="icon"
class="tolc-icon"
/>
<div class="tolc-icon">
<TMiImg :src="item.img" v-if="item.img !== ''" alt="award" />
<img v-else src="/source/UI/empty.webp" alt="empty" />
</div>
</template>
<template #append>
<v-btn
@@ -46,6 +45,7 @@
<script setup lang="ts">
import showSnackbar from "@comp/func/snackbar.js";
import TMiImg from "./t-mi-img.vue";
import TOverlay from "./t-overlay.vue";
import { generateShareImg } from "@/utils/TGShare.js";
@@ -105,9 +105,19 @@ async function shareImg(): Promise<void> {
}
.tolc-icon {
position: relative;
display: flex;
width: 40px;
height: 40px;
align-items: center;
justify-content: center;
margin-right: 10px;
aspect-ratio: 1;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.tolc-btn {

View File

@@ -10,7 +10,7 @@
<div class="tusm-content">
<div v-for="mission in parseMissions" :key="mission.id" class="mission-item">
<div class="left">
<v-icon v-if="!mission.status" color="var(--tgc-od-grey)">mdi-circle</v-icon>
<v-icon v-if="!mission.status" color="var(--tgc-od-white)">mdi-circle</v-icon>
<v-icon v-else color="var(--tgc-od-green)">mdi-check-circle</v-icon>
<span>{{ mission.name }} - {{ mission.reward }}米游币</span>
<span v-if="mission.cycleTimes"> - Day{{ mission.cycleTimes }}</span>
@@ -42,7 +42,6 @@ import miscReq from "@/web/request/miscReq.js";
import painterReq from "@/web/request/painterReq.js";
import postReq from "@/web/request/postReq.js";
type TusMissionProps = { account?: TGApp.App.Account.User };
type ParseMission = {
id: number;
key: string;
@@ -54,8 +53,7 @@ type ParseMission = {
cycleTimes?: number;
};
const { cookie } = storeToRefs(useUserStore());
const props = defineProps<TusMissionProps>();
const { cookie, uid } = storeToRefs(useUserStore());
const loadScript = defineModel<boolean>();
const todayPoints = ref<number>(0);
const totalPoints = ref<number>(0);
@@ -65,13 +63,10 @@ const parseMissions = shallowRef<Array<ParseMission>>([]);
const missionList = shallowRef<Array<TGApp.BBS.Mission.MissionItem>>([]);
watch(
() => props.account,
(val) => {
console.log(val);
() => uid.value,
() => {
todayPoints.value = 0;
totalPoints.value = 0;
loadState.value = false;
loadMission.value = false;
parseMissions.value = [];
missionList.value = [];
},

View File

@@ -252,11 +252,18 @@ async function tryCkVerify(): Promise<void> {
align-items: center;
justify-content: flex-start;
overflow-y: auto;
row-gap: 4px;
row-gap: 8px;
max-height: 100%;
padding-right: 8px;
box-sizing: border-box;
}
.us-title {
position: relative;
position: sticky;
width: 100%;
background: var(--app-page-bg);
top: 0;
z-index: 2;
margin-right: auto;
color: var(--common-text-title);
font-family: var(--font-title);

View File

@@ -1,7 +1,7 @@
/**
* @file plugins/Sqlite/modules/userAccounts.ts
* @description 用户账户模块
* @since Beta v0.6.1
* @since Beta v0.7.2
*/
import TGSqlite from "@Sqlite/index.js";
@@ -216,15 +216,16 @@ function copyCookie(cookie: TGApp.App.Account.Cookie): string {
/**
* @description 获取指定用户账号
* @since Beta v0.6.0
* @since Beta v0.7.2
* @param {string} uid - 用户UID
* @returns {Promise<TGApp.Sqlite.Account.Game[]>}
*/
async function getGameAccount(uid: string): Promise<TGApp.Sqlite.Account.Game[]> {
const db = await TGSqlite.getDB();
return await db.select<TGApp.Sqlite.Account.Game[]>("SELECT * FROM GameAccount WHERE uid = ?;", [
uid,
]);
return await db.select<TGApp.Sqlite.Account.Game[]>(
"SELECT * FROM GameAccount WHERE uid = ? ORDER BY region, gameUid;",
[uid],
);
}
/**
@@ -263,7 +264,7 @@ async function getCurGameAccount(uid: string): Promise<TGApp.Sqlite.Account.Game
/**
* @description 保存游戏账户数据
* @since Beta v0.6.0
* @since Beta v0.7.2
* @param {string} uid - 米社UID
* @param {Array<TGApp.BBS.Game.Account>} accounts - 账户数据
* @return {Promise<void>}
@@ -273,9 +274,7 @@ async function saveGameAccount(
accounts: Array<TGApp.BBS.Game.Account>,
): Promise<void> {
const db = await TGSqlite.getDB();
for (const account of accounts) {
await db.execute(getInsertGameAccountSql(uid, account));
}
await Promise.all(accounts.map((account) => db.execute(getInsertGameAccountSql(uid, account))));
}
/**