️ 一些优化

This commit is contained in:
目棃
2024-02-07 13:20:48 +08:00
parent fa891a6884
commit 82cdee00e7
6 changed files with 20 additions and 17 deletions

View File

@@ -9,7 +9,6 @@ use tauri::{AppHandle, Manager, WindowBuilder, WindowEvent, WindowUrl};
#[tauri::command] #[tauri::command]
pub async fn create_mhy_client(handle: AppHandle, func: String, url: String) { pub async fn create_mhy_client(handle: AppHandle, func: String, url: String) {
let mut mhy_window_config = handle.config().tauri.windows.get(1).unwrap().clone(); let mut mhy_window_config = handle.config().tauri.windows.get(1).unwrap().clone();
mhy_window_config.visible = true;
if url != "" { if url != "" {
mhy_window_config.url = WindowUrl::External(url.parse().unwrap()); mhy_window_config.url = WindowUrl::External(url.parse().unwrap());
} else { } else {

View File

@@ -213,6 +213,7 @@ async function getTokenWeb(cookie: string): Promise<void> {
await TGLogger.Error("[tc-userBadge][getTokenWeb] 获取 cookie 失败"); await TGLogger.Error("[tc-userBadge][getTokenWeb] 获取 cookie 失败");
return; return;
} }
await TGSqlite.saveAppData("cookie", JSON.stringify(cookieUser));
showSnackbar({ showSnackbar({
text: "登录成功!", text: "登录成功!",
color: "success", color: "success",

View File

@@ -74,7 +74,7 @@
/> />
</slot> </slot>
<slot name="inner-text"> <slot name="inner-text">
<span>{{ modelValue.innerText }}</span> <span :title="modelValue.innerText">{{ modelValue.innerText }}</span>
</slot> </slot>
</div> </div>
</div> </div>
@@ -208,6 +208,13 @@ const props = defineProps<TItemBoxProps>();
margin-right: 5px; margin-right: 5px;
} }
.tib-inner span {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-break: break-all;
}
.tib-outer { .tib-outer {
position: absolute; position: absolute;
bottom: 0; bottom: 0;

View File

@@ -101,10 +101,8 @@ onUnmounted(() => {
justify-content: center; justify-content: center;
padding: 10px; padding: 10px;
border-radius: 5px; border-radius: 5px;
background: var(--box-bg-2); background: var(--common-shadow-t-4) v-bind(bg) no-repeat;
background-image: v-bind(bg);
background-position-x: right; background-position-x: right;
background-repeat: no-repeat;
background-size: cover; background-size: cover;
} }
@@ -150,5 +148,6 @@ onUnmounted(() => {
.tur-ws-sub :nth-last-child(2) { .tur-ws-sub :nth-last-child(2) {
color: var(--tgc-yellow-1); color: var(--tgc-yellow-1);
font-family: var(--font-title);
} }
</style> </style>

View File

@@ -16,7 +16,7 @@ const props = defineProps<TwoConvertProps>();
const textColor = computed(() => { const textColor = computed(() => {
if (!props.data || !props.data.days) return "var(--tgc-blue-2)"; if (!props.data || !props.data.days) return "var(--tgc-blue-2)";
const day = new Date().getDay(); const day = new Date().getDay();
if (props.data.days.includes(day)) return "var(--tgc-pink-1)"; if (props.data.days.includes(day.toString())) return "var(--tgc-pink-1)";
return "var(--tgc-blue-2)"; return "var(--tgc-blue-2)";
}); });
</script> </script>

View File

@@ -40,12 +40,7 @@
</v-btn> </v-btn>
</div> </div>
<div class="posts-nav"> <div class="posts-nav">
<div <div v-for="navItem in nav" :key="navItem.id" class="post-nav" @click="toNav(navItem)">
v-for="navItem in nav"
:key="navItem.id"
class="post-nav"
@click="toNav(navItem.app_path)"
>
<img alt="navIcon" :src="navItem.icon" /> <img alt="navIcon" :src="navItem.icon" />
<span>{{ navItem.name }}</span> <span>{{ navItem.name }}</span>
</div> </div>
@@ -237,8 +232,10 @@ watch(curSortLabel, async (newVal) => {
await freshPostData(); await freshPostData();
}); });
async function toNav(path: string): Promise<void> { async function toNav(item: TGApp.BBS.Navigator.Navigator): Promise<void> {
const link = new URL(path); await TGLogger.Info(`[Posts][${curGameLabel.value}][toNav] 打开网页活动 ${item.name}`);
await TGLogger.Info(`[Posts][${curGameLabel.value}][toNav] ${item.app_path}`);
const link = new URL(item.app_path);
const mysList = [ const mysList = [
"https://act.mihoyo.com", "https://act.mihoyo.com",
"https://webstatic.mihoyo.com", "https://webstatic.mihoyo.com",
@@ -251,7 +248,7 @@ async function toNav(path: string): Promise<void> {
} }
// 如果不在上面的域名里面,就直接打开 // 如果不在上面的域名里面,就直接打开
if (!mysList.includes(link.origin)) { if (!mysList.includes(link.origin)) {
window.open(path); window.open(item.app_path);
return; return;
} }
const modeConfirm = await showConfirm({ const modeConfirm = await showConfirm({
@@ -265,8 +262,8 @@ async function toNav(path: string): Promise<void> {
}); });
return; return;
} }
if (modeConfirm) await TGClient.open("web_act", path); if (modeConfirm) await TGClient.open("web_act", item.app_path);
else await TGClient.open("web_act_thin", path); else await TGClient.open("web_act_thin", item.app_path);
} }
// 处理 protocol // 处理 protocol