Authored by 陶雨

资源内容将弹窗id放入button数组

var Button = [
{
template_intro: "文本",
button_name:"文本",
dialog:"template_dialog_text",
data: {text: ""},
template_name: "text"
},
{
template_intro: "一张图",
template_intro: "一张图片",
button_name:"一张图",
dialog:"template_dialog_grid",
template_name: "singleImage",
data: [{
"url": {
... ... @@ -14,12 +17,13 @@ var Button = [
},
"alt": "",
"src": "",
"imgId": ""
"imgId": "0"
}]
},
{
template_intro: "添加小图",
button_name:"添加小图",
template_name: "smallPic",
dialog:"template_dialog_grid",
data: [{
"url": {
"action": "",
... ... @@ -27,7 +31,7 @@ var Button = [
},
"alt": "",
"src": "",
"imgId": ""
"imgId": "0"
}, {
"url": {
"action": "",
... ... @@ -35,11 +39,13 @@ var Button = [
},
"alt": "",
"src": "",
"imgId": ""
"imgId": "1"
}]
},
{
template_intro: "焦点图",
button_name:"焦点图",
dialog:"focus-template",
template_name: "focus",
data: [
{
... ... @@ -47,14 +53,15 @@ var Button = [
"alt": "",
"url": {},
"bgColor": "",
"imgId": "0"
}
],
focus_type: "1"
},
{
template_intro: "添加商品",
button_name:"添加商品",
template_name: "goods",
dialog:"template_dialog_goods",
data: [
// {
// src:"",
... ... @@ -63,8 +70,10 @@ var Button = [
]
},
{
template_intro: "推荐商品组",
template_intro: "添加商品组",
button_name:"添加商品组",
template_name: "goodsGroup",
dialog:"template_dialog_remgoods",
data: [
{
cover: {cover: "", maxSortId: ""},
... ... @@ -80,7 +89,9 @@ var Button = [
},
{
"template_name": "appIconList",
"template_intro": "图标入口",
button_name:"图标入口",
"template_intro": "图标",
dialog:"icon-template",
"data": [
{
"url": {
... ... @@ -94,8 +105,10 @@ var Button = [
]
},
{
template_intro: "推荐(1T-1L-4R)",
button_name:"推荐(1T-1L-4R)",
template_intro: "一张大图一个大的推荐和4个小图推荐",
template_name: "recommendContentOne",
dialog:"recommendContent-template",
"data": {
"title": {
"name": "",
... ... @@ -147,13 +160,23 @@ var Button = [
"action": "",
"url": ""
}
},
{
"src": "",
"title": "",
"url": {
"action": "",
"url": ""
}
}
]
}
},
{
template_intro: "推荐(1T-6F)",
button_name: "推荐(1T-6F)",
template_name: "recommendContentTwo",
template_intro: "一张大图和6个小图推荐",
dialog:"recommendContent-template",
"data": {
"title": {
"name": "",
... ... @@ -226,8 +249,10 @@ var Button = [
}
},
{
button_name: "标题广告",
"template_name": "singleNameImage",
"template_intro": "标题广告",
"template_intro": "带标题的图片广告",
dialog:"singleNameImage-template",
"data": {
"title": "",
"src": "",
... ... @@ -239,8 +264,10 @@ var Button = [
}
},
{
template_intro: "推荐(1T-12F)",
button_name: "推荐(1T-12F)",
template_intro: "一张大图12个小图推荐",
template_name: "recommendContentThree",
dialog:"recommendContent-template",
"data": {
"big_image": [
{
... ... @@ -353,18 +380,24 @@ var Button = [
}
},
{
button_name: "潮人搭配",
template_intro: "潮人搭配",
template_name: "trendsetterCollocation",
dialog:"noEdit-template",
data: {}
},
{
button_name: "潮品话题",
template_intro: "潮品话题",
template_name: "trendgoodsTopic",
dialog:"noEdit-template",
data: {}
},
{
button_name: "推荐品牌",
template_intro: "推荐品牌",
template_name: "appHotBrands",
dialog:"brands-template",
"data": {
"title": {
"title": ""
... ... @@ -374,8 +407,10 @@ var Button = [
}
},
{
button_name: "自定义品牌",
template_intro: "自定义品牌",
template_name: "customBrands",
dialog:"brands-template",
"data": {
"title": {
"title": "",
... ... @@ -386,22 +421,28 @@ var Button = [
}
},
{
button_name: "一个链接",
template_intro: "一个链接",
template_name: "link",
dialog:"template_dialog_link",
data: [
{"url": {"action": "", "url": ""}}
]
},
{
template_intro: "添加促销",
button_name: "添加促销",
template_intro: "促销专区",
template_name: "promotion",
dialog:"promotion-template",
data: {
"promotionId": ""
}
},
{
button_name: "轮播banner",
template_intro: "轮播banner",
template_name: "carouselBanner",
dialog:"carouselBanner-template",
"data": {
"speed": "",
"list": [
... ... @@ -413,8 +454,10 @@ var Button = [
}
},
{
button_name: "kids推荐品牌",
template_intro: "kids推荐品牌",
template_name: "kidsBrands",
dialog:"brands-template",
"data": {
"params": {
"param": "",
... ... @@ -430,8 +473,10 @@ var Button = [
}
},
{
button_name: "推荐(L1-RT1-RF2)",
template_intro: "推荐(L1-RT1-RF2)",
template_name: "recommendContentFour",
dialog:"recommendContentFour-template",
"data": {
"left": {
"title": "",
... ... @@ -478,8 +523,10 @@ var Button = [
}
},
{
button_name: "添加楼层",
template_intro: "添加楼层",
template_name: "addfloor",
dialog:"icon-template",
data: [
{
"url": {},
... ... @@ -491,8 +538,10 @@ var Button = [
]
},
{
template_intro: "推荐(标题 + 12张图)",
button_name: "推荐(标题 + 12张图)",
template_intro: "带标题的12个小图推荐",
template_name: "recommendContentFive",
dialog:"recommendContent-template",
data: {
"title": {
"title": "",
... ... @@ -599,13 +648,16 @@ var Button = [
}
},
{
template_intro: "文本导航",
button_name: "文本导航",
template_intro: "文本链接",
template_name: "textNav",
dialog:"textNav-template",
data: []
},
{
template_intro: "图片列表",
button_name:"图片列表",
template_name: "imageList",
dialog:"imageList-template",
"data": {
"title": {
"title": "",
... ... @@ -616,8 +668,10 @@ var Button = [
}
},
{
button_name:"标题标签",
template_intro: "标题标签",
template_name: "title",
dialog:"title-template",
"data": {
"title_name": "",
"more_name": "",
... ... @@ -637,8 +691,10 @@ var Button = [
}
},
{
button_name:"编辑推荐",
template_intro: "编辑推荐",
template_name: "editorTalk",
dialog:"editorTalk-template",
"data": {
"title": {
"title": "",
... ... @@ -648,8 +704,10 @@ var Button = [
}
},
{
button_name:"热门品类",
template_intro: "热门品类",
template_name: "hotCategory",
dialog:"hotCategory-template",
"data": {
"title": {
"name": "",
... ... @@ -750,8 +808,10 @@ var Button = [
}
},
{
template_intro: "有序焦点",
button_name:"有序焦点",
template_intro: "三张左图两张右图多张中间图",
template_name: "debrisSlider",
dialog:"debrisSlider-template",
"data": {
"big_image": [
{
... ... @@ -768,8 +828,10 @@ var Button = [
}
},
{
button_name:"新人专享",
template_intro: "新人专享",
template_name: "newUserFloor",
dialog:"newUserFloor-template",
data: {
"title": {
"name": "",
... ... @@ -793,8 +855,10 @@ var Button = [
}
},
{
template_intro: "图片广告",
button_name:"图片广告",
template_intro: "带标题的图片广告",
template_name: "imageGroup",
dialog:"imageGroup-template",
data: {
"title": "",
"more": "",
... ... @@ -814,8 +878,10 @@ var Button = [
}
},
{
template_intro: "自定义参数",
button_name:"自定义参数",
template_intro: "参数集合",
template_name: "paramsGroup",
dialog:"paramsGroup-template",
data: {
"title": "",
"more": "",
... ... @@ -829,17 +895,23 @@ var Button = [
}
},
{
button_name:"自定义参数图片",
template_intro: "自定义参数图片",
template_name: "",
dialog:"noEdit-template",
data: {}
},
{
button_name:"站内公告",
template_intro: "站内公告",
template_name: "announcement"
template_name: "announcement",
dialog:"noEdit-template"
},
{
button_name:"标题图片",
template_intro: "标题图片",
template_name: "titleImage",
dialog:"titleImage-template",
data: {
"title": "",
"more_name": "",
... ... @@ -857,8 +929,10 @@ var Button = [
}
},
{
button_name:"多标签图片",
template_intro: "多标签图片",
template_name: "multiLabelImage",
dialog:"multiLabelImage-template",
data: {
"label": [
{
... ... @@ -881,8 +955,10 @@ var Button = [
}
},
{
button_name:"搭配(2T-nF)",
template_intro: "搭配(2T-nF)",
template_name: "matchImage",
dialog:"matchImage-template",
data: {
"title": {
"name": "",
... ... @@ -934,8 +1010,10 @@ var Button = [
}
},
{
button_name:"领券频道",
"template_name": "getCoupon",
"template_intro": "领券频道",
dialog:"getCoupon-template",
"data": [
{
"title": "",
... ...
/**
* Created by ty on 2016/4/15.
*/
var resourceObj = {
focus:""
};
\ No newline at end of file
... ...
... ... @@ -19,45 +19,6 @@ var edit = new common.edit(".modal-body", {
bucket: "yhb-img01"
});
var tempArr = [];
tempArr["text"] = "template_dialog_text";
tempArr["singleImage"] = "template_dialog_grid";
tempArr["smallPic"] = "template_dialog_grid";
tempArr["focus"] = "focus-template";
tempArr["goods"] = "template_dialog_goods";
tempArr["goodsGroup"] = "template_dialog_remgoods";
tempArr["appIconList"] = "icon-template";
tempArr["recommendContentOne"] = "recommendContent-template";
tempArr["recommendContentTwo"] = "recommendContent-template";
tempArr["singleNameImage"] = "singleNameImage-template";
tempArr["recommendContentThree"] = "recommendContent-template";
tempArr["trendsetterCollocation"] = "noEdit-template";
tempArr["trendgoodsTopic"] = "noEdit-template";
tempArr["appHotBrands"] = "brands-template";
tempArr["customBrands"] = "brands-template";
tempArr["link"] = "template_dialog_link";
tempArr["promotion"] = "promotion-template";
tempArr["carouselBanner"] = "carouselBanner-template";
tempArr["kidsBrands"] = "brands-template";
tempArr["recommendContentFour"] = "recommendContentFour-template";
tempArr["addfloor"] = "icon-template";
tempArr["recommendContentFive"] = "recommendContent-template";
tempArr["textNav"] = "textNav-template";
tempArr["imageList"] = "imageList-template";
tempArr["title"] = "title-template";
tempArr["editorTalk"] = "editorTalk-template";
tempArr["hotCategory"] = "hotCategory-template";
tempArr["debrisSlider"] = "debrisSlider-template";
tempArr["newUserFloor"] = "newUserFloor-template";
tempArr["imageGroup"] = "imageGroup-template";
tempArr["paramsGroup"] = "paramsGroup-template";
tempArr["自定义参数图片"] = "noEdit-template";
tempArr["announcement"] = "noEdit-template";
tempArr["titleImage"] = "titleImage-template";
tempArr["multiLabelImage"] = "multiLabelImage-template";
tempArr["matchImage"] = "matchImage-template";
tempArr["getCoupon"] = "getCoupon-template";
var Bll = {
Brands: [],
Brands1: {},
... ... @@ -68,20 +29,29 @@ var Bll = {
$(selecter).html(common.util.__template2($("#" + templater).html(), data));
},
toast: function (index, module) {
var btn = Button.filter(function (item) {
return item.template_name == module.contentData.template_name;
});
var d = new common.dialog({
title: (!!~index ? "修改" : "添加") + module.contentData.template_intro,
title: (!!~index ? "修改" : "添加") + module.contentData.button_name,
//content: common.util.__template2($("#" + module.contentData.dialog).html(), module),
content: common.util.__template2($("#" + tempArr[module.contentData.template_name]).html(), module),
content: common.util.__template2($("#" + btn[0].dialog).html(), module),
width: '70%',
button: [{
value: "保存",
callback: function () {
if (edit.validate()) {
//TODO
//if(CMDData(module.contentData.tmep_key)){
// module=CMDData(module.contentData.tmep_key)(module)
//}
!!~index ? Bll.contentDatas[index] = module : Bll.contentDatas.push(module);
Bll.__render("#add-content", "template_content", {modules: Bll.contentDatas});
d.close();
}
console.log(module);
return false;
},
css: "btn-primary"
... ... @@ -122,10 +92,12 @@ var Bll = {
});
for (var i in Brand) {
Brand[i].sort(function (a, b) {
if(a.brand_name && b.brand_name) {
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({
... ... @@ -255,6 +227,12 @@ $(document).on("change", ".observe", function () {
});
});
var clickBtns = {
multiLabelImage:{
}
};
$(document).on("click", '#multiLabelImage-addImage', function () {
Bll.module.contentData.data.image.push({
"src": "",
... ... @@ -556,7 +534,6 @@ $(document).on("click", '#focus-addOne', function () {
"alt": "",
"url": {},
"bgColor": "",
"imgId": "0"
}
);
Bll.renderDialog("focus-template");
... ... @@ -619,6 +596,8 @@ $(document).on("click", "#sub_btn", function () {
var action;
var url;
addSuffix(contentData);
delete contentData.button_name;
delete contentData.dialog;
if (contentData.template_name == "kidsBrands") {
action = contentData.data.params.more_url.action || "";
url = contentData.data.params.more_url.url || "";
... ... @@ -630,7 +609,6 @@ $(document).on("click", "#sub_btn", function () {
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;
}
... ... @@ -730,8 +708,7 @@ $(document).on("click", "#goodsSelectBtn", function () {
Bll.module.contentData.data = goodsgird.selected.map(function (item, index) {
return {
src: item.images_url,
id: item.product_skn,
product_skc: item.product_skc
id: item.product_skn
}
});
// Bll.module.data=goodsgird.selected;
... ... @@ -765,7 +742,6 @@ $(document).on("click", ".goodsSelectBtn", function () {
Bll.module.contentData.data[index].list[i] = {
src: item.images_url,
id: item.product_skn,
product_skc: item.product_skc,
maxSortId: item.max_sort_id
};
if (!i) {
... ...
... ... @@ -45,7 +45,7 @@
<!-- 按钮 -->
<script type="text/template" id="template_content_btns">
[[each btns as btn index]]
<li><a href="javascript:void(0)" name="text" class="add_btn" data-index="[[index]]">[[btn.template_intro]]</a></li>
<li><a href="javascript:void(0)" name="text" class="add_btn" data-index="[[index]]">[[btn.button_name]]</a></li>
[[/each]]
</script>
... ...
... ... @@ -443,7 +443,7 @@
<table style="width:100%;z-index:-1;">
<tbody>
<tr>
<td width="100px">标题:<input class="abc" type="text" required style="width: 60px;" class="observe" value="[[item.title]]" data-field="list.[[index]].title"></td>
<td width="100px">标题:<input type="text" required style="width: 60px;" class="observe" value="[[item.title]]" data-field="list.[[index]].title"></td>
<td>参数:<input type="text" style="width:300px;" class="observe" value="[[item.params]]" data-field="list.[[index]].params"></td>
<td><button class="btn btn-danger btn-sm paramsGroupDel" type="button" data-index="[[index]]">删除</button></td>
</tr>
... ...
... ... @@ -76,7 +76,7 @@
[[each contentData.data as item index]]
<tr>
<td>[[index+1]]</td>
<td><input type="file" name="file" id="src-[[index]]" value="[[item.src]]" data-field="[[index]].src" data-index="[[index]]" /></td>
<td><input type="file" name="file" id="src-[[index]]" value="[[item.src]]" data-field="[[index]].src" data-index="[[index]]" required/></td>
<td>
<div class="form-group">
<div class="col-sm-10">
... ...