From a3a48da30bdea132d2bfbb47fa2ccf83f1937c45 Mon Sep 17 00:00:00 2001
From: queenwuli <942534046@qq.com>
Date: Tue, 19 Jan 2021 08:29:55 +0800
Subject: [PATCH] 提交

---
 hive-app/pages/mine/knowledge.vue |  208 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 126 insertions(+), 82 deletions(-)

diff --git a/hive-app/pages/mine/knowledge.vue b/hive-app/pages/mine/knowledge.vue
index b7f3d1d..7893fc7 100644
--- a/hive-app/pages/mine/knowledge.vue
+++ b/hive-app/pages/mine/knowledge.vue
@@ -1,56 +1,108 @@
 <template>
-	<!-- 知识库 -->
-	<view class="container flex">
-		<scroll-view class="list-left" scroll-y>
-			<view v-for="(item,index) in list" class="list-left-row" @click="active(index)" :class="activeIndex==index?'active':''">
-				<text class="font-14 gray"  @click="show(item)">{{item.primaryTitle}}</text>
-				<!-- <view v-for="(sub,index) in item.subTitle" v-show="item.isShow" class="list-left-row-item" @click="selectItem(index)" :class="index==select?'select-item':''">
-					{{sub}}
-				</view> -->
-			</view>
-		</scroll-view>
-		<scroll-view class="list-right" scroll-y>
-			<view class="flex align-center list-right-row">
-				<image class="list-right-img ml-10" mode="aspectFit" src="../../static/images/head-img.jpg"></image>
-				<view class="flex flex-v ml-10">
-					<text class="overflow-nowrap font-14">我是文章的标题</text>
-					<text class="overflow-omit font-14">我是文章的内容我是文章的内容我是文章的内容我是文章的内容</text>
+	<!-- 当前客户 -->
+	<view class="container">
+		<view class="list">
+			<scroll-view class="list-left" scroll-y="true">
+				<view class="list-left-row" 
+					v-for="item in typeList" 
+					:class="item.id==typeId?'active':''"
+					@click="changeType(item.id)">
+						<text>{{item.articleTypeName}}</text>
 				</view>
-			</view>
-		</scroll-view>
+			</scroll-view>
+			<scroll-view class="list-right" scroll-y="true" @scrolltolower="scrolltolower()">
+				<navigator :url="'./knowledgeDetail?id='+item.id" hover-class="none" v-for="item in list">
+					<view class="list-right-row">
+						<image class="product-img" :src="item.image?item.image:'../../static/images/no-img.png'"></image>
+						<view class="flex-1">
+							<text class="font-13">{{item.title}}</text>
+							<view class="desc">
+								<text>{{item.articleTypeName}}</text>
+							</view>
+						</view>
+					</view>
+				</navigator>
+				<no-record :isShow="!list.length"></no-record>
+				<view v-if="list.length">
+					<uni-load-more :status="loadStatus" color="#a5abaf"></uni-load-more>
+				</view>
+			</scroll-view>
+		</view>
 	</view>
 </template>
 
 <script>
-	export default{
+	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
+	export default {
+		components: {
+			uniLoadMore
+		},
 		data(){
 			return{
-				list:[
-					{
-						primaryTitle:'院装产品',
-						subTitle:['水果','蔬菜'],
-						isShow:false,
-					},
-					{
-						primaryTitle:'美容套餐',
-						subTitle:['水果','蔬菜'],
-						isShow:false
-					}
-				],
-				select:'0',
-				activeIndex:'0'
+				typeList: [], 
+				list: [],
+				typeId: '',
+				loadStatus: 'more',
+				pageNum: 1
 			}
 		},
+		onLoad(options) {
+			this.loadTypeList()
+		},
+		onPullDownRefresh(){
+			this.reloadData();
+			let timer = setTimeout(function () {
+				uni.stopPullDownRefresh();
+				clearTimeout(timer);
+				timer = null;
+			}, 800);
+		},
 		methods:{
-			show(item){
-				item.isShow=!item.isShow
-				this.select=0
+			reloadData(){
+				this.list = [];
+				this.pageNum = 1;
+				this.loadStatus = 'more';
+				this.loadList();
 			},
-			selectItem(index){
-				this.select=index
+			scrolltolower(){
+				this.loadList()
 			},
-			active(index){
-				this.activeIndex=index
+			loadTypeList(){
+				this.$httpUtils.request('/api/know/findKnowledgeType').then((res) => {
+					if(res.status == 200){
+						let result = res.rows;
+						this.typeList = result;
+						if(result.length){
+							this.typeId = result[0].id;
+							this.loadList()
+						}
+					}
+				})
+			},
+			loadList(){
+				if(this.loadStatus!=='more'){
+					return;
+				}
+				this.$httpUtils.request('/api/know/findArticleList', {
+					pageNum: this.pageNum,
+					pageSize: 10,
+					typeId: this.typeId
+				}, 'POST').then((res) => {
+					if(res.status == 200){
+						let result = res.rows;
+						if(result.length < 10){
+							this.loadStatus = 'noMore';
+						} else {
+							this.pageNum ++ ;
+							this.loadStatus = 'more';
+						}
+						this.list = this.list.concat(result);
+					}
+				})
+			},
+			changeType(id){
+				this.typeId = id;
+				this.reloadData()
 			}
 		}
 	}
@@ -61,67 +113,59 @@
 		height: 100%;
 	}
 	.container{
+		display: flex;
+		flex-direction: column;
 		height: 100%;
 		padding: 10px 0 0;
 		box-sizing: border-box;
 	}
+	.list{
+		flex: 1;
+		display: flex;
+		overflow: hidden;
+	}
 	.list-left{
-		width: 30%;
-		height: 100%;
-		text-align: center;
+		width: 170rpx;
+		flex: 0 0 170rpx;
 		background: #F6F6F8;
 		border-radius: 4px;
-		
+	}
+	.list-right{
+		flex: 1;
 	}
 	.list-left-row{
-		padding: 10px 10px;
-		font-size: 16px;
-		display: flex;
-		flex-direction: column;
-		align-items: center;
+		padding: 10px;
+		color: #8c9fad;
+		font-size: 13px;
 	}
-	.list-left-row-item{
-		width: 80px;
-		margin-top: 8px;
-		font-size: 14px;
-		color: ;
-	}
-	.select-item{
-		background: red;
-		border-radius: 20px;
-		color: #FFFFFF;
-	}
-	.active{
+	.list-left-row.active{
 		background: #FFFFFF;
 		color: #000000;
 	}
-	.list-right{
-		width: 70%;
-		text-align: center;
-		padding: 0px 10px;
-	}
 	.list-right-row{
+		display: flex;
+		padding: 10px;
+		margin: 0 10px 10px;
 		border: 1px solid #EDEAF4;
 		box-shadow:0 6px 6px rgba(237,234,244,0.5);
 		border-radius: 4px;
-		padding: 10px;
+		font-size: 12px;
 	}
-	.list-right-img{
-		width: 150px;
-		height: 80px;
+	.list-right-row .product-img{
+		width: 62px;
+		height: 62px;
+		margin-right: 10px;
 	}
-	
-	/* 超过两行显示省略号 */
-	.overflow-omit{
+	.desc{
+		margin-top: 8px;
+		color: #a5abaf;
+		word-break: break-all;
 		text-overflow: -o-ellipsis-lastline;
-	    overflow: hidden;
-	    text-overflow: ellipsis;
-	    display: -webkit-box;
-	    -webkit-line-clamp: 2;
-	    -webkit-box-orient: vertical;
-	}
-	/* 只能一行,超出显示省略号 */
-	.overflow-nowrap{
-		white-space:nowrap;
+		overflow: hidden;
+		text-overflow: ellipsis;
+		display: -webkit-box;
+		-webkit-line-clamp: 2;
+		line-clamp: 2;
+		-webkit-box-orient: vertical;
 	}
 </style>

--
Gitblit v1.9.1