index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <view class="content">
  3. <view @click="getAndroid">安卓测试</view>
  4. {{androidData}}
  5. <view @click="gojkorder">集客订单</view>
  6. <view>救援订单1</view>
  7. <view>
  8. {{longitude}}-----{{latitude}}
  9. </view>
  10. <view @click="goRemind">客户提醒</view>
  11. <view class="title">{{$t('index.demo')}}</view>
  12. <view class="locale-item" v-for="(item, index) in locales" :key="index" @click="onLocaleChange(item)">
  13. <text class="text">{{item.text}}</text>
  14. <text class="icon-check" v-if="item.code == applicationLocale"></text>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. data() {
  21. return {
  22. title: 'Hello',
  23. androidData:'',
  24. latitude:'',
  25. longitude:'',
  26. }
  27. },
  28. computed:{
  29. locales() {
  30. return [{
  31. text: this.$t('locale.auto'),
  32. code: 'auto'
  33. }, {
  34. text: this.$t('locale.en'),
  35. code: 'en'
  36. },
  37. {
  38. text: this.$t('locale.zh-hans'),
  39. code: 'zh-Hans'
  40. },
  41. {
  42. text: this.$t('locale.zh-hant'),
  43. code: 'zh-Hant'
  44. },
  45. {
  46. text: this.$t('locale.ja'),
  47. code: 'ja'
  48. }
  49. ]
  50. }
  51. },
  52. onLoad() {
  53. window.getAndroid=this.getAndroid;
  54. // setTimeout( this.getAndroid(),500)
  55. // alert(11)
  56. // this.callByAndroid()
  57. // window.LoginOut=this.LoginOut
  58. /* uni.getLocation({
  59. type: 'wgs84',
  60. success: function (res) {
  61. console.log('当前位置的经度:' + res.longitude);
  62. console.log('当前位置的纬度:' + res.latitude);
  63. this.latitude=res.latitude
  64. this.longitude=res.longitude
  65. },fail(err){
  66. console.log(err)
  67. }
  68. }); */
  69. },
  70. created() {
  71. },
  72. methods: {
  73. onLocaleChange(e) {
  74. if (this.isAndroid) {
  75. uni.showModal({
  76. content: this.$t('index.language-change-confirm'),
  77. success: (res) => {
  78. if (res.confirm) {
  79. uni.setLocale(e.code);
  80. }
  81. }
  82. })
  83. } else {
  84. uni.setLocale(e.code);
  85. this.$i18n.locale = e.code;
  86. }
  87. },
  88. goRemind(){
  89. uni.navigateTo({
  90. url:'../remind/index'
  91. })
  92. },
  93. gojkorder(){
  94. uni.navigateTo({
  95. url:'../myOrder/myOrder'
  96. })
  97. },
  98. // LoginOut(){
  99. // uni.showToast({
  100. // title: '66666',
  101. // icon:'none',
  102. // duration: 6000
  103. // });
  104. // },
  105. getAndroid(e){
  106. uni.showToast({
  107. title: '66666',
  108. icon:'none',
  109. duration: 6000
  110. });
  111. this.androidData=e
  112. return "hello";
  113. },
  114. callByAndroid(){
  115. alert("Js收到消息");
  116. }
  117. }
  118. }
  119. </script>
  120. <style scoped>
  121. .content {
  122. display: flex;
  123. flex-direction: column;
  124. align-items: center;
  125. justify-content: center;
  126. }
  127. .logo {
  128. height: 200rpx;
  129. width: 200rpx;
  130. margin-top: 200rpx;
  131. margin-left: auto;
  132. margin-right: auto;
  133. margin-bottom: 50rpx;
  134. }
  135. .text-area {
  136. display: flex;
  137. justify-content: center;
  138. }
  139. .title {
  140. font-size: 36rpx;
  141. color: #8f8f94;
  142. }
  143. </style>