lhl 1 year ago
parent
commit
4b85cffbcb

+ 4 - 4
src/App.vue

@@ -1,6 +1,6 @@
 <template>
-<div :class="{'body-box': isGrey}">
-	<div class="bg" :class="{bgig: isGrey}">
+<div :class="{'body-box': isGrey}" >
+	<div class="bg bgig" :class="{bgig: isGrey}" >
 		<img src="@/assets/img/box-bg.png" >
 	</div>
 	<div id="app" class="app">
@@ -57,12 +57,12 @@ import { getList,getSearch,getgrey,index } from '@/request/api.js'
 					{
 						img: require('@/assets/img/navList/nav4.png'),
 						name: '核心业务',
-						url: '/business'
+						url: '/busine'
 					},
 					{
 						img: require('@/assets/img/navList/nav5.png'),
 						name: '新闻资讯',
-						url: '/news'
+						url: '/new'
 					},
 					{
 						img: require('@/assets/img/navList/nav6.png'),

+ 4 - 3
src/components/box.vue

@@ -16,8 +16,8 @@
 				<div @click="urlTo('index')">首页</div> 
 					> 
 				<div @click="listBack">
-					{{ navList.title }}
-					> {{ navList.list[navChoose].title }}
+					{{ navList.title || ''}}
+					> {{ navList.list[navChoose].title || '' }}
 				</div>
 				<span v-show="!(!content) && this.navList.listinlist"> > 信息详情</span>
 			</div>
@@ -124,6 +124,7 @@ import { details,getArticList } from '@/request/api.js'
 				this.artid = this.$route.query.id
 				this.listChoose({id:this.artid })
 			}
+			console.log(this.navList,'box-navlist+++')
 			this.init()
 			// if(this.isShowContent) {
 			// 	this.init()
@@ -160,7 +161,7 @@ import { details,getArticList } from '@/request/api.js'
 			},
 			listChoose(data) {
 				console.log(this.$route,'this.$route')
-				this.$router.push(this.$route.path + '?id=' + data.id + '&navChoose=' + this.navChoose)
+				this.$router.push(this.$route.path + 's' + '?id=' + data.id + '&navChoose=' + this.navChoose)
 				this.loadingType = 'loadmore'
 				this.isShowSon = true
 				this.contentId = data.id

+ 453 - 0
src/components/boxt.vue

@@ -0,0 +1,453 @@
+<template>
+	<div class="contact">
+		<div class="navlist" v-show="navList" v-if="isShownav">
+			<div class="nav" v-for="(n,index) in navList.list" :class="{navC: index ==  navChoose}" @click="navC(index,n)">
+				<div class="title" :title="n.title">
+					{{ n.title }}
+				</div>
+				<div class="you" style="">
+					>
+				</div>
+			</div>
+		</div>
+		<div class="right">
+			<div class="head nawarp" v-if="isShowHeader">
+				当前位置:
+				<div @click="urlTo('index')">首页</div> 
+					> 
+				<div @click="listBack">
+					{{ navList.title }}
+					> {{ navList.list[navChoose].title }}
+				</div>
+				<span v-show="!(!content) && this.navList.listinlist"> > 信息详情</span>
+			</div>
+			<div class="head" v-else>
+				当前位置:<div @click="urlTo('index')">首页</div> 
+					> 
+				<div @click="listBack">
+					{{ navList.title }}
+				</div>
+				<span v-show="!(!content) && this.navList.listinlist"> > 信息详情</span>
+			</div>
+			<slot v-if="!isShowSon"></slot>
+			<div class="contentbox">
+				<div class="content">
+					<div class="load" v-show="loadingType == 'loadmore'">
+						----- 加载中 -----
+					</div>
+					<div v-html="content" v-show="isShowSon" class="text">
+						
+					</div>
+					
+					<div class="contentList chooseitem" v-show="!isShowSon">
+						<div class="item" v-for="c in contentList" @click="listChoose(c)" :title="c.title">
+							<span class="title-icon"></span>
+							<div class="title nawarp">
+								<div class="">
+								</div>
+								<div class="">
+									{{ c.title }}
+								</div>
+								
+							</div>
+							<div class="time">
+								 {{ getTime(c.releasetime) }}
+							</div>
+						</div>
+						<!-- 页数大于一时显示分页 -->
+						<div class="pagec" v-if="totalPage >1">
+							<div class="fristPage" @click="page = 1">
+								第一页
+							</div>
+							<div class="pagetoomuch" v-show="totalPage>10">
+								<div class="nextPage" v-show="page-4>0">
+									...
+								</div>
+								<div class="pageNum" v-for="count in totalPage" @click="pageChoose(count)"
+								:class="{isChoose:count == page}" v-if="count>page-5&&count<page+4 &&count!=totalPage">
+									{{ count }}
+								</div>
+								<div class="nextPage" v-show="page+4<totalPage">
+									...
+								</div>
+								<div class="pageNum" v-for="count in totalPage" @click="pageChoose(count)"
+								:class="{isChoose:count == page}" v-show="totalPage>2" v-if="count==totalPage">
+									{{ count }}
+								</div>
+							</div>
+							
+							<div class="pageNum" v-for="count in totalPage" @click="pageChoose(count)"
+							:class="{isChoose:count == page}" v-show="totalPage<=10">
+								{{ count }}
+							</div>
+							<div class="nextPage" @click='nextPage'>
+								下一页
+							</div>
+						</div>
+					</div>
+				</div>
+			</div>
+			
+			
+		</div>
+	</div>
+</template>
+
+<script>
+
+import { details,getArticList } from '@/request/api.js'
+	export default {
+		props: ['navList'],
+		data() {
+			return {
+				artid: '',
+				page: 1, // 当前页
+				limit: 10, // 每页数量
+				sum: 0, // 文章列表总数
+				loadingType: 'loadmore', // 是否在加载
+				path: this.$route.path, // 路由
+				navChoose: this.$route.params.navChoose || this.$route.query.navChoose || 0, //左侧导航栏选择
+				timeOut: '',// 不断获取初始显示数据直至显示
+				content: '', // 文章
+				contentList: [], // 二级列表
+				contentId: this.$route.params.contentId || this.$route.query.contentId || 0, // 文章详情id
+				isShowSon: true, // 是否显示文章而不显示列表
+				pageId: 0, //文章列表id
+			}
+		},
+		mounted() {
+			console.log(this.$route.query)
+			if(this.$route.query.navChoose) {
+				this.navChoose = this.$route.query.navChoose
+			}
+			if(this.$route.query.id) {
+				this.artid = this.$route.query.id
+				this.listChoose({id:this.artid })
+			}
+			console.log(this.navList,'navList++++++++++')
+			// this.init()
+			// if(this.isShowContent) {
+			// 	this.init()
+			// }
+		},
+		methods: {
+			// 查询数据默认
+			init() {
+				this.navC(this.navChoose,this.navList.list[this.navChoose])
+			},
+			navC(index,data) {
+				// 组织介绍中各区县红十字会单独页面
+				const pd1 = this.path == '/introduce' && index == 2 
+				if (pd1) {
+					this.isShowSon = false
+					this.content = ''
+					this.loadingType == 'nomore'
+					this.contentList = []
+					
+				} else{
+					this.loadingType = 'loadmore' // 加载中
+					this.page = 1
+					this.isShowSon = true
+					this.content = ''
+					this.contentList = []
+					this.pageId = data.id
+					this.getlistslist()
+					
+				}
+				this.navChoose = index
+				this.$emit('navListC',index)
+				if(this.$route.path.indexOf('s') != -1) {
+					this.$router.push(this.$route.path.slice(0,this.$route.path.length-1) + '?navChoose=' +index)
+				}else {
+					this.$router.push(this.$route.path + '?navChoose=' +index)
+				}
+				// this.$router.push(this.$route.path + '?navChoose=' +index)
+					// this.navChoose = index
+					// this.$emit('navListC',index)
+				
+			},
+			listChoose(data) {
+				console.log(this.$route,'this.$route')
+				this.loadingType = 'loadmore'
+				this.isShowSon = true
+				this.contentId = data.id
+				this.getData()
+			},
+			getData() {
+				details({},this.contentId).then(({data}) => {
+					if (data.url == '') {
+						this.content = data.content
+						this.contentId = 0
+					} else{
+						this.originalText(data.url)
+						this.contentId = 0
+						this.isShowSon = false
+					}
+					this.loadingType = 'nomore'
+				})
+			},
+			// 获取文章列表
+			getlistslist() {
+				getArticList({page: this.page,limit: this.limit},this.pageId).then(res => {
+					this.sum = res.data.count
+					if(res.data.count > 0) {
+						// 但文章数量为一时显示第一篇文章
+						if(res.data.count == 1 ) {
+							this.isShowSon = true
+							this.contentId = res.data.list[0].id
+							this.getData()
+						// 但点进页面时有指定文章跳至文章详情
+						}else if(this.contentId != 0) {
+							this.isShowSon = true
+							this.getData()
+						// 但文章数量大于一时显示列表
+						}else if(res.data.count > 1) {
+							this.isShowSon = false
+							this.loadingType = 'nomore'
+						}
+						this.contentList = res.data.list
+						
+					}else {
+						this.loadingType = 'nomore'
+					}
+				})
+			},
+			// 改变当前页
+			pageChoose(page) {
+				this.page = page
+			},
+			// 文章详情转文章列表
+			listBack() {
+				if (this.path == '/introduce' && this.navChoose == 2) {
+				}else {
+					this.loadingType = 'nomore'
+					this.content = ''
+					this.isShowSon = false
+					this.$router.push(this.$route.path + '?navChoose=' +index)
+				}
+				
+			},
+			
+			// 下一页
+			nextPage() {
+				this.page++ 
+				if (this.page > this.totalPage) {
+					this.page = this.totalPage
+				}
+			},
+			// 跳转页面
+			urlTo(name,navChoose) {
+				this.$router.push({
+					name: name
+				})
+			},
+			// 时间戳准换
+			getTime(time) {
+				return time.substring(0,10)
+			},
+			// 查看原文
+			originalText(url) {
+				window.open(url)
+			}
+		},
+		computed: {
+			// 总页数
+			totalPage() {
+				return Math.ceil(this.sum/this.limit)
+			},
+			// 是否有文章列表
+			isShownav() {
+				return !(!this.navList.list)
+			},
+			// 文章列表是否大于数量一
+			isShowHeader() {
+				if(this.isShownav) {
+					if (this.navList.list.length > 1) {
+						return true
+					} else{
+						return false
+					}
+				}
+			},
+			isShowContent() {
+				if (!this.navList.list) {
+					return false
+				} else{
+					return this.navList.list.length > 0
+				}
+			},
+		},
+		watch: {
+			// isShowContent() {
+			// 	if(this.isShowContent) {
+			// 		this.init()
+			// 	}
+			// },
+			page() {
+				this.getlistslist()
+			}
+		},
+	}
+</script>
+
+<style lang="scss" scoped>
+$red: #D82020;
+	.contact {
+		display: flex;
+		height: 100%;
+		.navlist,.right {
+			box-shadow: 1px 1px 6px #e1e1e1;
+			height: 100%;
+		}
+		.navlist {
+			flex: 2;
+			margin-right: 20px;
+			.title {
+				overflow: hidden;
+				text-overflow: ellipsis;
+				display: -webkit-box;
+				-webkit-box-orient: vertical;
+				-webkit-line-clamp: 1;
+			}
+		}
+		.nav {
+			font-size: 16px;
+			font-family: PingFang-SC-Medium;
+			font-weight: Medium;
+			color: #333333;
+			background-color: #fff;
+			display: flex;
+			justify-content: space-between;
+			padding: 10px 20px;
+			.you {
+				color: #333333;
+			}
+		}
+		.navC {
+			background-color: #F7DFDF;
+			color: $red;
+			.you {
+				color: $red;
+			}
+		}
+		.right {
+			flex: 7;
+			.head, {
+				padding: 10px 20px;
+			}
+			.contentbox {
+				overflow: hidden;
+				height: 800px;
+				
+			}
+			.content::-webkit-scrollbar {
+				display: none;
+				position: relative;
+			}
+			.content {
+				position: relative;
+				height: 800px;
+				overflow: auto;
+				padding: 25px 40px;
+				background-color: #fff;
+				.text {
+					padding: 0 10px;
+					padding-bottom: 30px;
+				}
+				.original {
+					position: absolute;
+					color: $red;
+					top: 10px;
+					left: 20px;
+				}
+			}
+			.head {
+				background-color: #F2F2F2;
+				display: flex;
+			}
+		}
+	}
+	// 加载中
+	.load {
+		text-align: center;
+		margin: 20px 0;
+		color: #989898;
+	}
+	.contentList {
+		.item {
+			text-overflow:ellipsis;
+			line-height: 40px;
+			height: 40px;
+			display: flex;
+			justify-content: space-between;
+			color: #666666;
+			border-bottom: solid 1px #F2F2F2;
+			overflow: hidden;
+				img {
+					width: 20px;
+					height: 20px;
+					margin: auto 0;
+				}
+			.title {
+				width: calc(100% - 120px);
+				text-overflow: ellipsis;
+				display: -webkit-box;
+				-webkit-box-orient: vertical;
+				-webkit-line-clamp: 1;
+				
+			}
+			.time {
+				min-width: 100px;
+			}
+		}
+	}
+	.chooseitem  {
+		color: #666;	
+			.title-icon {
+				display: inline-block;
+				width: 0;
+				height: 0;
+				margin: auto 0;
+				border-top: 6px solid transparent;
+				border-left: 8px solid #d2d2d2;
+				border-bottom: 6px solid transparent;
+			}
+	}
+	.chooseitem :hover {
+		color: #d8272a;	
+		.title-icon {
+			border-left-color: #d8272a;
+		}
+	}
+	
+	.pagetoomuch {
+		display: flex;
+	}
+	.pagec {
+		color: #333333;
+		display: flex;
+		float: right;
+		margin: 20px 30px;
+		.fristPage,.pageNum,.nextPage {
+			margin-left: 3px;
+			border: solid 1px #F2F2F2;
+			line-height: 30px;
+			text-align: center;
+			color: #333;
+		}
+		.fristPage,.nextPage {
+			padding: 0 10px;
+		}
+		.pageNum {
+			width: 30px;
+			height: 30px;
+		}
+		.isChoose {
+			background-color: $red;
+			color: #fff;
+		}
+	}
+	.pagec :hover {
+		color: $red;
+	}
+</style>

+ 16 - 6
src/router/index.js

@@ -30,21 +30,31 @@ const routes = [
     path: '/partake',
     name: 'partake',
     component: () => import('../views/partake/partake.vue')
+  },
+  {
+    path: '/partakes',
+    name: 'partakes',
+    component: () => import('../views/partake/partakes.vue')
   },
   {
-    path: '/news',
-    name: 'news',
+    path: '/new',
+    name: 'new',
     component: () => import('../views/news/news.vue')
   },
   {
-    path: '/newss',
-    name: 'newss',
+    path: '/news',
+    name: 'news',
     component: () => import('../views/news/newss.vue')
   },
   {
-    path: '/business',
-    name: 'business',
+    path: '/busine',
+    name: 'busine',
     component: () => import('../views/business/business.vue')
+  },
+  {
+    path: '/busines',
+    name: 'busines',
+    component: () => import('../views/business/businesss.vue')
   },
   {
     path: '/law',

+ 75 - 0
src/views/business/businesss.vue

@@ -0,0 +1,75 @@
+<template>
+	<div class="business">
+		<jm-box :navList='navList' @navListC='navListC'>
+			<div class="abbbb">
+				<about1 v-if="navChoose == 0"></about1>
+				<about2 v-if="navChoose == 1"></about2>
+				<about3 v-if="navChoose == 2"></about3>
+				<about4 v-if="navChoose == 3"></about4>
+				<about5 v-if="navChoose == 4"></about5>
+				<about6 v-if="navChoose == 5"></about6>
+				<about7 v-if="navChoose == 6"></about7>
+			</div>
+			
+		</jm-box>
+	</div>
+</template>
+
+<script>
+import about1 from './chlid/about1.vue'
+import about2 from './chlid/about2.vue'
+import about3 from './chlid/about3.vue'
+import about4 from './chlid/about4.vue'
+import about5 from './chlid/about5.vue'
+import about6 from './chlid/about6.vue'
+import about7 from './chlid/about7.vue'
+	
+import { getArticList,getList } from '@/request/api.js'
+
+import jmBox from '@/components/boxt.vue'
+	export default {
+		components: {
+			jmBox,
+			about1,
+			about2,
+			about3,
+			about4,
+			about5,
+			about6,
+			about7
+		},
+		data() {
+			return {
+				navChoose: 0,
+				navList: {
+					title: '核心业务',
+					url: 'business',
+					list: this.$store.state.business || []
+				}
+			}
+		},
+		mounted() {
+			this.init()
+		},
+		methods: {
+			navListC(index) {
+				this.navChoose = index
+			},
+			init() {
+				this.getdataList()
+			},
+			getdataList() {
+				getList({},16).then(({data}) => {
+					this.navList.list = data
+					this.$store.commit('setBusiness',data)
+				})
+			},
+			navListC(index) {
+				this.navChoose = index
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 2 - 2
src/views/contribution.vue

@@ -10,7 +10,7 @@
 		<div class="jmbox">
 			<div class="center">
 				<div class="title">
-					<div class="time"> 捐赠时间 </div>
+					<div class="time"> 公示时间 </div>
 					<div class="name"> 捐赠者 </div>
 					<div class="price"> 捐赠金额 </div>
 					<div class="intention"> 捐赠意向 </div>
@@ -24,7 +24,7 @@
 						<div class="time"> {{ getTime(l.createtime) }} </div>
 						<div class="name"> {{ l.contact }} </div>
 						<div class="price"> {{ l.amount }} </div>
-						<div class="intention"> {{ getCategory(l.category_id) }} </div>
+						<div class="intention"> {{ l.order_name }} </div>
 						<div class="remarks"> {{ l.remarks }} </div>
 					</div>
 				</div>

+ 9 - 8
src/views/index.vue

@@ -26,7 +26,7 @@
 			</div>
 			<div class="cityNews">
 				<div class="title title2">
-					市红十字会新闻 <div class="more" @click="urlTo('news')">【查看更多】</div>
+					市红十字会新闻 <div class="more" @click="urlTo('new')">【查看更多】</div>
 				</div>
 				<div class="list chooseitem">
 					<div class="item" v-for="c in cityNewsList" @click="newsTo(0,c)" :title="c.title">
@@ -47,7 +47,7 @@
 					爱心滚动榜 <div class="more" @click="urlTo('contribution')">【查看更多】</div>
 				</div>
 				<div class="listHeader">
-					<div class=""> 捐赠时间 </div>
+					<div class=""> 公示时间 </div>
 					<div class=""> 捐赠者 </div>
 					<div class=""> 捐赠金额 </div>
 				</div>
@@ -78,7 +78,7 @@
 		<div class="boxFlex">
 			<div class="box">
 				<div class="title title2">
-					县市区红十字新闻 <div class="more" @click="urlTo('news',1)">【查看更多】</div>
+					县市区红十字新闻 <div class="more" @click="urlTo('new',1)">【查看更多】</div>
 				</div>
 				<div class="list chooseitem">
 					<div class="item" v-for="c in countyNewsList" @click="newsTo(1,c)" :title="c.title">
@@ -96,7 +96,7 @@
 			</div>
 			<div class="box">
 				<div class="title title2">
-					公示/公告 <div class="more" @click="urlTo('news',2)">【查看更多】</div>
+					公示/公告 <div class="more" @click="urlTo('new',2)">【查看更多】</div>
 				</div>
 				<div class="list chooseitem">
 					<div class="item" v-for="p in publicityList" @click="newsTo(3,p)" :title="p.title">
@@ -312,10 +312,11 @@ import slideLaR from '../components/slideLaR.vue'
 				this.toTop()
 			},
 			newsTo(navChoose,data) {
-				this.$router.push({
-					name: 'news',
-					params:{navChoose: navChoose || 0,contentId: data.id || 0}
-				})
+				// this.$router.push({
+				// 	name: 'new',
+				// 	params:{navChoose: navChoose || 0,contentId: data.id || 0}
+				// })
+				this.$router.push('/news?navChoose=' + navChoose + '&id=' + data.id)
 				this.toTop()
 			},
 			// 返回顶部

+ 1 - 1
src/views/news/newss.vue

@@ -9,7 +9,7 @@
 import { getArticList,details,getList } from '@/request/api.js'
 
 	
-import jmBox from '@/components/box.vue'
+import jmBox from '@/components/boxt.vue'
 	export default {
 		components: {
 			jmBox

+ 0 - 9
src/views/partake/new_file.html

@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-	<head>
-		<meta charset="utf-8">
-		<title></title>
-	</head>
-	<body>
-	</body>
-</html>

+ 6 - 2
src/views/partake/partake.vue

@@ -13,15 +13,19 @@ import jmBox from '@/components/box.vue'
 	export default {
 		components: {
 			jmBox,
+		},
+		created() {
+			console.log(this.navList.title,'navList+++++++')
 		},
 		mounted() {
-			this.init()
+			this.init()
+			console.log(this.navList.title,'navList+++++++')
 		},
 		data() {
 			return {
 				navChoose: this.$route.params.navChoose || this.$route.query.navChoose || 0,
 				navList: {
-					title: '我要参与',
+					title: "我要参与",
 					url: 'partake',
 					list: this.$store.state.partakeList || []
 				}

+ 51 - 0
src/views/partake/partakes.vue

@@ -0,0 +1,51 @@
+<template>
+	<div class="partake">
+		<jm-box :navList='navList' @navListC='navListC'>
+			
+		</jm-box>
+	</div>
+</template>
+
+<script>
+
+import { getArticList,getList } from '@/request/api.js'
+import jmBox from '@/components/boxt.vue'
+	export default {
+		components: {
+			jmBox,
+		},
+		mounted() {
+			this.init()
+		},
+		data() {
+			return {
+				navChoose: this.$route.params.navChoose || this.$route.query.navChoose || 0,
+				navList: {
+					title: '我要参与',
+					url: 'partake',
+					list: this.$store.state.partakeList || []
+				}
+			}
+		},
+		methods: {
+			init() {
+				this.getList()
+			},
+			getList() {
+				getList({},18).then(({data}) => {
+					this.navList.list = data
+					this.$store.commit('setPartakeList',data)
+				})
+			},
+			navListC(index) {
+				this.navChoose = index
+			}
+		}
+	}
+</script>
+
+<style>
+	.center {
+		padding: 10px 20px;
+	}
+</style>