From 7692df60c0746b9e23a228eb719349c697cfcb06 Mon Sep 17 00:00:00 2001 From: queenwuli <942534046@qq.com> Date: Thu, 07 Jan 2021 11:26:06 +0800 Subject: [PATCH] gx --- hive-app/pages/mine/knowledge.vue | 77 ++++++++++++++++++++++++++------------ 1 files changed, 52 insertions(+), 25 deletions(-) diff --git a/hive-app/pages/mine/knowledge.vue b/hive-app/pages/mine/knowledge.vue index 899546b..f06e7a0 100644 --- a/hive-app/pages/mine/knowledge.vue +++ b/hive-app/pages/mine/knowledge.vue @@ -4,24 +4,25 @@ <view class="list"> <scroll-view class="list-left" scroll-y="true"> <view class="list-left-row" - v-for="(item,index) in typeList" - :class="index==selectIndex?'active':''" - @click="changeType(item.id, index)"> - <text>{{item.name}}</text> + v-for="item in typeList" + :class="item.id==typeId?'active':''" + @click="changeType(item.id)"> + <text>{{item.articleTypeName}}</text> </view> </scroll-view> <scroll-view class="list-right" scroll-y="true"> - <navigator :url="'../productDetail/index?id='+item.id" hover-class="none" v-for="item in list"> + <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.img?item.img:'../../../static/images/no-img.png'"></image> + <image class="product-img" :src="item.image?item.image:'../../static/images/no-img.png'"></image> <view class="flex-1"> - <text>{{item.name}}</text> - <view class="flex justify-between mt-15"> - <text class="price">¥{{item.price}}</text> + <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> </scroll-view> </view> </view> @@ -31,27 +32,41 @@ export default { data(){ return{ - typeList: [{ - name: '312', - id: 2 - }], - list: [{ - name: '312', - id: 2 - }], - selectIndex: 0 + typeList: [], + list: [], + typeId: '' } }, onLoad(options) { - // this.loadTypeList() + this.loadTypeList() }, methods:{ loadTypeList(){ this.$httpUtils.request('/api/know/findKnowledgeType').then((res) => { if(res.status == 200){ - this.typeList = res.rows; + let result = res.rows; + this.typeList = result; + if(result.length){ + this.typeId = result[0].id; + this.loadList() + } } }) + }, + loadList(){ + this.$httpUtils.request('/api/know/findArticleList', { + pageNum: 1, + pageSize: 100, + typeId: this.typeId + }, 'POST').then((res) => { + if(res.status == 200){ + this.list = res.rows; + } + }) + }, + changeType(id){ + this.typeId = id; + this.loadList() } } } @@ -75,6 +90,7 @@ } .list-left{ width: 170rpx; + flex: 0 0 170rpx; background: #F6F6F8; border-radius: 4px; } @@ -92,17 +108,28 @@ } .list-right-row{ display: flex; - align-items: center; padding: 10px; margin: 0 10px 10px; border: 1px solid #EDEAF4; box-shadow:0 6px 6px rgba(237,234,244,0.5); border-radius: 4px; - font-size: 13px; + font-size: 12px; } .list-right-row .product-img{ - width: 66px; - height: 66px; - margin-right: 5px; + width: 62px; + height: 62px; + margin-right: 10px; + } + .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; + line-clamp: 2; + -webkit-box-orient: vertical; } </style> -- Gitblit v1.9.1