소스 검색

feat: 供需发布平台 设为第一个,增加版本更新弹窗

lizhaocai 3 주 전
부모
커밋
a54beed906
1개의 변경된 파일43개의 추가작업 그리고 140개의 파일을 삭제
  1. 43 140
      pages/index/index.vue

+ 43 - 140
pages/index/index.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="start-index">
-		<view v-if="tabberPageLoadFlag[0]" :style="{display: currentIndex === 0 ? '' : 'none'}">
+		<view v-if="tabberPageLoadFlag[1]" :style="{display: currentIndex === 1 ? '' : 'none'}">
 			<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: 30px;"></text>
@@ -22,7 +22,7 @@
 				
 			</scroll-view>
 		</view>
-		<view v-if="tabberPageLoadFlag[1]" :style="{display: currentIndex === 1 ? '' : 'none'}">
+		<view v-if="tabberPageLoadFlag[2]" :style="{display: currentIndex === 2 ? '' : 'none'}">
 			<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: 30px;"></text>
@@ -43,16 +43,11 @@
 				<Comm ref="comm"></Comm>
 			</scroll-view>
 		</view>
-		<view v-if="tabberPageLoadFlag[2]" :style="{display: currentIndex === 2 ? '' : 'none'}">
+		<view v-if="tabberPageLoadFlag[0]" :style="{display: currentIndex === 0 ? '' : 'none'}">
 			<scroll-view class="custom-tabbar-page" scroll-y enable-back-to-top @scrolltolower="tabbarPageScrollLower">
 				<Discovery ref="discovery"></Discovery>
 			</scroll-view>
 		</view>
-		<!-- <view v-if="tabberPageLoadFlag[3]" :style="{display: currentIndex === 3 ? '' : 'none'}">
-      <scroll-view class="custom-tabbar-page" scroll-y enable-back-to-top @scrolltolower="tabbarPageScrollLower">
-        <Message ref="message"></Message>
-      </scroll-view>
-    </view> -->
 		<view v-if="tabberPageLoadFlag[3]" :style="{display: currentIndex === 3 ? '' : 'none'}">
 			<scroll-view class="custom-tabbar-page" scroll-y enable-back-to-top @scrolltolower="tabbarPageScrollLower">
 				<Mine ref="mine"></Mine>
@@ -86,7 +81,14 @@
 				triggered: false,
 				_freshing: false,
 				// 底部tabbar菜单数据
-				tabbarList: [{
+				tabbarList: [
+					{
+						title: '供需发布平台',
+						activeIcon: 'add-fill',
+						inactiveIcon: 'add-circle',
+						// count: 12
+					},
+					{
 						title: '我要什么',
 						activeIcon: 'trust-fill',
 						inactiveIcon: 'trust'
@@ -96,21 +98,6 @@
 						activeIcon: 'team-fill',
 						inactiveIcon: 'team'
 					},
-					// {
-					//   title: '发现',
-					//   activeIcon: 'rocket',
-					//   inactiveIcon: 'cube',
-					//   activeIconColor: '#FFFFFF',
-					//   inactiveIconColor: '#FFFFFF',
-					//   iconSize: 50,
-					//   out: true
-					// },
-					{
-						title: '供需发布平台',
-						activeIcon: 'add-fill',
-						inactiveIcon: 'add-circle',
-						// count: 12
-					},
 					{
 						title: '我的',
 						activeIcon: 'my-fill',
@@ -134,17 +121,6 @@
 			this.switchTabbar(index);
 			let that = this;
 			uni.hideShareMenu();
-			// uni.login({
-			// 	success(res) {
-			// 		 console.error(res);
-			// 		 that.loginByCode(res.code);
-			// 	},
-			// 	fail(res) {
-			// 		 console.error(res);
-			// 		uni.hideLoading();
-			// 	}
-			// });
-
 		},
 		onShow(options){
 			if (this.currentIndex === 3&&this.$refs.mine) {
@@ -167,6 +143,22 @@
 			}else{
 				uni.setStorageSync('lastTime',new Date().getTime())
 			}
+			if(uni.getStorageSync('version')!='2.0.6'){
+				uni.showModal({
+				  title: '更新提示',
+				  content: '新版本已经准备好,是否重启应用?\r\n 更新内容:优化首页',
+				  success: (res) => {
+				    if (res.confirm) {
+				      uni.setStorageSync('version','2.0.6');
+					  uni.reLaunch({
+					  	url:'/pages/index/index'
+					  })
+				    }
+				  }
+				})
+			}
+			
+			
 			
 			if (wx.canIUse('getUpdateManager')) {
 			  const updateManager = wx.getUpdateManager();
@@ -205,81 +197,14 @@
 			// 切换导航
 			switchTabbar(index) {
 				this._switchTabbarPage(index)
-				if (index !== 1) {
-					this.$refs?.commRef?.stopAllVideo()
-				}
 			},
-			//获取openId,unionid
-			getOpenId(code) {
-				const that = this;
-				request.post('/wxma/code2Session',{
-					code: code,
-					platType: "slb",
-					mpType: "engineer",
-				}).then(res=>{
-					console.error(res);
-					if(res.success){
-						//登录成功
-						uni.setStorageSync('userMap', JSON.stringify(res.resultMap));
-					}
-				})
-			},
-
-			loginByCode(frontId) {
-				const that = this;
-				uni.setStorageSync('loginStatus', 'false');
-				wx.getUserInfo({
-				  success: function(res) {
-					console.error(res);
-					request.post("/slbMpAutoLogin", {
-					 		code:frontId, 
-					 	    appType:'ma',
-							encryptedData:res.encryptedData,
-							iv: res.iv
-					 	}, {
-						login: false,
-						warn:false,
-						loading:false
-					}).then(res2=>{
-						console.error(res2);
-						if(res2.success){
-							//登录成功
-							uni.setStorageSync('loginStatus', 'true');
-							uni.setStorageSync('userMap', JSON.stringify(res2.resultMap));
-							uni.setStorageSync('userNo', res2.resultMap.accountName);
-						}else{
-							console.error(12345);
-							uni.setStorageSync('loginStatus', 'false');
-							
-							//登录失败,
-							uni.login({
-								success(res) {
-									 console.error(res);
-									 that.getOpenId(res.code);
-								},
-								fail(res) {
-									 console.error(res);
-									uni.hideLoading();
-								}
-							});
-							 
-						}
-						console.error(res2);
-					});
-				  }
-				})
-			},
-
 			// 瀑布流导航页面滚动到底部
 			tabbarPageScrollLower(e) {
-				if (this.currentIndex === 0) {
-					this.$refs.home.loadMore();
-				}
 				if (this.currentIndex === 1) {
-					this.$refs.comm.loadMore();
+					this.$refs.home.loadMore();
 				}
 				if (this.currentIndex === 2) {
-					
+					this.$refs.comm.loadMore();
 				}
 			},
 			onPulling(e) {
@@ -292,12 +217,10 @@
 			onRefresh(){
 				if (this._freshing) return;
 				this._freshing = true;
-				if (this.currentIndex === 0) {
-					console.error('this');
+				if (this.currentIndex === 1) {
 					this.$refs.home.reFetchData();
 				}
-				if (this.currentIndex === 1) {
-					console.error('this');
+				if (this.currentIndex === 2) {
 					this.$refs.comm.reFetchData();
 				}
 				setTimeout(() => {
@@ -307,7 +230,6 @@
 			},
 			onRestore() {
 				this.triggered = false; // 需要重置
-				console.error("onRestore");
 			},
 			
 			addButton() {
@@ -330,17 +252,14 @@
 				//已登录,去新增第一步
 			},
 			reFetchData() {
-				 
-					if (this.currentIndex === 0) {
-						console.error('this');
-						this.$refs.home.reFetchData();
-					}
-					if (this.currentIndex === 1) {
-						console.error('this');
-						this.$refs.comm.reFetchData();
-					}
-					 
-				 
+				if (this.currentIndex === 1) {
+					console.error('this');
+					this.$refs.home.reFetchData();
+				}
+				if (this.currentIndex === 2) {
+					console.error('this');
+					this.$refs.comm.reFetchData();
+				}
 			},
 
 			// 切换导航页面
@@ -353,7 +272,7 @@
 					this.tabberPageLoadFlag[index] = true
 				}
 				this.currentIndex = index
-				if (this.currentIndex === 2&&this.$refs.discovery) {
+				if (this.currentIndex === 0&&this.$refs.discovery) {
 					this.$refs.discovery.fetchData();
 				}
 				if (this.currentIndex === 3&&this.$refs.mine) {
@@ -457,10 +376,10 @@
 			},
 			onShareAppMessage: function(option) {
 				if(option.from=="button"){
-					if (this.currentIndex === 0) {
+					if (this.currentIndex === 1) {
 						this.$refs.home.hideSheet();
 					}
-					if (this.currentIndex === 1) {
+					if (this.currentIndex === 2) {
 						this.$refs.comm.hideSheet();
 					}
 					
@@ -499,23 +418,7 @@
 				}
 				
 				
-			},
-			
-			onShareAppMessage0: function(option) {
-				if(option.from=="button"){
-					if (this.currentIndex === 0) {
-						this.$refs.home.hideSheet();
-					}
-					if (this.currentIndex === 1) {
-						this.$refs.comm.hideSheet();
-					}
-				}
-				
-				return {
-					title: '速立保',
-					path: '/pages/index/index',
-				};
-			},
+			}
 		}
 	}
 </script>