<template>
	<view class="content">
		<view @click="getAndroid">安卓测试</view>
		{{androidData}}
		<view @click="gojkorder">集客订单</view>
		<view>救援订单1</view>
		<view>
			{{longitude}}-----{{latitude}}
		</view>
		<view @click="goRemind">客户提醒</view>
		<view class="title">{{$t('index.demo')}}</view>
		<view class="locale-item" v-for="(item, index) in locales" :key="index" @click="onLocaleChange(item)">
		  <text class="text">{{item.text}}</text>
		  <text class="icon-check" v-if="item.code == applicationLocale"></text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello',
				androidData:'',
				latitude:'',
				longitude:'',
				
			}
		},
		computed:{
		  locales() {
		    return [{
		        text: this.$t('locale.auto'),
		        code: 'auto'
		      }, {
		        text: this.$t('locale.en'),
		        code: 'en'
		      },
		      {
		        text: this.$t('locale.zh-hans'),
		        code: 'zh-Hans'
		      },
		      {
		        text: this.$t('locale.zh-hant'),
		        code: 'zh-Hant'
		      },
		      {
		        text: this.$t('locale.ja'),
		        code: 'ja'
		      }
		    ]
		  }
		},
		onLoad() {
          window.getAndroid=this.getAndroid;
		//  setTimeout( this.getAndroid(),500)
		 // alert(11)
		 
		 // this.callByAndroid()
		 // window.LoginOut=this.LoginOut
		 /* uni.getLocation({
		 	type: 'wgs84',
		 	success: function (res) {
		 		console.log('当前位置的经度：' + res.longitude);
		 		console.log('当前位置的纬度：' + res.latitude);
				this.latitude=res.latitude
				this.longitude=res.longitude
		 	},fail(err){
				console.log(err)
			}
		 }); */
		
		},
		created() {
			
		},
		methods: {
			onLocaleChange(e) {
			  if (this.isAndroid) {
			    uni.showModal({
			      content: this.$t('index.language-change-confirm'),
			      success: (res) => {
			        if (res.confirm) {
			          uni.setLocale(e.code);
			        }
			      }
			    })
			  } else {
			    uni.setLocale(e.code);
			    this.$i18n.locale = e.code;
			  }
			},
			goRemind(){
				uni.navigateTo({
					url:'../remind/index'
				})
			},
			gojkorder(){
				uni.navigateTo({
					url:'../myOrder/myOrder'
				})
			},
			// LoginOut(){
			// 	uni.showToast({
			// 		 title: '66666',
			// 		 icon:'none',
			// 		 duration: 6000
			// 	});
			// },
           getAndroid(e){
			   uni.showToast({
			   	 title: '66666',
			   	 icon:'none',
			   	 duration: 6000
			   });
			  
			   this.androidData=e
			   return "hello";
		   },
		   callByAndroid(){
			    alert("Js收到消息");
		   }
		}
	}
</script>

<style scoped>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
