App.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. console.log(token)
  43. uni.setStorage({
  44. key: 'token',
  45. data: token,
  46. success: function() {
  47. console.log('success');
  48. }
  49. });
  50. t.globalData.token = token
  51. }
  52. })
  53. },
  54. onShow: function() {
  55. console.log('App Show')
  56. },
  57. onHide: function() {
  58. console.log('App Hide')
  59. },
  60. }
  61. </script>
  62. uni.getSystemInfo({
  63. success: (e) => {
  64. let statusBar = 0
  65. let customBar = 0
  66. // #ifdef MP
  67. statusBar = e.statusBarHeight
  68. customBar = e.statusBarHeight + 45
  69. if (e.platform === 'android') {
  70. customBar = e.statusBarHeight + 50
  71. }
  72. // #endif
  73. // #ifdef MP-WEIXIN
  74. statusBar = e.statusBarHeight
  75. const custom = wx.getMenuButtonBoundingClientRect()
  76. customBar = custom.bottom + custom.top - e.statusBarHeight
  77. // #endif
  78. // #ifdef MP-ALIPAY
  79. statusBar = e.statusBarHeight
  80. customBar = e.statusBarHeight + e.titleBarHeight
  81. // #endif
  82. // #ifdef APP-PLUS
  83. console.log('app-plus', e)
  84. statusBar = e.statusBarHeight
  85. customBar = e.statusBarHeight + 45
  86. // #endif
  87. // #ifdef H5
  88. statusBar = 0
  89. customBar = e.statusBarHeight + 45
  90. // #endif
  91. this.globalData.SET_SYSTEM_INFO = e
  92. this.globalData.SET_CUSTOM_BAR = customBar
  93. this.globalData.SET_STATUS_BAR = statusBar
  94. }
  95. })
  96. <style>
  97. /*每个页面公共css */
  98. @import url("@/static/style/style.css");
  99. @import url("@/static/style/icon.css");
  100. @import url("@/static/style/color.css");
  101. page {
  102. background: #f5f5f5;
  103. }
  104. .my-button {
  105. border-radius: 0px;
  106. transform: initial;
  107. background-color: transparent;
  108. }
  109. .my-button:after {
  110. border-width: 0px !important;
  111. border-radius: 0px !important;
  112. transform: initial;
  113. background-color: transparent;
  114. }
  115. .bule_line {
  116. width: 10rpx;
  117. height: 30rpx;
  118. background-color: #1e8ff9;
  119. border-radius: 6rpx;
  120. box-shadow: 0px 2px 4px 0px rgba(121, 190, 254, 0.59);
  121. }
  122. </style>