123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- <template>
- <view class="waterfall-item" :style="{width,...customStyle}" @click="goWork(item)">
- <view class="waterfall-item__image" :style="{width,backgroundColor:item.backgroundColor}">
- <image :src="item.image" mode="widthFix" style="border-radius: 20rpx;"></image>
- </view>
- <view class="waterfall-item__ft">
- <view class="waterfall-item__ft__title">
- <text class="value" :style="{color:textColor}">{{item.title}}</text>
- </view>
- <view class="waterfall-item__ft__desc">
- <view class="user">
- <image src="@/static/icon/caidou.png" mode="aspectFill" class="avater">
- </image>
- <text class="name" :style="{color:textColor}">{{item.author}}</text>
- </view>
- <view class="like" @click="changeLike">
- <image class="like-icon" :src="isLike ?'/static/icon/icon-18.png':'/static/icon/icon-19.png'" mode="">
- </image>
- <text class="value" :style="{color:textColor}">{{item.num_like}}</text>
- </view>
- </view>
- <view class="waterfall-item__ft__btn" v-if="false">
- <image class="waterfall-item__ft__btn__icon" src="@/static/zhHans-text-icon/text-10.png" mode="">
- </image>
- </view>
- </view>
- <view class="waterfall-item__tips">
- <view class="item">
- <image class="look-icon" src="@/static/icon/icon-17.png" mode=""></image>
- <text class="value" style="color: #fff;">{{item.num_view}}</text>
- </view>
- <view class="item" style="background-color: #1F1F1F;">
- <text class="value" style="color: #ACF934;">精选</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: "card",
- props: {
- width: {
- type: String,
- default: ''
- },
- item: {
- type: Object,
- default: () => ({})
- },
- textColor: {
- type: String,
- default: '#ff0000'
- },
- customStyle: {
- type: Object,
- default: () => ({
- background: '#3F4141',
- })
- }
- },
- data() {
- return {
- isLike: false,
- };
- },
- methods: {
- changeLike() {
- this.isLike = !this.isLike
- },
- goWork(item) {
- uni.$emit('check_login', () => {
- uni.navigateTo({
- url: '/pages/index/workDetail?id=' + item.id
- })
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .waterfall-item {
- margin-bottom: 20rpx;
- border-radius: 30rpx;
- position: relative;
- // #ifndef APP-NVUE
- .waterfall-item__image {
- width: 100%;
- height: auto;
- box-sizing: border-box;
- padding: 28rpx 20rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- // #endif
- .waterfall-item__tips {
- position: absolute;
- top: 10rpx;
- padding: 0rpx 10rpx;
- // #ifndef APP-NVUE
- box-sizing: border-box;
- // #endif
- width: 100%;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- .item {
- // #ifndef APP-NVUE
- // #endif
- display: flex;
- flex-direction: row;
- align-items: center;
- background: rgba(0, 0, 0, 0.2);
- padding: 4rpx 14rpx;
- border-radius: 12rpx;
- .look-icon {
- width: 26rpx;
- height: 18rpx;
- margin-right: 10rpx;
- }
- .value {
- font-size: 20rpx;
- }
- }
- }
- .waterfall-item__ft {
- padding: 10rpx 20rpx;
- &__title {
- line-height: 48rpx;
- font-weight: 700;
- .value {
- font-size: 30rpx;
- }
- }
- &__desc {
- width: 100%;
- // #ifndef APP-NVUE
- display: flex;
- // #endif
- // #ifdef APP-NVUE
- // #endif
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- margin: 20rpx 0;
- .user {
- // #ifndef APP-NVUE
- display: flex;
- // #endif
- // #ifdef APP-NVUE
- flex-direction: row;
- // #endif
- align-items: center;
- .avater {
- width: 36rpx;
- height: 36rpx;
- border-radius: 18rpx;
- margin-right: 10rpx;
- }
- .name {
- font-size: 24rpx;
- }
- }
- .like {
- // #ifndef APP-NVUE
- display: flex;
- // #endif
- // #ifdef APP-NVUE
- flex-direction: row;
- // #endif
- align-items: center;
- .like-icon {
- width: 30rpx;
- height: 25rpx;
- margin-right: 10rpx;
- }
- .value {
- font-size: 24rpx;
- }
- }
- }
- &__btn {
- height: 65rpx;
- border-radius: 18px;
- background-image: linear-gradient(to bottom, #BFFE9C, #AEE75D);
- // #ifndef APP-NVUE
- background: linear-gradient(180deg, #BFFE9C 0%, #AEE75D 62%, #AEE75D 100%);
- display: flex;
- // #endif
- justify-content: center;
- align-items: center;
- &__icon {
- width: 155rpx;
- height: 32rpx;
- }
- }
- }
- }
- </style>
|