Explorar o código

perf: 我要什么”和“我有什么”列表有一个下拉刷新的功能

lizhaocai hai 3 meses
pai
achega
8e6657a2de

+ 4 - 19
pages/comm/comm.vue

@@ -1,25 +1,10 @@
 <template>
 	<view class="circle tn-safe-area-inset-bottom">
-		<tn-nav-bar customBack>
-			<view slot="back" class='tn-custom-nav-bar__back' @click="reFetchData()">
-				<text v-if="!loading" class="tn-icon-circle-arrow" style="font-size: 50rpx;"></text>
-				<view style="margin-top:6px" v-if="loading" ><tn-loading :size="46"></tn-loading></view>
-			</view>
-
-			<view slot="default" style="display: flex;">
-				<view style="flex:1;margin-left:25px">
-					<text>我有什么</text>
-				</view>
-				<view>
-					<text class="tn-icon-add-fill" style="font-size: 30px;margin-right: 4px;"
-						@click="addButton()"></text>
-				</view>
-			</view>
-		</tn-nav-bar>
+		
 
 		<!-- 发现 -->
-		<view class="" v-if="current==0" :style="{paddingTop: vuex_custom_bar_height + 'px'}">
-			<uv-sticky :offsetTop="vuex_custom_bar_height + 'px'" bgColor="#ffffff">
+		<view class="" v-if="current==0" >
+			<uv-sticky   bgColor="#ffffff">
 				<view style="width: 100%;" v-if="currentTab==0">
 					<view style="display: flex; padding: 10px 12px;">
 						<view
@@ -215,7 +200,7 @@
 
 			</view>
 
-			<view class='tn-tabbar-height'></view>
+			<view class='tn-tabbar-height' :style="{marginTop: vuex_custom_bar_height + 'px'}"></view>
 
 		</view>
 

+ 4 - 4
pages/home/home.vue

@@ -3,8 +3,8 @@
 
 		
 
-		<view class="" :style="{paddingTop: vuex_custom_bar_height + 'px'}">
-			<uv-sticky :offsetTop="vuex_custom_bar_height + 'px'" bgColor="#ffffff">
+		<view class="">
+			<uv-sticky bgColor="#ffffff">
 				<uni-search-bar radius="15" placeholder="搜索" @confirm="search" v-model="searchValue" @blur="search"
 					@cancel="cancel" @clear="clear" cancelButton="auto" clearButton="auto"
 					style="border-bottom: 1rpx solid #f1f1f1cc;">
@@ -124,8 +124,8 @@
 
 		</view>
 
-
-		<view class='tn-tabbar-height'></view>
+		<view class='tn-tabbar-height' :style="{marginTop: vuex_custom_bar_height + 'px'}"></view>
+		
 		
 		<tn-popup v-model="showSheet" mode="center" closeBtn="true" borderRadius="16">
 			<view class="content" style="padding: 24px 36px;font-size: 16px;line-height: 24px; width: 320px;"

+ 55 - 2
pages/index/index.vue

@@ -17,12 +17,29 @@
 					</view>
 				</view>
 			</tn-nav-bar>
-			<scroll-view class="custom-tabbar-page" scroll-y :refresher-enabled="isTop" @scroll="handleScroll" :refresher-triggered="triggered" @refresherpulling="onPulling" @refresherrestore="onRestore" @refresherrefresh="onRefresh" enable-back-to-top @scrolltolower="tabbarPageScrollLower">
+			<scroll-view class="custom-tabbar-page"  :style="{marginTop: vuex_custom_bar_height + 'px'}" lower-threshold="60"  scroll-y :refresher-enabled="true" @scroll="handleScroll" :refresher-triggered="triggered" @refresherpulling="onPulling" @refresherrestore="onRestore" @refresherrefresh="onRefresh" enable-back-to-top @scrolltolower="tabbarPageScrollLower">
 				<Home ref="home"></Home>
+				
 			</scroll-view>
 		</view>
 		<view v-if="tabberPageLoadFlag[1]" :style="{display: currentIndex === 1 ? '' : 'none'}">
-			<scroll-view class="custom-tabbar-page" scroll-y :refresher-enabled="isTop" :refresher-triggered="triggered" @refresherrestore="onRestore" @refresherrefresh="onRefresh" enable-back-to-top @scrolltolower="tabbarPageScrollLower">
+			<tn-nav-bar customBack>
+				<view slot="back" class='tn-custom-nav-bar__back' @click="reFetchData()">
+					<text v-if="!loading" class="tn-icon-circle-arrow" style="font-size: 50rpx;"></text>
+					<view style="margin-top:6px" v-if="loading" ><tn-loading :size="46"></tn-loading></view>
+				</view>
+			
+				<view slot="default" style="display: flex;">
+					<view style="flex:1;margin-left:25px">
+						<text>我有什么</text>
+					</view>
+					<view>
+						<text class="tn-icon-add-fill" style="font-size: 30px;margin-right: 4px;"
+							@click="addButton()"></text>
+					</view>
+				</view>
+			</tn-nav-bar>
+			<scroll-view class="custom-tabbar-page" :style="{marginTop: vuex_custom_bar_height + 'px'}" scroll-y :refresher-enabled="true" :refresher-triggered="triggered" lower-threshold="60" @refresherrestore="onRestore" @refresherrefresh="onRefresh"  @refresherpulling="onPulling" enable-back-to-top @scrolltolower="tabbarPageScrollLower">
 				<Comm ref="comm"></Comm>
 			</scroll-view>
 		</view>
@@ -284,6 +301,10 @@
 			},
 			 onPulling(e) {
 			                console.log("onpulling", e);
+							if(e.detail.deltaY<0){
+								return
+							}
+							this.triggered = true
 			            }, 
 			onRefresh(){
 				if (this._freshing) return;
@@ -307,6 +328,38 @@
 				this.triggered = false; // 需要重置
 				console.error("onRestore");
 			},
+			
+			addButton() {
+				if (!uni.getStorageSync('userNo')) {
+					uni.showToast({
+						title: '请登录',
+						icon:'none'
+					})
+					uni.navigateTo({
+						url: '/pages/login/login'
+					})
+					return false;
+				} else {
+					uni.navigateTo({
+						url: this.currentIndex === 0?'/circlePages/circle':'/circlePages/addShare'
+					})
+				}
+				//未登录,去登录
+				//已登录,去新增第一步
+			},
+			reFetchData() {
+				 
+					if (this.currentIndex === 0) {
+						console.error('this');
+						this.$refs.home.reFetchData();
+					}
+					if (this.currentIndex === 1) {
+						console.error('this');
+						this.$refs.comm.reFetchData();
+					}
+					 
+				 
+			},
 
 			// 切换导航页面
 			_switchTabbarPage(index) {

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/comm/comm.js.map


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/home/home.js.map


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/index/index.js.map


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/comm/comm.js


+ 0 - 2
unpackage/dist/dev/mp-weixin/pages/comm/comm.json

@@ -1,8 +1,6 @@
 {
   "usingComponents": {
     "comm-basic-table-item": "/pages/comm/comm-basic-table-item",
-    "tn-nav-bar": "/tuniao-ui/components/tn-nav-bar/tn-nav-bar",
-    "tn-loading": "/tuniao-ui/components/tn-loading/tn-loading",
     "uv-sticky": "/uni_modules/uv-sticky/components/uv-sticky/uv-sticky",
     "uni-icons": "/uni_modules/uni-icons/components/uni-icons/uni-icons",
     "tn-tabs-swiper": "/tuniao-ui/components/tn-tabs-swiper/tn-tabs-swiper",

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/comm/comm.wxml


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/home/home.wxml


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/index/index.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/index/index.wxml