记得上下班打卡 | git大法好,push需谨慎

Commit 994ea8bc authored by dongchun's avatar dongchun

修改首页排版金刚位和魔方无法修改问题

parent f5c98313
......@@ -253,7 +253,72 @@
$("input[name=optionsRadios]").change(function(e){
$("#bannerList").empty();
count = e.target.value;
promiseMethods('/goblin-front-cube/list', 'post').then(res => {
let { data } = res;
if (data && data.length > 0) {
let arr = data[0].spuId.split(',');
if (count == data[0].rowType) {
for (var i = 0; i < data.length; i++) {
let str = '';
str += `<div class="items" data-id="${data[i].mid}">
<div class="first_content">
<div class="hot_title">
页面属性:
</div>
<div class="tags">
<label>
<input type="radio" checked value="1" id="pageAttribute${i}" name="pageAttribute${i}"><span>单商品</span></label>
</div>
</div>
<div class="first_content" style="align-items: flex-start;">
<div class="hot_title">
选择商品:
</div>
<div class="tags_content" style="width: 553px;">
<div class="input-group">
<input id="goodsName${i}" data-id="${arr[i]}" type="text" class="form-control storeList" placeholder="${data[i].goblinGoods.name}">
<div class="input-group-btn">
<ul class="dropdown-menu dropdown-menu-right" role="menu">
</ul>
</div>
</div>
<div class="img_box">
<img id="goodsImg${i}" src="${data[i].goblinGoods.coverPic}" alt="" style="max-height: 180px;max-width:180px;margin: 12px 0;">
<p id="goodsTitle${i}" style="width:180px;">${data[i].goblinGoods.name}</p>
<p id="goodsPrice${i}">${data[i].goblinGoods.priceLe}</p>
</div>
<button id="del${i}" type="button" class="btn btn-danger" style="width: 60px;" onclick="del('${i}')">删除</button>
</div>
</div>
<div class="first_content" style="align-items: flex-start;">
<div class="hot_title">
推荐文案:
</div>
<div class="tags">`;
if (i == 0) {
str+= `<textarea id="text${i}" class="form-control txtIpt" value="" name="" style="width: 553px;height: 150px;">${data[i].informationA}</textarea>`
} else if (i == 1) {
str+= `<textarea id="text${i}" class="form-control txtIpt" value="" name="" style="width: 553px;height: 150px;">${data[i].informationB}</textarea>`
} else if (i == 2) {
str+= `<textarea id="text${i}" class="form-control txtIpt" value="" name="" style="width: 553px;height: 150px;">${data[i].informationC}</textarea>`
} else {
str+= `<textarea id="text${i}" class="form-control txtIpt" value="" name="" style="width: 553px;height: 150px;">${data[i].informationD}</textarea>`
}
str+=`</div>
</div>
</div>`
$("#bannerList").append(str);
common(i)
}
} else {
addItem (count);
}
} else {
addItem (count);
}
// refreshItem()
})
})
function addItem (num) {
let str = '';
......
......@@ -158,6 +158,7 @@
let num = 0;
let jumpType = 1;
let hang = 1;
let returnData = [];
$(function() {
let url = window.location.hostname;
if (url.includes('test')) {
......@@ -167,9 +168,13 @@
} else {
}
showDetail (1)
})
function showDetail (numType) {
promiseMethods('/navigation/list', 'post').then(res => {
let { data } = res;
if (data&&data.length>0) {
if (numType == 1) {
if (data[0].displayType == 1) {
$('#optionsRadios1').attr('checked', true)
$('#optionsRadios2').removeAttr('checked')
......@@ -177,7 +182,8 @@
$('#optionsRadios2').attr('checked', true)
$('#optionsRadios1').removeAttr('checked')
}
}
if (hang == data[0].displayType) {
for (var i = 0; i < data.length; i++) {
let str = '';
str += `<div class="banner_item" data-id="${data[i].mid}">
......@@ -225,7 +231,7 @@
</div>`
if (data[i].goblinGoods) {
str+= `<div class="input-group iptOrSelect shwoSelect${i}" style="display:none;">
<input id="searchIpt${i}" type="text" class="form-control storeList" onFocus="focusMethod(this)" value="${data[i].goblinGoods.spuId}" placeholder="${data[i].goblinGoods.name}">
<input id="searchIpt${i}" type="text" class="form-control storeList" onFocus="focusMethod(this)" data-id="${data[i].goblinGoods.spuId}" value="${data[i].goblinGoods.name}" placeholder="">
<div class="input-group-btn">
<ul class="dropdown-menu dropdown-menu-right" role="menu">
</ul>
......@@ -264,22 +270,40 @@
showOrhide (type, i, data[i].categoryType)
$("#jumpType"+i+" option[value="+type+"]").attr('selected','selected');
returnData = [];
// }, 500);
}
} else {
returnData = data.map((item, index) => {
item.delTag = 1;
return {...item}
})
console.log(returnData, 'returnData')
if (hang == 1) {
addItem (4);
} else {
addItem (8);
}
}
} else {
console.log('?')
if (hang == 1) {
addItem (4);
} else {
addItem (8);
}
}
})
})
}
$("input[name=optionsRadios]").change(function(e){
$("#bannerList").empty();
if (e.target.value == 2) {
hang = 2;
addItem (8);
// addItem (8);
showDetail (2)
} else {
hang = 1;
addItem (4);
showDetail (2)
}
})
function addItem (num) {
......@@ -388,6 +412,8 @@
obj['updateTime'] = '';
arr.push({...obj})
});//foreach js6章封装的方法
arr = arr.concat(returnData);
console.log(arr,returnData, 'arr')
promiseMethods('/navigation/createOrUpdate', 'post', JSON.stringify(arr), 'application/json').then(() => {
let data = {
"mid": 2,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment