dwh 2 år sedan
förälder
incheckning
91ba459ceb
2 ändrade filer med 71 tillägg och 2 borttagningar
  1. 70 0
      src/App.vue
  2. 1 2
      src/views/login/login.vue

+ 70 - 0
src/App.vue

@@ -1,13 +1,83 @@
 <template>
 	<div id="app">
+		<div class="statusBar" :style="{'height':`${statusBarHeight}px`}"></div>
 		<keep-alive>
 			<router-view v-if="$route.meta.keepAlive"></router-view>
 		</keep-alive>
 		<router-view v-if="!$route.meta.keepAlive"></router-view>
 	</div>
 </template>
+<script>
+	export default{
+		data() {
+			return{
+				statusBarHeight:0
+			}
+		},
+		mounted() {
+			window.getStatusBarHeightInvoke=(data)=>{
+				localStorage.setItem('safeBottomHeight',data.safeBottomHeight);
+				localStorage.setItem('statusBarHeight',data.statusBarHeight);
+				this.statusBarHeight=data.statusBarHeight;
+			};
+			window.idfaInvoke=(data)=>{
+				localStorage.setItem('idfa',data.idfa);
+			};
+			window.deviceInfoInvoke=(data)=>{
+				localStorage.setItem('deviceInfo',data.data);
+			};
+			window.deviceTokenInvoke=(data)=>{
+				if(data.code===1){
+					localStorage.setItem('deviceToken',data.deviceId)
+				}
+			};
+			this.getStatusBarHeight();
+			this.getIDFA();
+			this.getDeviceInfo();
+			this.getDeviceToken();
+		},
+		methods: {
+			getStatusBarHeight(){//获取状态栏和底部安全距离
+				window.webkit.messageHandlers.call.postMessage({
+					api:"com.js.getStatusBarHeight",
+					data:{
+						url:''
+					},
+					callback:'getStatusBarHeightInvoke'
+				}) 
+			},
+			getIDFA(){
+				window.webkit.messageHandlers.call.postMessage({
+					api:"com.js.getIDFA",
+					data:{},
+					callback:'idfaInvoke'
+				}) 
+			},
+			getDeviceInfo(){
+				window.webkit.messageHandlers.call.postMessage({
+					api:"com.js.getDeviceInfo",
+					data:{
+						info:['idfa','platform','resolution','brand','ov','cate','appId','lang','currTime','av','model','deviceCode']
+					},
+					callback:'deviceInfoInvoke'
+				}) 
+			},
+			getDeviceToken(){
+				window.webkit.messageHandlers.call.postMessage({
+					api:"com.js.deviceToken",
+					data:{},
+					callback:'deviceTokenInvoke'
+				}) 
+			},
+		}
+	}
+</script>
 <style lang="scss">
 @import "./public.scss";
+	.statusBar{
+		width: 100vw;
+		background-color: transparent;
+	}
 	*{
 		margin: 0;
 		padding: 0;

+ 1 - 2
src/views/login/login.vue

@@ -45,8 +45,7 @@
 				localStorage.setItem('idfa',data.idfa);
 			};
 			window.deviceInfoInvoke=(data)=>{
-				//localStorage.setItem('idfa',data.idfa);
-				this.$toast(JSON.stringify(data));
+				localStorage.setItem('deviceInfo',data.data);
 			};
 			window.deviceTokenInvoke=(data)=>{
 				if(data.code===1){