mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-12 12:26:44 +08:00
2022年5月29日从svn移到git
This commit is contained in:
96
src/main.js
Normal file
96
src/main.js
Normal file
@@ -0,0 +1,96 @@
|
||||
import Vue from 'vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import store from './store'
|
||||
|
||||
//import './mock/index'
|
||||
|
||||
import constants from '@/utils/constants'
|
||||
import VueCookies from 'vue-cookies'
|
||||
Vue.use(VueCookies)
|
||||
import Element from 'element-ui'
|
||||
import 'element-ui/lib/theme-chalk/index.css'
|
||||
// import './assets/styles/element-variables.scss'
|
||||
import './icons' // icon
|
||||
import '@/assets/styles/index.scss' // global css
|
||||
import '@/assets/styles/portal.scss' // global css
|
||||
|
||||
|
||||
import Pagination from "@/components/Pagination";
|
||||
import Remark from "@/components/Remark";
|
||||
import './security'; //security control
|
||||
|
||||
import watermark from './utils/warterMark.js'
|
||||
|
||||
Vue.prototype.$watermark = watermark
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
Vue.prototype.$Constants = constants;
|
||||
|
||||
Vue.prototype.msgSuccess = function(msg) {
|
||||
this.$message({ showClose: true, message: msg, type: "success", offset: 50 });
|
||||
}
|
||||
//用来筛选图标是否显示的方法,字符串和数组都支持,如果传入其他值或者不传值图标全显示
|
||||
Vue.prototype.$iconFilter = function(hideArray) {
|
||||
let iconOpinion = {
|
||||
isRemark: false,
|
||||
isShare: false,
|
||||
isCollect: false,
|
||||
isPraise: false,
|
||||
isBrowse: false
|
||||
}
|
||||
if (typeof hideArray == 'string') {
|
||||
iconOpinion[hideArray] = true
|
||||
}
|
||||
if (hideArray instanceof Array) {
|
||||
hideArray.forEach(item => {
|
||||
iconOpinion[item] = true;
|
||||
})
|
||||
}
|
||||
return iconOpinion
|
||||
}
|
||||
|
||||
Vue.prototype.msgError = function(msg) {
|
||||
this.$message({ showClose: true, message: msg, type: "error" });
|
||||
}
|
||||
|
||||
Vue.prototype.msgInfo = function(msg) {
|
||||
this.$message.info(msg);
|
||||
}
|
||||
|
||||
//高亮显示
|
||||
Vue.prototype.$keywordActiveShow=function(str,keyword){
|
||||
//color:#588afc暂时用老系统颜色,ui给的颜色是这个值
|
||||
if(!str||str.indexOf(keyword)===-1||keyword==''){
|
||||
return str
|
||||
}
|
||||
return str.replace(keyword,`<span style="color:#FF0000">${keyword}</span>`)
|
||||
}
|
||||
|
||||
Vue.prototype.webBaseUrl = process.env.VUE_APP_PUBLIC_PATH;
|
||||
|
||||
// 全局组件挂载
|
||||
Vue.component('Pagination', Pagination)
|
||||
Vue.component('Remark', Remark)
|
||||
|
||||
|
||||
Vue.use(Element, {
|
||||
size: VueCookies.get('size') || 'medium' // set element-ui default size
|
||||
})
|
||||
|
||||
// 加入百度统计
|
||||
router.beforeEach((to, from, next) => {
|
||||
if (to.path) {
|
||||
if (window._hmt) {
|
||||
window._hmt.push(['_trackPageview', '/#' + to.fullPath])
|
||||
}
|
||||
}
|
||||
next()
|
||||
})
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
store,
|
||||
render: h => h(App)
|
||||
}).$mount('#app')
|
||||
Reference in New Issue
Block a user