App.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <script>
  2. import md5Libs from '@/uni_modules/uview-ui/libs/function/md5';
  3. import Vue from 'vue';
  4. // import { getConfig } from '@/service/api/common.js';
  5. export default {
  6. created() {
  7. // #ifdef APP-PLUS
  8. plus.navigator.closeSplashscreen();
  9. // #endif
  10. },
  11. onLaunch: async function () {
  12. // console.log('App Launch');
  13. // uni.hideTabBar();
  14. //加载配置
  15. uni.getSystemInfo({
  16. success: function (e) {
  17. // #ifndef MP
  18. Vue.prototype.StatusBar = e.statusBarHeight;
  19. if (e.platform == 'android') {
  20. Vue.prototype.CustomBar = e.statusBarHeight + 50;
  21. } else {
  22. Vue.prototype.CustomBar = e.statusBarHeight + 45;
  23. }
  24. // #endif
  25. // #ifdef MP-WEIXIN
  26. Vue.prototype.StatusBar = e.statusBarHeight;
  27. let custom = wx.getMenuButtonBoundingClientRect();
  28. Vue.prototype.Custom = custom;
  29. Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
  30. // #endif
  31. // #ifdef MP-ALIPAY
  32. Vue.prototype.StatusBar = e.statusBarHeight;
  33. Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
  34. // #endif
  35. }
  36. });
  37. // getConfig().then(([err, res]) => {
  38. // // console.log('getConfig', err, res);
  39. // if (!err) {
  40. // this.$store.commit('setGlobalConfig', res);
  41. // // 当前活动无效
  42. // if (res.activity_invalid) {
  43. // this.$store.commit('delActivityId'); // 删除活动ID
  44. // // 重新加载配置
  45. // getConfig().then(([err, res]) => {
  46. // // console.log('getConfig reload', err, res);
  47. // if (!err) {
  48. // this.$store.commit('setGlobalConfig', res);
  49. // }
  50. // });
  51. // }
  52. // }
  53. // });
  54. let res = await this.$api.getConfig();
  55. //console.log(res);
  56. if (!res.code) {
  57. return;
  58. }
  59. Vue.prototype.vuex_config = res.data;
  60. this.vuex_config = res.data;
  61. },
  62. onShow: function () {
  63. console.log('App 开启');
  64. },
  65. onHide: function () {
  66. console.log('App 关闭');
  67. }
  68. /* 隐藏默认tabBar */
  69. // onLoad:function(){
  70. // uni.hideTabBar();
  71. // }
  72. };
  73. </script>
  74. <style lang="scss">
  75. @import 'colorui/main.css';
  76. </style>