|
@@ -1,62 +1,27 @@
|
|
|
<template>
|
|
|
- <view class="article_list">
|
|
|
- <view class="search">
|
|
|
- <uni-search-bar
|
|
|
- v-model="searchText"
|
|
|
- radius="100"
|
|
|
- bgColor="#fff"
|
|
|
- placeholder="搜一搜"
|
|
|
- clearButton="auto"
|
|
|
- cancelButton="none"
|
|
|
- @confirm="search"
|
|
|
- />
|
|
|
- </view>
|
|
|
- <view class="complex-list-horizontal-1">
|
|
|
- <view
|
|
|
- class="item"
|
|
|
- hover-class="pressed"
|
|
|
- v-for="item in listLoader.list.value"
|
|
|
- :key="item.id"
|
|
|
- @click="goDetail(item.id)"
|
|
|
- >
|
|
|
- <ImageWrapper :src="item.image" width="170rpx" height="190rpx" />
|
|
|
- <view class="info">
|
|
|
- <view class="name ellipsis-2">{{ item.title }}</view>
|
|
|
- <view class="desc">{{ item.date }}</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <SimplePageListLoader :loader="listLoader" />
|
|
|
- </view>
|
|
|
+ <CommonListPage
|
|
|
+ title="闽南文化资讯"
|
|
|
+ :load="loadData"
|
|
|
+ itemType="article-common"
|
|
|
+ />
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import CommonContent, { GetContentListParams } from '@/api/CommonContent';
|
|
|
-import SimplePageListLoader from '@/common/components/SimplePageListLoader.vue';
|
|
|
-import ImageWrapper from '@/common/components/ImageWrapper.vue';
|
|
|
-import { useSimplePageListLoader } from '@/common/composeabe/SimplePageListLoader';
|
|
|
-import { ref } from 'vue';
|
|
|
+import { GetContentListParams } from '@/api/CommonContent';
|
|
|
import { DataDateUtils } from '@imengyu/js-request-transform';
|
|
|
-import { navTo } from '@/common/utils/PageAction';
|
|
|
-import { onLoad } from '@dcloudio/uni-app';
|
|
|
+import NewsIndexContent from '@/api/news/NewsIndexContent';
|
|
|
+import CommonListPage from './common/CommonListPage.vue';
|
|
|
|
|
|
-const searchText = ref('');
|
|
|
-const listLoader = useSimplePageListLoader<{
|
|
|
- id: number,
|
|
|
- image: string,
|
|
|
- title: string,
|
|
|
- date: string
|
|
|
-}, {
|
|
|
- modelId: number|undefined,
|
|
|
- mainBodyColumnId: number|undefined,
|
|
|
-}>(8, async (page, pageSize, params) => {
|
|
|
- if (!params || !params.modelId || !params.mainBodyColumnId)
|
|
|
- throw new Error("未传入参数,当前页面需要参数");
|
|
|
- const res = await CommonContent.getContentList(new GetContentListParams().setSelfValues({
|
|
|
- keywords: searchText.value,
|
|
|
- modelId: params.modelId,
|
|
|
- mainBodyColumnId: params.mainBodyColumnId ,
|
|
|
- }), page, pageSize);
|
|
|
+async function loadData(
|
|
|
+ page: number,
|
|
|
+ pageSize: number,
|
|
|
+ searchText: string,
|
|
|
+ dropDownValues: number[]
|
|
|
+) {
|
|
|
+ const res = await NewsIndexContent.getContentList(new GetContentListParams()
|
|
|
+ .setMainBodyColumnId([228/* , 298, 299 */])
|
|
|
+ .setKeywords(searchText)
|
|
|
+ , page, pageSize);
|
|
|
return { list: res.list.map((item) => {
|
|
|
return {
|
|
|
id: item.id,
|
|
@@ -65,30 +30,5 @@ const listLoader = useSimplePageListLoader<{
|
|
|
date: DataDateUtils.formatDate(item.publishAt, 'YYYY-MM-dd'),
|
|
|
}
|
|
|
}), total: res.total }
|
|
|
-});
|
|
|
-
|
|
|
-function goDetail(id: number) {
|
|
|
- navTo('/pages/article/details', { id });
|
|
|
-}
|
|
|
-function search() {
|
|
|
- listLoader.loadData(undefined, true);
|
|
|
}
|
|
|
-
|
|
|
-onLoad((query) => {
|
|
|
- if (query?.title) {
|
|
|
- uni.setNavigationBarTitle({
|
|
|
- title: query.title,
|
|
|
- });
|
|
|
- }
|
|
|
- listLoader.loadData({
|
|
|
- modelId: query?.modelId ? Number(query.modelId) : undefined,
|
|
|
- mainBodyColumnId: query?.mainBodyColumnId? Number(query.mainBodyColumnId) : undefined ,
|
|
|
- })
|
|
|
-})
|
|
|
</script>
|
|
|
-
|
|
|
-<style lang="scss">
|
|
|
-.article_list {
|
|
|
- padding: 20rpx;
|
|
|
-}
|
|
|
-</style>
|