mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-06 08:32:51 +08:00
💄 调整帖子回复浮窗UI,完善类型
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
<!-- 帖子回复按钮&一级回复列表组件 -->
|
||||||
<template>
|
<template>
|
||||||
<div class="tpr-main-box" title="查看回复">
|
<div class="tpr-main-box" title="查看回复">
|
||||||
<v-menu
|
<v-menu
|
||||||
@@ -7,7 +8,7 @@
|
|||||||
:persistent="true"
|
:persistent="true"
|
||||||
:no-click-animation="true"
|
:no-click-animation="true"
|
||||||
z-index="60"
|
z-index="60"
|
||||||
:offset="[4, 400]"
|
:offset="[12, 0]"
|
||||||
>
|
>
|
||||||
<template #activator="{ props }">
|
<template #activator="{ props }">
|
||||||
<v-btn
|
<v-btn
|
||||||
@@ -76,21 +77,53 @@ import showSnackbar from "@comp/func/snackbar.js";
|
|||||||
import postReq from "@req/postReq.js";
|
import postReq from "@req/postReq.js";
|
||||||
import useAppStore from "@store/app.js";
|
import useAppStore from "@store/app.js";
|
||||||
import { emit } from "@tauri-apps/api/event";
|
import { emit } from "@tauri-apps/api/event";
|
||||||
|
import TGLogger from "@utils/TGLogger.js";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
import { computed, ref, shallowRef, watch } from "vue";
|
import { computed, ref, shallowRef, watch } from "vue";
|
||||||
|
|
||||||
import VpReplyDebug from "./vp-reply-debug.vue";
|
import VpReplyDebug from "./vp-reply-debug.vue";
|
||||||
import VpReplyItem from "./vp-reply-item.vue";
|
import VpReplyItem from "./vp-reply-item.vue";
|
||||||
|
|
||||||
type TprMainProps = { gid: number; postId: string };
|
/**
|
||||||
type SelectItem = { label: string; value: string };
|
* 帖子一级回复列表组件参数
|
||||||
const props = defineProps<TprMainProps>();
|
*/
|
||||||
|
type TprMainProps = {
|
||||||
|
/* 版块ID */
|
||||||
|
gid: number;
|
||||||
|
/* 帖子ID */
|
||||||
|
postId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回复排序类型
|
||||||
|
*/
|
||||||
|
enum ReplyOrderType {
|
||||||
|
/* 热门 */
|
||||||
|
HOT = 0,
|
||||||
|
/* 最新 */
|
||||||
|
LATEST = 2,
|
||||||
|
/* 最早 */
|
||||||
|
OLDEST = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择项类型
|
||||||
|
*/
|
||||||
|
type SelectItem = {
|
||||||
|
/* 文本 */
|
||||||
|
label: string;
|
||||||
|
/* 值 */
|
||||||
|
value: ReplyOrderType;
|
||||||
|
};
|
||||||
|
|
||||||
const { devMode } = storeToRefs(useAppStore());
|
const { devMode } = storeToRefs(useAppStore());
|
||||||
|
|
||||||
|
const props = defineProps<TprMainProps>();
|
||||||
|
|
||||||
const orderList: Array<SelectItem> = [
|
const orderList: Array<SelectItem> = [
|
||||||
{ label: "热门", value: "hot" },
|
{ label: "热门", value: ReplyOrderType.HOT },
|
||||||
{ label: "最新", value: "latest" },
|
{ label: "最新", value: ReplyOrderType.LATEST },
|
||||||
{ label: "最早", value: "oldest" },
|
{ label: "最早", value: ReplyOrderType.OLDEST },
|
||||||
];
|
];
|
||||||
|
|
||||||
const pinId = ref<string>("0");
|
const pinId = ref<string>("0");
|
||||||
@@ -100,14 +133,12 @@ const loading = ref<boolean>(false);
|
|||||||
const showOverlay = ref<boolean>(false);
|
const showOverlay = ref<boolean>(false);
|
||||||
const showDebug = ref<boolean>(false);
|
const showDebug = ref<boolean>(false);
|
||||||
const onlyLz = ref<boolean>(false);
|
const onlyLz = ref<boolean>(false);
|
||||||
const orderType = ref<"hot" | "latest" | "oldest">("hot");
|
const orderType = ref<ReplyOrderType>(ReplyOrderType.HOT);
|
||||||
const reply = shallowRef<Array<TGApp.BBS.Reply.ReplyFull>>([]);
|
const reply = shallowRef<Array<TGApp.BBS.Reply.ReplyFull>>([]);
|
||||||
const isHot = computed<boolean>(() => orderType.value === "hot");
|
const isHot = computed<boolean>(() => orderType.value === ReplyOrderType.HOT);
|
||||||
const replyOrder = computed<1 | 2 | undefined>(() => {
|
const replyOrder = computed<1 | 2 | undefined>(() => {
|
||||||
if (orderType.value === "hot") return undefined;
|
if (orderType.value === ReplyOrderType.HOT) return undefined;
|
||||||
if (orderType.value === "latest") return 2;
|
return orderType.value;
|
||||||
if (orderType.value === "oldest") return 1;
|
|
||||||
return undefined;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
@@ -161,8 +192,11 @@ async function loadReply(): Promise<void> {
|
|||||||
onlyLz.value,
|
onlyLz.value,
|
||||||
replyOrder.value,
|
replyOrder.value,
|
||||||
);
|
);
|
||||||
|
console.debug("[VpBtnReply] Load Reply Response:", resp);
|
||||||
if ("retcode" in resp) {
|
if ("retcode" in resp) {
|
||||||
showSnackbar.error(`[${resp.retcode}] ${resp.message}`);
|
showSnackbar.error(`[${resp.retcode}] ${resp.message}`);
|
||||||
|
await TGLogger.Warn(`[VpBtnReply] Load Reply Error: ${resp.retcode} - ${resp.message}`);
|
||||||
|
loading.value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
isLast.value = resp.is_last;
|
isLast.value = resp.is_last;
|
||||||
@@ -222,7 +256,6 @@ async function handleDebug(): Promise<void> {
|
|||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
height: 400px;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -234,6 +267,7 @@ async function handleDebug(): Promise<void> {
|
|||||||
box-shadow: 2px 2px 8px var(--common-shadow-4);
|
box-shadow: 2px 2px 8px var(--common-shadow-4);
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
row-gap: 8px;
|
row-gap: 8px;
|
||||||
|
transition: height 0.5s ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tpr-main-filter {
|
.tpr-main-filter {
|
||||||
@@ -300,7 +334,7 @@ async function handleDebug(): Promise<void> {
|
|||||||
display: flex;
|
display: flex;
|
||||||
overflow: hidden auto;
|
overflow: hidden auto;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 360px;
|
height: fit-content;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
Reference in New Issue
Block a user