dev_2022-05-11
parent
245397841c
commit
9eed74a3b5
105 changed files with 7759 additions and 7406 deletions
@ -1,24 +1,25 @@ |
|||||||
<template> |
<template> |
||||||
<div id="app" > |
<div id="app"> |
||||||
<router-view></router-view> |
<router-view></router-view> |
||||||
</div> |
</div> |
||||||
</template> |
</template> |
||||||
|
|
||||||
<script> |
<script> |
||||||
import Setting from '@/setting'; |
import Setting from "@/setting"; |
||||||
import util from '@/libs/util'; |
import util from "@/libs/util"; |
||||||
export default { |
|
||||||
name: 'App', |
export default { |
||||||
created () { |
name: "App", |
||||||
|
created() { |
||||||
//在页面加载时读取localStorage里的状态信息 |
//在页面加载时读取localStorage里的状态信息 |
||||||
if (util.local.get(Setting.storeKey) ) { |
if (util.local.get(Setting.storeKey)) { |
||||||
this.$store.replaceState(Object.assign({}, this.$store.state,util.local.get(Setting.storeKey))) |
this.$store.replaceState(Object.assign({}, this.$store.state, util.local.get(Setting.storeKey))); |
||||||
} |
} |
||||||
|
|
||||||
//在页面刷新时将vuex里的信息保存到localStorage里 |
//在页面刷新时将vuex里的信息保存到localStorage里 |
||||||
window.addEventListener("beforeunload",()=>{ |
window.addEventListener("beforeunload", () => { |
||||||
util.local.get(Setting.tokenKey) && util.local.set(Setting.storeKey,this.$store.state) |
util.local.get(Setting.tokenKey) && util.local.set(Setting.storeKey, this.$store.state); |
||||||
}) |
}); |
||||||
} |
|
||||||
} |
} |
||||||
|
}; |
||||||
</script> |
</script> |
@ -1,16 +1,16 @@ |
|||||||
export default [ |
export default [ |
||||||
['bold', 'italic', 'underline', 'strike'], |
["bold", "italic", "underline", "strike"], |
||||||
['blockquote', 'code-block'], |
["blockquote", "code-block"], |
||||||
[{ 'header': 1 }, { 'header': 2 }], |
[{ "header": 1 }, { "header": 2 }], |
||||||
[{ 'list': 'ordered' }, { 'list': 'bullet' }], |
[{ "list": "ordered" }, { "list": "bullet" }], |
||||||
[{ 'script': 'sub' }, { 'script': 'super' }], |
[{ "script": "sub" }, { "script": "super" }], |
||||||
[{ 'indent': '-1' }, { 'indent': '+1' }], |
[{ "indent": "-1" }, { "indent": "+1" }], |
||||||
[{ 'direction': 'rtl' }], |
[{ "direction": "rtl" }], |
||||||
[{ 'size': ['small', false, 'large', 'huge'] }], |
[{ "size": ["small", false, "large", "huge"] }], |
||||||
[{ 'header': [1, 2, 3, 4, 5, 6, false] }], |
[{ "header": [1, 2, 3, 4, 5, 6, false] }], |
||||||
[{ 'color': [] }, { 'background': [] }], |
[{ "color": [] }, { "background": [] }], |
||||||
[{ 'font': [] }], |
[{ "font": [] }], |
||||||
[{ 'align': [] }], |
[{ "align": [] }], |
||||||
['clean'], |
["clean"], |
||||||
['link', 'image', 'video'] |
["link", "image", "video"] |
||||||
] |
]; |
@ -1,30 +1,30 @@ |
|||||||
export const messages = { |
export const messages = { |
||||||
'zh': { |
"zh": { |
||||||
i18n: { |
i18n: { |
||||||
breadcrumb: '国际化产品', |
breadcrumb: "国际化产品", |
||||||
tips: '通过切换语言按钮,来改变当前内容的语言。', |
tips: "通过切换语言按钮,来改变当前内容的语言。", |
||||||
btn: '切换英文', |
btn: "切换英文", |
||||||
title1: '常用用法', |
title1: "常用用法", |
||||||
p1: '要是你把你的秘密告诉了风,那就别怪风把它带给树。', |
p1: "要是你把你的秘密告诉了风,那就别怪风把它带给树。", |
||||||
p2: '没有什么比信念更能支撑我们度过艰难的时光了。', |
p2: "没有什么比信念更能支撑我们度过艰难的时光了。", |
||||||
p3: '只要能把自己的事做好,并让自己快乐,你就领先于大多数人了。', |
p3: "只要能把自己的事做好,并让自己快乐,你就领先于大多数人了。", |
||||||
title2: '组件插值', |
title2: "组件插值", |
||||||
info: 'Element组件需要国际化,请参考 {action}。', |
info: "Element组件需要国际化,请参考 {action}。", |
||||||
value: '文档' |
value: "文档" |
||||||
} |
} |
||||||
}, |
}, |
||||||
'en': { |
"en": { |
||||||
i18n: { |
i18n: { |
||||||
breadcrumb: 'International Products', |
breadcrumb: "International Products", |
||||||
tips: 'Click on the button to change the current language. ', |
tips: "Click on the button to change the current language. ", |
||||||
btn: 'Switch Chinese', |
btn: "Switch Chinese", |
||||||
title1: 'Common usage', |
title1: "Common usage", |
||||||
p1: "If you reveal your secrets to the wind you should not blame the wind for revealing them to the trees.", |
p1: "If you reveal your secrets to the wind you should not blame the wind for revealing them to the trees.", |
||||||
p2: "Nothing can help us endure dark times better than our faith. ", |
p2: "Nothing can help us endure dark times better than our faith. ", |
||||||
p3: "If you can do what you do best and be happy, you're further along in life than most people.", |
p3: "If you can do what you do best and be happy, you're further along in life than most people.", |
||||||
title2: 'Component interpolation', |
title2: "Component interpolation", |
||||||
info: 'The default language of Element is Chinese. If you wish to use another language, please refer to the {action}.', |
info: "The default language of Element is Chinese. If you wish to use another language, please refer to the {action}.", |
||||||
value: 'documentation' |
value: "documentation" |
||||||
} |
} |
||||||
} |
} |
||||||
} |
}; |
@ -1,16 +1,18 @@ |
|||||||
// rem等比适配配置文件
|
// rem等比适配配置文件
|
||||||
// 基准大小
|
// 基准大小
|
||||||
const baseSize = 16 |
const baseSize = 16; |
||||||
|
|
||||||
// 设置 rem 函数
|
// 设置 rem 函数
|
||||||
function setRem () { |
function setRem() { |
||||||
// 当前页面宽度相对于 1920宽的缩放比例,可根据自己需要修改。
|
// 当前页面宽度相对于 1920宽的缩放比例,可根据自己需要修改。
|
||||||
const scale = document.documentElement.clientWidth / 1920 |
const scale = document.documentElement.clientWidth / 1920; |
||||||
// 设置页面根节点字体大小(“Math.min(scale, 2)” 指最高放大比例为2,可根据实际业务需求调整)
|
// 设置页面根节点字体大小(“Math.min(scale, 2)” 指最高放大比例为2,可根据实际业务需求调整)
|
||||||
document.documentElement.style.fontSize = baseSize * Math.min(scale, 2) + 'px' |
document.documentElement.style.fontSize = baseSize * Math.min(scale, 2) + "px"; |
||||||
} |
} |
||||||
|
|
||||||
// 初始化
|
// 初始化
|
||||||
setRem() |
setRem(); |
||||||
// 改变窗口大小时重新设置 rem
|
// 改变窗口大小时重新设置 rem
|
||||||
window.onresize = function () { |
window.onresize = function() { |
||||||
setRem() |
setRem(); |
||||||
} |
}; |
@ -1,31 +1,31 @@ |
|||||||
import store from '@/store'; |
import store from "@/store"; |
||||||
import router from '@/router'; |
import router from "@/router"; |
||||||
import generateBtnPermission from '../auth/generateBtnPermission'; |
import generateBtnPermission from "../auth/generateBtnPermission"; |
||||||
|
|
||||||
const newRoutes = [] |
const newRoutes = []; |
||||||
|
|
||||||
function createMeta(item){ |
function createMeta(item) { |
||||||
let meta = { title: item.name } |
let meta = { title: item.name }; |
||||||
return meta |
return meta; |
||||||
} |
} |
||||||
|
|
||||||
function createRoute(data){ |
function createRoute(data) { |
||||||
data.map(e => { |
data.map(e => { |
||||||
if(e.menuUrl){ |
if (e.menuUrl) { |
||||||
let meta = createMeta(e) |
let meta = createMeta(e); |
||||||
newRoutes.push({ |
newRoutes.push({ |
||||||
name: e.menuUrl, |
name: e.menuUrl, |
||||||
path: e.menuUrl, |
path: e.menuUrl, |
||||||
meta |
meta |
||||||
}) |
}); |
||||||
} |
} |
||||||
// 递归生成路由集合
|
// 递归生成路由集合
|
||||||
e.children && e.children.length && createRoute(e.children) |
e.children && e.children.length && createRoute(e.children); |
||||||
}) |
}); |
||||||
} |
} |
||||||
|
|
||||||
export default function(data,path){ |
export default function(data, path) { |
||||||
generateBtnPermission(data) |
generateBtnPermission(data); |
||||||
createRoute(data) |
createRoute(data); |
||||||
store.dispatch('auth/addRoutes',newRoutes) |
store.dispatch("auth/addRoutes", newRoutes); |
||||||
} |
} |
@ -1,26 +1,26 @@ |
|||||||
import store from '@/store'; |
import store from "@/store"; |
||||||
import router from '@/router'; |
import router from "@/router"; |
||||||
|
|
||||||
export default function(){ |
export default function() { |
||||||
setTimeout(() => { |
setTimeout(() => { |
||||||
let routes = store.state.auth.routes |
let routes = store.state.auth.routes; |
||||||
routes.forEach(e => { |
routes.forEach(e => { |
||||||
if(e.path == '/'){ |
if (e.path == "/") { |
||||||
e.component = () => import('@/layouts/home/index.vue') |
e.component = () => import("@/layouts/home/index.vue"); |
||||||
}else{ |
} else { |
||||||
e.component = () => import(`@/pages/${e.path}.vue`) |
e.component = () => import(`@/pages/${e.path}.vue`); |
||||||
} |
} |
||||||
|
|
||||||
e.children && e.children.forEach(n => { |
e.children && e.children.forEach(n => { |
||||||
n.path && (n.component = () => import(`@/pages/${n.path}.vue`)) |
n.path && (n.component = () => import(`@/pages/${n.path}.vue`)); |
||||||
}) |
}); |
||||||
}) |
}); |
||||||
|
|
||||||
routes.push({ |
routes.push({ |
||||||
path: '*', |
path: "*", |
||||||
redirect: '404' |
redirect: "404" |
||||||
}) |
}); |
||||||
|
|
||||||
router.addRoutes(routes) |
router.addRoutes(routes); |
||||||
},500) |
}, 500); |
||||||
} |
} |
@ -1,6 +1,6 @@ |
|||||||
import router from '@/router'; |
import router from "@/router"; |
||||||
|
|
||||||
export default function(){ |
export default function() { |
||||||
const newRouter = createRouter() |
const newRouter = createRouter(); |
||||||
router.matcher = newRouter.matcher |
router.matcher = newRouter.matcher; |
||||||
} |
} |
@ -1,8 +1,8 @@ |
|||||||
export default { |
export default { |
||||||
beforeCreate() { |
beforeCreate() { |
||||||
document.querySelector('body').setAttribute('style', 'background-color:#fff') |
document.querySelector("body").setAttribute("style", "background-color:#fff"); |
||||||
}, |
}, |
||||||
beforeDestroy() { |
beforeDestroy() { |
||||||
document.body.removeAttribute('style') |
document.body.removeAttribute("style"); |
||||||
} |
} |
||||||
} |
}; |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,27 +1,27 @@ |
|||||||
import router from './index' |
import router from "./index"; |
||||||
import Setting from '@/setting' |
import Setting from "@/setting"; |
||||||
import util from '@/libs/util' |
import util from "@/libs/util"; |
||||||
|
|
||||||
router.beforeEach((to, from, next) => { |
router.beforeEach((to, from, next) => { |
||||||
document.title = Setting.titleSuffix |
document.title = Setting.titleSuffix; |
||||||
const role = util.local.get(Setting.tokenKey) |
const role = util.local.get(Setting.tokenKey); |
||||||
if (!role && to.path !== '/login') { |
if (!role && to.path !== "/login") { |
||||||
next('/login') |
next("/login"); |
||||||
} else if(role && to.path == '/login') { |
} else if (role && to.path == "/login") { |
||||||
next('/index') |
next("/index"); |
||||||
} else { |
} else { |
||||||
let mg = from.query.mg |
let mg = from.query.mg; |
||||||
if(mg){ |
if (mg) { |
||||||
if(!to.query.mg){ |
if (!to.query.mg) { |
||||||
next({ |
next({ |
||||||
path: to.path, |
path: to.path, |
||||||
query: {mg} |
query: { mg } |
||||||
}) |
}); |
||||||
}else{ |
} else { |
||||||
next() |
next(); |
||||||
} |
} |
||||||
}else{ |
} else { |
||||||
next() |
next(); |
||||||
} |
} |
||||||
} |
} |
||||||
}); |
}); |
@ -1,4 +1,2 @@ |
|||||||
const getters = { |
const getters = {}; |
||||||
|
export default getters; |
||||||
} |
|
||||||
export default getters |
|
@ -1,25 +1,25 @@ |
|||||||
import Vue from 'vue'; |
import Vue from "vue"; |
||||||
import Vuex from 'vuex'; |
import Vuex from "vuex"; |
||||||
import getters from './getters' |
import getters from "./getters"; |
||||||
|
|
||||||
Vue.use(Vuex); |
Vue.use(Vuex); |
||||||
|
|
||||||
// https://webpack.js.org/guides/dependency-management/#requirecontext
|
// https://webpack.js.org/guides/dependency-management/#requirecontext
|
||||||
const modulesFiles = require.context('./modules', true, /\.js$/) |
const modulesFiles = require.context("./modules", true, /\.js$/); |
||||||
|
|
||||||
// you do not need `import app from './modules/app'`
|
// you do not need `import app from './modules/app'`
|
||||||
// it will auto require all vuex module from modules file
|
// it will auto require all vuex module from modules file
|
||||||
const modules = modulesFiles.keys().reduce((modules, modulePath) => { |
const modules = modulesFiles.keys().reduce((modules, modulePath) => { |
||||||
// set './app.js' => 'app'
|
// set './app.js' => 'app'
|
||||||
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1') |
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, "$1"); |
||||||
const value = modulesFiles(modulePath) |
const value = modulesFiles(modulePath); |
||||||
modules[moduleName] = value.default |
modules[moduleName] = value.default; |
||||||
return modules |
return modules; |
||||||
}, {}) |
}, {}); |
||||||
|
|
||||||
const store = new Vuex.Store({ |
const store = new Vuex.Store({ |
||||||
modules, |
modules, |
||||||
getters |
getters |
||||||
}) |
}); |
||||||
|
|
||||||
export default store |
export default store; |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 11 KiB |
@ -1,3 +1,3 @@ |
|||||||
[class*=" icon-"], [class^=icon-] { |
[class*=" icon-"], [class^=icon-] { |
||||||
font-family: iconfont!important; |
font-family: iconfont !important; |
||||||
} |
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue