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