add:对接卡片接口

This commit is contained in:
zlong committed 2024-12-11 17:54:18 +08:00
1 parent c096a2c69b
commit ed3ce8ba53
7 files changed
+156 -90

No files matched your search

+33 -11
View File
@@ -1,13 +1,34 @@
<script setup lang="ts">
interface ListItem {
img: string
title: string
desc: string
time: string
import type { Paging } from '@/model/base'
import type { Article } from '@/model/pet-manual'
import titleBg from '@/static/image/feed-plan/bg.png'
interface ContentText {
contentdown: string
contentrefresh: string
contentnomore: string
}
const props = withDefaults(defineProps<{
cardList: Article[]
pagination: Paging
}>(), {
pagination: {
page: 0,
size: 10,
total: 0,
},
})
const emit = defineEmits(['loadMore'])
const contentText = ref<ContentText>({
contentdown: '查看更多',
contentrefresh: '加载中',
contentnomore: '没有更多',
})
function handleLoadMore() {
emit('loadMore')
}
const props = defineProps<{
cardList: ListItem[]
}>()
</script>
<template>
@@ -15,20 +36,21 @@ const props = defineProps<{
v-for="(item, index) in props.cardList" :key="index" class="bg-[white] rounded-md shadow-lg mx-4 mb-4 w-[calc(100% - 32px)] mt-3"
>
<view class="flex">
<image class="w-28 h-28 rounded-l-md" :src="item.img" />
<image class="w-28 h-28 rounded-l-md" :src="item?.imageUrl || titleBg" />
<view class="p-4">
<view class="text-[14px]">
{{ item.title }}
</view>
<view class="mt-2 text-[11px] text-[#999] whitespace-pre-line">
{{ item.desc }}
{{ item.content }}
</view>
<view class="mt-3 text-[10px] text-[#D8D8D8]">
{{ item.time }}
{{ item.updatedTime }}
</view>
</view>
</view>
</view>
<uni-load-more status="more" :content-text="contentText" @click-load-more="handleLoadMore" />
</template>
<style scoped>