增加
This commit is contained in:
59
Web/src/pages/news/index.vue
Normal file
59
Web/src/pages/news/index.vue
Normal file
@@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<div class="content">
|
||||
<Abar href="/">首页</Abar>>官方公告
|
||||
</div>
|
||||
<div class="common">
|
||||
<div class="item border" v-for="(item, index) in data" :key="index">
|
||||
{{ index + 1 }}.<Abar :href='"/news/info?id=" + item.noticeId'>{{ item.title }}</Abar>
|
||||
</div>
|
||||
<span v-if="data.length == 0">暂无公告.</span>
|
||||
</div>
|
||||
<div class="content">
|
||||
<Pagination :currentPage="currentPage" :limit="10" :total="totalPages" @pageChange="handlePageChange" />
|
||||
</div>
|
||||
<Abar href="/">返回游戏首页</Abar>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
||||
definePageMeta({
|
||||
layout: layout.empty,
|
||||
middleware: 'page-loading'
|
||||
})
|
||||
|
||||
const currentPage = ref<number>(1);
|
||||
const totalPages = ref<number>(0);
|
||||
const data = ref<Array<any>>([]);
|
||||
|
||||
const handlePageChange = async (page: number): Promise<void> => {
|
||||
currentPage.value = page;
|
||||
await BindData();
|
||||
console.log('跳转到第', page, '页');
|
||||
};
|
||||
|
||||
const BindData = async (): Promise<void> => {
|
||||
var result = await PubService.GetNoticeData(currentPage.value, 10);
|
||||
console.log(result);
|
||||
if (result.code == 0) {
|
||||
data.value = result.data.data;
|
||||
totalPages.value = result.data.total;
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowToast(result.msg, "fail");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
await BindData();
|
||||
}
|
||||
finally {
|
||||
|
||||
PageLoading.Close();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
1
Web/src/pages/news/info.vue
Normal file
1
Web/src/pages/news/info.vue
Normal file
@@ -0,0 +1 @@
|
||||
<template></template>
|
||||
Reference in New Issue
Block a user