You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
205 lines
4.9 KiB
205 lines
4.9 KiB
<template> |
|
<view class="body-background"></view> |
|
<u-navbar |
|
:title="title" |
|
:auto-back="true" |
|
left-icon-size="40rpx" |
|
:safe-area-inset-top="true" |
|
:placeholder="true" |
|
bgColor="transparent" |
|
></u-navbar> |
|
<view class="head-background"> |
|
<image mode="widthFix" :src="staticImage.bg" class="img" width="100%"/> |
|
</view> |
|
<view class="subsection" :style="sectionStyle"> |
|
<MzSubsection |
|
:list="list" |
|
@change="checkSection" |
|
:current="current" |
|
></MzSubsection> |
|
</view> |
|
<u-row :custom-style="{padding:'0 26rpx'}"> |
|
<u-col> |
|
<!-- <u-list--> |
|
<!-- @scrolltolower="scrollToLower"--> |
|
<!-- :height="(api.navHeight().windowHeight-size.height)+'px'"--> |
|
<!-- :custom-style="{marginTop:'20rpx'}"--> |
|
<!-- >--> |
|
|
|
<view |
|
style="margin-top:20rpx" |
|
v-for="(item, index) in lists" |
|
:key="index" |
|
@click="navTo('/pages/News/detail?id='+item.id)" |
|
> |
|
<view class="new-item row"> |
|
<view class="new-thumb "> |
|
<u-image |
|
:show-loading="true" |
|
:src="item.cover" |
|
width="260" |
|
height="160" |
|
radius="10" |
|
mode="widthFix" |
|
class="img" |
|
></u-image> |
|
</view> |
|
<view class="new-content row col border-box"> |
|
<view class="new-title"> |
|
<image |
|
v-if="item.is_new" |
|
class="new-icon img" |
|
mode="widthFix" |
|
:src="staticImage.newIcon" |
|
/> |
|
{{item.title}} |
|
</view> |
|
<view class="new-time">{{ item.create_time }}</view> |
|
</view> |
|
</view> |
|
</view> |
|
<!-- </u-list>--> |
|
<u-loadmore :status="status" fontSize="28" marginBottom="30" marginTop="30" @loadmore="getList()"/> |
|
|
|
</u-col> |
|
|
|
</u-row> |
|
</template> |
|
|
|
<script> |
|
import { |
|
imghost |
|
} from '@/config/host.js' |
|
import MzSubsection from '@/components/MzSubsection/Index.vue'; |
|
import api from '@/utils/functions.js'; |
|
import {roomList} from "@/api/shop"; |
|
import {newList} from "@/api/other"; |
|
|
|
export default { |
|
components: { |
|
MzSubsection |
|
}, |
|
data() { |
|
return { |
|
list: [{ |
|
name: '最新资讯' |
|
}, { |
|
name: '表彰评优' |
|
}, { |
|
name: '活动回顾' |
|
}], |
|
// 或者如下,也可以配置keyName参数修改对象键名 |
|
// list: [{name: '未付款'}, {name: '待评价'}, {name: '已付款'}], |
|
current: 0, |
|
title: '资讯列表', |
|
loading: true, |
|
staticImage: { |
|
bg: imghost + '/static/image/BG.png', |
|
newIcon: imghost + '/static/image/new-icon.png', |
|
}, |
|
user: { |
|
avatar: imghost + '/static/image/banner.png', |
|
nickname: '清晨的风', |
|
coupons: 221, |
|
id: 88685, |
|
}, |
|
isTop: false, |
|
lists: [], |
|
size: { |
|
height: 500, |
|
}, |
|
pages:{ |
|
page:1, |
|
limit:2, |
|
}, |
|
status:'loadmore', |
|
} |
|
}, |
|
onLoad() { |
|
|
|
}, |
|
mounted() { |
|
this.getList(); |
|
}, |
|
computed: { |
|
api() { |
|
return api |
|
}, |
|
sectionStyle() { |
|
const style = {}; |
|
style.padding = '0 26rpx'; |
|
style.position = 'sticky'; |
|
style.zIndex = '9999'; |
|
style.top = api.navHeight().systemBarHeight + 'px' |
|
return style; |
|
}, |
|
listHeight() { |
|
let that = this; |
|
let height; |
|
let info = uni.createSelectorQuery().in(this).select('.subsection'); |
|
info.boundingClientRect(function (data) { |
|
that.size.height = data.height; |
|
}).exec(function (res) { |
|
|
|
}); |
|
// that.size.height = (api.navHeight().windowHeight - height); |
|
} |
|
}, |
|
methods: { |
|
navTo(url) { |
|
wx.navigateTo({ |
|
url: url |
|
}) |
|
}, |
|
chatDetail(item) { |
|
wx.navigateTo({ |
|
url: '/pages/ChatDetail/index?id=' + item.id |
|
}); |
|
}, |
|
checkSection(index) { |
|
this.current = index; |
|
this.pages.type = index+1; |
|
this.getList(true); |
|
}, |
|
scrollToLower() { |
|
|
|
}, |
|
getList(clear){ |
|
if(clear){ |
|
this.status = 'loadmore' |
|
this.pages.page = 1; |
|
this.lists = []; |
|
} |
|
if(this.status === 'nomore'){ |
|
return false; |
|
} |
|
newList(this.pages).then(res => { |
|
this.lists.push.apply(this.lists,res.data); |
|
if(res.data.length === 0){ |
|
this.status = 'nomore' |
|
} |
|
}) |
|
this.pages.page++; |
|
}, |
|
}, |
|
onReachBottom() { |
|
this.getList(); |
|
}, |
|
onPageScroll(res) { |
|
if (res.scrollTop <= 20) { |
|
uni.$emit('isTop', true); |
|
} else { |
|
uni.$emit('isTop', false); |
|
} |
|
}, |
|
created() { |
|
this.listHeight(); |
|
// this.pagePadding = (api.navHeight().navPaddingTop + |
|
// api.navHeight().navHeight + (api.navHeight().headerPadding * 2)) |
|
} |
|
} |
|
</script> |
|
|
|
<style lang="scss"> |
|
@import './components/index.scss'; |
|
</style> |