Newer
Older
xinJiangMiniProgranm / packageA / myReport / myReport.vue
dutingting on 3 Apr 2023 3 KB ui改版第一版
<template>
	<view class="my-report">
		<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="record-area">
			<Record :list="reportList"/>
		</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 Record from '../components/record.vue'
	import { getLocationParams } from '../../common/utils.js';
	export default {
		components: {
			Record
		},
		data() {
			return {
				isEmpty: false,   //数据是否为空
				scrollTop: 0,
				status: 'loadmore', //上滑加载状态 loading加载中,nomore没有更多了
				currentTab: '0', //当前选中的标签的索引
				tabList: [
					{
						name: '全部'
					},
					{
						name: '待评估'
					},
					{
						name: '已评估'
					},
				],
				reportList: [], // 列表数据
			}
		},
		watch: {
			reportList: {
				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('tabType'); // 当前tab
			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;
		},
		//上滑加载
		onReachBottom() {
			
		},
		methods: {
			clickTab(val, currentTab) {
				if((val && val.index === 0) || currentTab === '0') { // 全部
					this.reportList = [
						{
							code: '1111',
							status: '待评估',
							time: '2022-12-12'
						},
						{
							code: '222',
							status: '已评估',
							time: '2022-12-12'
						},
						{
							code: '333',
							status: '待评估',
							time: '2022-12-12'
						},
					]
				} else if((val && val.index === 1) || currentTab === '1') { // 待评估
					this.reportList = [
						{
							code: '1111',
							status: '待评估',
							time: '2022-12-12'
						},
						{
							code: '333',
							status: '待评估',
							time: '2022-12-12'
						},
					]
				} else if((val && val.index === 1) || currentTab === '2') { // 已评估
					this.reportList = [
						{
							code: '222',
							status: '已评估',
							time: '2022-12-12'
						},
					]
				} else {
					this.reportList = []
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.my-report {
		width: 100%;
		box-sizing: border-box;
		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>