|
@@ -91,20 +91,17 @@
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
import { computed, onMounted, ref } from "vue";
|
|
import { computed, onMounted, ref } from "vue";
|
|
import { MAGAZINES_INFO } from "../constants";
|
|
import { MAGAZINES_INFO } from "../constants";
|
|
-import { getPublishListApi, type PubicationItem } from "@/api";
|
|
|
|
|
|
+import {
|
|
|
|
+ getMagazineYearListApi,
|
|
|
|
+ getPublishListApi,
|
|
|
|
+ type PubicationItem,
|
|
|
|
+} from "@/api";
|
|
import { getBaseURL } from "@dage/service";
|
|
import { getBaseURL } from "@dage/service";
|
|
import { debounce } from "lodash-unified";
|
|
import { debounce } from "lodash-unified";
|
|
|
|
|
|
const PAGE_SIZE = 8;
|
|
const PAGE_SIZE = 8;
|
|
|
|
|
|
-const MIN_YEAR = 2017;
|
|
|
|
-const date = new Date();
|
|
|
|
-const year = date.getFullYear();
|
|
|
|
-const years = Array.from(
|
|
|
|
- { length: year - MIN_YEAR + 1 },
|
|
|
|
- (_, index) => year - index
|
|
|
|
-);
|
|
|
|
-
|
|
|
|
|
|
+const years = ref<string[]>([]);
|
|
const curInfoIndex = ref(0);
|
|
const curInfoIndex = ref(0);
|
|
const curDateIndex = ref(0);
|
|
const curDateIndex = ref(0);
|
|
const baseUrl = getBaseURL();
|
|
const baseUrl = getBaseURL();
|
|
@@ -116,7 +113,7 @@ const loading = ref(false);
|
|
const list = ref<PubicationItem[]>([]);
|
|
const list = ref<PubicationItem[]>([]);
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
- getList();
|
|
|
|
|
|
+ getMagazineYearList();
|
|
});
|
|
});
|
|
|
|
|
|
const debounceSearch = debounce(() => {
|
|
const debounceSearch = debounce(() => {
|
|
@@ -124,13 +121,20 @@ const debounceSearch = debounce(() => {
|
|
getList();
|
|
getList();
|
|
}, 500);
|
|
}, 500);
|
|
|
|
|
|
|
|
+const getMagazineYearList = async () => {
|
|
|
|
+ const data = await getMagazineYearListApi();
|
|
|
|
+ years.value = data;
|
|
|
|
+
|
|
|
|
+ getList();
|
|
|
|
+};
|
|
|
|
+
|
|
const getList = async () => {
|
|
const getList = async () => {
|
|
try {
|
|
try {
|
|
loading.value = true;
|
|
loading.value = true;
|
|
const data = await getPublishListApi({
|
|
const data = await getPublishListApi({
|
|
pageSize: PAGE_SIZE,
|
|
pageSize: PAGE_SIZE,
|
|
pageNum: pageNum.value,
|
|
pageNum: pageNum.value,
|
|
- year: years[curDateIndex.value],
|
|
|
|
|
|
+ year: years.value[curDateIndex.value],
|
|
type: "Magazines",
|
|
type: "Magazines",
|
|
});
|
|
});
|
|
total.value = data.total;
|
|
total.value = data.total;
|