App.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. authorize.getSetting().then(res =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  65. if(res == 1){
  66. wxLogin.wxLoginAuthorize()
  67. }else{
  68. console.log('授权失败============>:'+'用户取消授权或者未操作')
  69. }
  70. }).catch(error=>{
  71. console.log('授权失败============>:'+'用户授权失败,提醒用户重新授权')
  72. })
  73. },TIME)
  74. }
  75. },
  76. onShow: function() {
  77. // this.getCheekeyCode()
  78. },
  79. onHide: function() {
  80. console.log('App Hide')
  81. },
  82. }
  83. </script>
  84. <style lang="scss">
  85. /*每个页面公共css */
  86. @import "@/common/css/common.scss";
  87. @import "@/common/css/iconfont.scss";
  88. view,
  89. scroll-view,
  90. swiper,
  91. swiper-item,
  92. cover-view,
  93. cover-image,
  94. icon,
  95. text,
  96. rich-text,
  97. progress,
  98. button,
  99. checkbox,
  100. form,
  101. input,
  102. label,
  103. radio,
  104. slider,
  105. switch,
  106. textarea,
  107. navigator,
  108. audio,
  109. camera,
  110. image,
  111. video {
  112. // box-sizing: border-box;
  113. }
  114. // page {
  115. // width: 100%;
  116. // height: 100%;
  117. // background: #fff;
  118. // filter: grayscale(100%);
  119. // filter: gray;
  120. // filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
  121. // --toast-default-width: 114px;
  122. // }
  123. page{
  124. height: 100%;
  125. background-color: #FFFFFF;
  126. }
  127. /* 骨架屏替代方案 */
  128. .Skeleton {
  129. background: #f3f3f3;
  130. padding: 20upx 0;
  131. border-radius: 8upx;
  132. }
  133. .clamp {
  134. overflow: hidden;
  135. text-overflow: ellipsis;
  136. white-space: nowrap;
  137. display: block;
  138. }
  139. .common-hover {
  140. background: #f5f5f5;
  141. }
  142. /* input 样式 */
  143. .input-placeholder {
  144. color: #999999;
  145. }
  146. .placeholder {
  147. color: #999999;
  148. }
  149. </style>