317 lines
6.5 KiB
Vue
317 lines
6.5 KiB
Vue
<template>
|
|
<view class="newsList" ref="container">
|
|
<mescroll-body ref="mescrollRef" top="0" bottom="0" class='cotent-scroll' :up="upOption" :down="downOption" @up="upCallback" @down="downCallback" @init="mescrollInit" @emptyclick="emptyClick">
|
|
|
|
<view class="list" v-for="(item, index) in list" :key="index">
|
|
<view @click="goNewsDetail(item)" class="item acea-row" style="flex-wrap: nowrap;">
|
|
<view class="text acea-row row-column-between">
|
|
<view class="acea-row row-column" style="position: relative;">
|
|
<view class="name line2">{{ item.name }}</view>
|
|
<view class="summary line1" style="width: 322rpx;">{{ shortDateString(item.createdTime) }}</view>
|
|
|
|
</view>
|
|
<view class="acea-row row-left row-middle">
|
|
<view class="see-num-box acea-row row-middle" style="margin-right: 20rpx;">
|
|
<image :src="webUrl+'/20230304131559277594.png'" class="eye-icon" mode=""></image>
|
|
<text class="see-num-text">{{item.pv||0}}</text>
|
|
</view>
|
|
<view class="zan-num-box acea-row row-middle">
|
|
<img class="zan-icon" :src="webUrl+'/20230304133322439350.png'" />
|
|
<text class="zan-num-text">{{item.zan||0}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="pictrue">
|
|
|
|
<image v-if="item.type=='NT_TEXT'" style="width: 100%;height: 100%;" :src="item.resources[0]" />
|
|
<video v-if="item.type=='NT_VIDEO'" style="width: 100%;height: 100%;" :src="item.resources[0]"></video>
|
|
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view id="loading-more"></view>
|
|
</mescroll-body>
|
|
</view>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
import MescrollMixins from "@/mixins/mescroll-mixins.js";
|
|
import MescrollBody from "@/components/mescroll-uni/mescroll-body.vue";
|
|
import { getHotelNewsZanList } from "@/api/inn.js";
|
|
import { formatDateTime,isNullOrEmpty} from "@/utils";
|
|
var _this;
|
|
export default {
|
|
data() {
|
|
return {
|
|
webUrl: this.$VUE_APP_RESOURCES_URL,
|
|
list:[],
|
|
upOption:{
|
|
noMoreSize: 10, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
|
|
auto:true,
|
|
empty:{
|
|
tip: '暂无数据' // 提示
|
|
// btnText:'点击刷新'
|
|
}
|
|
},
|
|
downOption:{
|
|
auto:false
|
|
}
|
|
}
|
|
},
|
|
components:{
|
|
MescrollBody
|
|
},
|
|
mixins:[
|
|
MescrollMixins({
|
|
getPageData(mescroll){
|
|
var _this = this;
|
|
// 此时mescroll会携带page的参数:
|
|
let pageNum = mescroll.num; // 页码, 默认从1开始
|
|
let pageSize = mescroll.size; // 页长, 默认每页10条
|
|
var params = {
|
|
limit:pageNum,
|
|
page:pageSize
|
|
}
|
|
getHotelNewsZanList(params)
|
|
.then(res => {
|
|
|
|
|
|
if(mescroll.num == 1) {
|
|
_this.list = []; //如果是第一页需手动制空列表
|
|
}
|
|
_this.list = _this.list.concat(res.data);//追加新数据
|
|
mescroll.endSuccess(res.data.length);
|
|
})
|
|
.catch(err => {
|
|
|
|
console.log(err);
|
|
mescroll.endErr();
|
|
uni.showToast({
|
|
title: err.msg || '请求出错',
|
|
icon: 'none',
|
|
mask: false,
|
|
duration: 1500
|
|
});
|
|
})
|
|
}
|
|
})
|
|
],
|
|
onLoad:function(e){
|
|
_this = this;
|
|
//从query里取模式
|
|
//this.isSelectMode = this.$yroute.query.isSelected;
|
|
},
|
|
onShow:function(){
|
|
//静默刷新
|
|
this.mescroll && this.mescroll.resetUpScroll(false);
|
|
},
|
|
methods: {
|
|
isNullOrEmpty,
|
|
shortDateString(dateStr){
|
|
var ret = '';
|
|
if (isNullOrEmpty(dateStr)) {
|
|
|
|
} else{
|
|
// var s = dataStr;
|
|
// s = s.replace(/-/g,"/");
|
|
// var date = new Date(s).getTime();
|
|
ret = formatDateTime(dateStr,'yyyy-MM-dd HH:mm:ss');
|
|
}
|
|
return ret;
|
|
},
|
|
goNewsDetail:function(item){
|
|
this.$yrouter.push('/pagesInn/inn/innInfoDetail?id='+item.id);
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
|
|
.pink-dot{
|
|
width:24rpx;
|
|
height:24rpx;
|
|
background:rgba(255,86,74,0.4);
|
|
border-radius:50%;
|
|
position: absolute;
|
|
z-index: 0;
|
|
bottom: 0;
|
|
right: -12rpx;
|
|
}
|
|
.main-title{
|
|
font-size: 36rpx;
|
|
line-height: 36rpx;
|
|
// color: #080F1A;
|
|
color: #FFFFFF;
|
|
position: relative;
|
|
}
|
|
|
|
.eye-icon{
|
|
width: 32rpx;
|
|
height: 32rpx;
|
|
margin-right: 8rpx;
|
|
}
|
|
|
|
.zan-icon{
|
|
width: 32rpx;
|
|
height: 32rpx;
|
|
margin-right: 8rpx;
|
|
}
|
|
.zan-num-text{
|
|
color: #080F1A;
|
|
font-size: 24rpx;
|
|
}
|
|
.see-num-text{
|
|
color: #080F1A;
|
|
font-size: 24rpx;
|
|
}
|
|
|
|
.newsList .list .item .text .name{
|
|
color: #080F1A !important;
|
|
font-size: 32rpx;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.newsList .list .item .text{
|
|
margin-right: 10rpx;
|
|
width: auto !important;
|
|
height: auto !important;
|
|
}
|
|
|
|
.newsList .list .item .pictrue{
|
|
flex-shrink: 0;
|
|
width: 288rpx !important;
|
|
height: 216rpx !important;
|
|
}
|
|
|
|
.newsList .list .item{
|
|
background-color: #fff;
|
|
flex-wrap: nowrap;
|
|
padding: 35rpx !important;
|
|
margin: 35rpx 30rpx !important;
|
|
border-radius: 8rpx;
|
|
|
|
}
|
|
|
|
.summary{
|
|
color: #C2C5CC;
|
|
font-size: 24rpx;
|
|
}
|
|
|
|
.sub-title{
|
|
font-size:14*2rpx;
|
|
margin-top: 10rpx;
|
|
color:rgba(252,85,179,0.7);
|
|
}
|
|
|
|
.title .hot-title{
|
|
font-size: 18*2rpx;
|
|
color: #FF7900;
|
|
background:rgba(255,255,255,1);
|
|
margin-left: 5*2rpx;
|
|
margin-right: 5*2rpx;
|
|
}
|
|
|
|
.hotGoodsList{
|
|
position: relative;
|
|
margin: 35rpx 0;
|
|
background-color: #fff;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.hotGoodsList .newProductsItem{
|
|
margin-left: 35rpx;
|
|
margin-top: 20rpx;
|
|
}
|
|
.img-box{
|
|
position: relative;
|
|
}
|
|
|
|
.price-tag{
|
|
position: absolute;
|
|
width: 39*2rpx;
|
|
height: 19*2rpx;
|
|
left: 0;
|
|
top: 0;
|
|
}
|
|
|
|
.like-btn{
|
|
position: absolute;
|
|
width: 24*2rpx;
|
|
height: 24*2rpx;
|
|
right: 0;
|
|
top: 0;
|
|
}
|
|
|
|
.inn-tag-wrap{
|
|
margin-top: 10rpx;
|
|
margin-bottom: 10rpx;
|
|
}
|
|
|
|
.zanmost-tag{
|
|
padding: 2rpx 8rpx 2rpx 8rpx;
|
|
background: #FF2D69;
|
|
font-size: 10*2rpx;
|
|
color: #FFFFFF;
|
|
}
|
|
|
|
.latest-tag{
|
|
padding: 2rpx 8rpx 2rpx 8rpx;
|
|
background: #0DC5C5;
|
|
font-size: 10*2rpx;
|
|
color: #FFFFFF;
|
|
margin-left: 8rpx;
|
|
}
|
|
|
|
.location-tag{
|
|
padding: 2rpx 8rpx 2rpx 8rpx;
|
|
background: #FD685D;
|
|
font-size: 10*2rpx;
|
|
color: #FFFFFF;
|
|
margin-left: 8rpx;
|
|
}
|
|
|
|
.inn-shop-icon{
|
|
border-radius: 50%;
|
|
width: 24*2rpx;
|
|
height: 24*2rpx;
|
|
}
|
|
|
|
.inn-shop-name{
|
|
font-size: 24rpx;
|
|
color: #080F1A;
|
|
}
|
|
|
|
.inn-shop-date{
|
|
font-size: 18rpx;
|
|
color: #C2C5CC;
|
|
}
|
|
|
|
.location{
|
|
padding: 4rpx 16rpx;
|
|
background: #FFFFFF;
|
|
border-radius: 22rpx;
|
|
}
|
|
|
|
.city-name{
|
|
color: #FD685D;
|
|
font-size: 24rpx;
|
|
margin-left: 4rpx;
|
|
}
|
|
|
|
.btLine{
|
|
width: 100%;
|
|
height: 12rpx;
|
|
margin-top: -4rpx;
|
|
background: #FD685D;
|
|
}
|
|
|
|
.pro-info{
|
|
font-size: 14*2rpx;
|
|
|
|
}
|
|
|
|
</style>
|