<!--
 * @Author: PoJun
 * @Date: 2023-12-19 14:57:48
 * @LastEditors: XuanJi
 * @LastEditTime: 2024-05-21 00:12:16
 * @Message: 合作记录
-->
<template>
    <uv-cell-group :border="false">
        <uv-cell :border="false" :isLink="true" value="查看更多" url="/subpkg/home/records">
            <uv-text slot="title" text="近期合作记录" :customStyle="{ 'font-weight': 'bold' }"></uv-text>
        </uv-cell>

        <template v-if="recordsList && recordsList.length > 0">
            <uv-cell
                class="uv-cell-view"
                v-for="(item, index) in recordsList"
                :key="index"
                :border="false"
                @click="toDetail(item.id)"
            >
                <template v-slot:title>
                    <text>{{ item.content }}</text>
                </template>
                <template v-slot:label>
                    <view class="uv-info">{{ item.time }}</view>
                </template>
            </uv-cell>
        </template>

        <view v-else class="uv-m-b-50">
            <uv-empty marginTop="30" mode="data" text="暂无数据"></uv-empty>
        </view>
    </uv-cell-group>
</template>

<script>
import { getSelfRecords } from "@/config/http.js";
export default {
    data() {
        return {
            recordsList: [],
        };
    },
    async created() {
        const params = {
            params: {
                pageSize: 5,
                pageNum: 1,
                query: {},
            },
        };
        const data = await getSelfRecords(params);
        this.recordsList = data.list;
    },
    methods: {
        toDetail(id) {
            uni.navigateTo({
                url: `/subpkg/home/records-detail?id=${id}`,
            });
        },
    },
};
</script>

<style lang="scss" scoped>
.uv-cell-view {
    border-top: 1px solid #f8f8f8;
}
</style>
