切换导航条
此项目
正在载入...
登录
何书鹏
/
recruit
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
Karson
7 years ago
提交
2ad46507309aece451ed393a1ed194ebcdf18e71
1 个父辈
ac6aa072
修复后台关闭当前选项卡未激活前一选项卡的BUG
修复在移动端包含tooltip需要点击两次的BUG
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
62 行增加
和
45 行删除
public/assets/js/backend.js
public/assets/js/frontend.js
public/assets/js/require-backend.min.js
public/assets/js/require-frontend.min.js
public/assets/js/backend.js
查看文件 @
2ad4650
...
...
@@ -104,7 +104,7 @@ define(['fast', 'template', 'moment'], function (Fast, Template, Moment) {
refreshmenu
:
function
()
{
top
.
window
.
$
(
".sidebar-menu"
).
trigger
(
"refresh"
);
},
gettablecolumnbutton
:
function
(
options
)
{
gettablecolumnbutton
:
function
(
options
)
{
if
(
typeof
options
.
tableId
!==
'undefined'
&&
typeof
options
.
fieldIndex
!==
'undefined'
&&
typeof
options
.
buttonIndex
!==
'undefined'
)
{
var
tableOptions
=
$
(
"#"
+
options
.
tableId
).
bootstrapTable
(
'getOptions'
);
if
(
tableOptions
)
{
...
...
@@ -226,8 +226,10 @@ define(['fast', 'template', 'moment'], function (Fast, Template, Moment) {
});
}
//tooltip和popover
$
(
'body'
).
tooltip
({
selector
:
'[data-toggle="tooltip"]'
});
$
(
'body'
).
tooltip
({
selector
:
'[data-toggle="popover"]'
});
if
(
!
(
'ontouchstart'
in
document
.
documentElement
))
{
$
(
'body'
).
tooltip
({
selector
:
'[data-toggle="tooltip"]'
});
}
$
(
'body'
).
popover
({
selector
:
'[data-toggle="popover"]'
});
}
};
Backend
.
api
=
$
.
extend
(
Fast
.
api
,
Backend
.
api
);
...
...
public/assets/js/frontend.js
查看文件 @
2ad4650
...
...
@@ -50,8 +50,10 @@ define(['fast', 'template'], function (Fast, Template) {
return
false
;
});
//tooltip和popover
$
(
'body'
).
tooltip
({
selector
:
'[data-toggle="tooltip"]'
});
$
(
'body'
).
tooltip
({
selector
:
'[data-toggle="popover"]'
});
if
(
!
(
'ontouchstart'
in
document
.
documentElement
))
{
$
(
'body'
).
tooltip
({
selector
:
'[data-toggle="tooltip"]'
});
}
$
(
'body'
).
popover
({
selector
:
'[data-toggle="popover"]'
});
}
};
Frontend
.
api
=
$
.
extend
(
Fast
.
api
,
Frontend
.
api
);
...
...
public/assets/js/require-backend.min.js
查看文件 @
2ad4650
...
...
@@ -5330,7 +5330,7 @@ define('backend',['fast', 'template', 'moment'], function (Fast, Template, Momen
refreshmenu
:
function
()
{
top
.
window
.
$
(
".sidebar-menu"
).
trigger
(
"refresh"
);
},
gettablecolumnbutton
:
function
(
options
)
{
gettablecolumnbutton
:
function
(
options
)
{
if
(
typeof
options
.
tableId
!==
'undefined'
&&
typeof
options
.
fieldIndex
!==
'undefined'
&&
typeof
options
.
buttonIndex
!==
'undefined'
)
{
var
tableOptions
=
$
(
"#"
+
options
.
tableId
).
bootstrapTable
(
'getOptions'
);
if
(
tableOptions
)
{
...
...
@@ -5452,8 +5452,10 @@ define('backend',['fast', 'template', 'moment'], function (Fast, Template, Momen
});
}
//tooltip和popover
$
(
'body'
).
tooltip
({
selector
:
'[data-toggle="tooltip"]'
});
$
(
'body'
).
tooltip
({
selector
:
'[data-toggle="popover"]'
});
if
(
!
(
'ontouchstart'
in
document
.
documentElement
))
{
$
(
'body'
).
tooltip
({
selector
:
'[data-toggle="tooltip"]'
});
}
$
(
'body'
).
popover
({
selector
:
'[data-toggle="popover"]'
});
}
};
Backend
.
api
=
$
.
extend
(
Fast
.
api
,
Backend
.
api
);
...
...
@@ -10389,14 +10391,14 @@ define("drop", function(){});
var
title
=
$
(
this
).
attr
(
'title'
)
?
$
(
this
).
attr
(
'title'
)
:
$
.
trim
(
$
(
this
).
text
());
var
url
=
$
(
this
).
attr
(
'url'
);
var
content
=
options
.
content
?
options
.
content
:
$
(
this
).
attr
(
'content'
);
var
ajax
=
$
(
this
).
attr
(
'ajax'
)
?
true
:
false
;
var
ajax
=
$
(
this
).
attr
(
'ajax'
)
===
'1'
||
$
(
this
).
attr
(
'ajax'
)
===
'true'
;
var
state
=
({
url
:
url
,
title
:
title
,
id
:
id
,
content
:
content
,
ajax
:
ajax
});
document
.
title
=
title
;
if
(
history
.
pushState
&&
!
$
(
this
).
data
(
"pushstate"
))
{
var
pushurl
=
url
.
indexOf
(
"ref=addtabs"
)
==
-
1
?
(
url
+
(
url
.
indexOf
(
"?"
)
>
-
1
?
"&"
:
"?"
)
+
"ref=addtabs"
)
:
url
;
var
pushurl
=
url
.
indexOf
(
"ref=addtabs"
)
==
=
-
1
?
(
url
+
(
url
.
indexOf
(
"?"
)
>
-
1
?
"&"
:
"?"
)
+
"ref=addtabs"
)
:
url
;
try
{
window
.
history
.
pushState
(
state
,
title
,
pushurl
);
}
catch
(
e
)
{
...
...
@@ -10414,27 +10416,27 @@ define("drop", function(){});
}
});
navobj
.
on
(
'click'
,
'.close-tab'
,
function
(
e
)
{
id
=
$
(
this
).
prev
(
"a"
).
attr
(
"aria-controls"
);
navobj
.
on
(
'click'
,
'.close-tab'
,
function
()
{
var
id
=
$
(
this
).
prev
(
"a"
).
attr
(
"aria-controls"
);
_close
(
id
);
return
false
;
});
navobj
.
on
(
'dblclick'
,
'li[role=presentation]'
,
function
(
e
)
{
navobj
.
on
(
'dblclick'
,
'li[role=presentation]'
,
function
()
{
$
(
this
).
find
(
".close-tab"
).
trigger
(
"click"
);
});
navobj
.
on
(
'click'
,
'li[role=presentation]'
,
function
(
e
)
{
navobj
.
on
(
'click'
,
'li[role=presentation]'
,
function
()
{
$
(
"a[addtabs="
+
$
(
"a"
,
this
).
attr
(
"node-id"
)
+
"]"
).
trigger
(
"click"
);
});
$
(
window
).
resize
(
function
()
{
if
(
typeof
options
.
nav
==
'object'
)
{
if
(
typeof
options
.
nav
==
=
'object'
)
{
var
siblingsWidth
=
0
;
navobj
.
siblings
().
each
(
function
()
{
siblingsWidth
+=
$
(
this
).
outerWidth
();
});
navobj
.
width
(
navobj
.
parent
().
width
()
-
siblingsWidth
);
}
else
{
$
(
"#nav"
).
width
(
$
(
"#header
> .navbar"
).
width
()
-
$
(
".sidebar-toggle"
).
outerWidth
()
-
$
(
".navbar-custom-menu"
).
outerWidth
()
-
20
);
$
(
"#nav"
).
width
(
$
(
"#header
"
).
find
(
"
> .navbar"
).
width
()
-
$
(
".sidebar-toggle"
).
outerWidth
()
-
$
(
".navbar-custom-menu"
).
outerWidth
()
-
20
);
}
_drop
();
});
...
...
@@ -10446,36 +10448,41 @@ define("drop", function(){});
conid
=
'con_'
+
opts
.
id
;
url
=
opts
.
url
;
url
+=
(
opts
.
url
.
indexOf
(
"?"
)
>
-
1
?
"&addtabs=1"
:
"?addtabs=1"
);
var
tabitem
=
$
(
'#'
+
tabid
,
navobj
);
var
conitem
=
$
(
'#'
+
conid
,
tabobj
);
navobj
.
find
(
"[role='presentation']"
).
removeClass
(
'active'
);
tabobj
.
find
(
"[role='tabpanel']"
).
removeClass
(
'active'
);
//如果TAB不存在,创建一个新的TAB
if
(
$
(
"#"
+
tabid
).
size
()
==
0
)
{
if
(
tabitem
.
size
()
=
==
0
)
{
//创建新TAB的title
t
itle
=
$
(
'<li role="presentation" id="'
+
tabid
+
'"><a href="#'
+
conid
+
'" node-id="'
+
opts
.
id
+
'" aria-controls="'
+
id
+
'" role="tab" data-toggle="tab">'
+
opts
.
title
+
'</a></li>'
);
t
abitem
=
$
(
'<li role="presentation" id="'
+
tabid
+
'"><a href="#'
+
conid
+
'" node-id="'
+
opts
.
id
+
'" aria-controls="'
+
id
+
'" role="tab" data-toggle="tab">'
+
opts
.
title
+
'</a></li>'
);
//是否允许关闭
if
(
options
.
close
&&
$
(
"li"
,
navobj
).
size
()
>
0
)
{
t
itle
.
append
(
' <i class="close-tab fa fa-remove"></i>'
);
t
abitem
.
append
(
' <i class="close-tab fa fa-remove"></i>'
);
}
//创建新TAB的内容
con
tent
=
$
(
'<div role="tabpanel" class="tab-pane" id="'
+
conid
+
'"></div>'
);
con
item
=
$
(
'<div role="tabpanel" class="tab-pane" id="'
+
conid
+
'"></div>'
);
//是否指定TAB内容
if
(
opts
.
content
)
{
con
tent
.
append
(
opts
.
content
);
con
item
.
append
(
opts
.
content
);
}
else
if
(
options
.
iframeUse
&&
!
opts
.
ajax
)
{
//没有内容,使用IFRAME打开链接
var
height
=
options
.
iframeHeight
;
con
tent
.
append
(
'<iframe src="'
+
url
+
'" width="100%" height="'
+
height
+
'" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes"></iframe></div>'
);
con
item
.
append
(
'<iframe src="'
+
url
+
'" width="100%" height="'
+
height
+
'" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes"></iframe></div>'
);
}
else
{
$
.
get
(
url
,
function
(
data
)
{
con
tent
.
append
(
data
);
con
item
.
append
(
data
);
});
}
//加入TABS
if
(
$
(
'.tabdrop li'
).
size
()
>
0
)
{
$
(
'.tabdrop ul'
).
append
(
title
);
if
(
$
(
'.tabdrop li'
,
navobj
).
size
()
>
0
)
{
$
(
'.tabdrop ul'
,
navobj
).
append
(
tabitem
);
}
else
{
navobj
.
append
(
t
itle
);
navobj
.
append
(
t
abitem
);
}
tabobj
.
append
(
con
tent
);
tabobj
.
append
(
con
item
);
}
else
{
//强制刷新iframe
if
(
options
.
iframeForceRefresh
)
{
...
...
@@ -10486,27 +10493,31 @@ define("drop", function(){});
}
localStorage
.
setItem
(
"addtabs"
,
$
(
this
).
prop
(
'outerHTML'
));
//激活TAB
$
(
"#"
+
tabid
).
addClass
(
'active'
);
$
(
"#"
+
conid
).
addClass
(
"active"
);
tabitem
.
addClass
(
'active'
);
conitem
.
addClass
(
"active"
);
_drop
();
};
var
_close
=
function
(
id
)
{
var
tabid
=
'tab_'
+
id
;
var
conid
=
'con_'
+
id
;
var
tabitem
=
$
(
'#'
+
tabid
,
navobj
);
var
conitem
=
$
(
'#'
+
conid
,
tabobj
);
//如果关闭的是当前激活的TAB,激活他的前一个TAB
if
(
obj
.
find
(
"li.active"
).
not
(
'.tabdrop'
).
attr
(
'id'
)
==
tabid
)
{
if
(
$
(
"#"
+
tabid
).
prev
().
not
(
".tabdrop"
).
size
()
>
0
)
{
$
(
"#"
+
tabid
).
prev
().
not
(
".tabdrop"
).
find
(
"a"
).
trigger
(
"click"
);
}
else
if
(
$
(
"#"
+
tabid
).
next
().
size
()
>
0
)
{
$
(
"#"
+
tabid
).
next
().
trigger
(
"click"
);
if
(
obj
.
find
(
"li.active"
).
not
(
'.tabdrop'
).
attr
(
'id'
)
===
tabid
)
{
var
prev
=
tabitem
.
prev
().
not
(
".tabdrop"
);
var
next
=
tabitem
.
next
().
not
(
".tabdrop"
);
if
(
prev
.
size
()
>
0
)
{
prev
.
find
(
'a'
).
trigger
(
"click"
);
}
else
if
(
next
.
size
()
>
0
)
{
next
.
find
(
'a'
).
trigger
(
"click"
);
}
else
{
$
(
">li:last > a"
,
navobj
).
trigger
(
'click'
);
$
(
">li:
not(.tabdrop):
last > a"
,
navobj
).
trigger
(
'click'
);
}
}
//关闭TAB
$
(
"#"
+
tabid
).
remove
();
$
(
"#"
+
conid
).
remove
();
tabitem
.
remove
();
conitem
.
remove
();
_drop
();
options
.
callback
();
};
...
...
@@ -10519,11 +10530,11 @@ define("drop", function(){});
$
.
fn
.
refreshAddtabs
=
function
()
{
var
navobj
=
$
(
this
);
var
dropdown
=
$
(
".tabdrop"
,
navobj
);
if
(
dropdown
.
size
()
==
0
)
{
var
dropdown
=
$
(
'<li class="dropdown pull-right hide tabdrop"><a class="dropdown-toggle" data-toggle="dropdown" href="javascript:;">'
+
if
(
dropdown
.
size
()
===
0
)
{
dropdown
=
$
(
'<li class="dropdown pull-right hide tabdrop"><a class="dropdown-toggle" data-toggle="dropdown" href="javascript:;">'
+
'<i class="glyphicon glyphicon-align-justify"></i>'
+
' <b class="caret"></b></a><ul class="dropdown-menu"></ul></li>'
);
dropdown
.
ap
pendTo
(
navobj
);
dropdown
.
pre
pendTo
(
navobj
);
}
//检测是否有下拉样式
...
...
@@ -10538,11 +10549,11 @@ define("drop", function(){});
//检查超过一行的标签页
var
litabs
=
navobj
.
append
(
dropdown
.
find
(
'li'
)).
find
(
'>li'
).
not
(
'.tabdrop'
);
var
totalwidth
=
0
;
litabs
.
each
(
function
(
i
,
j
)
{
litabs
.
each
(
function
()
{
totalwidth
+=
$
(
this
).
outerWidth
(
true
);
});
if
(
navobj
.
width
()
<
totalwidth
)
{
litabs
.
each
(
function
(
i
,
j
)
{
litabs
.
each
(
function
()
{
liwidth
+=
$
(
this
).
outerWidth
(
true
);
if
(
liwidth
>
maxwidth
)
{
dropdown
.
find
(
'ul'
).
append
(
$
(
this
));
...
...
@@ -10551,7 +10562,7 @@ define("drop", function(){});
});
if
(
collection
>
0
)
{
dropdown
.
removeClass
(
'hide'
);
if
(
dropdown
.
find
(
'.active'
).
length
==
1
)
{
if
(
dropdown
.
find
(
'.active'
).
length
==
=
1
)
{
dropdown
.
addClass
(
'active'
);
}
else
{
dropdown
.
removeClass
(
'active'
);
...
...
public/assets/js/require-frontend.min.js
查看文件 @
2ad4650
...
...
@@ -1040,8 +1040,10 @@ define('frontend',['fast', 'template'], function (Fast, Template) {
return
false
;
});
//tooltip和popover
$
(
'body'
).
tooltip
({
selector
:
'[data-toggle="tooltip"]'
});
$
(
'body'
).
tooltip
({
selector
:
'[data-toggle="popover"]'
});
if
(
!
(
'ontouchstart'
in
document
.
documentElement
))
{
$
(
'body'
).
tooltip
({
selector
:
'[data-toggle="tooltip"]'
});
}
$
(
'body'
).
popover
({
selector
:
'[data-toggle="popover"]'
});
}
};
Frontend
.
api
=
$
.
extend
(
Fast
.
api
,
Frontend
.
api
);
...
...
请
注册
或
登录
后发表评论