|
@@ -2,13 +2,19 @@
|
|
|
<!-- pages/fuwu/fuwu.wxml -->
|
|
|
<view class="contain">
|
|
|
<!-- 问答类别 -->
|
|
|
- <ul class="wendaFL" v-for="(e,idx) in typeList" :key="idx" style="width: 48%;">
|
|
|
- <li class="sanNong" style="width: 100%;">
|
|
|
- <image :src="loadImgSrcLocalhost(e.path)" class="lbBj" @tap="goType(e.id,e.type)"></image>
|
|
|
- <h2>{{e.type}}</h2>
|
|
|
- <span>{{e.questionNum}}</span>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
+ <swiper :indicator-dots="true" :autoplay="false" class="swiper">
|
|
|
+ <swiper-item v-for="(e,idx) in loopTimes" style="padding: 1% 2% 0 0;">
|
|
|
+ <view class="swiper-item">
|
|
|
+ <view v-for="(v,index) in imgListExcuted(idx)" style="width: 48%;height: 27%;" @tap="goType(v.id,v.type)">
|
|
|
+ <image :src="loadImgSrcLocalhost(v.path)" class="img"></image>
|
|
|
+ <view class="textDesc">
|
|
|
+ <h2>{{v.type}}</h2>
|
|
|
+ <span>{{v.questionNum}}</span>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </swiper-item>
|
|
|
+ </swiper>
|
|
|
<!-- 问答列表 -->
|
|
|
<view class="rnwdList" v-for="(item, index) in hotQuestionList" :key="index" @tap="goDetails(item.id)">
|
|
|
<span class="lb">{{ item.type }}</span>
|
|
@@ -66,6 +72,7 @@ export default {
|
|
|
pageNum: 1,
|
|
|
pageSize: 6,
|
|
|
},
|
|
|
+ loopTimes:null
|
|
|
};
|
|
|
}
|
|
|
/**
|
|
@@ -76,10 +83,32 @@ export default {
|
|
|
this.getHotQuestionList();
|
|
|
},
|
|
|
methods: {
|
|
|
+ imgListExcuted(idx){
|
|
|
+ let result = []
|
|
|
+ let pageNum = 6
|
|
|
+ if(idx == 0){
|
|
|
+ result = this.typeList.slice(0,6)
|
|
|
+ } else {
|
|
|
+ this.typeList.filter(e => {
|
|
|
+ if(this.typeList.length - pageNum * (idx +1) < pageNum){
|
|
|
+ console.log(this.typeList.slice(idx*6,this.typeList.length))
|
|
|
+ // 剩余信息不够6条 全部返回
|
|
|
+ result = this.typeList.slice(idx*6,this.typeList.length)
|
|
|
+ } else {
|
|
|
+ result = this.typeList.slice(idx*6,idx*6 +6 )
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ console.log('加工后result',idx,result)
|
|
|
+ return result
|
|
|
+ },
|
|
|
//获取类型列表
|
|
|
getTypeList(){
|
|
|
getTypeList(this.queryParams).then(res =>{
|
|
|
this.typeList = res.rows
|
|
|
+ this.typeList = this.typeList.concat(this.typeList)
|
|
|
+ this.loopTimes = (this.typeList.length/6).toFixed(0) *1
|
|
|
+ console.log('loopTimes',this.loopTimes)
|
|
|
})
|
|
|
},
|
|
|
//获取热门问答列表
|
|
@@ -114,7 +143,7 @@ export default {
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
-<style scoped>
|
|
|
+<style lang="scss">
|
|
|
@import '@/pages/asking/asking.css';
|
|
|
.contain {
|
|
|
height: 100%;
|
|
@@ -124,4 +153,51 @@ export default {
|
|
|
box-sizing: border-box;
|
|
|
flex-wrap: wrap;
|
|
|
}
|
|
|
+ /deep/ .wx-swiper-dots-horizontal {
|
|
|
+ bottom: 0 !important;
|
|
|
+}
|
|
|
+.swiper{
|
|
|
+ width: 100%;
|
|
|
+ height: 324px;
|
|
|
+ .swiper-item{
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ height: 100%;
|
|
|
+ justify-content: space-between;
|
|
|
+ .img{
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ .textDesc{
|
|
|
+ position: relative;
|
|
|
+ height: 78%;
|
|
|
+ bottom: 95%;
|
|
|
+ left: 1%;
|
|
|
+ }
|
|
|
+ .textDesc h2{
|
|
|
+ font-size: 36rpx;
|
|
|
+ position: absolute;
|
|
|
+ left: 30rpx;
|
|
|
+ top: 40rpx;
|
|
|
+ z-index: 1;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ .textDesc span {
|
|
|
+ font-size: 30rpx;
|
|
|
+ position: absolute;
|
|
|
+ left: 30rpx;
|
|
|
+ top: 88rpx;
|
|
|
+ z-index: 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .swiper-item view{
|
|
|
+ width: 300px;
|
|
|
+ height: 30%;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ }
|
|
|
+ .swiper-item view image{
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|