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
Plain Diff
Browse Files
Authored by
weiqingting
9 years ago
Commit
3c16caf4aabd48a91d1d853384f6f6b294c77dd4
2 parents
bf405578
9d7aa80d
Merge branch 'develop' of
http://git.dev.yoho.cn/platform/yohobuy-portal-fe
into develop
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
237 additions
and
23 deletions
client/js/sourceManage/resourceContentManage.js
server/views/partials/resource/jiangming.html
client/js/sourceManage/resourceContentManage.js
View file @
3c16caf
var
$
=
require
(
'jquery'
),
common
=
require
(
'../common/common'
);
var
Button
=
require
(
'./partials/Button1'
);
/*获取数据*/
...
...
@@ -18,13 +17,15 @@ common.util.__ajax({
var
edit
=
new
common
.
edit
(
".modal-body"
,
{
bucket
:
"goodsimg"
});
var
Bll
=
{
Brands
:
[],
Brands1
:
{},
Brdata
:
[],
contentDatas
:[],
module
:
null
,
__render
:
function
(
selecter
,
templater
,
data
){
$
(
selecter
).
html
(
common
.
util
.
__template2
(
$
(
"#"
+
templater
).
html
(),
data
)
);
},
contentDatas
:[],
module
:
null
,
toast
:
function
(
index
,
module
)
{
var
d
=
new
common
.
dialog
({
title
:
(
!!~
index
?
"修改"
:
"添加"
)
+
module
.
contentData
.
template_intro
,
...
...
@@ -65,8 +66,76 @@ var Bll={
}
});
},
//获取品牌
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
];
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
);
}
});
Bll
.
module
=
Bll
.
module
||
{};
Bll
.
module
.
contentData
=
Bll
.
module
.
contentData
||
{};
Bll
.
module
.
contentData
.
data
=
Bll
.
module
.
contentData
.
data
||
{};
Bll
.
module
.
contentData
.
data
.
list
=
Bll
.
module
.
contentData
.
data
.
list
||
[];
for
(
var
i
=
0
;
i
<
Brands2
.
length
;
i
++
){
var
pic
=
{};
if
(
Bll
.
module
.
contentData
.
template_name
==
"kidsBrands"
){
pic
=
{
"src"
:
Brands2
[
i
].
brandIco
,
"id"
:
Brands2
[
i
].
id
,
"title"
:
Brands2
[
i
].
brand_name
};
}
else
{
pic
=
{
"src"
:
Brands2
[
i
].
brandIco
,
"id"
:
Brands2
[
i
].
id
,
"name"
:
Brands2
[
i
].
brand_name
};
}
Bll
.
module
.
contentData
.
data
.
list
.
push
(
pic
);
}
Bll
.
renderDialog
(
"brands-template"
);
}
}
}
;
...
...
@@ -127,9 +196,13 @@ $(document).on("click", ".edit", function() {
$
(
document
).
on
(
"change"
,
".observe"
,
function
()
{
var
$this
=
$
(
this
);
var
name
=
$this
.
data
(
"field"
);
console
.
log
(
"name"
);
console
.
log
(
name
);
Bll
.
module
.
contentData
.
data
=
common
.
util
.
__buildobj
(
name
,
'.'
,
Bll
.
module
.
contentData
.
data
,
function
(
obj
,
name
)
{
obj
[
name
]
=
$this
.
val
();
});
console
.
log
(
"Bll.module.contentData.data"
);
console
.
log
(
Bll
.
module
.
contentData
.
data
);
});
$
(
document
).
on
(
"click"
,
'#multiLabelImage-addImage'
,
function
()
{
...
...
@@ -193,6 +266,31 @@ $(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.Brdata"
,
Bll
.
Brdata
);
common
.
dialog
.
confirm
(
"选择品牌"
,
common
.
util
.
__template2
(
$
(
"#template5"
).
html
(),
{
Brands
:
Bll
.
Brands
,
//所有品牌数据
Brdata
:
[]
}),
function
()
{
//todo
Bll
.
Brdata
=
$
(
"#brandCheckBox"
).
val
().
split
(
'|'
);
Bll
.
renderBrandPic
(
Bll
.
Brdata
);
});
e
.
init
();
});
//删除一个品牌
$
(
document
).
on
(
"click"
,
'#remove_brand'
,
function
()
{
var
index
=
$
(
this
).
data
(
"index"
);
Bll
.
module
.
contentData
.
data
.
list
.
splice
(
index
,
1
);
Bll
.
renderDialog
(
"brands-template"
);
});
/*自定义参数*/
$
(
document
).
on
(
"click"
,
'.paramsGroupDel'
,
function
()
{
Bll
.
module
.
contentData
.
data
.
list
.
splice
(
$
(
this
).
data
(
"index"
),
1
);
...
...
server/views/partials/resource/jiangming.html
View file @
3c16caf
...
...
@@ -22,31 +22,27 @@
<
/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"
/>
<
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
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
>
<
/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"
/>
<
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'
]]
<
input
value
=
"[[item.altEn]]"
class
=
"col-sm-4 observe"
required
=
"required"
data
-
field
=
"list.[[index]].altEn"
placeholder
=
"英文描述"
/>
[[
/if]
]
<
/div
>
[[
/if]
]
<
/td
>
<
td
>
<
a
class
=
"btn btn-danger"
id
=
"icon-delOne"
data_index
=
"[[index]]"
>
删除
<
/a
>
...
...
@@ -58,4 +54,124 @@
<
/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"
>
[[
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 observe"
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 observe"
>
<
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]]"
class
=
"observe"
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 observe"
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-2 control-label"
>
附加参数值
<
/label
>
<
input
class
=
"col-sm-2 observe"
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 observe"
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"
>
促销
id
<
/option
>
<
option
value
=
"1"
>
大分类
ID
<
/option
>
<
/select
>
<
label
class
=
"col-sm-2 control-label"
>
附加参数值
<
/label
>
<
input
class
=
"col-sm-2 observe"
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
>
<
div
class
=
"panel-body"
>
<
div
>
<
table
class
=
"table table-hover table-bordered responsive dataTable no-footer"
>
<
thead
>
<
tr
>
<
th
>
品牌图标
<
/th
>
<
th
>
品牌名称
<
/th
>
<
th
>
操作
<
/th
>
<
/tr
>
<
/thead
>
<
tbody
>
[[
each
contentData
.
data
.
list
as
item
index
]]
<
tr
>
<
td
><
input
type
=
"file"
name
=
"file"
value
=
"[[item.src]]"
class
=
"observe"
data
-
field
=
"[[index]].src"
/>
<
/td
>
<
td
>
[[
if
contentData
.
template_name
==
'kidsBrands'
]]
<
input
class
=
"col-sm-8 observe"
type
=
"text"
value
=
"[[item.title]]"
data
-
field
=
"[[index]].title"
>
[[
else
]]
<
input
class
=
"col-sm-8 observe"
type
=
"text"
value
=
"[[item.name]]"
data
-
field
=
"[[index]].name"
>
[[
/if]
]
<
/td
>
<
td
>
<
a
class
=
"btn btn-danger"
id
=
"remove_brand"
data_index
=
"[[index]]"
>
删除
<
/a
>
<
/td
>
<
/tr
>
[[
/each]
]
<
/tbody
>
<
/table
>
<
/div
>
<
a
href
=
"JavaScript:;"
id
=
"addBrands"
class
=
"btn btn-primary btn-xs"
>
添加品牌
<
/a
>
<
/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>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment