<template>
	<view class="pageBgImg pad">
		<view class="status_bar"></view>
		<view class="" style="height: 100rpx;"></view>
		<topInfo :carType="curObject.name" @changeSubject="changeSubject"></topInfo>
		<subject1 v-if="curObject.id==1"></subject1>
		<subject2 v-if="curObject.id==2"></subject2>
		<subject3 v-if="curObject.id==3"></subject3>
		<subject4 v-if="curObject.id==4"></subject4>
	</view>
</template>

<script>
	import topInfo from './comp/topInfo.vue'
	import subject1 from './comp/subject1.vue'
	import subject2 from './comp/subject2.vue'
	import subject3 from './comp/subject3.vue'
	import subject4 from './comp/subject4.vue'
	var KJGNSS = uni.requireNativePlugin("KJ-GNSS");
	export default {
		components: { topInfo, subject1, subject2,subject3,subject4 },
		data() {
			return {
				curObject: {
					name: '科目一',
					id: 1
				}
			}
		},
		onLoad() {
			if (plus.os.name == 'Android') {
				plus.android.requestPermissions(
					['android.permission.ACCESS_FINE_LOCATION',
						'android.permission.ACCESS_COARSE_LOCATION'
					],
					function(resultObj) {
						var result = 0;
						for (var i = 0; i < resultObj.granted.length; i++) {
							var grantedPermission = resultObj.granted[i];
							console.log('已获取的权限：' + grantedPermission);
							result = 1
						}
						for (var i = 0; i < resultObj.deniedPresent.length; i++) {
							var deniedPresentPermission = resultObj.deniedPresent[i];
							console.log('拒绝本次申请的权限：' + deniedPresentPermission);
							result = 0
						}
						for (var i = 0; i < resultObj.deniedAlways.length; i++) {
							var deniedAlwaysPermission = resultObj.deniedAlways[i];
							console.log('永久拒绝申请的权限：' + deniedAlwaysPermission);
							result = -1
						}
					},
					function(error) {
						console.log('申请权限错误：' + error.code + " = " + error.message);
					}
				);
			}
		},
		onShow() {
			
		},
		methods: {
			// 切换科目
			changeSubject(val) {
				console.log(val)
				this.curObject = val
			},
			getProviderFn() {
				
			}
		}
	}
</script>

<style scoped lang="scss">
	
</style>