cshenfu
2024-06-27 58aa6e282bb343503be3cb198948328ea3ed7b79
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<template>
    <view class="course-item" @click="openCourse">
        <image class="picture" :src="item.thumb+'?x-oss-process=image/resize,m_fill,h_192,w_342'" mode="aspectFill"></image>
        <view class="detail">
            <view class="u-line-2 u-font-32 course-name">
                {{item.title}}
            </view>
            <view class="u-line-1 u-font-20 course-desc">
                {{item.short_description}}
            </view>
            <view class="course-price" v-if="!hasBuy">
                <view class="u-font-26 tip">
                    单价:
                </view>
                <view class="u-font-26 tip-1">
                    ¥
                </view>
                <view class="u-font-40 price">
                    {{Number(item.charge/100).toFixed(1)}}
                </view>
                <view class="u-font-34 price-discount" v-if="item.charge_original>0">
                    {{Number(item.charge_original/100).toFixed(1)}}
                </view>
            </view>
            <view class="go-learn" v-else>
                <view class="button">
                    立即学习
                </view>
            </view>
        </view>
    </view>
</template>
 
<script>
    export default {
        name: "course-item",
        props: ['item', 'hasBuy'],
        data() {
            return {
 
            };
        },
        methods: {
            openCourse() {
                uni.vk.navigateTo('/uni_modules/uce-course/pages/detail/detail?_id=' + this.item._id, false);
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .course-item {
        margin: 0 auto;
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 252rpx;
        width: 696rpx;
        border-bottom: 2px solid #f5f5f5;
 
        .picture {
            width: 342rpx;
            height: 192rpx;
        }
 
        .detail {
            margin-left: 30rpx;
            flex: 1;
            position: relative;
            overflow: hidden;
 
            .course-name {
                font-weight: bold;
                color: #303030;
            }
 
            .course-desc {
                margin-top: 8rpx;
                font-weight: bold;
                color: #C5C5C5;
            }
 
            .go-learn {
                display: flex;
                margin-top: 8rpx;
 
                .button {
                    background: #1663FF;
                    color: #FFFFFF;
                    font-size: 26rpx;
                    text-align: center;
                    height: 60rpx;
                    line-height: 60rpx;
                    padding: 0 20rpx;
                    border-radius: 5rpx;
                }
            }
 
            .course-price {
                display: flex;
                margin-top: 8rpx;
                align-items: flex-end;
 
                .tip {
                    color: #303030;
                }
 
                .tip-1 {
                    color: #FF724E;
                }
 
                .price {
                    color: #FF724E;
                }
 
                .price-discount {
                    color: #C5C5C5;
                    margin-left: 10rpx;
                    text-decoration: line-through;
                }
            }
        }
    }
</style>