App.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <script>
  2. import configpath from 'config/setting.config.js';
  3. import api from 'api/index.js'
  4. import Vue from 'vue'
  5. const inforeq = (cb) => {
  6. fetch('/static/.config.json')
  7. .then((res) => res.json())
  8. .then(async (res) => {
  9. let obj = {
  10. ...res,
  11. img_local_host: (process.env.NODE_ENV === 'production' ?
  12. res.prodIp || configpath.prodIp :
  13. process.env.NODE_ENV === 'test' ?
  14. res.testIp || configpath.testIp :
  15. res.devIp || configpath.devIp) + '/file/',
  16. // 请求 地址
  17. baseURL: (process.env.NODE_ENV === 'production' ?
  18. res.prodIp || configpath.prodIp :
  19. process.env.NODE_ENV === 'test' ?
  20. res.testIp || configpath.testIp :
  21. res.devIp || configpath.devIp) + '/api/h5',
  22. }
  23. cb && cb(obj)
  24. })
  25. }
  26. export default {
  27. globalData: {
  28. SET_STATUS_BAR: 0,
  29. SET_CUSTOM_BAR: 0,
  30. SET_SYSTEM_INFO: {},
  31. configData: {},
  32. token: ''
  33. },
  34. onLaunch: function(option) {
  35. let token = window.location.search.split('token=')[1]
  36. console.log('App Launch')
  37. // console.log(token)
  38. let t = this;
  39. inforeq((res) => {
  40. t.globalData.configData = res
  41. if (token && token.length > 0) {
  42. uni.setStorage({
  43. key: 'token',
  44. data: token,
  45. success: function() {
  46. console.log('success');
  47. }
  48. });
  49. t.globalData.token = token
  50. }
  51. })
  52. },
  53. onShow: function() {
  54. console.log('App Show')
  55. },
  56. onHide: function() {
  57. console.log('App Hide')
  58. },
  59. }
  60. </script>
  61. uni.getSystemInfo({
  62. success: (e) => {
  63. let statusBar = 0
  64. let customBar = 0
  65. // #ifdef MP
  66. statusBar = e.statusBarHeight
  67. customBar = e.statusBarHeight + 45
  68. if (e.platform === 'android') {
  69. customBar = e.statusBarHeight + 50
  70. }
  71. // #endif
  72. // #ifdef MP-WEIXIN
  73. statusBar = e.statusBarHeight
  74. const custom = wx.getMenuButtonBoundingClientRect()
  75. customBar = custom.bottom + custom.top - e.statusBarHeight
  76. // #endif
  77. // #ifdef MP-ALIPAY
  78. statusBar = e.statusBarHeight
  79. customBar = e.statusBarHeight + e.titleBarHeight
  80. // #endif
  81. // #ifdef APP-PLUS
  82. console.log('app-plus', e)
  83. statusBar = e.statusBarHeight
  84. customBar = e.statusBarHeight + 45
  85. // #endif
  86. // #ifdef H5
  87. statusBar = 0
  88. customBar = e.statusBarHeight + 45
  89. // #endif
  90. this.globalData.SET_SYSTEM_INFO = e
  91. this.globalData.SET_CUSTOM_BAR = customBar
  92. this.globalData.SET_STATUS_BAR = statusBar
  93. }
  94. })
  95. <style>
  96. /*每个页面公共css */
  97. @import url("@/static/style/style.css");
  98. @import url("@/static/style/icon.css");
  99. @import url("@/static/style/color.css");
  100. page {
  101. background: #f5f5f5;
  102. }
  103. .my-button {
  104. border-radius: 0px;
  105. transform: initial;
  106. background-color: transparent;
  107. }
  108. .my-button:after {
  109. border-width: 0px !important;
  110. border-radius: 0px !important;
  111. transform: initial;
  112. background-color: transparent;
  113. width: 100%;
  114. height: 100%;
  115. }
  116. .bule_line {
  117. width: 10rpx;
  118. height: 30rpx;
  119. background-color: #1e8ff9;
  120. border-radius: 6rpx;
  121. box-shadow: 0px 2px 4px 0px rgba(121, 190, 254, 0.59);
  122. }
  123. </style>