Authored by weiqingting

Merge branch 'release/qqtest' of http://git.dev.yoho.cn/platform/yohobuy-portal-…

…fe into release/qqtest
... ... @@ -25,22 +25,23 @@ var tableGird = new common.grid({
},
columns: [
{display: "属性名称", name: "attributeName"},
{display: "属性类型",
{
display: "属性类型",
//name: "attributeValues"
render: function (item) {
var propType = item.attributeValues;
var propsStr="";
var propsStr = "";
if (common.util.__isJsonString(propType)) {
var props = JSON.parse(propType);
[].slice.call(props,0).forEach(function(prop){
[].slice.call(props, 0).forEach(function (prop) {
propsStr += prop.name + ",";
});
} else {
propsStr = propType;
}
return '<p> '+propsStr+'</p>';
return '<p> ' + propsStr + '</p>';
}
},
... ... @@ -63,7 +64,7 @@ var tableGird = new common.grid({
render: function (items) {
if (items.categoryId == window.sortid)
return ('<button data-index="' + items.__index + '" class="btn btn-success btn-xs edit-class-btn">编辑</button>');
return ('<button data-index="' + items.__index + '" class="btn btn-success btn-xs edit-class-btn">编辑</button>');
}
}
]
... ... @@ -74,16 +75,18 @@ var propValueGrid = new common.grid({
el: "#prop-value-table",
columns: [
{display: "ID", name: "id",
{
display: "ID", name: "id",
render: function (items) {
//items.id=items.__index+1;
return('<input id="id" disabled="true" class="form-control width110 propValueID" value="'+items.id+'" required="required" data-index="'+items.__index+'" type="text">');
return ('<input id="id" disabled="true" class="form-control width110 propValueID" value="' + items.id + '" required="required" data-index="' + items.__index + '" type="text">');
}
},
{display: "属性值", name: "name",
{
display: "属性值", name: "name",
render: function (items) {
return('<input id="name" class="form-control width110 propValue" value="'+items.name+'" data-index="'+items.__index+'" required="required" type="text" placeholder="属性值">');
return ('<input id="name" class="form-control width110 propValue" value="' + items.name + '" data-index="' + items.__index + '" required="required" type="text" placeholder="属性值">');
}
},
... ... @@ -93,10 +96,10 @@ var propValueGrid = new common.grid({
render: function (items) {
var html = [];
if (items.__index == propValueGrid.__rows.length-1) {
if (items.__index == propValueGrid.__rows.length - 1) {
html.push('<button data-index="' + items.__index + '" class="btn btn-success btn-xs prop-add-btn">添加</button>');
}
if (items.__index == 0 ) {
if (items.__index == 0) {
if (propValueGrid.__rows.length != 1) {
html.push('<button data-index="' + items.__index + '" class="btn btn-success btn-xs prop-del-btn">删除</button>');
... ... @@ -112,9 +115,8 @@ var propValueGrid = new common.grid({
});
$(document).on("change",".propValueID",function(){
var item=propValueGrid.__rows[$(this).data("index")];
$(document).on("change", ".propValueID", function () {
var item = propValueGrid.__rows[$(this).data("index")];
if (item) {
item.id = $(this).val();
... ... @@ -122,8 +124,8 @@ $(document).on("change",".propValueID",function(){
});
$(document).on("change",".propValue",function(){
var item=propValueGrid.__rows[$(this).data("index")];
$(document).on("change", ".propValue", function () {
var item = propValueGrid.__rows[$(this).data("index")];
if (item) {
item.name = $(this).val();
... ... @@ -133,7 +135,7 @@ $(document).on("change",".propValue",function(){
//增加属性值
$(document).on('click', '.prop-add-btn', function () {
propValueGrid.__rows.push({name:"",id:parseInt(propValueGrid.__rows[propValueGrid.__rows.length-1].id) + 1});
propValueGrid.__rows.push({name: "", id: parseInt(propValueGrid.__rows[propValueGrid.__rows.length - 1].id) + 1});
propValueGrid.reload();
});
... ... @@ -141,15 +143,15 @@ $(document).on('click', '.prop-add-btn', function () {
$(document).on('click', '.prop-del-btn', function () {
var item = propValueGrid.__rows[$(this).data('index')];
propValueGrid.__rows.splice($(this).data('index'),1);
propValueGrid.__rows.splice($(this).data('index'), 1);
propValueGrid.reload();
});
var timeid;
sortmenu.init(function () {
clearTimeout(timeid);
timeid=setTimeout(function(){
timeid = setTimeout(function () {
tableGird.init('/product/attr/queryProductAttributeList');
},2000);
}, 2000);
});
$('#add-attri').click(function () {
... ... @@ -173,65 +175,119 @@ function attributeOp(prefix, url, item) {
var a = new common.edit(".confirm");
if(item.attributeValues) {
if (item.attributeValues) {
if (common.util.__isJsonString(item.attributeValues)) {
propValueGrid.__rows = JSON.parse(item.attributeValues);
} else {
propValueGrid.__rows=[{ 'name':"", 'id':"1"}];
propValueGrid.__rows = [{'name': "", 'id': "1"}];
}
} else {
propValueGrid.__rows=[{ 'name':"", 'id':"1"}];
propValueGrid.__rows = [{'name': "", 'id': "1"}];
}
common.dialog.confirm(prefix + "属性", common.util.__template($("#template").html(), item), function () {
return a.submit(url, function (option) {
option.data.categoryId = item.categoryId;
option.data.attributeId = item.attributeId;
// 检查所有属性值是否为空
//if (!checkPropName()) {
// alert()
//}
var inputType = $('#inputType').val();
var propVlaueArr = propValueGrid.__rows.splice(0).map(function (v, index) {
return {
id: v.id,
name: v.name
}
});
if (inputType == 'textarea' || inputType == 'text' || inputType == "") {
// 不显示属性列表
return a.submit(url, function (option) {
option.data.categoryId = item.categoryId;
option.data.attributeId = item.attributeId;
var inputType = $('#inputType').val();
// 检查所有属性值是否为空
console.log(inputType);
// 单行文本 或者 多行文本 时不显示表格
if (inputType == 'textarea' || inputType == 'text' || inputType =="") {
console.log(inputType);
// 单行文本 或者 多行文本 时不显示表格
if (inputType == 'textarea' || inputType == 'text' || inputType == "") {
} else {
var propVlaueArr = propValueGrid.__rows.splice(0).map(function(item,inex){
return {id:item.id,
name:item.name
} else {
option.data.attributeValues = JSON.stringify(propVlaueArr);
}
console.log(propVlaueArr);
//option.debug = true;
propValueGrid.__rows = [];
option.success = function (res) {
res = res.data;
if (res.code == "200") {
a.$tip("提交成功", function () {
tableGird.reload();
}, 'growl-success');
} else {
a.$tip(res.message);
}
});
option.data.attributeValues = JSON.stringify(propVlaueArr);
return false;
},
option.error = function (res) {
a.$tip(res.message);
}
});
} else {
// 显示属性列表
if (propVlaueArr) {
propVlaueArr.forEach(function (pv) {
if (!pv.name) {
a.$tip('属性值不能为空');
return false;
}
return a.submit(url, function (option) {
option.data.categoryId = item.categoryId;
option.data.attributeId = item.attributeId;
// 检查所有属性值是否为空
console.log(inputType);
// 单行文本 或者 多行文本 时不显示表格
if (inputType == 'textarea' || inputType == 'text' || inputType == "") {
} else {
option.data.attributeValues = JSON.stringify(propVlaueArr);
}
console.log(propVlaueArr);
//option.debug = true;
propValueGrid.__rows = [];
option.success = function (res) {
res = res.data;
if (res.code == "200") {
a.$tip("提交成功", function () {
tableGird.reload();
}, 'growl-success');
} else {
a.$tip(res.message);
}
return false;
},
option.error = function (res) {
a.$tip(res.message);
}
});
});
} else {
a.$tip('属性值不能为空');
return false;
}
console.log(propVlaueArr);
//option.debug = true;
}
propValueGrid.__rows = [];
option.success = function (res) {
res = res.data;
if (res.code == "200") {
a.$tip("提交成功", function () {
tableGird.reload();
}, 'growl-success');
} else {
a.$tip(res.message);
}
return false;
},
option.error = function (res) {
a.$tip(res.message);
}
});
});
... ... @@ -249,10 +305,10 @@ function attributeOp(prefix, url, item) {
}
function showORHidePropValue () {
function showORHidePropValue() {
var inputType = $('#inputType').val();
// 单行文本 或者 多行文本 时不显示表格
if (inputType == 'textarea' || inputType == 'text' || inputType =="") {
if (inputType == 'textarea' || inputType == 'text' || inputType == "") {
$('#attributeValues').show();
$('#prop-value-table').hide();
$('.propValue').removeAttr("required");
... ...
... ... @@ -954,26 +954,26 @@ function editorTipInit(id){
switch (id){
case "editor-banner":
if(curPlatform == "shopWeb-pc"){
tipHtml = "<span>提示:请上传像素1150*150的图片。</span>";
tipHtml = "<span>提示:请上传像素1150*150的图片,图片大小不能大于500KB。</span>";
}
if(curPlatform == "shopWeb-app"){
tipHtml = "<span>提示:请上传像素640*200的图片。</span>";
tipHtml = "<span>提示:请上传像素640*200的图片,图片大小不能大于500KB。</span>";
}
break;
case "editor-nav":
tipHtml = "<span>提示:标题名称最多5个汉字。</span>";
break;
case "editor-largePic":
tipHtml = "<span>提示:请上传像素660*358的图片,该图片会适配到APP端。</span>";
tipHtml = "<span>提示:请上传像素660*358的图片,图片大小不能大于500KB,该图片会适配到APP端。</span>";
break;
case "editor-largePic-app":
tipHtml = "<span>提示:由PC端适配,修改请到PC端修改。</span>";
break;
case "editor-smallPic":
if(curPlatform == "shopWeb-app"){
tipHtml = "<span>提示:请上传像素275*160的图片。</span>";
tipHtml = "<span>提示:请上传像素275*160的图片,图片大小不能大于500KB。</span>";
}else{
tipHtml = "<span>提示:请上传像素300*174的图片。</span>";
tipHtml = "<span>提示:请上传像素300*174的图片,图片大小不能大于500KB。</span>";
}
break;
case "editor-brand":
... ... @@ -983,16 +983,16 @@ function editorTipInit(id){
tipHtml = "<span>提示:【品牌一览】由PC端【品牌集合】适配,修改请到PC端【品牌集合】修改。</span>";
break;
case "editor-recommend":
tipHtml = "<span>提示:请上传像素150*150的图片,图片和标题会适配到APP的【热门品类】中。</span>";
tipHtml = "<span>提示:请上传像素150*150的图片,图片大小不能大于500KB,图片和标题会适配到APP的【热门品类】中。</span>";
break;
case "editor-recommend-app":
tipHtml = "<span>提示:【热门品类】由PC端【经典推荐】适配,修改请到PC端【经典推荐】修改。</span>";
break;
case "editor-signboard":
tipHtml = "<span>提示:请上传像素160*240的图片。</span>";
tipHtml = "<span>提示:请上传像素160*240的图片,图片大小不能大于500KB。</span>";
break;
case "editor-hotRecommend":
tipHtml = "<span>提示:请上传像素160*240的图片。</span>";
tipHtml = "<span>提示:请上传像素160*240的图片,图片大小不能大于500KB。</span>";
break;
case "editor-newGoodTab":
tipHtml = "<span>提示:最多编辑5个标签,标题名称最多5个汉字。</span>";
... ...