import OEmpty from '@/components/o-empty' import OPopup from '@/components/o-popup' import request from '@/helpers/request' import dayjs from 'dayjs' import { Button, Cell, Image, List } from 'vant' import { defineComponent, onMounted, reactive } from 'vue' import { useRoute } from 'vue-router' import AddInformation from './modal/add-information' import styles from './orchestra-information.module.less' export default defineComponent({ name: 'orchestra-information', setup() { const route = useRoute() const state = reactive({ addStatus: false, isLoading: false, list: [] as any, listState: { dataShow: true, // 判断是否有数据 loading: false, finished: false }, params: { type: 'HOT_CONSULTATION', clientType: 'SCHOOL', page: 1, rows: 20 } }) const getList = async () => { try { if (state.isLoading) return state.isLoading = true const res = await request.post('/api-school/sysNewsInformation/page', { data: { ...state.params, orchestraPhotoAlbumId: route.query.photoId } }) state.listState.loading = false const result = res.data || {} // 处理重复请求数据 if (state.list.length > 0 && result.pageNo === 1) { return } const rows = result.rows || [] state.list = state.list.concat(rows) state.listState.finished = result.current >= result.pages state.params.page = result.current + 1 state.listState.dataShow = state.list.length > 0 state.isLoading = false } catch { state.listState.dataShow = false state.listState.finished = true state.isLoading = false } } onMounted(() => { getList() }) return () => (
{state.listState.dataShow ? ( {state.list.map((item: any, index: number) => ( {{ icon: () => , title: () => (
{item.title}
{item.memo}
{dayjs(item.createBy).format('YYYY年MM月DD日')}
) }}
))}
) : ( )} (state.addStatus = false)} />
) } })