소스 검색

问吧类型列表样式完善
资讯 && 法律下乡 完善

付宇航 1 년 전
부모
커밋
526c4f9ecb
5개의 변경된 파일100개의 추가작업 그리고 14개의 파일을 삭제
  1. 11 1
      pages/asking/addquestion.vue
  2. 84 8
      pages/asking/asking.vue
  3. 1 1
      pages/index/index.vue
  4. 2 2
      pages/information/fuwu/fuwu.vue
  5. 2 2
      pages/information/toLegal/toLegal.vue

+ 11 - 1
pages/asking/addquestion.vue

@@ -9,7 +9,7 @@
 		  <uni-easyinput type="textarea" v-model="form.text" :maxlength="1000" @blur="binddata('textDetails', $event.detail.value)" placeholder="请输入正文"></uni-easyinput>
         </uni-forms-item>
 		
-        <uni-forms-item label="提问类型" required name="typeId">
+        <uni-forms-item label="提问类型" required name="typeId" class="askType">
 		  <uni-data-select
 			  v-model="form.typeId"
 			  :localdata="typeList"
@@ -124,3 +124,13 @@ export default {
 };
 </script>
 
+<style lang="scss" scoped>
+	::v-deep .item--uni-forms-item__label text{
+		width: fit-content;
+		white-space: nowrap;
+	}
+	::v-deep .uni-section-content{
+		padding: 3%;
+	}
+	
+</style>

+ 84 - 8
pages/asking/asking.vue

@@ -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>

+ 1 - 1
pages/index/index.vue

@@ -460,7 +460,7 @@
 			},
 			goWenBa() {
 				uni.navigateTo({
-					url: '/pages/demo/wenba/wenba'
+					url: '/pages/asking/asking'
 				});
 			},
 			goHangQing() {

+ 2 - 2
pages/information/fuwu/fuwu.vue

@@ -47,10 +47,10 @@
 	                        <em class="iconfont icon-chakan"></em>
 	                        {{ item.watchNum }}
 	                    </span>
-	                    <span :class=" favoriteList.includes(item.id) ? 'favorite' : 'not-favorite' ">
+	                    <!-- <span :class=" favoriteList.includes(item.id) ? 'favorite' : 'not-favorite' ">
 	                        <em class="iconfont icon-shoucang" @click.stop="addFavorite(item)"></em>
 	                        {{ currentFavoriteCount(item) }}
-	                    </span>
+	                    </span> -->
 	                </view>
 	            </view>
 

+ 2 - 2
pages/information/toLegal/toLegal.vue

@@ -45,10 +45,10 @@
 	                        <em class="iconfont icon-chakan"></em>
 	                        {{ item.watchNum }}
 	                    </span>
-	                    <span :class=" favoriteList.includes(item.id) ? 'favorite' : 'not-favorite' ">
+	                    <!-- <span :class=" favoriteList.includes(item.id) ? 'favorite' : 'not-favorite' ">
 	                        <em class="iconfont icon-shoucang" @click.stop="addFavorite(item)"></em>
 	                        {{ currentFavoriteCount(item) }}
-	                    </span>
+	                    </span> -->
 	                </view>
 	            </view>