Newer
Older
xinJiangMiniProgranm / pages / index / index.vue
dutingting on 9 Jun 2023 10 KB 首页和通之公告列表页联调
<!-- 首页 -->
<template>
	<view class="index">
		<!-- <div class='slideShine' style="position:absolute;top: 36rpx;left: 46rpx;z-index: -998;font-size: 50rpx;color: #fff;font-weight: 600;letter-spacing: 4rpx;">新疆网络举报</div> -->
		<!-- <image style="width: 70px;height: 60px;position:absolute;top: 36rpx;left: 60rpx;z-index: -998" src="http://111.198.10.15:11604/png/share.png"></image> -->
		<image src="http://111.198.10.15:11604/png/back_complete.png" style="position:absolute;top: -4rpx;left: 0;z-index: -999; width:100%;height: 300rpx;"></image>
		<view class="swiper-area">
			<swiper class="swiper-box" style="height: 300rpx;" :interval="3000" :indicator-dots="true" :autoplay="true" :circular="circular">
				<swiper-item v-for="(item ,index) in swiperList" :key="index">
					<view class="swiper-item">
						<image :src="item.url" style="width:100%;height: 300rpx;"></image>
					</view>
				</swiper-item>
			</swiper>
		</view>
		<view class="tab-area">
			<view class="tab">
				<u-row>
					<u-col span="4" v-for="item in tabList_first" :key="item.id">
						<view class="tab-item" @click="handleClick(item.id)">
							<image style="width: 120rpx;height: 120rpx;margin-bottom: 12rpx;" :src="item.icon" mode=""></image>
							<text class="grid-text">{{item.name}}</text>
						</view>
					</u-col>
				</u-row>
				<!-- <u-row>
					<u-col span="4" v-for="item in tabList_second" :key="item.id">
						<view class="tab-item" @click="handleClick(item.id)">
							<image style="width: 120rpx;height: 120rpx;margin-bottom: 12rpx;" :src="item.icon" mode=""></image>
							<text class="grid-text">{{item.name}}</text>
						</view>
					</u-col>
				</u-row> -->
				<!-- <u-row>
					<u-col span="6" v-for="item in tabList_third" :key="item.id">
						<view class="tab-item" @click="handleClick(item.id)">
							<image style="width: 120rpx;height: 120rpx;margin-bottom: 12rpx;" :src="item.icon" mode=""></image>
							<text class="grid-text">{{item.name}}</text>
						</view>
					</u-col>
				</u-row> -->
			</view>
		</view>
		
		<!-- 通知公告、辟谣信息、案例警醒 -->
		<view class="event-area">
			<!-- <EventList 
				v-for="(item,index) in eventList" 
				:key="index" 
				:title="item.name"
				:list="item.value"
				@checkMore="checkMore(item.id)">
			</EventList> -->
			<view class="title">
				<text>通知公告</text>
				<view class="icon-text" @click="checkMore('tzgg')">
					<text class="text">更多</text>
					<u-icon name="arrow-right-double" color="#0043ac" size="18"></u-icon>
				</view>
			</view>
			<view class="list">
				<view class="list-item" v-for="e in tzggList" :key="e.id">
					<text @click="clickTitle">{{e.title}}</text>
				</view>
			</view>
		</view>
		<view class="event-area">
			<view class="title">
				<text>辟谣信息</text>
				<view class="icon-text" @click="checkMore('pyxx')">
					<text class="text">更多</text>
					<u-icon name="arrow-right-double" color="#0043ac" size="18"></u-icon>
				</view>
			</view>
			<view class="list">
				<view class="list-item" v-for="e in pyxxList" :key="e.id">
					<text @click="clickTitle">{{e.title}}</text>
				</view>
			</view>
		</view>
		<view class="event-area">
			<view class="title">
				<text>案例警醒</text>
				<view class="icon-text" @click="checkMore('aljx')">
					<text class="text">更多</text>
					<u-icon name="arrow-right-double" color="#0043ac" size="18"></u-icon>
				</view>
			</view>
			<view class="list">
				<view class="list-item" v-for="e in aljxList" :key="e.id">
					<text @click="clickTitle">{{e.title}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import EventList from '@/components/eventList.vue'
	import { stamp2Time } from '@/common/utils.js'
	import { getNoticeList, getPyxxList } from '@/api/index.js'
	export default {
		name: 'Index',
		components: {
			EventList
		},
		data() {
			return {
				tabList_first: [
					{
						id: 'will',
						name: '我要举报',
						icon: '../../static/index/will.png',
					},
					// {
					// 	id: 'search',
					// 	name: '举报查询',
					// 	icon: '../../static/index/search.png',
					// },
					{
						id: 'guide',
						name: '举报指南',
						icon: '../../static/index/guide.png',
					},
					{
						id: 'jdy',
						name: '加入我们',
						// name: '成为监督员',
						icon: '../../static/index/jdy.png',
					},
				],
				tabList_second: [
					{
						id: 'status',
						name: '工作动态',
						icon: '../../static/index/status.png',
					},
					{
						id: 'rules',
						name: '法律法规',
						icon: '../../static/index/rules.png',
					},
					{
						id: 'jdy',
						name: '成为监督员',
						icon: '../../static/index/jdy.png',
					},
				],
				tabList_third: [
				],
				//轮播图信息
				swiperList: [
					{
						url: 'http://111.198.10.15:11604/png/swiper4.png'
					},
					{
						url: 'http://111.198.10.15:11604/png/swiper3.png'
					},
					{
						url: 'http://111.198.10.15:11604/png/swiper2.png'
					},
					{
						url: 'http://111.198.10.15:11604/png/swiper1.png'
					},
				],
				tzggList: [], // 通知公告列表
				pyxxList: [
					{
						title: '辟谣信息标题1',
						publishTime: '2022-03-03 12:12:00'
					},
					{
						title: '辟谣信息标题2',
						publishTime: '2022-03-03 12:12:00'
					},
				],
				aljxList: [
					{
						title: '案例警醒假数据:缺少接口',
						publishTime: '2022-03-03 12:12:00'
					},
					{
						title: '案例警醒假数据:缺少接口',
						publishTime: '2022-03-03 12:12:00'
					},
				],
				eventList: [
					{
						id: 'tzgg',
						name: '通知公告',
						value: 'tzggList'
					},
					{
						id: 'pyxx',
						name: '辟谣信息',
						value: 'pyxxList'
					},
					{
						id: 'aljx',
						name: '案例警醒',
						value: 'tzggList'
					},
				]
			}
		},
		mounted(){
			uni.showShareMenu({
				withShareTicket: true,
				menus: ["shareAppMessage", "shareTimeline"]
			});
			this.fetchNoticeList() // 获取通知公告列表
			this.fetchPyxxList() // 获取辟谣信息列表
		},
		//分享好友
		onShareAppMessage() {
			return {
				title: '新疆网络举报',
				imageUrl: '../../static/share.png',
			};
		},
		//分享朋友圈
		onShareTimeline() {
			return {
				title: '新疆网络举报',
			}
		},
		methods: {
			// 点击按钮
			handleClick(val) {
				console.log('---', val)
				if(val === 'search') { // 举报查询
					wx.navigateTo({
						url: '/packageB/search/search'
					})
				} else if(val === 'guide') { // 举报指南
					wx.navigateTo({
						url: '/packageB/guide/guide'
					})
				} else if(val === 'will') { // 我要举报
					wx.navigateTo({
						url: '/packageB/center/center'
					})
				}
				else if(val === 'rules' || val === 'status') { // 法律法规、工作动态
					let tabIndex = 0;
					if(val === 'status') {
						tabIndex = 1;
					} else if(val === 'net') {
						tabIndex = 2;
					}
					wx.navigateTo({
						url: `/packageB/messageList/messageList?tabIndex=${tabIndex}`
					})
				} else if(val === 'jdy') { // 成为监督员
					wx.navigateTo({
						url: `/packageB/supervisor/supervisor`
					})
				}
			},
			// 点击更多
			checkMore(id) {
				// 跳转到固定页面
				if(id === 'aljx') {
					wx.navigateTo({
						url: '/packageA/egersis/egersis'
					})
				} 
				if(id === 'pyxx') {
					wx.navigateTo({
						url: '/packageC/rumorInfo/rumorInfo'
					})
				} 
				if(id === 'tzgg') {
					wx.navigateTo({
						url: '/packageC/notice/notice'
					})
				} 
			},
			// 获取通知公告列表
			fetchNoticeList() {
				const param = {
					pageIndex: 1, //当前页数(必传)
					pageSize: 2, //每页数 (必传)
					yuzhong: 'zh',//(必传)固定值
					siteRoleCode: 'xjwljb', //(必传)固定值
					catalogCode: 'tzgg', //(必传)固定值
				}
				getNoticeList(param).then(res => {
					this.tzggList = res.map(item => {
						return {
							title: item.title,
							publishTime: stamp2Time(item.publishDate)
						}
					})
				})
			},
			// 获取辟谣信息
			fetchPyxxList() {
				const param = {
					pageIndex: 1,
					pageSize: 2,
					siteRoleCode: 'zzqwxbPortal',
					catalogCode: 'yykt'
				}
				getPyxxList(param).then(res => {
					this.pyxxList = res.map(item => {
						return {
							title: item.title,
							publishTime: stamp2Time(item.publishDate)
						}
					})
				})
			},
			// 点击标题
			clickTitle() {
				console.log('点击标题')
				wx.navigateTo({
					url: '/packageB/messageDetail/messageDetail'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.index {
		position: relative;
		width: 100%;
		box-sizing: border-box;
		padding: 60rpx 0;
		padding-top: 192rpx;
		.swiper-area {
			padding: 0 40rpx;
		}
		.tab-area {
			margin-top: 40rpx;
			padding: 0 40rpx;
			.tab {
				background: linear-gradient(#eef1fd 0%, #bed5fe 100%);
				border-radius: 20rpx;
				padding-bottom: 80rpx;
			}
			.tab-item {
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				margin-top: 80rpx;
				.grid-text {
					color: #3a3a3b;
				}
			}
		}
		.slideShine{
				background: #871317 -webkit-linear-gradient(left, #561214, #febaf7 50%, #ff0 90%,#561214) no-repeat 0 0;
				background-size:20% 100%; 
				background-clip: text;
				-webkit-text-fill-color: transparent;
				font-size: 36px;
				text-align: center;
				font-weight: bold;
				text-decoration: underline;
		 }
		.slideShine {
			animation: slideShine 4s linear infinite;animation: slideShine 4s linear infinite;
		}
		@keyframes slideShine {
			0% {background-position: 0 0; }
			100% {background-position: 100% 100%; }
		}
		.title {
			width: 100%;
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			align-items: center;
			font-size: 36rpx;
			font-weight: 600;
			// padding: 20rpx 20rpx 0 20rpx;
			box-sizing: border-box;
			padding: 32rpx 40rpx;
			.icon-text {
				display: flex;
				flex-direction: row;
				align-items: center;
				font-size: 34rpx;
				font-weight: 400;
				color: #0043ac;
				.text {
					margin-right: 16rpx;
				}
			}
		}
		.list {
			.list-item {
				margin: 32rpx 0;
				padding: 0 40rpx;
			}
		}
		
	}
</style>
<style lang="scss">
	.index {
	}
</style>