Authored by dongjunjie

店铺装修校验销售类目

... ... @@ -343,28 +343,28 @@ function findTopHotProducts_APP(){
//Ajax保存,暂存:100,提交审核:200
function saveDecoration(submitStatus){
console.log(jsonMain);
// common.util.__ajax({
// url:'/shop/ShopsDecoratorRest/saveShopsDecorator',
// data: {
// "submitStatus": submitStatus,
// "shopsId": jsonMain.shopsId,
// "platform": jsonMain.platform,
// "templateType": jsonMain.templateType,
// "resources": JSON.stringify(jsonMain.resources)
// }
// },function(rs){
// if(rs.data){
// if(submitStatus == 100){
// jsonMain = rs.data;
// jsonClone = $.extend(true,{},jsonMain);
// showMain();
// }else{
// setTimeout(function() {
// location.href="/supplier/shop/decoration";
// }, 1000);
// }
// }
// });
common.util.__ajax({
url:'/shop/ShopsDecoratorRest/saveShopsDecorator',
data: {
"submitStatus": submitStatus,
"shopsId": jsonMain.shopsId,
"platform": jsonMain.platform,
"templateType": jsonMain.templateType,
"resources": JSON.stringify(jsonMain.resources)
}
},function(rs){
if(rs.data){
if(submitStatus == 100){
jsonMain = rs.data;
jsonClone = $.extend(true,{},jsonMain);
showMain();
}else{
setTimeout(function() {
location.href="/supplier/shop/decoration";
}, 1000);
}
}
});
}
//Ajax审核,审核通过:300,驳回:900
function checkDecoration(checkStatus,comment){
... ... @@ -756,7 +756,13 @@ function gridInit(id){
if(item.__index == 0){
return "http://店铺商品列表页(默认)";
}else{
return "<input class='form-control inputChange urlInput' type=text name='url' value='"+(item.url).replace(/'/g,'\"')+"' data-index='"+item.__index+"' />";
if(item.url != ''){
item.linkType = item.linkType || '0';
}else{
item.linkType = item.linkType || '1';
}
item.categoryId = item.categoryId || '-1';
return common.util.__template2($("#link").html(),{data:item, categoryList:shopCategory, index:item.__index});
}
}},
{display:"操作", render:function(item){
... ... @@ -804,7 +810,13 @@ function gridInit(id){
if(item.__index == 0){
return "http://店铺商品列表页(默认)";
}else{
return "<input class='form-control inputChange urlInput' type=text name='url' value='"+(item.url).replace(/'/g,'\"')+"' data-index='"+item.__index+"' />";
if(item.url != ''){
item.linkType = item.linkType || '0';
}else{
item.linkType = item.linkType || '1';
}
item.categoryId = item.categoryId || '-1';
return common.util.__template2($("#link").html(),{data:item, categoryList:shopCategory, index:item.__index});
}
}},
{display:"操作", render:function(item){
... ... @@ -1203,15 +1215,15 @@ function editorTipInit(id){
function editorCheck(id){
switch (id){
case "editor-nav":
return checkUrlInput();
return (checkUrlInput() && checkCategory());
break;
case "editor-largePic":
return (checkNumInput() && checkEndTime() && checkUrlInput());
return (checkNumInput() && checkCategory() && checkEndTime() && checkUrlInput());
break;
case "editor-smallPic":
return (checkNumInput() && checkEndTime() && checkUrlInput());
return (checkNumInput() && checkCategory() && checkEndTime() && checkUrlInput());
break;
case "editor-brand":
... ... @@ -1225,7 +1237,7 @@ function editorCheck(id){
common.util.__tip("模块标题不能为空!");
return false;
}
if(checkNumInput() && checkUrlInput()){
if(checkNumInput() && checkCategory() && checkUrlInput()){
var nameList = $(".grid input[name='name']");
for(var i=0; i<nameList.length; i++){
if(!nameList.eq(i).val()){
... ... @@ -1239,19 +1251,19 @@ function editorCheck(id){
break;
case "editor-hotRecommend":
return (checkNumInput() && checkUrlInput());
return (checkNumInput() && checkCategory() && checkUrlInput());
break;
case "editor-signboard":
return (checkNumInput() && checkEndTime() && checkUrlInput());
return (checkNumInput() && checkCategory() && checkEndTime() && checkUrlInput());
break;
case "editor-newGoodTab":
return (checkNumInput() && checkUrlInput());
return (checkNumInput() && checkCategory() && checkUrlInput());
break;
case "editor-hotGoodTab":
return (checkNumInput() && checkUrlInput());
return (checkNumInput() && checkCategory() && checkUrlInput());
break;
case "editor-newProduct":
... ... @@ -1267,6 +1279,19 @@ function editorCheck(id){
break;
}
}
//销售类目校验
function checkCategory(){
var categoryList = $(".grid select[name='categoryId']:visible");
console.log(categoryList.length);
for(var i=0; i<categoryList.length; i++){
if(categoryList.eq(i).val() < 0){
categoryList.eq(i).focus().addClass("error");
common.util.__tip("请选择店铺销售类目!");
return false;
}
}
return true;
}
//排序序号校验
function checkNumInput(){
var positionList = $(".grid input[name='position']");
... ... @@ -1293,7 +1318,7 @@ function checkNumInput(){
}
//url域名校验
function checkUrlInput(){
var urlList = $(".grid input[name='url']");
var urlList = $(".grid input[name='url']:visible");
for(var i=0; i<urlList.length; i++){
var reg = new RegExp(".+\.yoho[^.]*\.(com|cn).*","g");
if(urlList.eq(i).val() != ""){
... ...
... ... @@ -3,7 +3,7 @@ pc端店铺模板css
*/
.editor-dialog ul.upload-image-list{padding: 0 10px}
.editor-dialog input.numInput{ width: 40px}
.editorTitle input.error,.editor-dialog input.error{ border: 2px solid #ff0000}
.editorTitle input.error,.editor-dialog input.error,.editor-dialog select.error{ border: 2px solid #ff0000}
.moduleTypeSelect .error{ border: 2px solid #ff0000}
.editorTip{ color: #ff0000}
.bannerTip{ color: #ec971f; clear: both; padding-top: 5px}
... ...