zkx hace 1 año
padre
commit
ee5e295f5f
Se han modificado 1 ficheros con 49 adiciones y 5 borrados
  1. 49 5
      components/u-navbar/u-navbar.vue

+ 49 - 5
components/u-navbar/u-navbar.vue

@@ -47,13 +47,20 @@
 		 confirm-text="知道了"
 		 :title="descriptionTitle" >
 			<view v-html="descriptionHtml" style="padding: 10px;font-size: 14px;"></view>
+		</u-modal>
+		
+		<u-modal v-model="gotoGzShow" @confirm="gotoGz" cancel-text="暂不关注" @cancel="cancelGz" confirm-text="前往关注"
+			confirm-color="#53b56b" :show-cancel-button="true" ref="uModal2" :asyncClose="true">
+			<view style="padding: 15px;">请关注<span
+					style=" color:  #53b56b;">{{projectName}}</span>公众号,以便第一时间收到充电结束消息提醒</view>
 		</u-modal>
 	
 	</view>
 </template>
 
 <script>
-	import * as API from '@/apis/index.js'
+	import * as API from '@/apis/index.js'
+		import * as API_weixin from '@/apis/weixin.js'
 	import {
 		newDate,
 		currentTimeStamp,
@@ -197,7 +204,9 @@
 			}
 		},
 		data() {
-			return {
+			return {
+				gotoGzShow:false,
+				projectName: "",
 				description:'',
 				descriptionHtml:'',
 				descriptionShow:false,
@@ -262,7 +271,7 @@
 		},
 		created() {
 			 
-			 
+			 this.projectName = process.car.ProjectName;
 			 var nowtime = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}  {h}')
 			 var time=this.carhelp.get("getTips_$");
 			 if((time&&nowtime==time)){
@@ -276,10 +285,45 @@
 			 		
 			 	})
 			 }
-			 
+			 if (this.carhelp.getGzDate() && !this.gotoGzShow) {
+			 
+			 	this.checkSubscribe()
+			 
+			 }
+			// this.checkSubscribe()
 			
 		},
-		methods: {
+		methods: {
+			checkSubscribe() {
+				API_weixin.checkSubscribe({
+					openId: this.carhelp.getOpenId()
+				}).then((res) => {
+			
+					if (res.data == "0") {
+			
+						this.gotoGzShow = true;
+					} else {
+						this.carhelp.setGzDate()
+					}
+			
+					//setGzDate
+				}).catch(error => {
+					uni.showToast({
+						title: error
+					})
+				})
+			
+			},
+			cancelGz() {
+				this.carhelp.setGzDate()
+			},
+			gotoGz() {
+				this.carhelp.setGzDate()
+				this.gotoGzShow = false;
+				var url = "https://mp.weixin.qq.com/s/mCHz1nNvg0xAICiBeIyKRQ";
+				window.location.href = url
+			
+			},
 			getConfigMessage(){
 				let url=window.location.href.split("#/")[1];
 				let routes = getCurrentPages(); // 获取当前打开过的页面路由数组