App.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <script>
  2. /**
  3. * vuex管理登陆状态,具体可以参考官方登陆模板示例
  4. */
  5. import Vue from 'vue'
  6. import { mapState,mapMutations} from 'vuex';
  7. import authorize from '@/common/config/authorize.js'
  8. import wxLogin from "@/common/config/wxLogin.js"
  9. export default {
  10. onLaunch: function() {
  11. let self = this
  12. uni.getSystemInfo({
  13. success: function(e) {
  14. let modelmes = e.model;
  15. console.log(e);
  16. if (modelmes.search('iPhone 11') || modelmes.search('iPhone 11 Pro Max') ||modelmes.search('iPhone X') != -1) { //XS,XR,XS MAX均可以适配
  17. self.$store.dispatch('setVariableFun',true)
  18. }else{
  19. self.$store.dispatch('setVariableFun',false)
  20. }
  21. // #ifndef MP
  22. Vue.prototype.StatusBar = e.statusBarHeight;
  23. if (e.platform == 'android') {
  24. Vue.prototype.CustomBar = e.statusBarHeight + 50;
  25. Vue.prototype.platformClass = true
  26. } else {
  27. Vue.prototype.CustomBar = e.statusBarHeight + 45;
  28. Vue.prototype.platformClass = false
  29. };
  30. // #endif
  31. // #ifdef MP-WEIXIN || MP-QQ
  32. console.log(e.platform)
  33. if (e.platform == 'android') {
  34. Vue.prototype.platformClass = 'left'
  35. } else {
  36. Vue.prototype.platformClass = 'center'
  37. self.$store.dispatch('setIsIphoneFun',true)
  38. }
  39. Vue.prototype.StatusBar = e.statusBarHeight;
  40. Vue.prototype.fontSizeSetting = e.fontSizeSetting
  41. Vue.prototype.screenWidth = e.screenWidth
  42. let capsule = wx.getMenuButtonBoundingClientRect();
  43. Vue.prototype.capsule = capsule
  44. if (capsule) {
  45. Vue.prototype.Custom = capsule;
  46. // Vue.prototype.capsuleSafe = uni.upx2px(750) - capsule.left + uni.upx2px(750) - capsule.right;
  47. Vue.prototype.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
  48. } else {
  49. Vue.prototype.CustomBar = e.statusBarHeight + 50;
  50. }
  51. // #endif
  52. // #ifdef MP-ALIPAY
  53. Vue.prototype.StatusBar = e.statusBarHeight;
  54. Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
  55. // #endif
  56. }
  57. })
  58. this.refresh()
  59. },
  60. methods:{
  61. refresh(){
  62. let TIME = (20*60)*1000;
  63. setInterval(()=>{
  64. wxLogin.wxLoginAuthorize()
  65. },TIME)
  66. }
  67. },
  68. onShow: function() {
  69. // this.getCheekeyCode()
  70. },
  71. onHide: function() {
  72. console.log('App Hide')
  73. },
  74. }
  75. </script>
  76. <style lang="scss">
  77. /*每个页面公共css */
  78. @import "@/common/css/common.scss";
  79. @import "@/common/css/iconfont.scss";
  80. view,
  81. scroll-view,
  82. swiper,
  83. swiper-item,
  84. cover-view,
  85. cover-image,
  86. icon,
  87. text,
  88. rich-text,
  89. progress,
  90. button,
  91. checkbox,
  92. form,
  93. input,
  94. label,
  95. radio,
  96. slider,
  97. switch,
  98. textarea,
  99. navigator,
  100. audio,
  101. camera,
  102. image,
  103. video {
  104. // box-sizing: border-box;
  105. }
  106. // page {
  107. // width: 100%;
  108. // height: 100%;
  109. // background: #fff;
  110. // filter: grayscale(100%);
  111. // filter: gray;
  112. // filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
  113. // --toast-default-width: 114px;
  114. // }
  115. page{
  116. height: 100%;
  117. background-color: #FFFFFF;
  118. }
  119. /* 骨架屏替代方案 */
  120. .Skeleton {
  121. background: #f3f3f3;
  122. padding: 20upx 0;
  123. border-radius: 8upx;
  124. }
  125. .clamp {
  126. overflow: hidden;
  127. text-overflow: ellipsis;
  128. white-space: nowrap;
  129. display: block;
  130. }
  131. .common-hover {
  132. background: #f5f5f5;
  133. }
  134. /* input 样式 */
  135. .input-placeholder {
  136. color: #999999;
  137. }
  138. .placeholder {
  139. color: #999999;
  140. }
  141. </style>