|
|
@@ -3,57 +3,48 @@
|
|
|
<template #header>
|
|
|
<app-navbar title="市场资讯" />
|
|
|
</template>
|
|
|
- <PullRefresh class="news-list__container" v-model="refreshing" @refresh="onRefresh">
|
|
|
- <Tabs class="mine-generalize__tabs">
|
|
|
+ <Tabs class="mine-generalize__tabs" v-model:active="active" @click-tab="onClickTab" sticky>
|
|
|
<Tab title="宏观新闻">
|
|
|
- <Empty v-if="newsList.length===0" />
|
|
|
+ <Empty v-if="dataList.length===0" />
|
|
|
</Tab>
|
|
|
<Tab title="行业动态">
|
|
|
- <Empty v-if="newsList.length===0" />
|
|
|
+ <Empty v-if="dataList.length===0" />
|
|
|
</Tab>
|
|
|
<Tab title="厂家信息">
|
|
|
- <Empty v-if="newsList.length===0" />
|
|
|
+ <Empty v-if="dataList.length===0" />
|
|
|
</Tab>
|
|
|
</Tabs>
|
|
|
- <div class="news-list__news">
|
|
|
- <CellGroup class="article">
|
|
|
- <template v-for="(item, index) in newsList" :key="index">
|
|
|
+ <app-pull-refresh class="news-list__container" v-model:pageIndex="pageIndex" :page-count="pageCount"
|
|
|
+ :updateList="dataList" @refresh="onRefresh">
|
|
|
+ <template #default="{ item }">
|
|
|
<Cell class="article-item" title-class="article-item__title" value-class="article-item__time"
|
|
|
:title="item.title" :value="formatDate(item.creaedate, 'MM/DD')"
|
|
|
:to="{ name: 'news-details', params: { details: JSON.stringify(item) } }" />
|
|
|
</template>
|
|
|
- </CellGroup>
|
|
|
- </div>
|
|
|
- </PullRefresh>
|
|
|
+ </app-pull-refresh>
|
|
|
</app-view>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
- import { shallowRef } from 'vue'
|
|
|
- import { Cell, CellGroup, PullRefresh, Tab, Tabs, Empty } from 'vant'
|
|
|
+
|
|
|
+ import { ref } from 'vue'
|
|
|
+ import { Cell, Tab, Tabs, Empty } from 'vant'
|
|
|
import { formatDate } from '@/filters'
|
|
|
- import { querySiteColumnDetail } from '@/services/api/news'
|
|
|
-
|
|
|
- const refreshing = shallowRef(false) // 是否处于加载中状态
|
|
|
- const newsList = shallowRef<Model.SiteColumnDetailRsp[]>([]) // 资讯列表
|
|
|
-
|
|
|
- // 下拉刷新
|
|
|
- const onRefresh = () => {
|
|
|
- querySiteColumnDetail({
|
|
|
- data: {
|
|
|
- page: 1,
|
|
|
- pagesize: 100,
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- newsList.value = res.data
|
|
|
- },
|
|
|
- complete: () => {
|
|
|
- refreshing.value = false
|
|
|
- }
|
|
|
- })
|
|
|
+ import { useSiteColumnDetail } from '@/business/news'
|
|
|
+ import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
|
|
|
+
|
|
|
+ /// tab激活项
|
|
|
+ const active = ref(0);
|
|
|
+
|
|
|
+ const { dataList, pageIndex, pageCount, getSiteColumnDetail } = useSiteColumnDetail()
|
|
|
+ /// Tab触发
|
|
|
+ const onClickTab = (e => {
|
|
|
+ active.value = e.name
|
|
|
+ })
|
|
|
+
|
|
|
+ const onRefresh = (callback: () => void) => {
|
|
|
+ getSiteColumnDetail(active.value).finally(() => callback())
|
|
|
}
|
|
|
-
|
|
|
- onRefresh()
|
|
|
</script>
|
|
|
|
|
|
<style lang="less">
|