App.vue 2.9 KB

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