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.
186 lines
4.8 KiB
186 lines
4.8 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'}" |
|
> |
|
|
|
<u-list-item |
|
v-for="(item, index) in lists" |
|
:key="index" |
|
> |
|
<view class="new-item row"> |
|
<view class="new-thumb "> |
|
<u-image |
|
:show-loading="true" |
|
:src="item.thumb" |
|
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.time }}</view> |
|
</view> |
|
</view> |
|
</u-list-item> |
|
</u-list> |
|
</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'; |
|
|
|
export default { |
|
components: { |
|
MzSubsection |
|
}, |
|
data() { |
|
return { |
|
list: [{ |
|
name: '最新资讯' |
|
}, { |
|
name: '表彰评优' |
|
}, { |
|
name: '活动回顾' |
|
}], |
|
// 或者如下,也可以配置keyName参数修改对象键名 |
|
// list: [{name: '未付款'}, {name: '待评价'}, {name: '已付款'}], |
|
current: 1, |
|
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: [ |
|
{ |
|
id: 1, |
|
thumb: imghost + '/static/image/new-1.png', |
|
title: '全市公安机关夏季治安打击整治“彭安行动”新闻发布会召开', |
|
desc: '需要您带一点猫砂上门,谢谢', |
|
time: '2023/06/16', |
|
is_new: true |
|
}, { |
|
id: 2, |
|
thumb: imghost + '/static/image/new-2.png', |
|
title: '全市公安机关夏季治安打击整治“彭安行动”新闻发布会召开', |
|
desc: '需要您带一点猫砂上门,谢谢', |
|
time: '2023/06/16', |
|
is_new: true |
|
}, { |
|
id: 3, |
|
thumb: imghost + '/static/image/new-3.png', |
|
title: '全市公安机关夏季治安打击整治“彭安行动”111开', |
|
desc: '需要您带一点猫砂上门,谢谢', |
|
time: '2023/06/16', |
|
is_new: false |
|
}, |
|
], |
|
size: { |
|
height: 500, |
|
} |
|
} |
|
}, |
|
onLoad() { |
|
|
|
}, |
|
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: { |
|
chatDetail(item) { |
|
wx.navigateTo({ |
|
url: '/pages/ChatDetail/index?id=' + item.id |
|
}); |
|
}, |
|
checkSection(index) { |
|
this.current = index; |
|
}, |
|
scrollToLower() { |
|
|
|
}, |
|
}, |
|
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> |