{"size": 2631, "ext": "js", "max_stars_repo_path": "src/main.js", "max_stars_repo_name": "houseme/dashboard", "max_stars_repo_stars_event_min_datetime": "2021-10-20T07:06:56.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T02:49:51.000Z", "max_issues_repo_path": "src/main.js", "max_issues_repo_name": "houseme/dashboard", "max_issues_repo_issues_event_min_datetime": "2021-10-19T02:28:11.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-06T11:34:30.000Z", "max_forks_repo_path": "src/main.js", "max_forks_repo_name": "houseme/dashboard", "max_forks_repo_forks_event_min_datetime": "2021-10-19T02:17:29.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-07T22:13:51.000Z"}
{"max_stars_count": 18, "max_issues_count": 4, "max_forks_count": 7, "avg_line_length": 29.2333333333, "max_line_length": 64, "alphanum_fraction": 0.5769669327}
/* jshint esversion: 6 */
import 'babel-polyfill';
import Vue from 'vue';
import VueRouter from 'vue-router';
import noahvRequest from 'noahv-request';
import noahvComponent from 'noahv-component';
import noahv from 'noahv-core';
import routerConfig from '@/router/router';
import NProgress from '@/utils/nprogress';
import layoutApp from '@/layout/layout';
import checkRole from '@/utils/authorize';
import { urlFormat } from '@/utils/tool';
import { i18n, loadLanguageAsync, getLang } from '@/utils/i18n';
import store from '@/utils/store';

import '@/utils/Element';
import '@/utils/request';
import '@/assets/css/main.less';
import './utils/directive';

Vue.prototype.$urlFormat = urlFormat;
Vue.prototype.$BFEProductLineId = 1;
Vue.prototype.$AdminRole = 'admin';
Vue.prototype.$ProductRole = 'product';
Vue.prototype.$store = store;
Vue.prototype.Version = '_VERSION_';

Vue.use(VueRouter);
Vue.use(noahvRequest);
Vue.use(noahvComponent);

Vue.prototype.$Message.config({
    top: 20,
    duration: 3
});

noahv.useLayout(layoutApp);
noahv.router(routerConfig, 'history');
noahv._router.beforeEach((to, from, next) => {
    NProgress.start();
    const lang = getLang();
    loadLanguageAsync(lang).then(() => next());
    checkRole(to, next).then(result => {
        if (result === true) {
            next();
            return;
        }
        let content = i18n.t('login.tipNotLogin');
        if (result === 'product.list') {
            content = i18n.t('login.tipSelectProductLine');
        }
        Vue.prototype.$Modal.warning({
            title: i18n.t('com.tips'),
            content: content,
            onOk: () => {
                NProgress.done();
                next({
                    name: result
                });
            }
        });
        if (result === 'illegalAccess') {
            content = i18n.t('login.tipUrlIllegal');
            result = store.getUser();
            Vue.prototype.$Modal.warning({
                title: i18n.t('com.tips'),
                content: content,
                onOk: () => {
                    NProgress.done();
                    next({
                        name: 'LoginPassword'
                    });
                }
            });
        }
    });
});
noahv._router.onError(error => {
    const pattern = /Loading chunk (\d)+ failed/g;
    const isChunkLoadFailed = error.message.match(pattern);
    const targetPath = noahv._router.history.pending.fullPath;
    if (isChunkLoadFailed) {
        noahv._router.replace(targetPath);
    }
});
noahv._router.afterEach(() => {
    NProgress.done();
});
noahv.start('#app', '', i18n);
