App.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. self.$store.dispatch('setVariableFun',false)
  36. } else {
  37. Vue.prototype.platformClass = 'center'
  38. self.$store.dispatch('setIsIphoneFun',true)
  39. }
  40. Vue.prototype.StatusBar = e.statusBarHeight;
  41. Vue.prototype.fontSizeSetting = e.fontSizeSetting
  42. Vue.prototype.screenWidth = e.screenWidth
  43. let capsule = wx.getMenuButtonBoundingClientRect();
  44. Vue.prototype.capsule = capsule
  45. if (capsule) {
  46. Vue.prototype.Custom = capsule;
  47. // Vue.prototype.capsuleSafe = uni.upx2px(750) - capsule.left + uni.upx2px(750) - capsule.right;
  48. Vue.prototype.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
  49. } else {
  50. Vue.prototype.CustomBar = e.statusBarHeight + 50;
  51. }
  52. // #endif
  53. // #ifdef MP-ALIPAY
  54. Vue.prototype.StatusBar = e.statusBarHeight;
  55. Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
  56. // #endif
  57. }
  58. })
  59. this.refresh()
  60. // this.$store.dispatch('setActivityFn',true)
  61. },
  62. methods:{
  63. refresh(){
  64. let TIME = (20*60)*1000;
  65. setInterval(()=>{
  66. authorize.getSetting().then(res =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  67. if(res == 1){
  68. wxLogin.wxLoginAuthorize()
  69. }else{
  70. console.log('授权失败============>:'+'用户取消授权或者未操作')
  71. }
  72. }).catch(error=>{
  73. console.log('授权失败============>:'+'用户授权失败,提醒用户重新授权')
  74. })
  75. },TIME)
  76. }
  77. },
  78. onShow: function() {
  79. // this.getCheekeyCode()
  80. },
  81. onHide: function() {
  82. console.log('App Hide')
  83. },
  84. }
  85. </script>
  86. <style lang="scss">
  87. /*每个页面公共css */
  88. @import "@/common/css/common.scss";
  89. @import "@/common/css/iconfont.scss";
  90. @import "@/common/css/style/thorui.css";
  91. @import "@/common/css/style/icon.css";
  92. view,
  93. scroll-view,
  94. swiper,
  95. swiper-item,
  96. cover-view,
  97. cover-image,
  98. icon,
  99. text,
  100. rich-text,
  101. progress,
  102. button,
  103. checkbox,
  104. form,
  105. input,
  106. label,
  107. radio,
  108. slider,
  109. switch,
  110. textarea,
  111. navigator,
  112. audio,
  113. camera,
  114. image,
  115. video {
  116. // box-sizing: border-box;
  117. }
  118. // page {
  119. // width: 100%;
  120. // height: 100%;
  121. // background: #fff;
  122. // filter: grayscale(100%);
  123. // filter: gray;
  124. // filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
  125. // --toast-default-width: 114px;
  126. // }
  127. page{
  128. height: 100%;
  129. background-color: #FFFFFF;
  130. }
  131. /* 骨架屏替代方案 */
  132. .Skeleton {
  133. background: #f3f3f3;
  134. padding: 20upx 0;
  135. border-radius: 8upx;
  136. }
  137. .clamp {
  138. overflow: hidden;
  139. text-overflow: ellipsis;
  140. white-space: nowrap;
  141. display: block;
  142. }
  143. .common-hover {
  144. background: #f5f5f5;
  145. }
  146. /* input 样式 */
  147. .input-placeholder {
  148. color: #999999;
  149. }
  150. .placeholder {
  151. color: #999999;
  152. }
  153. </style>