提交 | 用户 | 时间
|
0ca254
|
1 |
import Vue from 'vue' |
A |
2 |
|
|
3 |
import Cookies from 'js-cookie' |
|
4 |
|
|
5 |
import Element from 'element-ui' |
|
6 |
import './assets/styles/element-variables.scss' |
|
7 |
|
|
8 |
import '@/assets/styles/index.scss' // global css |
|
9 |
import '@/assets/styles/ruoyi.scss' // ruoyi css |
|
10 |
import App from './App' |
|
11 |
import store from './store' |
|
12 |
import router from './router' |
|
13 |
import directive from './directive' // directive |
|
14 |
import plugins from './plugins' // plugins |
|
15 |
import { download } from '@/utils/request' |
|
16 |
|
|
17 |
import './assets/icons' // icon |
|
18 |
import './permission' // permission control |
|
19 |
import { getDicts } from "@/api/system/dict/data"; |
|
20 |
import { getConfigKey } from "@/api/system/config"; |
|
21 |
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi"; |
|
22 |
// 分页组件 |
|
23 |
import Pagination from "@/components/Pagination"; |
|
24 |
// 自定义表格工具组件 |
|
25 |
import RightToolbar from "@/components/RightToolbar" |
|
26 |
// 富文本组件 |
|
27 |
import Editor from "@/components/Editor" |
|
28 |
// 文件上传组件 |
|
29 |
import FileUpload from "@/components/FileUpload" |
|
30 |
// 图片上传组件 |
|
31 |
import ImageUpload from "@/components/ImageUpload" |
|
32 |
// 图片预览组件 |
|
33 |
import ImagePreview from "@/components/ImagePreview" |
|
34 |
// 字典标签组件 |
|
35 |
import DictTag from '@/components/DictTag' |
|
36 |
// 头部标签组件 |
|
37 |
import VueMeta from 'vue-meta' |
|
38 |
// 字典数据组件 |
|
39 |
import DictData from '@/components/DictData' |
|
40 |
import './router/directives.js'; |
|
41 |
|
|
42 |
// 全局方法挂载 |
|
43 |
Vue.prototype.getDicts = getDicts |
|
44 |
Vue.prototype.getConfigKey = getConfigKey |
|
45 |
Vue.prototype.parseTime = parseTime |
|
46 |
Vue.prototype.resetForm = resetForm |
|
47 |
Vue.prototype.addDateRange = addDateRange |
|
48 |
Vue.prototype.selectDictLabel = selectDictLabel |
|
49 |
Vue.prototype.selectDictLabels = selectDictLabels |
|
50 |
Vue.prototype.download = download |
|
51 |
Vue.prototype.handleTree = handleTree |
|
52 |
|
|
53 |
// 全局组件挂载 |
|
54 |
Vue.component('DictTag', DictTag) |
|
55 |
Vue.component('Pagination', Pagination) |
|
56 |
Vue.component('RightToolbar', RightToolbar) |
|
57 |
Vue.component('Editor', Editor) |
|
58 |
Vue.component('FileUpload', FileUpload) |
|
59 |
Vue.component('ImageUpload', ImageUpload) |
|
60 |
Vue.component('ImagePreview', ImagePreview) |
|
61 |
|
|
62 |
Vue.use(directive) |
|
63 |
Vue.use(plugins) |
|
64 |
Vue.use(VueMeta) |
|
65 |
DictData.install() |
|
66 |
|
|
67 |
/** |
|
68 |
* If you don't want to use mock-server |
|
69 |
* you want to use MockJs for mock api |
|
70 |
* you can execute: mockXHR() |
|
71 |
* |
|
72 |
* Currently MockJs will be used in the production environment, |
|
73 |
* please remove it before going online! ! ! |
|
74 |
*/ |
|
75 |
|
|
76 |
Vue.use(Element, { |
|
77 |
size: Cookies.get('size') || 'medium' // set element-ui default size |
|
78 |
}) |
|
79 |
|
|
80 |
Vue.config.productionTip = false |
|
81 |
|
|
82 |
new Vue({ |
|
83 |
el: '#app', |
|
84 |
router, |
|
85 |
store, |
|
86 |
render: h => h(App) |
|
87 |
}) |
|
88 |
//ip验证 |
|
89 |
Vue.directive('ipAddressValidator', { |
|
90 |
bind(el, binding, vnode) { |
|
91 |
el.addEventListener('input', () => { |
|
92 |
const value = el.value; |
|
93 |
// IPv4 address validation |
|
94 |
if (/^((\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])(\.((\d{1,2}|1\d{2}|2[0-4]\d|25[0-5]))){3})$/.test(value)) { |
|
95 |
console.log("Valid IPv4 Address"); |
|
96 |
} else if (!/(^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$)|(^(?:(?:[\x00-\x7F]|[\u0391-\uFFEF])+)(?:\.[a-zA-Z0-9]+)*$)/i.test(value)) { |
|
97 |
console.log("Invalid IPv4 or IPv6 Address"); |
|
98 |
} else { |
|
99 |
console.log("Valid IPv6 Address"); |
|
100 |
} |
|
101 |
}); |
|
102 |
}, |
|
103 |
}); |