Skip to content

Commit

Permalink
优化后台帖子列表样式
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbbbbbbbbbbba committed Feb 26, 2024
1 parent f07298f commit 65d9f12
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 21 deletions.
21 changes: 19 additions & 2 deletions admin/src/assets/style/custom.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.container {
padding: 10px;
/* padding: 10px; */
margin: 10px;
background-color: var(--color-bg-1);

.container-header {
display: flex;
Expand All @@ -17,6 +19,21 @@
.container-main {
padding: 10px;
overflow: auto;
background-color: var(--color-bg-1);

&::-webkit-scrollbar-track-piece {
background: var(--color-neutral-3);
}

&::-webkit-scrollbar {
width: 6px;
}

&::-webkit-scrollbar-thumb {
background: var(--color-neutral-4);

/* border-radius: 20px; */
}

/* background-color: var(--color-bg-1); */
}
}
6 changes: 3 additions & 3 deletions admin/src/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ declare global {
const getUserInfo: typeof import('./api/user')['getUserInfo']
const h: typeof import('vue')['h']
const ignorableWatch: typeof import('@vueuse/core')['ignorableWatch']
const index: typeof import('./store/modules/tab-bar/index')['default']
const index: typeof import('./store/modules/user/index')['default']
const inject: typeof import('vue')['inject']
const isAnyBlank: typeof import('./composables/index')['isAnyBlank']
const isBlank: typeof import('./composables/index')['isBlank']
Expand Down Expand Up @@ -342,7 +342,7 @@ declare module 'vue' {
readonly getUserInfo: UnwrapRef<typeof import('./api/user')['getUserInfo']>
readonly h: UnwrapRef<typeof import('vue')['h']>
readonly ignorableWatch: UnwrapRef<typeof import('@vueuse/core')['ignorableWatch']>
readonly index: UnwrapRef<typeof import('./store/modules/tab-bar/index')['default']>
readonly index: UnwrapRef<typeof import('./store/modules/user/index')['default']>
readonly inject: UnwrapRef<typeof import('vue')['inject']>
readonly isAnyBlank: UnwrapRef<typeof import('./composables/index')['isAnyBlank']>
readonly isBlank: UnwrapRef<typeof import('./composables/index')['isBlank']>
Expand Down Expand Up @@ -638,7 +638,7 @@ declare module '@vue/runtime-core' {
readonly getUserInfo: UnwrapRef<typeof import('./api/user')['getUserInfo']>
readonly h: UnwrapRef<typeof import('vue')['h']>
readonly ignorableWatch: UnwrapRef<typeof import('@vueuse/core')['ignorableWatch']>
readonly index: UnwrapRef<typeof import('./store/modules/tab-bar/index')['default']>
readonly index: UnwrapRef<typeof import('./store/modules/user/index')['default']>
readonly inject: UnwrapRef<typeof import('vue')['inject']>
readonly isAnyBlank: UnwrapRef<typeof import('./composables/index')['isAnyBlank']>
readonly isBlank: UnwrapRef<typeof import('./composables/index')['isBlank']>
Expand Down
6 changes: 6 additions & 0 deletions admin/src/composables/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export function useTableHeight() {
proxy.$el.getElementsByClassName('container-header')[0];
const containerMainRef =
proxy.$el.getElementsByClassName('container-main')[0];
const containerFooterRef =
proxy.$el.getElementsByClassName('container-footer')[0];

if (!containerMainRef) {
return;
Expand All @@ -94,6 +96,10 @@ export function useTableHeight() {
if (containerHeaderRef) {
height -= containerHeaderRef.clientHeight;
}
if (containerFooterRef) {
height -= containerFooterRef.clientHeight;
}
// height -= 32;
containerMainRef.style.height = `${Math.max(height, minHeight)}px`;
}

Expand Down
38 changes: 22 additions & 16 deletions admin/src/views/pages/topic/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,24 @@
</a-form>
</div>
<div class="container-main">
<div v-if="data && data.results">
<div v-if="data && data.results" class="topic-container">
<topic-list :results="data.results" @change="list" />
<div style="margin-top: 10px; display: flex; justify-content: flex-end">
<a-pagination
:total="pagination.total"
:current="pagination.current"
:page-size="pagination.pageSize"
:show-total="pagination.showTotal"
:show-jumper="pagination.showJumper"
:show-page-size="pagination.showPageSize"
@change="onPageChange"
@page-size-change="onPageSizeChange"
/>
</div>
</div>
<a-empty v-else />
</div>
<div class="container-footer">
<a-pagination
style="margin: 10px"
:total="pagination.total"
:current="pagination.current"
:page-size="pagination.pageSize"
:show-total="pagination.showTotal"
:show-jumper="pagination.showJumper"
:show-page-size="pagination.showPageSize"
@change="onPageChange"
@page-size-change="onPageSizeChange"
/>
</div>
</div>
</template>

Expand Down Expand Up @@ -93,6 +94,10 @@
};
});
onMounted(() => {
useTableHeight();
});
const list = async () => {
loading.value = true;
try {
Expand Down Expand Up @@ -121,8 +126,9 @@
</script>

<style scoped lang="less">
.topic-list {
.topic-item {
}
.container-footer {
// padding: 10px;
display: flex;
justify-content: end;
}
</style>

0 comments on commit 65d9f12

Please sign in to comment.