Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-portal-fe
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
姜敏
9 years ago
Commit
919fad2ae45d485201f20a1e23c392a4fb0dcb06
1 parent
845673fb
资源位-品牌初步
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
206 additions
and
19 deletions
client/js/sourceManage/resourceContentManage.js
server/views/partials/resource/jiangming.html
client/js/sourceManage/resourceContentManage.js
View file @
919fad2
var
$
=
require
(
'jquery'
),
common
=
require
(
'../common/common'
);
var
Button
=
require
(
'./partials/Button1'
);
/*获取数据*/
...
...
@@ -18,8 +17,59 @@ common.util.__ajax({
var
edit
=
new
common
.
edit
(
".modal-body"
,
{
bucket
:
"goodsimg"
});
var
Bll
=
{
Brands
:
[],
Brands1
:
{},
Brdata
:
[],
//获取品牌
getBrands
:
function
()
{
var
Brand
=
{};
$
.
get
(
"/ajax/yohosearch"
,
function
(
res
)
{
res
.
data
.
forEach
(
function
(
item
,
index
)
{
var
brandAlif
=
(
item
.
brand_alif
||
""
).
toUpperCase
();
if
(
/^
[
0-9
]
$/
.
test
(
item
.
brand_alif
))
{
brandAlif
=
"0-9"
;
}
if
(
/^
\W
$/
.
test
(
item
.
brand_alif
))
{
brandAlif
=
"#"
;
}
Brand
[
brandAlif
]
=
Brand
[
brandAlif
]
||
[];
Brand
[
brandAlif
].
push
(
item
);
Bll
.
Brands1
[
item
.
id
]
=
item
;
});
for
(
var
i
in
Brand
)
{
Brand
[
i
].
sort
(
function
(
a
,
b
)
{
var
aName
=
a
.
brand_name
.
toLowerCase
(),
bName
=
b
.
brand_name
.
toLowerCase
();
if
(
aName
<
bName
)
return
-
1
;
if
(
aName
>
bName
)
return
1
;
return
0
;
});
Bll
.
Brands
.
push
({
name
:
i
,
items
:
Brand
[
i
]
});
}
});
},
renderBrandPic
:
function
(
Brdata
)
{
var
Brands2
=
[];
Brdata
.
forEach
(
function
(
item
,
index
)
{
if
(
!
item
.
brandIco
){
var
a
=
Bll
.
Brands1
[
item
.
id
]
a
.
brandIco
=
common
.
util
.
__joinImg
(
"brandLogo"
,
a
.
brand_ico
)
Brands2
.
push
(
a
);
}
else
{
item
.
brandIco
=
common
.
util
.
__template
(
item
.
brandIco
,{
width
:
110
,
height
:
150
});
Brands2
.
push
(
item
);
}
});
$
(
"#addBrands"
).
parent
(
"div"
).
parent
(
"li"
).
prevAll
().
remove
();
$
(
"#addPic"
).
prepend
(
common
.
util
.
__template2
(
$
(
"#template3"
).
html
(),
{
Brands
:
Brands2
}));
},
__render
:
function
(
selecter
,
templater
,
data
){
$
(
selecter
).
html
(
common
.
util
.
__template2
(
$
(
"#"
+
templater
).
html
(),
data
)
);
},
...
...
@@ -193,6 +243,32 @@ $(document).on("click", '#icon-delOne', function() {
Bll
.
module
.
contentData
.
data
.
splice
(
index
,
1
);
Bll
.
renderDialog
(
"icon-template"
);
});
//获取品牌
Bll
.
getBrands
();
/*渲染品牌*/
Bll
.
Brdata
=
ViewModel
.
brandList
||
[];
Bll
.
renderBrandPic
(
Bll
.
Brdata
);
//打开品牌选择模态
$
(
document
).
on
(
"click"
,
"#addBrands"
,
function
()
{
var
e
=
new
common
.
edit
(
"#brandForm"
);
console
.
log
(
"BLL"
,
Bll
);
console
.
log
(
"Bll.Brands"
,
Bll
.
Brands
);
common
.
dialog
.
confirm
(
"选择品牌"
,
common
.
util
.
__template2
(
$
(
"#template5"
).
html
(),
{
Brands
:
Bll
.
Brands
,
Brdata
:
Bll
.
Brdata
.
join
(
'|'
)
}),
function
()
{
//todo
Bll
.
Brdata
=
$
(
"#brandCheckBox"
).
val
().
split
(
'|'
);
Bll
.
Brdata
=
Bll
.
Brdata
.
map
(
function
(
item
,
index
)
{
return
{
"brandCategory"
:
"1"
,
"id"
:
item
}
});
Bll
.
renderBrandPic
(
Bll
.
Brdata
);
});
e
.
init
();
});
/*自定义参数*/
$
(
document
).
on
(
"click"
,
'.paramsGroupDel'
,
function
()
{
console
.
log
(
$
(
this
).
data
(
"index"
));
...
...
server/views/partials/resource/jiangming.html
View file @
919fad2
...
...
@@ -22,31 +22,26 @@
<
/td
>
<
td
>
<
div
class
=
"col-sm-12"
>
<
label
class
=
"col-sm-2"
>
跳转目的
<
/label
>
<
select
name
=
"goTo"
class
=
"form-control observe"
value
=
"[[item.url.action]]"
<
select
name
=
"goTo"
class
=
"col-sm-4 observe"
value
=
"[[item.url.action]]"
data
-
field
=
"[[index]].url.action"
>
[[
layout
action_template
]]
<
/select
>
<
/div
>
<
div
class
=
"col-sm-12"
>
<
label
class
=
"col-sm-2"
>
图片链接
<
/label
>
<
input
value
=
"[[item.url.url]]"
class
=
"form-control observe"
required
=
"required"
data
-
field
=
"[[index]].url.url"
/>
<
div
class
=
"col-sm-1"
><
/div
>
<
input
value
=
"[[item.url.url]]"
class
=
" col-sm-4 observe"
required
=
"required"
data
-
field
=
"[[index]].url.url"
placeholder
=
"图片链接"
/>
<
p
style
=
"color:#999;margin-top: 5px;"
>
注:
链接中不能有英文单引号
<
/p
>
<
p
style
=
"color:#999;margin-top: 5px;"
>
链接中不能有英文单引号
<
/p
>
<
/div
>
<
div
class
=
"col-sm-12"
>
<
label
class
=
"col-sm-2"
>
图片描述
<
/label
>
<
input
value
=
"[[item.alt]]"
class
=
"form-control observe"
required
=
"required"
data
-
field
=
"[[index]].alt"
/>
<
/div
>
<
input
value
=
"[[item.alt]]"
class
=
"col-sm-4 observe"
required
=
"required"
data
-
field
=
"[[index]].alt"
placeholder
=
"图片描述"
/>
<
div
class
=
"col-sm-1"
><
/div
>
[[
if
contentData
.
template_name
==
'addfloor'
]]
<
div
class
=
"col-sm-12"
>
<
label
class
=
"col-sm-2"
>
英文描述
<
/label
>
<
input
value
=
"[[item.altEn]]"
class
=
"form-control observe"
required
=
"required"
data
-
field
=
"list.[[index]].altEn"
/>
<
/div
>
<
input
value
=
"[[item.altEn]]"
class
=
"col-sm-4 observe"
required
=
"required"
data
-
field
=
"list.[[index]].altEn"
placeholder
=
"英文描述"
/>
[[
/if]
]
<
/div
>
<
/td
>
<
td
>
<
a
class
=
"btn btn-danger"
id
=
"icon-delOne"
data_index
=
"[[index]]"
>
删除
<
/a
>
...
...
@@ -58,4 +53,120 @@
<
/div
>
<
a
href
=
"JavaScript:;"
id
=
"icon-addOne"
class
=
"btn btn-primary btn-xs"
>
添加一个
<
/a
>
<
/div
>
</script>
<!-- 推荐品牌-->
<script
type=
"text/template"
id=
"brands-template"
>
<
div
class
=
"rows"
id
=
"brands1"
>
[[
if
contentData
.
template_name
==
'appHotBrands'
]]
<
div
class
=
"form-group col-sm-12"
>
<
label
class
=
"col-sm-1 control-label"
>
标题
<
/label
>
<
input
class
=
"col-sm-2"
type
=
"text"
value
=
"[[contentData.data.title.title]]"
data
-
field
=
"title.title"
placeholder
=
"推荐品牌"
>
<
label
class
=
"col-sm-1 control-label"
>
显示名称
<
/label
>
<
div
class
=
"col-sm-2 "
>
<
label
style
=
"cursor: pointer;"
><
input
type
=
"radio"
name
=
"is_show_name"
value
=
"Y"
>
是
<
/label
>
<
label
style
=
"cursor: pointer;"
><
input
type
=
"radio"
name
=
"is_show_name"
value
=
"N"
>
否
<
/label
>
<
/div
>
<
input
type
=
"hidden"
id
=
"is_show_name"
value
=
"[[contentData.data.is_show_name]]"
data
-
field
=
"is_show_name"
for
=
"radio"
/>
<
/div
>
[[
/if]
]
[[
if
contentData
.
template_name
==
'customBrands'
]]
<
div
class
=
"form-group col-sm-12"
>
<
label
class
=
"col-sm-1 control-label"
>
标题
<
/label
>
<
input
class
=
"col-sm-2 "
type
=
"text"
value
=
"[[contentData.data.title.title]]"
data
-
field
=
"title.title"
placeholder
=
"自定义品牌"
>
<
label
class
=
"col-sm-1 control-label"
>
附加参数
<
/label
>
<
select
class
=
"col-sm-2 "
value
=
"[[contentData.data.title.param]]"
>
<
option
value
=
"-1"
>
请选择附加参数
<
/option
>
<
option
value
=
"1"
>
大分类
<
/option
>
<
/select
>
<
label
class
=
"col-sm-1 control-label"
>
附加参数值
<
/label
>
<
input
class
=
"col-sm-2"
type
=
"text"
value
=
"[[contentData.data.title.param_value]]"
data
-
field
=
"title.param_value"
placeholder
=
"附加参数值"
>
<
/div
>
[[
/if]
]
[[
if
contentData
.
template_name
==
'kidsBrands'
]]
<
div
class
=
"form-group col-sm-12"
>
<
label
class
=
"col-sm-1 control-label"
>
标题
<
/label
>
<
input
class
=
"col-sm-2 "
type
=
"text"
value
=
"[[contentData.data.params.title]]"
data
-
field
=
"params.title"
>
<
label
class
=
"col-sm-1 control-label"
>
分类
<
/label
>
<
select
class
=
"col-sm-2 "
value
=
"[[contentData.data.params.param]]"
data
-
field
=
"params.param"
>
<
option
value
=
"-1"
>
请选择附加参数
<
/option
>
<
option
value
=
"1"
>
大分类
<
/option
>
<
/select
>
<
label
class
=
"col-sm-1 control-label"
>
附加参数值
<
/label
>
<
input
class
=
"col-sm-2 "
type
=
"text"
value
=
"[[contentData.data.params.paramValue]]"
data
-
field
=
"params.paramValue"
placeholder
=
"附加参数值"
>
<
/div
>
<
div
class
=
"form-group col-sm-12"
>
<
label
class
=
"col-sm-1 control-label"
>
跳转目的
<
/label
>
<
select
name
=
"goTo"
class
=
"col-sm-2 observe"
value
=
"[[contentData.data.params.more]]"
data
-
field
=
"params.more"
>
[[
layout
action_template
]]
<
/select
>
<
label
class
=
"col-sm-1 control-label"
>
链接
<
/label
>
<
input
value
=
"[[contentData.data.params.more_url]]"
class
=
"col-sm-2 observe"
required
=
"required"
data
-
field
=
"params.more_url"
/>
<
p
style
=
"color:#999;margin-top: 5px;"
>
注:链接中不能有英文单引号
<
/p
>
<
/div
>
[[
/if]
]
<
div
class
=
"form-group"
>
<
label
class
=
"col-sm-2 control-label"
>
添加品牌:
<
/label
>
<
div
class
=
"col-sm-8"
>
<
ul
class
=
"cover-image-list col-sm-10"
id
=
"addPic"
style
=
"padding: 0;margin: 0;"
>
<
li
class
=
"cover-image-item fileinput-button"
>
<
div
class
=
"goods-img"
>
<
a
class
=
"fileinput-button-icon"
href
=
"javascript:void(0);"
id
=
"addBrands"
>+<
/a
>
<
/div
>
<
/li
>
<
/ul
>
<
/div
>
<
/div
>
<
/div
>
<
div
id
=
"brands2"
>
<
/div
>
</script>
<!--品牌选择模态-->
<script
type=
"text/template"
id=
"template5"
>
<
div
class
=
"row"
id
=
"brandForm"
>
<
div
class
=
"form-group"
>
[[
each
Brands
as
brand
index
]]
<
a
class
=
"btn brand-index"
href
=
"#[[brand.name]]"
>
[[
brand
.
name
]]
<
/a
>
[[
/each]
]
<
/div
>
<
div
class
=
"form-group brand-wrap"
style
=
"height: 400px;overflow: auto;"
>
[[
each
Brands
as
brand
index
]]
<
div
class
=
"form-group"
name
=
"[[brand.name]]"
>
[[
each
brand
.
items
as
item
__index
]]
<
a
class
=
"btn"
>
<
input
type
=
"checkbox"
value
=
"[[item.id]]"
name
=
"brandCheckBox"
>
<
label
>
[[
item
.
brand_name
]]
<
/label
>
<
/a
>
[[
/each]
]
<
/div
>
[[
/each]
]
<
/div
>
<
input
type
=
"hidden"
id
=
"brandCheckBox"
for
=
"checkbox"
value
=
"[[Brdata]]"
/>
<
/div
>
</script>
<script
type=
"text/template"
id=
"template3"
>
[[
each
Brands
as
brand
index
]]
<
li
class
=
"cover-image-item image-list"
data
-
index
=
"2"
>
<
div
class
=
"goods-img"
>
<
a
class
=
"fileinput-button-icon"
href
=
"javascript:void(0);"
>
<
img
src
=
"[[brand.brandIco]]"
>
<
/a
>
<
i
class
=
"remove-item-btn remove1 glyphicon glyphicon-remove-circle"
data
-
index
=
"[[index]]"
><
/i
>
<
/div
>
<
div
class
=
"col-sm-12"
>
<
label
class
=
"col-sm-6"
>
图片名称
<
/label
>
<
input
class
=
"col-sm-6"
type
=
"text"
value
=
"[[brand.title]]"
data
-
field
=
"brand.title"
>
<
/div
>
<
/li
>
[[
/each]
]
</script>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment