|
|
var $ = require('jquery'),
|
|
|
common = require('../common/common');
|
|
|
var Button=require('./partials/Button1');
|
|
|
var Button = require('./partials/Button1');
|
|
|
|
|
|
/*获取数据*/
|
|
|
var ViewModel={};
|
|
|
var ViewModel = {};
|
|
|
//资源id
|
|
|
var param = location.href.substring(location.href.lastIndexOf("/") + 1);
|
|
|
common.util.__ajax({
|
|
|
url: "/resource/content/resContentIndex",
|
|
|
url: "/resources/resContentIndex",
|
|
|
data: {id: param},
|
|
|
async:false
|
|
|
},function(res) {
|
|
|
async: false
|
|
|
}, function (res) {
|
|
|
ViewModel = res.data;
|
|
|
},true);
|
|
|
}, true);
|
|
|
|
|
|
/*配置模块*/
|
|
|
var edit = new common.edit(".modal-body", {
|
|
|
bucket: "goodsimg"
|
|
|
bucket: "yhb-img01"
|
|
|
});
|
|
|
|
|
|
var tempArr = [];
|
...
|
...
|
@@ -44,7 +44,7 @@ tempArr["addfloor"] = "icon-template"; |
|
|
tempArr["recommendContentFive"] = "recommendContent-template";
|
|
|
tempArr["textNav"] = "textNav-template";
|
|
|
tempArr["imageList"] = "imageList-template";
|
|
|
tempArr["标题标签"] = "noEdit-template";
|
|
|
tempArr["title"] = "title-template";
|
|
|
tempArr["editorTalk"] = "editorTalk-template";
|
|
|
tempArr["hotCategory"] = "hotCategory-template";
|
|
|
tempArr["debrisSlider"] = "debrisSlider-template";
|
...
|
...
|
@@ -58,16 +58,16 @@ tempArr["multiLabelImage"] = "multiLabelImage-template"; |
|
|
tempArr["matchImage"] = "matchImage-template";
|
|
|
tempArr["getCoupon"] = "getCoupon-template";
|
|
|
|
|
|
var Bll={
|
|
|
var Bll = {
|
|
|
Brands: [],
|
|
|
Brands1: {},
|
|
|
Brdata: [],
|
|
|
contentDatas:[],
|
|
|
contentDatas: [],
|
|
|
module: null,
|
|
|
__render:function(selecter,templater,data){
|
|
|
$(selecter).html(common.util.__template2($("#"+templater).html(),data) );
|
|
|
__render: function (selecter, templater, data) {
|
|
|
$(selecter).html(common.util.__template2($("#" + templater).html(), data));
|
|
|
},
|
|
|
toast: function(index, module) {
|
|
|
toast: function (index, module) {
|
|
|
var d = new common.dialog({
|
|
|
title: (!!~index ? "修改" : "添加") + module.contentData.template_intro,
|
|
|
//content: common.util.__template2($("#" + module.contentData.dialog).html(), module),
|
...
|
...
|
@@ -75,11 +75,11 @@ var Bll={ |
|
|
width: '70%',
|
|
|
button: [{
|
|
|
value: "保存",
|
|
|
callback: function() {
|
|
|
callback: function () {
|
|
|
if (edit.validate()) {
|
|
|
//TODO
|
|
|
!!~index ? Bll.contentDatas[index] = module : Bll.contentDatas.push(module);
|
|
|
Bll.__render("#add-content","template_content",{modules:Bll.contentDatas});
|
|
|
Bll.__render("#add-content", "template_content", {modules: Bll.contentDatas});
|
|
|
d.close();
|
|
|
}
|
|
|
return false;
|
...
|
...
|
@@ -89,28 +89,26 @@ var Bll={ |
|
|
});
|
|
|
Bll.__editRender();
|
|
|
},
|
|
|
renderDialog:function(templater){
|
|
|
Bll.__render(".modal-body",templater,Bll.module);
|
|
|
renderDialog: function (templater) {
|
|
|
Bll.__render(".modal-body", templater, Bll.module);
|
|
|
Bll.__editRender();
|
|
|
},
|
|
|
__editRender:function(){
|
|
|
__editRender: function () {
|
|
|
edit.init();
|
|
|
edit.on("callback", function(obj) {
|
|
|
edit.on("callback", function (obj) {
|
|
|
if (/^file_onComplete/.test(obj.key)) {
|
|
|
var names=obj.field;
|
|
|
Bll.module.contentData.data=common.util.__buildobj(names, '.', Bll.module.contentData.data, function(o, name) {
|
|
|
var names = obj.field;
|
|
|
Bll.module.contentData.data = common.util.__buildobj(names, '.', Bll.module.contentData.data, function (o, name) {
|
|
|
o[name] = obj.data;
|
|
|
});
|
|
|
console.log(Bll.module.contentData.data);
|
|
|
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
//获取品牌
|
|
|
getBrands: function() {
|
|
|
getBrands: function () {
|
|
|
var Brand = {};
|
|
|
$.get("/ajax/yohosearch", function(res) {
|
|
|
res.data.forEach(function(item, index) {
|
|
|
$.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";
|
...
|
...
|
@@ -123,7 +121,7 @@ var Bll={ |
|
|
Bll.Brands1[item.id] = item;
|
|
|
});
|
|
|
for (var i in Brand) {
|
|
|
Brand[i].sort(function(a, b) {
|
|
|
Brand[i].sort(function (a, b) {
|
|
|
var aName = a.brand_name.toLowerCase(),
|
|
|
bName = b.brand_name.toLowerCase();
|
|
|
if (aName < bName) return -1;
|
...
|
...
|
@@ -137,39 +135,38 @@ var Bll={ |
|
|
}
|
|
|
});
|
|
|
},
|
|
|
renderBrandPic: function(Brdata) {
|
|
|
renderBrandPic: function (Brdata) {
|
|
|
var Brands2 = [];
|
|
|
Brdata.forEach(function(item, index) {
|
|
|
if(!item.brandIco){
|
|
|
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});
|
|
|
} 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
|
|
|
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
|
|
|
} 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");
|
...
|
...
|
@@ -177,26 +174,40 @@ var Bll={ |
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*第一步,基础模板*/
|
|
|
Bll.__render("#content-list","content-template",ViewModel);
|
|
|
Bll.__render(".contents","template_content_btns",{btns:Button});
|
|
|
Bll.__render("#content-list", "content-template", ViewModel);
|
|
|
Bll.__render(".contents", "template_content_btns", {btns: Button});
|
|
|
|
|
|
/*第二部,把楼层数据转化成数组*/
|
|
|
ViewModel.contentData.forEach(function(item,index){
|
|
|
item.contentData=item.contentData.replace(/(gif|png|jpg|jpeg)\?[^"]*/g,'$1');
|
|
|
item.contentData=common.util.__ObjToArray(JSON.parse(item.contentData));
|
|
|
ViewModel.contentData.forEach(function (item, index) {
|
|
|
item.contentData = JSON.parse(item.contentData);
|
|
|
var temp;
|
|
|
if (item.contentData.template_name == "kidsBrands") {
|
|
|
temp = item.contentData.data.params.more_url;
|
|
|
item.contentData.data.params.more_url = {};
|
|
|
item.contentData.data.params.more_url.action = JSON.parse(temp).action || "";
|
|
|
item.contentData.data.params.more_url.url = JSON.parse(temp).url || "";
|
|
|
}
|
|
|
if (item.contentData.template_name == 'title') {
|
|
|
temp = item.contentData.data.more_link;
|
|
|
item.contentData.data.more_link = {};
|
|
|
item.contentData.data.more_link.action = JSON.parse(temp).action || "";
|
|
|
item.contentData.data.more_link.url = JSON.parse(temp).url || "";
|
|
|
}
|
|
|
item.contentData = JSON.stringify(item.contentData);
|
|
|
item.contentData = item.contentData.replace(/(gif|png|jpg|jpeg)\?[^"]*/g, '$1');
|
|
|
item.contentData = common.util.__ObjToArray(JSON.parse(item.contentData));
|
|
|
Bll.contentDatas.push(item);
|
|
|
});
|
|
|
|
|
|
/*第三部解析楼层*/
|
|
|
Bll.__render("#add-content","template_content",{modules:Bll.contentDatas});
|
|
|
Bll.__render("#add-content", "template_content", {modules: Bll.contentDatas});
|
|
|
|
|
|
|
|
|
/*第四部 操作按钮 添加 删除 修改*/
|
|
|
$(document).on("click", ".add_btn", function() {
|
|
|
$(document).on("click", ".add_btn", function () {
|
|
|
var item = Button[$(this).data("index")];
|
|
|
Bll.module={};
|
|
|
Bll.module = {};
|
|
|
Bll.module.contentData = $.extend(true, {}, item);
|
|
|
Bll.toast(-1, Bll.module);
|
|
|
});
|
...
|
...
|
@@ -206,37 +217,35 @@ $(document).on("click", ".add_btn", function() { |
|
|
//});
|
|
|
$(document).on("click", ".del", function () {//删除
|
|
|
var index = $(this).data("index");
|
|
|
console.log(Bll.contentDatas);
|
|
|
common.dialog.confirm("警告",
|
|
|
common.util.__template2("是否确认删除?", {}),
|
|
|
function() {
|
|
|
if(Bll.contentDatas[index].id) {
|
|
|
function () {
|
|
|
if (Bll.contentDatas[index].id) {
|
|
|
common.util.__ajax({
|
|
|
url: "/resource/content/delResContent",
|
|
|
url: "/resources/delResContent",
|
|
|
data: {id: Bll.contentDatas[index].id}
|
|
|
});
|
|
|
}
|
|
|
Bll.contentDatas.splice(index, 1);
|
|
|
Bll.__render("#add-content","template_content",{modules:Bll.contentDatas});
|
|
|
Bll.__render("#add-content", "template_content", {modules: Bll.contentDatas});
|
|
|
});
|
|
|
|
|
|
//$("#index_" + index).remove();
|
|
|
});
|
|
|
$(document).on("click", ".edit", function() {
|
|
|
$(document).on("click", ".edit", function () {
|
|
|
var index = $(this).data("index");
|
|
|
var item = Bll.contentDatas[index];
|
|
|
console.log(Bll.contentDatas);
|
|
|
Bll.module = $.extend(true, {}, item);
|
|
|
Bll.toast(index, Bll.module);
|
|
|
});
|
|
|
|
|
|
/*第五步 绑定监听事件*/
|
|
|
$(document).on("change", ".observe", function() {
|
|
|
$(document).on("change", ".observe", function () {
|
|
|
var $this = $(this);
|
|
|
var name = $this.data("field");
|
|
|
Bll.module.contentData.data=common.util.__buildobj(name, '.', Bll.module.contentData.data, function(obj, name) {
|
|
|
Bll.module.contentData.data = common.util.__buildobj(name, '.', Bll.module.contentData.data, function (obj, name) {
|
|
|
obj[name] = $this.val();
|
|
|
if(name == "image_style") {
|
|
|
if (name == "image_style") {
|
|
|
delete obj["default"];
|
|
|
delete obj["T1F2"];
|
|
|
delete obj["L1R2"];
|
...
|
...
|
@@ -246,7 +255,7 @@ $(document).on("change", ".observe", function() { |
|
|
});
|
|
|
});
|
|
|
|
|
|
$(document).on("click", '#multiLabelImage-addImage', function() {
|
|
|
$(document).on("click", '#multiLabelImage-addImage', function () {
|
|
|
Bll.module.contentData.data.image.push({
|
|
|
"src": "",
|
|
|
"url": {
|
...
|
...
|
@@ -257,7 +266,7 @@ $(document).on("click", '#multiLabelImage-addImage', function() { |
|
|
Bll.renderDialog("multiLabelImage-template");
|
|
|
});
|
|
|
|
|
|
$(document).on("click", '#multiLabelImage-addOne', function() {
|
|
|
$(document).on("click", '#multiLabelImage-addOne', function () {
|
|
|
Bll.module.contentData.data.label.push({
|
|
|
"src": "",
|
|
|
"url": {
|
...
|
...
|
@@ -268,7 +277,7 @@ $(document).on("click", '#multiLabelImage-addOne', function() { |
|
|
Bll.renderDialog("multiLabelImage-template");
|
|
|
});
|
|
|
|
|
|
$(document).on("click", '#imageGroup-addOne', function() {
|
|
|
$(document).on("click", '#imageGroup-addOne', function () {
|
|
|
Bll.module.contentData.data.list.push({
|
|
|
"src": "",
|
|
|
"title": "",
|
...
|
...
|
@@ -280,7 +289,7 @@ $(document).on("click", '#imageGroup-addOne', function() { |
|
|
Bll.renderDialog("imageGroup-template");
|
|
|
});
|
|
|
|
|
|
$(document).on("click", '#matchImage-addOne', function() {
|
|
|
$(document).on("click", '#matchImage-addOne', function () {
|
|
|
Bll.module.contentData.data.list.push({
|
|
|
"title": "",
|
|
|
"url": {
|
...
|
...
|
@@ -291,7 +300,7 @@ $(document).on("click", '#matchImage-addOne', function() { |
|
|
Bll.renderDialog("matchImage-template");
|
|
|
});
|
|
|
//添加一个图标
|
|
|
$(document).on("click", '#icon-addOne', function() {
|
|
|
$(document).on("click", '#icon-addOne', function () {
|
|
|
Bll.module.contentData.data.push({
|
|
|
//"title": "",
|
|
|
"url": {
|
...
|
...
|
@@ -302,60 +311,93 @@ $(document).on("click", '#icon-addOne', function() { |
|
|
Bll.renderDialog("icon-template");
|
|
|
});
|
|
|
//删除一个图标
|
|
|
$(document).on("click", '#icon-delOne', function() {
|
|
|
$(document).on("click", '#icon-delOne', function () {
|
|
|
var index = $(this).data("index");
|
|
|
Bll.module.contentData.data.splice(index,1);
|
|
|
Bll.module.contentData.data.splice(index, 1);
|
|
|
Bll.renderDialog("icon-template");
|
|
|
});
|
|
|
//添加一个标签
|
|
|
$(document).on("click", '#nav-addOne', function () {
|
|
|
Bll.module.contentData.data.nav.push({
|
|
|
"name": "",
|
|
|
"url": {
|
|
|
"action": "",
|
|
|
"url": ""
|
|
|
}
|
|
|
});
|
|
|
Bll.renderDialog("title-template");
|
|
|
});
|
|
|
//添加领券
|
|
|
$(document).on("click", '#coupon-addOne', function () {
|
|
|
var length = Bll.module.contentData.data.length;
|
|
|
if (length >= 4) {
|
|
|
alert("最多添加4个")
|
|
|
} else {
|
|
|
Bll.module.contentData.data.push({
|
|
|
"title": "",
|
|
|
"isShow": "YES",
|
|
|
"image": {
|
|
|
"src": "",
|
|
|
"url": {
|
|
|
"action": "",
|
|
|
"url": ""
|
|
|
}
|
|
|
},
|
|
|
"couponID": ""
|
|
|
});
|
|
|
Bll.renderDialog("getCoupon-template");
|
|
|
}
|
|
|
|
|
|
});
|
|
|
//获取品牌
|
|
|
Bll.getBrands();
|
|
|
/*渲染品牌*/
|
|
|
//Bll.Brdata=ViewModel.brandList||[];
|
|
|
//Bll.renderBrandPic(Bll.Brdata);
|
|
|
//打开品牌选择模态
|
|
|
$(document).on("click", "#addBrands", function() {
|
|
|
$(document).on("click", "#addBrands", function () {
|
|
|
var e = new common.edit("#brandForm");
|
|
|
new common.dialog({
|
|
|
title:"选择品牌",
|
|
|
width:"70%",
|
|
|
title: "选择品牌",
|
|
|
width: "70%",
|
|
|
content: common.util.__template2($("#template5").html(), {
|
|
|
Brands: Bll.Brands,//所有品牌数据
|
|
|
Brdata: []
|
|
|
}),
|
|
|
button:[
|
|
|
button: [
|
|
|
{
|
|
|
value:"确定",
|
|
|
callback:function(){
|
|
|
value: "确定",
|
|
|
callback: function () {
|
|
|
Bll.Brdata = $("#brandCheckBox").val().split('|');
|
|
|
Bll.renderBrandPic(Bll.Brdata);
|
|
|
},
|
|
|
css:"btn-primary"
|
|
|
css: "btn-primary"
|
|
|
},
|
|
|
{
|
|
|
value:"取消"
|
|
|
value: "取消"
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
e.init();
|
|
|
});
|
|
|
//品牌筛选
|
|
|
$(document).on('click', '.brand-index', function() {
|
|
|
$(document).on('click', '.brand-index', function () {
|
|
|
var brandIndex = $(this).text();
|
|
|
$('.brand-wrap').find('[name="' + brandIndex + '"]').show().siblings().hide();
|
|
|
});
|
|
|
//删除一个品牌
|
|
|
$(document).on("click", '#remove_brand', function() {
|
|
|
$(document).on("click", '#remove_brand', function () {
|
|
|
var index = $(this).data("index");
|
|
|
Bll.module.contentData.data.list.splice(index,1);
|
|
|
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);
|
|
|
$(document).on("click", '.paramsGroupDel', function () {
|
|
|
Bll.module.contentData.data.list.splice($(this).data("index"), 1);
|
|
|
Bll.renderDialog("paramsGroup-template");
|
|
|
});
|
|
|
$(document).on("click", '#paramsGroup-addOne', function() {
|
|
|
$(document).on("click", '#paramsGroup-addOne', function () {
|
|
|
Bll.module.contentData.data.list.push(
|
|
|
{
|
|
|
"title": "",
|
...
|
...
|
@@ -365,7 +407,7 @@ $(document).on("click", '#paramsGroup-addOne', function() { |
|
|
Bll.renderDialog("paramsGroup-template");
|
|
|
});
|
|
|
/*新人专享*/
|
|
|
$(document).on("click", '#newUserFloor-addBanner', function() {
|
|
|
$(document).on("click", '#newUserFloor-addBanner', function () {
|
|
|
Bll.module.contentData.data.banner_image.push(
|
|
|
{
|
|
|
"src": "",
|
...
|
...
|
@@ -379,7 +421,7 @@ $(document).on("click", '#newUserFloor-addBanner', function() { |
|
|
Bll.renderDialog("newUserFloor-template");
|
|
|
});
|
|
|
/*有序焦点添加*/
|
|
|
$(document).on("click", '#debrisSlider-addLeft', function() {
|
|
|
$(document).on("click", '#debrisSlider-addLeft', function () {
|
|
|
Bll.module.contentData.data.left.push(
|
|
|
{
|
|
|
"src": "",
|
...
|
...
|
@@ -392,7 +434,7 @@ $(document).on("click", '#debrisSlider-addLeft', function() { |
|
|
);
|
|
|
Bll.renderDialog("debrisSlider-template");
|
|
|
});
|
|
|
$(document).on("click", '#debrisSlider-addCenter', function() {
|
|
|
$(document).on("click", '#debrisSlider-addCenter', function () {
|
|
|
Bll.module.contentData.data.big_image.push(
|
|
|
{
|
|
|
"src": "",
|
...
|
...
|
@@ -405,7 +447,7 @@ $(document).on("click", '#debrisSlider-addCenter', function() { |
|
|
);
|
|
|
Bll.renderDialog("debrisSlider-template");
|
|
|
});
|
|
|
$(document).on("click", '#debrisSlider-addRight', function() {
|
|
|
$(document).on("click", '#debrisSlider-addRight', function () {
|
|
|
Bll.module.contentData.data.right.push(
|
|
|
{
|
|
|
"src": "",
|
...
|
...
|
@@ -420,7 +462,7 @@ $(document).on("click", '#debrisSlider-addRight', function() { |
|
|
});
|
|
|
//*****************************************************************//
|
|
|
/*热门品类*/
|
|
|
$(document).on("click", '#hotCategory-addLeft', function() {
|
|
|
$(document).on("click", '#hotCategory-addLeft', function () {
|
|
|
Bll.module.contentData.data.blocks.push(
|
|
|
{
|
|
|
"src": "",
|
...
|
...
|
@@ -433,7 +475,7 @@ $(document).on("click", '#hotCategory-addLeft', function() { |
|
|
);
|
|
|
Bll.renderDialog("hotCategory-template");
|
|
|
});
|
|
|
$(document).on("click", '#hotCategory-addRight', function() {
|
|
|
$(document).on("click", '#hotCategory-addRight', function () {
|
|
|
Bll.module.contentData.data.imgs.push(
|
|
|
{
|
|
|
"src": "",
|
...
|
...
|
@@ -446,17 +488,17 @@ $(document).on("click", '#hotCategory-addRight', function() { |
|
|
);
|
|
|
Bll.renderDialog("hotCategory-template");
|
|
|
});
|
|
|
$(document).on("click", '.hotCategory-delLeft', function() {
|
|
|
Bll.module.contentData.data.blocks.splice($(this).data("index"),1);
|
|
|
$(document).on("click", '.hotCategory-delLeft', function () {
|
|
|
Bll.module.contentData.data.blocks.splice($(this).data("index"), 1);
|
|
|
Bll.renderDialog("hotCategory-template");
|
|
|
});
|
|
|
$(document).on("click", '.hotCategory-delRight', function() {
|
|
|
Bll.module.contentData.data.imgs.splice($(this).data("index"),1);
|
|
|
$(document).on("click", '.hotCategory-delRight', function () {
|
|
|
Bll.module.contentData.data.imgs.splice($(this).data("index"), 1);
|
|
|
Bll.renderDialog("hotCategory-template");
|
|
|
});
|
|
|
//*****************************************************************//
|
|
|
/*图片列表*/
|
|
|
$(document).on("click", '#imageList-addOne', function() {
|
|
|
$(document).on("click", '#imageList-addOne', function () {
|
|
|
Bll.module.contentData.data.list.push(
|
|
|
{
|
|
|
"src": "",
|
...
|
...
|
@@ -469,25 +511,21 @@ $(document).on("click", '#imageList-addOne', function() { |
|
|
);
|
|
|
Bll.renderDialog("imageList-template");
|
|
|
});
|
|
|
$(document).on("click", '.imageList-del', function() {
|
|
|
Bll.module.contentData.data.list.splice($(this).data("index"),1);
|
|
|
$(document).on("click", '.imageList-del', function () {
|
|
|
Bll.module.contentData.data.list.splice($(this).data("index"), 1);
|
|
|
Bll.renderDialog("imageList-template");
|
|
|
});
|
|
|
$(document).on("click", '.is_show_name', function() {
|
|
|
$(document).on("click", '.is_show_name', function () {
|
|
|
Bll.module.contentData.data.title.is_show_name = $(this).val();
|
|
|
Bll.renderDialog("imageList-template");
|
|
|
});
|
|
|
$(document).on("click", '#is_show_name_Y', function() {
|
|
|
Bll.module.contentData.data.is_show_name = "Y";
|
|
|
Bll.renderDialog("brands-template");
|
|
|
});
|
|
|
$(document).on("click", '#is_show_name_N', function() {
|
|
|
Bll.module.contentData.data.is_show_name = "N";
|
|
|
Bll.renderDialog("brands-template");
|
|
|
$(document).on("click", '.isShow_coupon', function () {
|
|
|
Bll.module.contentData.data.isShow = $(this).val();
|
|
|
Bll.renderDialog("getCoupon-template");
|
|
|
});
|
|
|
//*****************************************************************//
|
|
|
/*文本导航*/
|
|
|
$(document).on("click", '#textNav-addOne', function() {
|
|
|
$(document).on("click", '#textNav-addOne', function () {
|
|
|
Bll.module.contentData.data.push(
|
|
|
{
|
|
|
"name": "",
|
...
|
...
|
@@ -499,19 +537,19 @@ $(document).on("click", '#textNav-addOne', function() { |
|
|
);
|
|
|
Bll.renderDialog("textNav-template");
|
|
|
});
|
|
|
$(document).on("click", '.textNav-delOne', function() {
|
|
|
$(document).on("click", '.textNav-delOne', function () {
|
|
|
Bll.module.contentData.data.splice($(this).data("index"), 1);
|
|
|
Bll.renderDialog("textNav-template");
|
|
|
});
|
|
|
//*****************************************************************//
|
|
|
/*推荐(标题 + 12张图)*/
|
|
|
$(document).on("change", '#recommendContentFive-is_show', function() {
|
|
|
Bll.module.contentData.data.title.is_show = 1-Bll.module.contentData.data.title.is_show;
|
|
|
$(document).on("change", '#recommendContentFive-is_show', function () {
|
|
|
Bll.module.contentData.data.title.is_show = 1 - Bll.module.contentData.data.title.is_show;
|
|
|
Bll.renderDialog("recommendContent-template");
|
|
|
});
|
|
|
//*****************************************************************//
|
|
|
/*焦点图*/
|
|
|
$(document).on("click", '#focus-addOne', function() {
|
|
|
$(document).on("click", '#focus-addOne', function () {
|
|
|
Bll.module.contentData.data.push(
|
|
|
{
|
|
|
"src": "",
|
...
|
...
|
@@ -523,17 +561,17 @@ $(document).on("click", '#focus-addOne', function() { |
|
|
);
|
|
|
Bll.renderDialog("focus-template");
|
|
|
});
|
|
|
$(document).on("click", '.focus-del', function() {
|
|
|
$(document).on("click", '.focus-del', function () {
|
|
|
Bll.module.contentData.data.splice($(this).data("index"), 1);
|
|
|
Bll.renderDialog("focus-template");
|
|
|
});
|
|
|
$(document).on("change", '#focus-select', function() {
|
|
|
$(document).on("change", '#focus-select', function () {
|
|
|
Bll.module.contentData.focus_type = $(this).val();
|
|
|
Bll.renderDialog("focus-template");
|
|
|
});
|
|
|
//*****************************************************************//
|
|
|
/*轮播banner*/
|
|
|
$(document).on("click", '#carouselBanner-addOne', function() {
|
|
|
$(document).on("click", '#carouselBanner-addOne', function () {
|
|
|
Bll.module.contentData.data.list.push(
|
|
|
{
|
|
|
"src": "",
|
...
|
...
|
@@ -542,13 +580,13 @@ $(document).on("click", '#carouselBanner-addOne', function() { |
|
|
);
|
|
|
Bll.renderDialog("carouselBanner-template");
|
|
|
});
|
|
|
$(document).on("click", '.carouselBanner-del', function() {
|
|
|
$(document).on("click", '.carouselBanner-del', function () {
|
|
|
Bll.module.contentData.data.list.splice($(this).data("index"), 1);
|
|
|
Bll.renderDialog("carouselBanner-template");
|
|
|
});
|
|
|
//*****************************************************************//
|
|
|
/*编辑推荐*/
|
|
|
$(document).on("click", '#editorTalk-addOne', function() {
|
|
|
$(document).on("click", '#editorTalk-addOne', function () {
|
|
|
Bll.module.contentData.data.list.push(
|
|
|
{
|
|
|
"src": "",
|
...
|
...
|
@@ -561,41 +599,55 @@ $(document).on("click", '#editorTalk-addOne', function() { |
|
|
);
|
|
|
Bll.renderDialog("editorTalk-template");
|
|
|
});
|
|
|
$(document).on("click", '.editorTalk-del', function() {
|
|
|
$(document).on("click", '.editorTalk-del', function () {
|
|
|
Bll.module.contentData.data.list.splice($(this).data("index"), 1);
|
|
|
Bll.renderDialog("editorTalk-template");
|
|
|
});
|
|
|
$(document).on("change", '#editorTalk-is_show', function() {
|
|
|
Bll.module.contentData.data.title.is_show = 1-Bll.module.contentData.data.title.is_show;
|
|
|
$(document).on("change", '#editorTalk-is_show', function () {
|
|
|
Bll.module.contentData.data.title.is_show = 1 - Bll.module.contentData.data.title.is_show;
|
|
|
Bll.renderDialog("editorTalk-template");
|
|
|
});
|
|
|
|
|
|
$(document).on("click", "#sub_btn", function() {
|
|
|
$(document).on("click", "#sub_btn", function () {
|
|
|
var data = {
|
|
|
"content": {},
|
|
|
"data_id": {},
|
|
|
"rId": ""
|
|
|
};
|
|
|
for(var i = 0; i < Bll.contentDatas.length; i++) {
|
|
|
addSuffix(Bll.contentDatas[i].contentData);
|
|
|
data.content[i]=JSON.stringify(common.util.__ArrayToObj(Bll.contentDatas[i].contentData));
|
|
|
if(Bll.contentDatas[i].id) {
|
|
|
data.data_id[i] = "id_"+Bll.contentDatas[i].id;
|
|
|
for (var i = 0; i < Bll.contentDatas.length; i++) {
|
|
|
var contentData = Bll.contentDatas[i].contentData;
|
|
|
var action;
|
|
|
var url;
|
|
|
addSuffix(contentData);
|
|
|
if (contentData.template_name == "kidsBrands") {
|
|
|
action = contentData.data.params.more_url.action || "";
|
|
|
url = contentData.data.params.more_url.url || "";
|
|
|
contentData.data.params.more_url = "{\"action\":\"" + action + "\",\"url\":\"" + url + "\"}";
|
|
|
}
|
|
|
if (contentData.template_name == "title") {
|
|
|
action = contentData.data.more_link.action || "";
|
|
|
url = contentData.data.more_link.url || "";
|
|
|
contentData.data.more_link = "{\"action\":\"" + action + "\",\"url\":\"" + url + "\"}";
|
|
|
}
|
|
|
data.content[i] = JSON.stringify(common.util.__ArrayToObj(contentData));
|
|
|
data.content[i] = JSON.stringify(common.util.__ArrayToObj(Bll.contentDatas[i].contentData));
|
|
|
if (Bll.contentDatas[i].id) {
|
|
|
data.data_id[i] = "id_" + Bll.contentDatas[i].id;
|
|
|
}
|
|
|
}
|
|
|
data.rId = param;
|
|
|
data.content = JSON.stringify(data.content);
|
|
|
data.data_id = JSON.stringify(data.data_id);
|
|
|
common.util.__ajax({
|
|
|
url: "/resource/content/addResContent",
|
|
|
url: "/resources/addResContent",
|
|
|
data: data
|
|
|
},function(res) {
|
|
|
window.location.href=window.location.href;
|
|
|
}, function (res) {
|
|
|
window.location.href = window.location.href;
|
|
|
});
|
|
|
});
|
|
|
|
|
|
var addSuffix = function(contentData) {
|
|
|
if( typeof contentData == "object") {
|
|
|
var addSuffix = function (contentData) {
|
|
|
if (typeof contentData == "object") {
|
|
|
for (var i in contentData) {
|
|
|
if (i == "src" && contentData[i].indexOf("?") == -1) {
|
|
|
contentData[i] = contentData[i] + "?imageView/{mode}/w/{width}/h/{height}";
|
...
|
...
|
@@ -663,7 +715,7 @@ var goodsgird = new common.grid({ |
|
|
}]
|
|
|
});
|
|
|
//搜索按钮
|
|
|
$(document).on("click", "#search", function() {
|
|
|
$(document).on("click", "#search", function () {
|
|
|
goodsgird.reload();
|
|
|
});
|
|
|
//点击“选择标签”按钮(添加商品)
|
...
|
...
|
@@ -694,7 +746,7 @@ $(document).on("click", "#goodsSelectBtn", function () { |
|
|
});
|
|
|
//点击“添加组”按钮(添加商品组)
|
|
|
$(document).on("click", "#goodsaddBtn", function () {
|
|
|
if(Bll.module.contentData.data[0].list.length){
|
|
|
if (Bll.module.contentData.data[0].list.length) {
|
|
|
Bll.module.contentData.data.push(Button[5].data[0]);
|
|
|
}
|
|
|
Bll.__render("#groupsgoods", "template_dialog_remgoodsgroup", Bll.module);
|
...
|
...
|
@@ -731,9 +783,37 @@ $(document).on("click", ".goodsSelectBtn", function () { |
|
|
goodsgird.init('/yohosearch/search');
|
|
|
});
|
|
|
//删除图片按钮
|
|
|
$(document).on("click", ".removepic", function() {
|
|
|
$(document).on("click", ".removepic", function () {
|
|
|
Bll.module.contentData.data.splice($(this).data("index"), 1);
|
|
|
$("#goodspic").html(common.util.__template2($("#template_dialog_goodsimgs").html(), {
|
|
|
datas: Bll.module.contentData.data
|
|
|
}));
|
|
|
});
|
|
|
|
|
|
$(document).on("mouseover","#add-content .dragItem",function(){
|
|
|
var drag = new common.drag("#add-content", Bll.contentDatas, function(data){
|
|
|
Bll.contentDatas = data;
|
|
|
Bll.__render("#add-content","template_content",{modules:Bll.contentDatas});
|
|
|
})
|
|
|
drag.Initialize();
|
|
|
});
|
|
|
$(document).on("mouseleave","#add-content .dragItem",function(){
|
|
|
new common.drag("#add-content").destroy();
|
|
|
});
|
|
|
|
|
|
/*
|
|
|
$(document).on("mouseover","#sortable .dragItem",function(){
|
|
|
//console.log(Bll.module.contentData.data.list);
|
|
|
var drag = new common.drag("#sortable", Bll.module.contentData.data.list, function(data){
|
|
|
Bll.module.contentData.data.list = data;
|
|
|
console.log(Bll.module.contentData);
|
|
|
console.log(Bll.module);
|
|
|
Bll.renderDialog("paramsGroup-template");
|
|
|
//Bll.__render("#sortable","paramsGroup-template",{modules:Bll.module});
|
|
|
})
|
|
|
drag.Initialize();
|
|
|
});
|
|
|
$(document).on("mouseleave","#sortable .dragItem",function(){
|
|
|
new common.drag("#sortable").destroy();
|
|
|
});
|
|
|
*/ |
...
|
...
|
|