xincheng.js 3.11 KB
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import xincheng from './xincheng.vue'
import Vue from 'vue'
import Vuex from 'vuex'
import 'element-ui/lib/theme-chalk/index.css'

import './third-party/lazy_use'

import router from './router/xcroute.js'

import 'babel-polyfill'
if (Number.parseInt === undefined) Number.parseInt = window.parseInt;
if (Number.parseFloat === undefined) Number.parseFloat = window.parseFloat;
import promise from 'es6-promise'
promise.polyfill();

import api from './api'
import store from './newStore'
import recover from './newStore/recover'

 // 导入所有过滤器变量
import * as custom from './filters/'

import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { getTimer } from "./utils"

Vue.use(Vuex)

// local js
import './utils/vproto'
import './styles/fonts/iconfont.css'
import './styles/index.css'
// import 'jquery-form'

import Charts from '@/components/Charts'
import i18n from './assets/i18n/i18n'

import formatOpt from './components/conditions/formatOption'
import storelevel from './components/conditions/storelevelOption'
import exportData from './views/public/exportData'
import mallSelect from './components/conditions/mallSelector'

// Vue.use(ElementUI)
Vue.component('export-data-dialog', exportData)
Vue.component('mix-charts', Charts)
Vue.component('format-option-content', formatOpt)
Vue.component('store-level-content', storelevel)
Vue.component('mall-select', mallSelect)

recover.recoverState()

// 全局配置axios
Vue.prototype.$api = api;

Vue.config.productionTip = false;
Vue.config.performance = process.env.NODE_ENV !== 'production';
Vue.prototype.Time = getTimer

// 全局过滤器
Object.keys(custom).forEach(key => {
    Vue.filter(key, custom[key]);
});

// 读取配置文件 多项目 默认6.0 平台
const platformName = window._vionConfig.platform || 'mall'
document.title = platformName === 'mall'
  ? '智慧商业客流分析平台'
  : '智慧连锁客流分析平台'

Vue.prototype.$Project = platformName

// 读取配置文件 菜单权限 默认有菜单权限
Vue.prototype.$Menu = window._vionConfig.allMenu || false;

Vue.directive('select-loadmore', (el, binding) => {
  const SELECTWRAP_DOM = 
  el.querySelector(".el-select-dropdown .el-select-dropdown__wrap");
  if (SELECTWRAP_DOM) {
    SELECTWRAP_DOM.addEventListener("scroll", function () {
      /**
       * scrollHeight 获取元素内容高度(只读)
       * scrollTop 获取或者设置元素的偏移值,
       *  常用于:计算滚动条的位置, 当一个元素的容器没有产生垂直方向的滚动条, 那它的scrollTop的值默认为0.
       * clientHeight 读取元素的可见高度(只读)
       * 如果元素滚动到底, 下面等式返回true, 没有则返回false:
       * ele.scrollHeight - ele.scrollTop === ele.clientHeight;
       */
      const condition = this.scrollHeight - this.scrollTop <= this.clientHeight;
      if (condition) binding.value();
    })
  }
})

/* eslint-disable no-new */
new Vue({
    el: '#xincheng',
    router,
    store,
    i18n,
    render: h => h(xincheng)
})