Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-blk
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
1
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
姜枫
9 years ago
Commit
e3b0b07de09eac2083c7a3e5ae5ef8bc6c32138a
1 parent
167a010c
fix bug 800
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
31 deletions
doraemon/middleware/user.js
public/js/plugins/cascading-address.js
doraemon/middleware/user.js
View file @
e3b0b07
...
...
@@ -19,7 +19,6 @@ module.exports = () => {
// session 没有读取到的时候,从 cookie 读取 UID
if
(
!
req
.
user
.
uid
&&
req
.
cookies
.
_UID
)
{
req
.
user
.
uid
=
cookie
.
getUid
(
req
);
console
.
log
(
'req.user.uid'
,
req
.
user
.
uid
);
}
// 从 SESSION 中获得 USERNAME
...
...
public/js/plugins/cascading-address.js
View file @
e3b0b07
...
...
@@ -33,34 +33,40 @@ var settings = {
};
// 显示或隐藏下拉区域
function
toggleDistItem
()
{
function
toggleDistItem
(
event
)
{
var
$this
=
$
(
this
),
resetHeight
=
$this
.
css
(
'height'
),
openHeight
=
(
parseInt
(
resetHeight
.
match
(
/
\d
*/
)[
0
],
10
)
+
5
)
+
'px'
,
openAndResetHeight
=
(
parseInt
(
resetHeight
.
match
(
/
\d
*/
)[
0
],
10
)
-
5
)
+
'px'
;
var
e
=
event
||
window
.
event
;
e
.
preventDefault
&&
e
.
preventDefault
();
e
.
stopPropagation
&&
e
.
stopPropagation
();
e
.
cancelBubble
=
true
;
if
(
$this
.
hasClass
(
'closed'
))
{
// 如果有其他开着,先关掉
$
(
'.items-indicator .open'
).
each
(
function
()
{
$
(
this
).
find
(
'.iconfont'
).
replaceWith
(
'<span class="iconfont up"></span>'
)
.
end
()
.
removeClass
(
'open'
)
.
addClass
(
'closed'
)
.
css
({
height
:
resetHeight
}).
next
().
hide
();
.
end
()
.
removeClass
(
'open'
)
.
addClass
(
'closed'
)
.
css
({
height
:
resetHeight
}).
next
().
hide
();
});
// open
$this
.
find
(
'.iconfont'
).
replaceWith
(
'<span class="iconfont up"></span>'
)
.
end
()
.
removeClass
(
'closed'
)
.
addClass
(
'open'
)
.
css
({
height
:
openHeight
})
.
next
()
.
show
();
.
end
()
.
removeClass
(
'closed'
)
.
addClass
(
'open'
)
.
css
({
height
:
openHeight
})
.
next
()
.
show
();
// 有视觉差
// setTimeout(function(){
...
...
@@ -69,12 +75,12 @@ function toggleDistItem() {
}
else
{
// close
$this
.
find
(
'.iconfont'
).
replaceWith
(
'<span class="iconfont up"></span>'
)
.
end
()
.
removeClass
(
'open'
)
.
addClass
(
'closed'
)
.
css
({
height
:
openAndResetHeight
}).
next
().
hide
();
.
end
()
.
removeClass
(
'open'
)
.
addClass
(
'closed'
)
.
css
({
height
:
openAndResetHeight
}).
next
().
hide
();
}
}
...
...
@@ -92,8 +98,8 @@ function resetNextLevel(level, config) {
.
addClass
(
'empty'
)
.
text
(
config
.
defaultDes
)
.
prev
().
find
(
'.indicator-name'
)
.
text
(
config
.
indicators
[
config
.
levels
-
level
-
1
])
.
next
().
val
(
''
);
.
text
(
config
.
indicators
[
config
.
levels
-
level
-
1
])
.
next
().
val
(
''
);
}
// 选择特定省份,城市,或区县
...
...
@@ -117,9 +123,9 @@ function selectDistItem(options) {
currPanel
.
find
(
'span.checked'
).
removeClass
(
'checked'
).
prev
().
hide
();
distElement
.
addClass
(
'checked'
).
prev
().
show
();
distItem
.
find
(
'.indicator-name'
)
.
html
(
distElement
.
text
())
.
next
()
.
val
(
currAreaId
);
.
html
(
distElement
.
text
())
.
next
()
.
val
(
currAreaId
);
// 填充下一级
if
(
level
<
0
)
{
...
...
@@ -277,7 +283,7 @@ function setAddress(evt, config, level, areaId) {
// 设置label文本 和 设置areaId
currPanel
=
$
(
'#level_'
+
level
+
'_panel'
);
currPanel
.
prev
().
find
(
'.indicator-name'
).
text
(
label
)
.
next
().
val
(
distVal
);
.
next
().
val
(
distVal
);
// 侦听选择
currPanel
.
off
(
'click'
,
'.dist-name'
).
on
(
'click'
,
'.dist-name'
,
function
()
{
...
...
@@ -399,6 +405,18 @@ CascadingAddress.prototype.init = function() {
// 初始化完成,提供回调执行
el
.
trigger
(
'ca.onCreated'
);
$
(
document
).
click
(
function
()
{
$
(
'.items-indicator .open'
).
each
(
function
()
{
$
(
this
).
find
(
'.iconfont'
).
replaceWith
(
'<span class="iconfont up"></span>'
)
.
end
()
.
removeClass
(
'open'
)
.
addClass
(
'closed'
)
.
css
({
height
:
(
parseInt
(
$
(
this
).
css
(
'height'
).
match
(
/
\d
*/
)[
0
],
10
)
-
5
)
+
'px'
}).
next
().
hide
();
});
});
};
// 获取地址文本
...
...
@@ -474,9 +492,9 @@ CascadingAddress.prototype.reset = function() {
items
.
each
(
function
(
index
,
item
)
{
$
(
item
).
find
(
'span.indicator-name'
).
text
(
labels
[
index
])
.
next
().
val
(
''
)
.
parent
().
next
()
.
find
(
'span.checked'
).
removeClass
(
'checked'
).
prev
().
hide
();
.
next
().
val
(
''
)
.
parent
().
next
()
.
find
(
'span.checked'
).
removeClass
(
'checked'
).
prev
().
hide
();
});
};
...
...
Please
register
or
login
to post a comment