Sfoglia il codice sorgente

优化无openId问题, 图片显示问题

zhengkaixin 11 mesi fa
parent
commit
a1301b3456
2 ha cambiato i file con 37 aggiunte e 28 eliminazioni
  1. 8 6
      pages/friend/personal.vue
  2. 29 22
      utils/init.js

+ 8 - 6
pages/friend/personal.vue

@@ -24,11 +24,12 @@
 				</view>
 			</u-modal>
 
-			<view class="personalHead personalHead-friend" :style="'height: '+(detail.faceImage?'375':'120')+'px;background: url('+detail.faceImage+') no-repeat   center  ;background-size: 100% !important;'">
+			<view class="personalHead personalHead-friend" :style="'height: '+(detail.faceImage?'375':'120')+'px;background-size : cover;background-image: url('+detail.faceImage+') ;background-repeat:no-repeat;background-position:center; '">
 				
-				<u-navbar :is-back="false" :border-bottom="false" :backTextStyle="backTextStyle" :backIconColor="backIconColor" :background="navbarBg" >
-					<view class="slot-wrap" @tap="goBack">
-						<u-icon class="navbar-back" custom-prefix="custom-icon" name="icon-back2" ></u-icon>
+				<u-navbar :is-back="false"
+				 :border-bottom="false" :backTextStyle="backTextStyle" :backIconColor="backIconColor" :background="navbarBg" >
+					<view class="slot-wrap" @tap="goBack"  >
+						<u-icon class="navbar-back" style="border: 1px solid #fff;border-radius:100%" custom-prefix="custom-icon" name="icon-back2" ></u-icon>
 					</view>
 				</u-navbar>
 			
@@ -277,8 +278,9 @@
 						readStatus:this.readStatus
 						}).then(response => {
 				        this.isLoading = false;
-						this.detail = Object.assign(response.data.memberInfo)
 						
+						this.detail = Object.assign(response.data.memberInfo)
+						this.$forceUpdate()
 						if(this.islogin){
 							this.hobbyList = response.data.hobbyList;
 							this.isLike = response.data.isLike;
@@ -339,7 +341,7 @@
 </style>
 <style lang="scss" scoped>
 	.personalHead-friend {
-			background-size: 100% !important;
+			//background-size: 100% !important;
 		 
 	}
 	 .slot-wrap{

+ 29 - 22
utils/init.js

@@ -12,28 +12,35 @@ var openId = carhelp.getOpenId();
 var app = {
 	init: function() {
 		 
-		if(isWeiXin()|| !(process.env.NODE_ENV === "development") ){
-			if (isWeiXin()) {
-				if (checkOpenId) {
-					if (!openId) {
-						this.getOpenId();
-					} else {
-						//this.getPersion(openId)
-					}
-				}
-			} else{
-				var NODE_NAME=  process.env['NODE_NAME']
-				if(NODE_NAME=="production"){
-					// alert("请使用微信打开本页面")
-					carhelp.setOpenId(this.guid())
-				}
-			}
-		}else{
-			//carhelp.setOpenId(process.car.openId)
-			carhelp.setOpenId(this.guid())
-			//this.getPersion(process.car.openId)
-		}
-		
+		// if(isWeiXin()|| !(process.env.NODE_ENV === "development") ){
+		// 	if (isWeiXin()) {
+		// 		if (checkOpenId) {
+		// 			if (!openId) {
+		// 				this.getOpenId();
+		// 			} else {
+		// 				//this.getPersion(openId)
+		// 			}
+		// 		}
+		// 	} else{
+		// 		var NODE_NAME=  process.env['NODE_NAME']
+		// 		if(NODE_NAME=="production"){
+		// 			// alert("请使用微信打开本页面")
+		// 			carhelp.setOpenId(this.guid())
+		// 		}
+		// 	}
+		// }else{
+		// 	//carhelp.setOpenId(process.car.openId)
+			
+		// 	//this.getPersion(process.car.openId)
+		// }
+		var tdate=new Date().getTime()
+		var token_tdate=carhelp.get("openId_guid");//每10分钟存储一次token
+		
+		if(token_tdate&&token_tdate+(1000*60*60) >tdate){
+					return
+		}
+		carhelp.setOpenId(this.guid())
+		carhelp.set( 'openId_guid', tdate)
 		
 	},
 	 guid() {