feat: reply sort style

This commit is contained in:
KUN1007 2023-09-14 17:33:36 +08:00
parent bc6e45a337
commit 45be80f3d8
6 changed files with 71 additions and 51 deletions

View file

@ -17,7 +17,7 @@
height: 100vh; height: 100vh;
width: 100vw; width: 100vw;
min-width: 700px; min-width: 700px;
min-height: 600px; min-height: 100vh;
background: linear-gradient( background: linear-gradient(
var(--kungalgame-trans-pink-1), var(--kungalgame-trans-pink-1),
var(--kungalgame-trans-blue-1) var(--kungalgame-trans-blue-1)

View file

@ -17,7 +17,7 @@
height: 100vh; height: 100vh;
width: 100vw; width: 100vw;
min-width: 700px; min-width: 700px;
min-height: 600px; height: 100vh;
background: linear-gradient( background: linear-gradient(
var(--kungalgame-trans-pink-1), var(--kungalgame-trans-pink-1),
var(--kungalgame-trans-blue-1) var(--kungalgame-trans-blue-1)

View file

@ -71,14 +71,6 @@ const fetchTopicData = async () => {
topicData.value = topicResponseData topicData.value = topicResponseData
} }
const fetchReplyData = async () => {
//
const replyResponseData = (
await useKUNGalgameTopicStore().getReplies(tid.value)
).data
repliesData.value = replyResponseData
}
/** 这里拿到的已经是后端返回回来的 data 数据了 */ /** 这里拿到的已经是后端返回回来的 data 数据了 */
onMounted(async () => { onMounted(async () => {
await fetchTopicData() await fetchTopicData()
@ -120,8 +112,7 @@ onBeforeMount(() => {
<!-- 总容器 --> <!-- 总容器 -->
<div class="root"> <div class="root">
<ReplyPanel /> <ReplyPanel />
<!-- 下面话题详情区的容器 -->
<div class="container">
<!-- 下方可视内容区的容器 --> <!-- 下方可视内容区的容器 -->
<div class="content-container"> <div class="content-container">
<!-- 侧边栏 --> <!-- 侧边栏 -->
@ -134,27 +125,21 @@ onBeforeMount(() => {
</div> </div>
</div> </div>
</div> </div>
</div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
/* 页面总容器 */ /* 页面总容器 */
.root { .root {
min-height: 1500px; min-height: calc(100vh - 65px);
display: flex; display: flex;
flex-shrink: 0; flex-shrink: 0;
flex-direction: column; flex-direction: column;
} }
/* 下面话题详情区的容器 */
.container {
display: flex;
flex-shrink: 0;
}
/* 下方可视内容区的容器 */ /* 下方可视内容区的容器 */
.content-container { .content-container {
width: v-bind(topicPageWidth); width: v-bind(topicPageWidth);
transition: all 0.2s; transition: all 0.2s;
max-width: 1500px;
height: 100%; height: 100%;
margin: 0 auto; margin: 0 auto;
display: flex; display: flex;
@ -174,6 +159,7 @@ onBeforeMount(() => {
/* 右侧内容区为弹性盒(用户可以一直向下滑) */ /* 右侧内容区为弹性盒(用户可以一直向下滑) */
display: flex; display: flex;
flex-direction: column; flex-direction: column;
z-index: 1;
} }
@media (max-width: 1000px) { @media (max-width: 1000px) {

View file

@ -61,6 +61,8 @@ watch(
<style lang="scss" scoped> <style lang="scss" scoped>
/* 侧边栏部分 */ /* 侧边栏部分 */
.aside { .aside {
top: 70px;
position: sticky;
/* 侧边栏距离文章区域的距离 */ /* 侧边栏距离文章区域的距离 */
margin-right: 5px; margin-right: 5px;
width: v-bind('asideWidth'); width: v-bind('asideWidth');
@ -71,7 +73,7 @@ watch(
display: flex; display: flex;
/* 方向为竖向 */ /* 方向为竖向 */
flex-direction: column; flex-direction: column;
transition: 0.1s; transition: 0.5s;
span { span {
white-space: nowrap; white-space: nowrap;
} }

View file

@ -10,19 +10,22 @@ defineProps<{
</script> </script>
<template> <template>
<Transition
enter-active-class="animate__animated animate__fadeInLeft animate__faster"
appear
>
<div class="aside"> <div class="aside">
<TopicAsideNav /> <TopicAsideNav />
<TopicOtherTag style="margin-bottom: 17px" :tags="$props.tags" /> <TopicOtherTag style="margin-bottom: 17px" :tags="$props.tags" />
<TopicMaster /> <TopicMaster />
<KUNGalgameFooter /> <KUNGalgameFooter />
</div> </div>
</Transition>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
/* 左侧内容区 */ /* 左侧内容区 */
.aside { .aside {
top: 70px;
position: sticky;
/* 左侧区域的总高度 */ /* 左侧区域的总高度 */
height: 940px; height: 940px;
/* 左侧区域宽度 */ /* 左侧区域宽度 */

View file

@ -27,13 +27,13 @@ const orderDescending = () => {
<template> <template>
<div class="nav"> <div class="nav">
<!-- 交互区容器 --> <!-- 交互区容器 -->
<ul> <div class="item">
<li> <span>
<Icon class="icon" icon="line-md:arrow-close-up" />{{ <Icon class="icon" icon="line-md:arrow-close-up" />{{
$tm('topic.aside.top') $tm('topic.aside.top')
}} }}
</li> </span>
<li <span
v-for="kun in asideNavItem" v-for="kun in asideNavItem"
:key="kun.index" :key="kun.index"
@click="handleSortReply(kun.sortField)" @click="handleSortReply(kun.sortField)"
@ -41,11 +41,15 @@ const orderDescending = () => {
<Icon class="icon" :icon="kun.icon" />{{ <Icon class="icon" :icon="kun.icon" />{{
$tm(`topic.aside['${kun.name}']`) $tm(`topic.aside['${kun.name}']`)
}} }}
</li> </span>
</ul> </div>
<div> <div class="sort-order">
<span @click="orderAscending">升序</span> <span @click="orderAscending">
<span @click="orderDescending">降序</span> <Icon icon="tdesign:order-ascending" />
</span>
<span @click="orderDescending">
<Icon icon="tdesign:order-descending" />
</span>
</div> </div>
</div> </div>
</template> </template>
@ -53,26 +57,26 @@ const orderDescending = () => {
<style lang="scss" scoped> <style lang="scss" scoped>
/* 话题详情页的交互 */ /* 话题详情页的交互 */
.nav { .nav {
height: 107px;
display: flex; display: flex;
flex-direction: column;
justify-content: center; justify-content: center;
/* 左边第一个部分的边 */ /* 左边第一个部分的边 */
border: 1px solid var(--kungalgame-trans-red-4); border: 1px solid var(--kungalgame-trans-red-4);
background-color: var(--kungalgame-trans-blue-0);
box-shadow: var(--shadow); box-shadow: var(--shadow);
border-radius: 5px; border-radius: 5px;
/* 距离顶部的距离 */ /* 距离顶部的距离 */
margin-bottom: 17px; margin-bottom: 17px;
/* 隐藏溢出的边角 */ /* 隐藏溢出的边角 */
overflow: hidden; overflow: hidden;
ul { .item {
flex-grow: 1; flex-grow: 1;
display: flex; display: flex;
background-color: var(--kungalgame-trans-blue-0);
display: grid; display: grid;
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr);
& > li { & > span {
height: 40px;
padding: 0 11px; padding: 0 11px;
flex-grow: 1;
display: flex; display: flex;
align-items: center; align-items: center;
position: relative; position: relative;
@ -81,6 +85,10 @@ const orderDescending = () => {
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
cursor: pointer; cursor: pointer;
font-size: 15px;
&:nth-child(1) {
color: var(--kungalgame-blue-4);
}
&::before { &::before {
transform: scaleX(0); transform: scaleX(0);
transform-origin: bottom right; transform-origin: bottom right;
@ -102,8 +110,29 @@ const orderDescending = () => {
} }
} }
} }
.icon { .icon {
margin-right: 4px; margin-right: 4px;
font-size: 17px; font-size: 17px;
} }
/* 按照升序还是降序排列 */
.sort-order {
width: 100%;
display: flex;
cursor: default;
span {
height: 27px;
color: var(--kungalgame-blue-4);
width: 100%;
display: flex;
justify-content: center;
align-items: center;
font-size: 17px;
&:hover {
transition: all 0.2s;
color: var(--kungalgame-red-4);
}
}
}
</style> </style>