89 lines
2.0 KiB
JavaScript
89 lines
2.0 KiB
JavaScript
import Vue from 'vue'
|
|
import App from './App.vue'
|
|
import router from './router'
|
|
import store from './store'
|
|
import Storage from 'vue-ls'
|
|
|
|
import Vant, { Toast } from 'vant'
|
|
import 'vant/lib/index.css'
|
|
import 'vant/lib/index.less'
|
|
|
|
import VueI18n from 'vue-i18n'
|
|
import LangENUS from './common/lang/en-us'
|
|
import LangZHCN from './common/lang/zh-cn'
|
|
import { ACCESS_TOKEN, USER_INFO } from '@/store/mutation-types'
|
|
import './permission'
|
|
import './assets/font/iconfont.css'
|
|
|
|
import { Table, FormModel, Input, Row, Col, LocaleProvider } from 'ant-design-vue'
|
|
import 'ant-design-vue/dist/antd.css'
|
|
|
|
import Viewer from 'v-viewer'
|
|
import 'viewerjs/dist/viewer.css'
|
|
|
|
// 引入 VConsole
|
|
import VConsole from 'vconsole'
|
|
import * as dd from 'dingtalk-jsapi'
|
|
|
|
Vue.config.productionTip = false
|
|
|
|
// 启动 VConsole
|
|
// eslint-disable-next-line no-new
|
|
if (process.env.NODE_ENV !== 'production') new VConsole()
|
|
|
|
Vue.use(Vant)
|
|
Vue.use(VueI18n)
|
|
Vue.prototype.$message = Toast
|
|
Vue.use(Table)
|
|
Vue.use(FormModel)
|
|
Vue.use(Input)
|
|
Vue.use(Row)
|
|
Vue.use(Col)
|
|
Vue.use(LocaleProvider)
|
|
Vue.use(Viewer)
|
|
|
|
Viewer.setDefaults({
|
|
// 需要配置的属性 注意属性并没有引号
|
|
title: false,
|
|
toolbar: false
|
|
})
|
|
|
|
const i18n = new VueI18n({
|
|
locale: 'zh-CN',
|
|
messages: {
|
|
'en-US': LangENUS,
|
|
'zh-CN': LangZHCN
|
|
}
|
|
})
|
|
|
|
Vue.prototype.global = {
|
|
emptyLine: '—'
|
|
}
|
|
|
|
Vue.use(Storage, {
|
|
namespace: 'pro__', // key prefix
|
|
name: 'ls', // name variable Vue.[ls] or this.[$ls],
|
|
storage: 'local' // storage name session, local, memory
|
|
})
|
|
|
|
new Vue({
|
|
router,
|
|
store,
|
|
i18n,
|
|
mounted () {
|
|
store.commit('SET_TOKEN', Vue.ls.get(ACCESS_TOKEN))
|
|
store.commit('SET_INFO', Vue.ls.get(USER_INFO))
|
|
// 判断是否有token,没有的话就直接单点登录
|
|
if (!Vue.ls.get(ACCESS_TOKEN)) {
|
|
// 非钉钉平台 不进行钉钉单点登录
|
|
if (dd.env.platform === 'notInDingTalk') return
|
|
|
|
console.log('store.dispatch(\'DingLogin\')')
|
|
store.dispatch('DingLogin').catch((e) => {
|
|
Toast(e.message)
|
|
})
|
|
}
|
|
},
|
|
render: h => h(App)
|
|
}).$mount('#app')
|