Skip to content

Commit

Permalink
Merge pull request #86 from newpanjing/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
newpanjing authored Jun 18, 2019
2 parents cb0261c + 641f0a8 commit 51f1f53
Show file tree
Hide file tree
Showing 13 changed files with 273 additions and 289 deletions.
20 changes: 18 additions & 2 deletions QUICK.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ SIMPLEUI_INDEX = 'https://www.88cto.com'
默认可以不用填写,缺省配置为默认排序,不对菜单进行过滤和排序。<br>
开启认为传一个列表,如果列表为空,则什么也不显示。列表中的每个元素要对应到menus里面的name字段

#### dynamic 开启动态菜单功能
该字段用于告诉simpleui,是否需要开启动态菜单功能。<br>
默认可以不用填写,缺省配置为False,不开启动态菜单功能。<br>
开启为True,开启后,每次用户登陆都会刷新左侧菜单配置。<br>
需要注意的是:开启后每次访问admin都会重读配置文件,所以会带来额外的消耗。

#### menus说明

|字段|说明|
Expand All @@ -261,9 +267,11 @@ SIMPLEUI_INDEX = 'https://www.88cto.com'

#### 例子
```python
import time
SIMPLEUI_CONFIG = {
'system_keep':False,
'menu_display': ['Simpleui', '测试', '权限认证'], # 开启排序和过滤功能, 不填此字段为默认排序和全部显示, 空列表[] 为全部不显示.
'system_keep': False,
'menu_display': ['Simpleui', '测试', '权限认证', '动态菜单测试'], # 开启排序和过滤功能, 不填此字段为默认排序和全部显示, 空列表[] 为全部不显示.
'dynamic': True, # 设置是否开启动态菜单, 默认为False. 如果开启, 则会在每次用户登陆时动态展示菜单内容
'menus': [{
'name': 'Simpleui',
'icon': 'fas fa-code',
Expand All @@ -289,6 +297,14 @@ SIMPLEUI_CONFIG = {
'url': 'https://www.wezoz.com',
'icon': 'fab fa-github'
}]
}, {
'name': '动态菜单测试' ,
'icon': 'fa fa-desktop',
'models': [{
'name': time.time(),
'url': 'http://baidu.com',
'icon': 'far fa-surprise'
}]
}]
}
```
Expand Down
2 changes: 1 addition & 1 deletion simpleui/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
def get_version():
return '2.1.3'
return '2.1.4'
22 changes: 21 additions & 1 deletion simpleui/static/admin/simpleui-x/css/index.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion simpleui/static/admin/simpleui-x/css/index.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 32 additions & 6 deletions simpleui/static/admin/simpleui-x/css/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,14 @@ html, body {
.float-wrap span {
margin-left: 10px;
}
.float-wrap{
.el-breadcrumb__item,.el-breadcrumb__item span{

.float-wrap {
.el-breadcrumb__item, .el-breadcrumb__item span {
margin-left: 0px;
}
.el-breadcrumb__separator{
margin-left: 5px!important;

.el-breadcrumb__separator {
margin-left: 5px !important;
}
}

Expand Down Expand Up @@ -319,15 +321,17 @@ html, body {
.iframe-wrap {
height: 100%;
position: relative;

.loading {
z-index: 10;
position: absolute;
top: 1px;
left: 1px;
right: 1px;
bottom: 1px;
background-color: rgba(#000,0.3);
.center{
background-color: rgba(#000, 0.3);

.center {
position: absolute;
top: 50%;
left: 50%;
Expand Down Expand Up @@ -382,3 +386,25 @@ html, body {
}
}

.menu {
overflow-x:hidden ;
/*滚动条样式*/
.el-icon-arrow-right{
display: none;
}
&::-webkit-scrollbar {
width: 4px;
}

&::-webkit-scrollbar-thumb {
border-radius: 10px;
-webkit-box-shadow: inset 0 0 5px rgba(123, 123, 123, 0.2);
background: #7d7d7d;
}

&::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
border-radius: 0;
background: rgba(0, 0, 0, 0.1);
}
}
49 changes: 28 additions & 21 deletions simpleui/static/admin/simpleui-x/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
new Vue({
el: '#main',
data: {
searchInput:'',
height: 1000,
fold: false,
zoom: false,
Expand All @@ -50,7 +51,7 @@
tabModel: 0,
tabIndex: 0,
menus: [],
menuActive: '1',
menuActive: '0',
breadcrumbs: [],
language: window.language,
pwdDialog: {},
Expand Down Expand Up @@ -125,7 +126,8 @@
models: [],
fontDialogVisible: false,
fontSlider: 12,
loading:false
loading: false,
menuTextShow: true
},
watch: {
fold: function (newValue, oldValue) {
Expand Down Expand Up @@ -154,16 +156,20 @@

var val = getCookie('fold') == 'true';
this.small = this.fold = val;

this.menuTextShow = !this.fold;

var self = this;
window.onload = window.onresize = function () {
window.onresize = function () {

self.height = document.documentElement.clientHeight || document.body.clientHeight
var width = document.documentElement.clientWidth || document.body.clientWidth;

if (!self.small) {
self.fold = width < 800;

self.menuTextShow = !(width < 800);
self.$nextTick(()=>{
self.fold= width < 800;
})
}

//判断全屏状态
Expand Down Expand Up @@ -230,11 +236,11 @@
url = e.target.contentWindow.location.href

tab.newUrl = url;
tab.loading=false;
tab.loading = false;
this.$forceUpdate();
var self=this;
e.target.contentWindow.beforeLoad=function(){
tab.loading=true;
var self = this;
e.target.contentWindow.beforeLoad = function () {
tab.loading = true;
self.$forceUpdate();
}
this.loading = false;
Expand Down Expand Up @@ -319,8 +325,8 @@
this.tabModel = exists.id;
} else {
//其他的网址loading会一直转
if(data.url.indexOf('http')!=0){
data.loading=true;
if (data.url.indexOf('http') != 0) {
data.loading = true;
this.loading = true;
}
data.id = new Date().getTime() + "" + Math.random();
Expand All @@ -332,23 +338,24 @@
}
,
foldClick: function () {
if (this.fold) {
this.fold = false;
} else {
this.fold = true;
}

this.small = this.fold;
this.menuTextShow = !this.menuTextShow;
this.$nextTick(() => {
this.fold = !this.fold;

this.small = this.fold;
//设置进cookie
setCookie('fold', this.fold);
});


//设置进cookie
setCookie('fold', this.fold);
}
,
changePassword: function () {
var width = document.documentElement.clientWidth || document.body.clientWidth;
if (width > 800) {
this.pwdDialog = {
url: window.urls.changePassword+'?dialog=1',
url: window.urls.changePassword + '?dialog=1',
name: language.change_password,
show: true
};
Expand All @@ -357,7 +364,7 @@
url: window.urls.changePassword,
icon: 'far fa-edit',
name: language.change_password,
breadcrumbs:[{
breadcrumbs: [{
name: language.change_password,
icon: 'far fa-edit'
}]
Expand Down
Loading

0 comments on commit 51f1f53

Please sign in to comment.