mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
⚡️ 调整分类删除逻辑,优化卡片样式
This commit is contained in:
@@ -38,13 +38,20 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tpc-forum" v-if="card.forum" :title="`频道: ${card.forum.name}`">
|
||||
<div
|
||||
class="tpc-forum"
|
||||
v-if="card.forum && card.forum.name !== ''"
|
||||
:title="`频道: ${card.forum.name}`"
|
||||
>
|
||||
<img :src="card.forum.icon" :alt="card.forum.name" />
|
||||
<span>{{ card.forum.name }}</span>
|
||||
</div>
|
||||
<div v-if="props.selectMode" class="tpc-select">
|
||||
<v-checkbox-btn v-model="selectedList" :value="props.modelValue.post.post_id" />
|
||||
</div>
|
||||
<v-checkbox-btn
|
||||
v-if="props.selectMode"
|
||||
class="tpc-select"
|
||||
v-model="selectedList"
|
||||
:value="props.modelValue.post.post_id"
|
||||
/>
|
||||
</v-card>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
@@ -254,15 +261,23 @@ function getPostCard(item: TGApp.Plugins.Mys.Post.FullData): TGApp.Plugins.Mys.N
|
||||
border-bottom-left-radius: 5px;
|
||||
box-shadow: 0 0 10px var(--tgc-dark-1);
|
||||
color: var(--tgc-white-1);
|
||||
text-shadow: 0 0 5px var(--tgc-dark-1);
|
||||
}
|
||||
|
||||
.tpc-select {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
display: flex;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
backdrop-filter: blur(20px);
|
||||
background: var(--tgc-yellow-2);
|
||||
border-bottom-right-radius: 4px;
|
||||
box-shadow: 0 0 10px var(--tgc-dark-1);
|
||||
}
|
||||
|
||||
.tpc-forum img {
|
||||
|
||||
@@ -317,11 +317,11 @@ async function toEdit(): Promise<void> {
|
||||
await load();
|
||||
}
|
||||
|
||||
async function deleteOper(forever: boolean): Promise<void> {
|
||||
async function deleteOper(force: boolean): Promise<void> {
|
||||
if (selectedMode.value) {
|
||||
await deletePost(forever);
|
||||
await deletePost(force);
|
||||
} else {
|
||||
await deleteCollect(forever);
|
||||
await deleteCollect(force);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,7 +377,10 @@ async function deleteCollect(force: boolean): Promise<void> {
|
||||
return;
|
||||
}
|
||||
const title = force ? "删除分类" : "清空分类";
|
||||
const res = await showConfirm({ title: `确定${title}?` });
|
||||
const res = await showConfirm({
|
||||
title: `确定${title}?`,
|
||||
text: `该分类下${selected.value.length}条帖子将被${force ? "删除" : "移除分类(未分类将被删除)"}`,
|
||||
});
|
||||
if (!res) {
|
||||
showSnackbar({
|
||||
text: "取消删除",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file plugins/Sqlite/modules/userCollect.ts
|
||||
* @description 用户收藏模块
|
||||
* @since Beta v0.4.5
|
||||
* @since Beta v0.5.1
|
||||
*/
|
||||
|
||||
import TGSqlite from "../index.js";
|
||||
@@ -93,7 +93,7 @@ async function createCollect(title: string, desc: string): Promise<boolean> {
|
||||
|
||||
/**
|
||||
* @description 删除收藏合集
|
||||
* @since Beta v0.4.5
|
||||
* @since Beta v0.5.1
|
||||
* @param {string} title 收藏合集标题
|
||||
* @param {boolean} force 是否强制删除
|
||||
* @return {Promise<boolean>} 返回是否删除成功
|
||||
@@ -108,6 +108,9 @@ async function deleteCollect(title: string, force: boolean): Promise<boolean> {
|
||||
if (force) {
|
||||
const deleteSql = "DELETE FROM UFCollection WHERE title = ?";
|
||||
await db.execute(deleteSql, [title]);
|
||||
const deletePostSql =
|
||||
"DELETE FROM UFPost WHERE id IN (SELECT postId FROM UFMap WHERE collectionId = ?)";
|
||||
await db.execute(deletePostSql, [res[0].id]);
|
||||
}
|
||||
const deleteRefSql = "DELETE FROM UFMap WHERE collectionId = ?";
|
||||
await db.execute(deleteRefSql, [res[0].id]);
|
||||
|
||||
Reference in New Issue
Block a user