Newer
Older
xinJiangMiniProgranm / packageB / messageList / messageList.vue
<!-- 网信信息列表 -->
<template>
	<view class="message-list">
		<image src="../../static/index/back.png" style="position:fixed;top: -4rpx;left: 0;z-index: -999; width:100%;height: 300rpx;"></image>
		<view class="tab-area">
			<u-tabs 
				:list="tabList" 
				:scrollable="false" 
				:current="currentTab"
				lineColor="#fff"
				lineWidth="50"
				lineHeight="5"
				:activeStyle="{
					color: '#fff',
					fontWeight: 'bold',
				}"
				:inactiveStyle="{
					color: '#fff',
					fontWeight: 'bold',
				}"
				@click="clickTab">
			</u-tabs>
		</view>
		
		<view class="event-area">
			<EventList :list="eventList"/>
		</view>
		<u-loadmore :status="status" loadmoreText=" "/>
		<!-- 返回顶部 -->
		<u-back-top 
			:scroll-top="scrollTop" 
			icon="arrow-up" 
			customStyle="background: rgba(67, 144, 247, .7)"
			:iconStyle="{
					fontSize: '32rpx',
					color: '#fff',
					fontWeight: '600'
				}"
			duration="200"
		></u-back-top>
		
		<!-- 空 -->
		<u-empty
			v-if="isEmpty"
			mode="search"
			text="暂无结果"
			:show="true"
			iconColor="#77797d"
			textColor="#77797d"
			marginTop="80"
		></u-empty>
	</view>
</template>

<script>
	import EventList from '../components/eventList.vue';
	import { getLocationParams } from '../../common/utils.js';
	export default {
		name: 'MessageList',
		components: {
			EventList
		},
		data() {
			return {
				isEmpty: false,   //数据是否为空
				scrollTop: 0,
				currentTab: '0', //当前选中的标签的索引
				status: 'loadmore', //上滑加载状态 loading加载中,nomore没有更多了
				tabList: [
					{
						name: '法律法规'
					},
					{
						name: '工作动态'
					},
				],
				eventList: [],  //事件数据
			}
		},
		watch: {
			eventList: {
				handler(val){
					if(val.length) {
						this.isEmpty = false;
					} else {
						this.isEmpty = true;
					}
				},
				deep: true,
				// immediate: true,
			}
		},
		mounted() {
			uni.showShareMenu({
				withShareTicket: true,
				menus: ["shareAppMessage", "shareTimeline"]
			});
			
			this.currentTab = getLocationParams('tabIndex');
			this.clickTab(null, this.currentTab);
		},
		//分享好友
		onShareAppMessage() {
			return {
				title: ' ',
				// imageUrl: '../../static/share.png',
				path: "/pages/messageList/messageList",
			};
		},
		//分享朋友圈
		onShareTimeline() {
			return {
				title: '新疆网络举报',
			}
		},
		// 监听滚动条位置
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
		},
		//下拉刷新
		onPullDownRefresh() {
			console.log('refresh');
			setTimeout(function () {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		//上滑加载
		onReachBottom() {
			
		},
		methods: {
			clickTab(val, currentTab) {
				console.log(val)
				if((val && val.index === 0) || currentTab === '0') {
					this.eventList = [
						{
							title: '法律法规',
							time: '2121-12-12 12:02:20',
							img: '../../static/share.png'
						},
						{
							title: '法律法规法律法规法律法规法律法规',
							time: '2121-12-12 12:02:20',
							img: '../../static/share.png'
						},
						{
							title: '法律法规法律法规法律法规法律法规',
							time: '2121-12-12 12:02:20',
							img: '../../static/share.png'
						},
						{
							title: '法律法规',
							time: '2121-12-12 12:02:20',
							img: '../../static/share.png'
						},
						{
							title: '法律法规法律法规法律法规法律法规',
							time: '2121-12-12 12:02:20',
							img: '../../static/share.png'
						},
						{
							title: '法律法规法律法规法律法规法律法规',
							time: '2121-12-12 12:02:20',
							img: '../../static/share.png'
						},
						{
							title: '法律法规',
							time: '2121-12-12 12:02:20',
							img: '../../static/share.png'
						},
						{
							title: '法律法规法律法规法律法规法律法规',
							time: '2121-12-12 12:02:20',
							img: '../../static/share.png'
						},
						{
							title: '法律法规法律法规法律法规法律法规',
							time: '2121-12-12 12:02:20',
							img: '../../static/share.png'
						},
						{
							title: '法律法规',
							time: '2121-12-12 12:02:20',
							img: '../../static/share.png'
						},
						{
							title: '法律法规法律法规法律法规法律法规',
							time: '2121-12-12 12:02:20',
							img: '../../static/share.png'
						},
						{
							title: '法律法规法律法规法律法规法律法规',
							time: '2121-12-12 12:02:20',
							img: '../../static/share.png'
						},
					]
				} else if((val && val.index === 1) || currentTab === '1') {
					this.eventList = [
						
					]
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.message-list {
		width: 100%;
		box-sizing: border-box;
		padding: 40rpx;
		padding-top: 146rpx;
		.tab-area {
			position: fixed;
			box-sizing: border-box;
			top: 0;
			left: 0;
			width: 100%;
			padding: 20rpx;
			background-color: #4390f7;
		}
	}

</style>
<style>
	page {
		background-color: #f0f0f0;
	}
</style>