底层架构优化

pull/59/head
smallchill 7 years ago
parent 9c2d8504be
commit 3dc3cb6481
  1. 17
      src/components/basic-container/main.vue
  2. 1
      src/lang/en.js
  3. 1
      src/lang/zh.js
  4. 7
      src/page/index/sidebar/index.vue
  5. 12
      src/page/index/sidebar/sidebarItem.vue
  6. 5
      src/page/index/tags.vue
  7. 13
      src/page/index/top/top-lang.vue
  8. 6
      src/page/index/top/top-menu.vue
  9. 5
      src/page/index/top/top-search.vue
  10. 2
      src/permission.js
  11. 3
      src/router/avue-router.js
  12. 1
      src/store/getters.js
  13. 4
      src/store/modules/common.js
  14. 3
      src/styles/media.scss
  15. 4
      vue.config.js

@ -1,5 +1,6 @@
<template>
<div class="basic-container">
<div class="basic-container"
:class="{'basic-container--block':block}">
<el-card>
<slot></slot>
</el-card>
@ -8,7 +9,13 @@
<script>
export default {
name: "basicContainer"
name: "basicContainer",
props: {
block: {
type: Boolean,
default: false
}
}
};
</script>
@ -17,6 +24,12 @@ export default {
padding: 10px 6px;
border-radius: 10px;
box-sizing: border-box;
&--block {
height: 100%;
.el-card {
height: 100%;
}
}
.el-card {
width: 100%;
}

@ -96,6 +96,7 @@ export default {
color: 'color'
},
tagsView: {
search: 'Search',
menu: 'menu',
closeOthers: 'Close Others',
closeAll: 'Close All'

@ -95,6 +95,7 @@ export default {
color: '换色'
},
tagsView: {
search: '搜索',
menu: '更多',
closeOthers: '关闭其它',
closeAll: '关闭所有'

@ -3,7 +3,8 @@
<logo></logo>
<el-scrollbar style="height:100%">
<div v-if="validatenull(menu)"
class="avue-sidebar--tip">{{$t('menuTip')}}</div>
class="avue-sidebar--tip">{{$t('menuTip')}}
</div>
<el-menu unique-opened
:default-active="nowTagValue"
mode="vertical"
@ -23,6 +24,7 @@
import {mapGetters} from "vuex";
import logo from "../logo";
import sidebarItem from "./sidebarItem";
export default {
name: "sidebar",
components: {sidebarItem, logo},
@ -41,7 +43,8 @@ export default {
return this.$router.$avueRouter.getValue(this.$route);
}
},
mounted() {},
mounted() {
},
methods: {}
};
</script>

@ -42,6 +42,7 @@
import {mapGetters} from "vuex";
import {validatenull} from "@/util/validate";
import config from "./config.js";
export default {
name: "sidebarItem",
data() {
@ -70,8 +71,10 @@ export default {
type: Boolean
}
},
created() {},
mounted() {},
created() {
},
mounted() {
},
computed: {
...mapGetters(["roles"]),
labelKey() {
@ -117,9 +120,8 @@ export default {
this.$router.push({
path: this.$router.$avueRouter.getPath({
name: item[this.labelKey],
src: item[this.pathKey],
i18n: (item.meta || {}).i18n
}),
src: item[this.pathKey]
}, item.meta),
query: item.query
});
}

@ -133,9 +133,8 @@
this.$router.push({
path: this.$router.$avueRouter.getPath({
name: tag.label,
src: tag.value,
i18n: tag.meta.i18n
}),
src: tag.value
}, tag.meta),
query: tag.query
});
},

@ -4,22 +4,27 @@
<i class="icon-zhongyingwen"></i>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :disabled="language==='zh'"
command="zh">中文</el-dropdown-item>
command="zh">中文
</el-dropdown-item>
<el-dropdown-item :disabled="language==='en'"
command="en">English</el-dropdown-item>
command="en">English
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
<script>
import {mapGetters} from "vuex";
export default {
name: "top-lang",
data() {
return {};
},
created() {},
mounted() {},
created() {
},
mounted() {
},
computed: {
...mapGetters(["language", "tag"])
},

@ -27,6 +27,7 @@
<script>
import {mapGetters} from "vuex";
export default {
name: "top-menu",
data() {
@ -76,9 +77,8 @@ export default {
this.$router.push({
path: this.$router.$avueRouter.getPath({
name: itemActive.label,
src: itemActive.path,
i18n: itemActive.meta.i18n
})
src: itemActive.path
}, itemActive.meta)
});
});
}

@ -88,9 +88,8 @@
this.$router.push({
path: this.$router.$avueRouter.getPath({
name: item[this.labelKey],
src: item[this.pathKey],
i18n: (item.meta || {}).i18n
}),
src: item[this.pathKey]
}, item.meta),
query: item.query
});
}

@ -12,6 +12,8 @@ NProgress.configure({showSpinner: false});
const lockPage = store.getters.website.lockPage; //锁屏页
router.beforeEach((to, from, next) => {
const meta = to.meta || {};
const isMenu = meta.menu === undefined ? to.query.menu : meta.menu;
store.commit('SET_IS_MENU', isMenu === undefined);
if (getToken()) {
if (store.getters.isLock && to.path != lockPage) { //如果系统激活锁屏,全部跳转到锁屏页
next({path: lockPage})

@ -9,6 +9,7 @@ RouterPlugin.install = function (vue, router, store, i18n) {
this.$vue = new vue({i18n});
function isURL(s) {
if (s.includes('html')) return true;
return /^http[s]?:\/\/.*/.test(s)
}
@ -55,7 +56,7 @@ RouterPlugin.install = function (vue, router, store, i18n) {
getPath: function (params) {
let {src} = params;
let result = src || '/';
if (src.includes("http") || src.includes("https")) {
if (isURL(src)) {
result = `/myiframe/urlPath?${objToform(params)}`;
}
return result;

@ -11,6 +11,7 @@ const getters = {
screen: state => state.common.screen,
isLock: state => state.common.isLock,
isFullScren: state => state.common.isFullScren,
isMenu: state => state.common.isMenu,
lockPasswd: state => state.common.lockPasswd,
tagList: state => state.tags.tagList,
tagWel: state => state.tags.tagWel,

@ -11,6 +11,7 @@ const common = {
language: getStore({name: 'language'}) || 'zh',
isCollapse: false,
isFullScren: false,
isMenu: true,
isShade: false,
screen: -1,
isLock: getStore({name: 'isLock'}) || false,
@ -45,6 +46,9 @@ const common = {
SET_FULLSCREN: (state) => {
state.isFullScren = !state.isFullScren;
},
SET_IS_MENU: (state, menu) => {
state.isMenu = menu;
},
SET_LOCK: (state) => {
state.isLock = true;
setStore({

@ -58,6 +58,7 @@
height: calc(100% - 64px);
box-sizing: border-box;
overflow: hidden;
transition: all 0.5s;
background: #f0f2f5;
z-index: 1026;
@ -68,7 +69,7 @@
}
.avue-view {
padding: 10px !important;
padding: 0 10px !important;
width: 100%;
box-sizing: border-box;
}

@ -26,9 +26,9 @@ module.exports = {
proxy: {
'/api': {
//本地服务接口地址
//target: 'http://localhost',
target: 'http://localhost',
//远程演示服务地址
target: 'https://saber.bladex.vip/api',
//target: 'https://saber.bladex.vip/api',
ws: true,
pathRewrite: {
'^/api': '/'

Loading…
Cancel
Save