绿满眶商城微信小程序-uniapp
zxl
3 天以前 4c0c7752dc996baba58f33aa101a7385752061a3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<template>
    <view class="page-container">
        <scroll-view scroll-y="true" class="scroll-view">
            <image v-if="coverUrl" :src="coverUrl" mode="widthFix" class="bg-image"></image>
            <view v-else class="empty-text">暂无</view>
 
            <!-- 底部留出导航栏高度的空间 -->
            <view class="safe-area-bottom"></view>
        </scroll-view>
        <custom-tabbar bgColor="#ffffff" selected="kitchen"></custom-tabbar>
    </view>
</template>
 
<script>
    import { getKitchenCover } from "@/api/kitchen.js";
    export default {
        data() {
            return {
                coverUrl: ''
            };
        },
        onLoad() {
            this.fetchCover();
        },
        methods: {
            async fetchCover() {
                try {
                    const res = await getKitchenCover();
                    if (res.statusCode === 200 && res.data.data && res.data.data.length > 0) {
                        this.coverUrl = res.data.data[0].coverUrl;
                    }
                } catch (e) {
                    console.error("获取神厨封面失败", e);
                }
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .page-container {
        width: 100vw;
        height: 100vh;
        position: relative;
        overflow: hidden;
        background-color: #ffffff;
    }
 
    .scroll-view {
        width: 100%;
        height: 100%;
    }
 
    .bg-image {
        width: 100%;
        display: block;
    }
 
    .empty-text {
        text-align: center;
        padding-top: 300rpx;
        color: #999;
        font-size: 28rpx;
    }
 
    .safe-area-bottom {
        height: 120rpx; // 为底部导航栏留出空间
        width: 100%;
    }
</style>