dwh 2 years ago
parent
commit
bdbe93d2c6
2 changed files with 15 additions and 6 deletions
  1. 12 6
      src/main.js
  2. 3 0
      src/router/index.js

+ 12 - 6
src/main.js

@@ -31,28 +31,28 @@ Vue.prototype.$TUIKitTIM = TIM;
 Vue.prototype.$TUIKitEvent = TIM.EVENT;
 Vue.prototype.$TUIKitEvent = TIM.EVENT;
 Vue.prototype.$TUIKitVersion = TIM.VERSION;
 Vue.prototype.$TUIKitVersion = TIM.VERSION;
 Vue.prototype.$TUIKitTypes = TIM.TYPES; // 监听系统级事件
 Vue.prototype.$TUIKitTypes = TIM.TYPES; // 监听系统级事件
-vue.prototype.$getIDFA=()=>{
+Vue.prototype.$getIDFA=()=>{
 	window.webkit.messageHandlers.call.postMessage({
 	window.webkit.messageHandlers.call.postMessage({
 		api:"com.js.getIDFA",
 		api:"com.js.getIDFA",
 		data:{},
 		data:{},
 		callback:'idfaInvoke'
 		callback:'idfaInvoke'
 	}) 
 	}) 
 }
 }
-vue.prototype.$getDeviceInfo=()=>{
+Vue.prototype.$getDeviceInfo=()=>{
 	window.webkit.messageHandlers.call.postMessage({
 	window.webkit.messageHandlers.call.postMessage({
 		api:"com.js.getDeviceInfo",
 		api:"com.js.getDeviceInfo",
 		data:{},
 		data:{},
 		callback:'deviceInfoInvoke'
 		callback:'deviceInfoInvoke'
 	}) 
 	}) 
 }
 }
-vue.prototype.$getDeviceToken=()=>{
+Vue.prototype.$getDeviceToken=()=>{
 	window.webkit.messageHandlers.call.postMessage({
 	window.webkit.messageHandlers.call.postMessage({
 		api:"com.js.deviceToken",
 		api:"com.js.deviceToken",
 		data:{},
 		data:{},
 		callback:'deviceTokenInvoke'
 		callback:'deviceTokenInvoke'
 	})  
 	})  
 }
 }
-vue.prototype.$toShare=(img,url)=>{
+Vue.prototype.$toShare=(img,url)=>{
 	window.webkit.messageHandlers.call.postMessage({
 	window.webkit.messageHandlers.call.postMessage({
 		api:"com.js.nativeShare",
 		api:"com.js.nativeShare",
 		data:{
 		data:{
@@ -63,7 +63,7 @@ vue.prototype.$toShare=(img,url)=>{
 		callback:'toShareInvoke'
 		callback:'toShareInvoke'
 	})
 	})
 }
 }
-vue.prototype.$toOutLink=(url)=>{
+Vue.prototype.$toOutLink=(url)=>{
 	window.webkit.messageHandlers.call.postMessage({
 	window.webkit.messageHandlers.call.postMessage({
 		api:"com.js.urlJump",
 		api:"com.js.urlJump",
 		data:{
 		data:{
@@ -72,9 +72,15 @@ vue.prototype.$toOutLink=(url)=>{
 		callback:'toOutLinkInvoke'
 		callback:'toOutLinkInvoke'
 	}) 
 	}) 
 }
 }
-vue.prototype.$toOutLinkByBrowser=(url)=>{
+Vue.prototype.$toOutLinkByBrowser=(url)=>{
 	window.location.href=`sugarpark://${encodeURIComponent(url)}`
 	window.location.href=`sugarpark://${encodeURIComponent(url)}`
 }
 }
+Vue.prototype.$getStatusBarHeight=()=>{//获取状态栏和底部安全距离
+	window.webkit.messageHandlers.call.postMessage({
+		api:"com.js.getStatusBarHeight",
+		callback:'getStatusBarHeightInvoke'
+	}) 
+}
 new Vue({
 new Vue({
   router,
   router,
   store,
   store,

+ 3 - 0
src/router/index.js

@@ -256,6 +256,9 @@ const router = new VueRouter({
 });
 });
 router.beforeEach((to,from,next)=>{
 router.beforeEach((to,from,next)=>{
 	console.log(to,from)
 	console.log(to,from)
+	if(to.name==='test'){
+		next();
+	}
 	if(!localStorage.getItem('user')){
 	if(!localStorage.getItem('user')){
 		if(to.name==='login'||(from.name==='login'&&to.name==='loginByPhone')||(from.name==='loginByPhone'&&to.name==='loginByCode')){
 		if(to.name==='login'||(from.name==='login'&&to.name==='loginByPhone')||(from.name==='loginByPhone'&&to.name==='loginByCode')){
 			next();
 			next();