1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <script>
- import md5Libs from '@/uni_modules/uview-ui/libs/function/md5';
- import Vue from 'vue';
- import { getConfig } from '@/service/api/common.js';
- export default {
- created() {
- // #ifdef APP-PLUS
- plus.navigator.closeSplashscreen();
- // #endif
- },
- onLaunch: async function () {
- // console.log('App Launch');
- // uni.hideTabBar();
- //加载配置
- uni.getSystemInfo({
- success: function (e) {
- // #ifndef MP
- Vue.prototype.StatusBar = e.statusBarHeight;
- if (e.platform == 'android') {
- Vue.prototype.CustomBar = e.statusBarHeight + 50;
- } else {
- Vue.prototype.CustomBar = e.statusBarHeight + 45;
- }
- // #endif
- // #ifdef MP-WEIXIN
- Vue.prototype.StatusBar = e.statusBarHeight;
- let custom = wx.getMenuButtonBoundingClientRect();
- Vue.prototype.Custom = custom;
- Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
- // #endif
- // #ifdef MP-ALIPAY
- Vue.prototype.StatusBar = e.statusBarHeight;
- Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
- // #endif
- }
- });
- getConfig().then(([err, res]) => {
- // console.log('getConfig', err, res);
- if (!err) {
- this.$store.commit('setGlobalConfig', res);
- // 当前活动无效
- if (res.activity_invalid) {
- this.$store.commit('delActivityId'); // 删除活动ID
- // 重新加载配置
- getConfig().then(([err, res]) => {
- // console.log('getConfig reload', err, res);
- if (!err) {
- this.$store.commit('setGlobalConfig', res);
- }
- });
- }
- }
- });
- let res = await this.$api.getConfig();
- //console.log(res);
- if (!res.code) {
- return;
- }
- Vue.prototype.vuex_config = res.data;
- this.vuex_config = res.data;
- },
- onShow: function () {
- console.log('App 开启');
- },
- onHide: function () {
- console.log('App 关闭');
- }
- /* 隐藏默认tabBar */
- // onLoad:function(){
- // uni.hideTabBar();
- // }
- };
- </script>
- <style lang="scss">
- @import 'colorui/main.css';
- @import 'colorui/icon.css';
- </style>
|