App.vue 3.1 KB

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