zhengkaixin vor 2 Jahren
Ursprung
Commit
39f2f3b35e
3 geänderte Dateien mit 39 neuen und 23 gelöschten Zeilen
  1. 2 1
      main.js
  2. 2 1
      package.json
  3. 35 21
      pages/index/index.vue

+ 2 - 1
main.js

@@ -10,7 +10,7 @@ import  mixin from './utils/mixin.js'
 
  Vue.prototype.carhelp=mixin 
 
-// import Vconsole from 'vconsole'
+ import Vconsole from 'vconsole'
 //  //import './router' // 引入路由
 //import router from './bobo-router'
 
@@ -32,6 +32,7 @@ const app = new Vue({
 Vue.mixin({ 
     onLoad( option){  
         if (option.test == 'test') {
+			let vConsole = new Vconsole()
         
         }
 		

+ 2 - 1
package.json

@@ -13,7 +13,8 @@
   "vue-cli": "^2.9.6",
   "vue-cropper": "^0.5.6",
   "vuex": "^3.6.2",
-  "weixin-js-sdk": "^1.6.0"
+  "weixin-js-sdk": "^1.6.0",
+   "vconsole": "^3.4.0"
  },
  "devDependencies": {
   "node-sass": "^5.0.0",

+ 35 - 21
pages/index/index.vue

@@ -34,8 +34,11 @@
 		
 		<view class="homeWrap">
 			<u-swiper  v-if="wrapList.length" :list="wrapList" @click="clickBanner" :img-mode="'aspectFit'" :name="'picUrl'" height="294" border-radius="24"></u-swiper>
-		</view>
-		<view class="homeUser">
+		</view>
+		
+		<view class="homeUser">
+			<u-divider color="#19be6b" style="margin-bottom:10px;" font-size="28rpx" ><span @click="changeList" v-show="timeOut" >点击刷新</span><span style="margin-left:20px" @click="onHideMethod" v-show="timeOut" >暂停</span><span style="margin-left:20px" v-show="!timeOut" @click="changeList" >自动刷新</span></u-divider>
+			
 			<view class="homeUser-item" 
 			@click="gotoUrl('pages/friend/personal?id='+item.id)"
 			v-for="(item ,index) in list" :key="item.id" >
@@ -56,7 +59,8 @@
 			</view>
 			
 		</view>
-		<u-divider color="#19be6b" style="margin-bottom:20px;" font-size="28rpx" @click="changeList">点击换一批</u-divider>
+		<u-divider color="#19be6b" style="margin-bottom:20px;" font-size="28rpx" ><span @click="changeList" v-show="timeOut" >点击刷新</span><span style="margin-left:20px" @click="onHideMethod" v-show="timeOut" >暂停</span><span style="margin-left:20px" v-show="!timeOut" @click="changeList" >自动刷新</span></u-divider>
+		
 		
  	</view>
 </template>
@@ -145,10 +149,13 @@
 					this.pageIndex = 1;
 				}
 				this.homePage()
+				if(this.uuid){
+					clearInterval(this.uuid)
+				}
 				
-				clearInterval(this.uuid)
 				this.uuid='';
-				if(!this.uuid){
+				if(!this.uuid){
+					this.timeOut=true;
 					this.uuid=setInterval(()=>{
 						if(this.timeOut){
 							this.timingchangeList();
@@ -249,7 +256,7 @@
 						this.recordsTotal = res.data.recordsTotal
 						this.totalPage = res.data.totalPage
 						uni.hideLoading()
-						this.getBaseDictionary()
+					
 					}).catch(error => {
 						uni.showToast({
 						
@@ -273,6 +280,23 @@
 					url:obj.linkUrl
 				})
 				
+			},
+			onHideMethod(){
+				this.timeOut = false;
+				if(this.uuid){
+					clearInterval(this.uuid)	
+					this.uuid='';
+				}
+			},
+			onShowMethod(){
+				this.timeOut=true
+				if(!this.uuid){
+					this.uuid=setInterval(()=>{
+						if(this.timeOut){
+							this.timingchangeList();
+						}
+					},10*1000)
+				}
 			}
 			
 		},
@@ -281,22 +305,12 @@
 				clearInterval(this.uuid)
 			}
 		},
-		onHide() {
-			this.timeOut = false;
-			if(this.uuid){
-				clearInterval(this.uuid)	
-				this.uuid='';
-			}
+		onHide() {
+			console.log("onHide")
+			this.onHideMethod()
 		},
 		onShow() {
-			this.timeOut=true
-			if(!this.uuid){
-				this.uuid=setInterval(()=>{
-					if(this.timeOut){
-						this.timingchangeList();
-					}
-				},10*1000)
-			}
+			this.onShowMethod()
 		},
 		onLoad() {
 			 var  logo=this.carhelp.getConfig().logo
@@ -305,7 +319,7 @@
  			 }
 		},
 		onReady() {
-			
+			this.getBaseDictionary()
 			this.getBannerInfo()
 			this.homePage()
 		}