Authored by weiqingting

逛-内容

... ... @@ -15,7 +15,7 @@ if(param&&param.length==1){
async:false
},function(res){
ViewModel=res.data;
});
},true);
}
console.log("ViewModel",ViewModel);
... ... @@ -59,6 +59,15 @@ var Bll = {
});
},
renderBrandPic: function(Brdata) {
var map2={};
Brdata.forEach(function(item){
map2[item.id]=item;
});
Brdata=[];
for(var key in map2){
Brdata.push(map2[key]);
}
var Brands2 = [];
Brdata.forEach(function(item, index) {
if(!item.brandIco){
... ... @@ -75,6 +84,7 @@ var Bll = {
$("#addPic").prepend(common.util.__template2($("#template3").html(), {
Brands: Brands2
}));
return Brdata;
},
contentDatas: [],
module: null,
... ... @@ -226,14 +236,22 @@ $(document).on("click", "#addBrands", function() {
Brdata: Bll.Brdata.join('|')
}), function() {
//todo
Bll.Brdata = $("#brandCheckBox").val().split('|');
Bll.Brdata = Bll.Brdata.map(function(item, index) {
return {
"brandCategory": "1",
// Bll.Brdata = $("#brandCheckBox").val().split('|');
// Bll.Brdata = Bll.Brdata.map(function(item, index) {
// return {
// "brandCategory": "1",
// "id": item
// }
// });
$("#brandCheckBox").val().split('|').forEach(function(item){
Bll.Brdata.push({
"brandCategory": "1",
"id": item
}
});
Bll.renderBrandPic(Bll.Brdata);
});
});
Bll.Brdata=Bll.renderBrandPic(Bll.Brdata);
});
e.init();
});
... ... @@ -479,7 +497,11 @@ var e = new common.edit("#panel-body", {
bucket: "article"
});
e.init();
e.on("validate",function(){
if(Bll.contentDatas.length==0&&$("#url").val()==""){
return "内容和链接不可为空";
}
})
$(document).on("click", "#submit", function() {
e.submit($("#panel-body").attr("action"), function(option) {
if(param&&param.length==1){
... ... @@ -505,7 +527,7 @@ $(document).on("click", "#submit", function() {
res = res.data;
if(res.code == "200") {
e.$tip("提交成功", function() {
//location.href="/supplier/baseproduct/index"
location.href="/guang/article/index"
}, 'growl-success');
}else{
e.$tip(res.message);
... ... @@ -557,7 +579,7 @@ $(document).on("click","#brandAutoBtn",function(){
});
}
});
product_skc=["51022754","51178582","50030519","51128961","51146105","51055462","51143090","51153133","51010047","51153223","51152761","51149414","51082157","51149561","51079256"];
//product_skc=["51022754","51178582","50030519","51128961","51146105","51055462","51143090","51153133","51010047","51153223","51152761","51149414","51082157","51149561","51079256"];
if(product_skc.length>0){
common.util.__ajax({
url:'/yohosearch/search',
... ... @@ -573,7 +595,8 @@ $(document).on("click","#brandAutoBtn",function(){
map[item.product_skn]={
id:item.brand_id,
brandIco:item.brand_ico,
brandName:item.brand_name
brandName:item.brand_name,
brandCategory:1
};
});
console.log(map);
... ... @@ -585,17 +608,17 @@ $(document).on("click","#brandAutoBtn",function(){
});
//console.log(b);
Bll.Brdata=(ViewModel.brandList||[]).concat(b);
var map2={};
Bll.Brdata.forEach(function(item){
map2[item.id]=item;
});
Bll.Brdata=[];
for(var key in map2){
Bll.Brdata.push(map2[key]);
}
Bll.renderBrandPic(Bll.Brdata);
// var map2={};
// Bll.Brdata.forEach(function(item){
// map2[item.id]=item;
// });
// Bll.Brdata=[];
// for(var key in map2){
// Bll.Brdata.push(map2[key]);
// }
Bll.Brdata=Bll.renderBrandPic(Bll.Brdata);
}
});
},true);
}
});
... ...
... ... @@ -563,7 +563,8 @@ exports.res = [
view:'pages/guang/contentEdit',
src:'/guang/contentEdit',
data:{
action:"/ajax/guang/article/addArticle"
action:"/ajax/guang/article/addArticle",
pageTitle:"添加文章"
}
},
{
... ... @@ -615,7 +616,8 @@ exports.res = [
view:'pages/guang/contentEdit',
src:'/guang/contentEdit',
data:{
action:"/ajax/guang/article/updateArticle"
action:"/ajax/guang/article/updateArticle",
pageTitle:"修改文章"
},
params:[
{name:"id",type:"Number"}
... ...
... ... @@ -7,11 +7,11 @@
<ul class="breadcrumb">
<li><a href=""><i class="glyphicon glyphicon-home"></i></a></li>
<li><a href="/guang/article/index">文章管理</a></li>
<li>添加文章</li>
<li>{{pageTitle}}</li>
</ul>
<div>
<h4>添加文章</h4>
<h4>{{pageTitle}}</h4>
</div>
</div>
</div><!-- media -->
... ...