Authored by dongjunjie

Merge branch 'release/1.6' of http://git.dev.yoho.cn/platform/yohobuy-portal-fe into release/1.6

... ... @@ -68,16 +68,12 @@ var g= new common.grid({
]
});
var Url={},Urls=[];
$(document).on("click","#addUrl",function(){
common.dialog.confirm("添加链接",common.util.__template2($("#template2").html(),{}),function(){
Url[$("#goTo").val()]=$("#goToUrl").val();
//todo
Urls=[];
for(var i in Url){
Urls.push({url:i,text:Url[i]});
}
$("#url").val(JSON.stringify(Urls));
$("#url").val(JSON.stringify({
action:'go.'+$("#goTo").val(),
url:$("#goToUrl").val()
}));
});
});
... ... @@ -111,7 +107,8 @@ var e=new common.edit("#panel-body",{});
e.init();
$(document).on("click","#submit",function(){
e.submit($("#panel-body").attr("action"),function(){
e.submit($("#panel-body").attr("action"),function(option){
console.log(option.data);
option.data.debug=true;
});
});
\ No newline at end of file
... ...
... ... @@ -6,7 +6,9 @@ var common = require('../common/common');
var util = require('../common/util');
var hasClickEvent = false;//判断保存按钮是否有点击事件;
//定义全局数据变量
var dataList={};
//点击搜索按钮
$(document).on('click', '#searchSku', function () {
var val = $.trim($("#skuInput").val());
if (!val.match(/^[0-9]+$/)) {
... ... @@ -21,99 +23,117 @@ $(document).on('click', '#searchSku', function () {
}, function (res) {
if (res.data.list && res.data.list.length > 0) {
var e = new common.edit("#add-list");
var item = res.data.list[0];
dataList = res.data.list[0];
//拼接分类字符串
var a = dataList.productType.replace(/<br>/g, "/");
dataList.productType = a.substring(0, a.length - 1);
var headList = [];
var j = 0;//创造一个变量以供赋值
if (item.sizeRelationsList.length > 0) {
if (dataList.sizeRelationsList.length > 0) {
headList.push({display: "尺码", name: "sizeName"});//尺码
headList.push({
display: "参考尺码(" + item.genderName + ")", name: "referenceName", render: function (item) {//参考尺码列
var refName = item.referenceName ? item.referenceName : "";//非空判断
return '<input class="form-control refInfo" data-index="' + item.__index + '"' + 'value="' + refName + '"/>';
display: "参考尺码(" + dataList.genderName + ")", name: "referenceName", render: function (item1) {//参考尺码列
var refName = item1.referenceName ? item1.referenceName : "";//非空判断
var a = refName.split(/[|/]/g);
var refName1 = a[0] || "", refName2 = a[1] || "";
return '<input class="col-sm-2 refInfo refInfo1" data-index="' + item1.__index + '"' + 'value="' + refName1 + '"/>' + '<div class="col-sm-1">' + '/</div>' + '<input class="col-sm-2 refInfo refInfo2" data-index="' + item1.__index + '"' + 'value="' + refName2 + '"/>';
}
});
for (var i = 0; i < item.sizeRelationsList[0].prdSizeAttributeBoList.length; i++) {//尺码列
var sizeAttributes = item.sizeRelationsList[0].prdSizeAttributeBoList[i];//参考尺码数组里的数据
for (var i = 0; i < dataList.sizeRelationsList[0].prdSizeAttributeBoList.length; i++) {//尺码列
var sizeAttributes = dataList.sizeRelationsList[0].prdSizeAttributeBoList[i];//参考尺码数组里的数据
var chkbox = '<label style="cursor: pointer;"><input type="checkbox" name="noMeasureIds" value="' + sizeAttributes.sizeAttributeId + '"/>无需测量</label>';
headList.push({
display: sizeAttributes.sizeAttributeName + "<br>" + chkbox,
name: "sizeValue",
render: function (item) {
var prdList = item.prdSizeAttributeBoList;
render: function (item1) {
var prdList = item1.prdSizeAttributeBoList;
if (j == prdList.length) j = 0;//防止越界
var sizeVal = prdList[j].sizeValue ? prdList[j].sizeValue : "";
//j++;//
return '<input class="form-control sizeInfo ' + prdList[j++].sizeAttributeId
+ '" data-index="' + item.__index + '"' + 'value="' + sizeVal + '"/>';
+ '" data-index="' + item1.__index + '"' + 'value="' + sizeVal + '"/>';
}
});
}
}
var grid = new common.grid({
el: "#content-list",
hash: false,
columns: headList
});
grid.init(item.sizeRelationsList);
//$("#add-saveArea").show();
$("#add-head").html(common.util.__template2($("#modifySize-template").html(), item));
$("#noMeasureIds").val(item.noMeasureIds ? item.noMeasureIds.join("|") : "");
grid.init(dataList.sizeRelationsList);
$("#add-head").html(common.util.__template2($("#modifySize-template").html(), dataList));
$("#noMeasureIds").val(dataList.noMeasureIds ? dataList.noMeasureIds.join("|") : "");
$("#add-list").show();
e.init();
if (!hasClickEvent) {
hasClickEvent = true;
$(document).on('click', '#add-saveBtn', function () {
var flag = false;
$("input[name='noMeasureIds']").not("input:checked").each(function () {
$("." + $(this).val()).each(function () {
if (!$(this).val()) {
flag = true;
return false;
}
});
if (flag) return false;
});
if (flag) {
util.__tip("请将没有勾选无需测量的列填写完整!", "warning");
return false;
}
//var flag = false;
//$("input[name='noMeasureIds']").not("input:checked").each(function () {
// $("." + $(this).val()).each(function () {
// if (!$(this).val()) {
// flag = true;
// return false;
// }
// });
// if (flag) return false;
//});
//if (flag) {
// util.__tip("请将没有勾选无需测量的列填写完整!", "warning");
// return false;
//}
//var flag = false;
//$("input[name='noMeasureIds']").not("input:checked").each(function () {
// $("." + $(this).val()).each(function () {
// if (!$(this).val()) {
// flag = true;
// return false;
// }
// });
// if (flag) return false;
//});
//if (flag) {
// util.__tip("请将没有勾选无需测量的列填写完整!", "warning");
// return false;
//}
var noMeasureIds = JSON.stringify($("#noMeasureIds").val() ? $("#noMeasureIds").val().split("|") : []);//无需测量的列
//尺码信息列表
var sizeInfoList = [];
for (var i = 0; i < $(".sizeInfo").length; i++) {
var info = $($(".sizeInfo")[i]);//当前尺码input对象
var prdList = grid.rows[info.data("index")].prdSizeAttributeBoList;//当前列的对象的尺码列表
var prdList = dataList.sizeRelationsList[info.data("index")].prdSizeAttributeBoList;//当前列的对象的尺码列表
var attrIndex = parseInt(i % prdList.length);//在当前列的索引
sizeInfoList[i] = ({
productSkn: item.productSkn,
sizeId: grid.rows[info.data("index")].sizeId,
productSkn: dataList.productSkn,
sizeId: dataList.sizeRelationsList[info.data("index")].sizeId,
sizeAttributeId: prdList[attrIndex].sizeAttributeId,
sizeValue: info.val()
});
}
//商品参考尺码
var productSizeReferList = [];
for (var i = 0; i < $(".refInfo").length; i++) {
var ref = $($(".refInfo")[i]);
for (var i = 0; i < $(".refInfo").length / 2; i++) {
var ref1 = $($(".refInfo1")[i]);
var ref2 = $($(".refInfo2")[i]);
productSizeReferList.push({
sizeId: grid.rows[ref.data("index")].sizeId,
gender: item.gender,
referenceName: ref.val()
sizeId: dataList.sizeRelationsList[ref1.data("index")].sizeId,
gender: dataList.gender,
referenceName: ref1.val() + '/' + ref2.val()
});
}
var data = {
productSkn: dataList.productSkn,
noMeasureIds: noMeasureIds,
sizeInfoList: JSON.stringify(sizeInfoList),
productSizeReferList: JSON.stringify(productSizeReferList)
};
common.util.__ajax({
url: "/meterManage/productSize/saveProdSizeInfo",
data: {
productSkn: item.productSkn,
noMeasureIds: noMeasureIds,
sizeInfoList: JSON.stringify(sizeInfoList),
productSizeReferList: JSON.stringify(productSizeReferList)
data: data
}, function (res) {
if(res.code=='200'){
}
}, function () {
});
return false;
});
... ...
... ... @@ -50,21 +50,22 @@ var g = new common.grid({
{
display: "尺码",
name: "sizeRelationsList",
render: function (item) {
return common.util.__template2($("#sizeinfo-template").html(), item);
render: function (item1) {
return common.util.__template2($("#sizeinfo-template").html(), item1);
}
},
{
display: "到货时间",
name: "",
render: function (item) {
return Bll.getLocalTime(item.expectArrivalTime);
render: function (item1) {
return Bll.getLocalTime(item1.expectArrivalTime);
}
},
{
display: "操作", name: "", render: function (item) {
display: "操作", name: "", render: function (item1) {
var arr = [];
arr.push('<a class="btn btn-info add2" data-index="' + item.__index + '">编辑</a>');
arr.push('<a class="btn btn-info add2" data-index="' + item1.__index + '">编辑</a>');
return arr.join("");
}
}
... ... @@ -98,21 +99,20 @@ var Bll = {
value: "提交",
css: 'btn-info',
callback: function () {
var flag = false;
$("input[name='noMeasureIds']").not("input:checked").each(function () {
$("." + $(this).val()).each(function () {
if (!$(this).val()) {
flag = true;
return false;
}
});
if (flag) return false;
});
if (flag) {
util.__tip("请将没有勾选无需测量的列填写完整!", "warning");
return false;
}
//var flag = false;
//$("input[name='noMeasureIds']").not("input:checked").each(function () {
// $("." + $(this).val()).each(function () {
// if (!$(this).val()) {
// flag = true;
// return false;
// }
// });
// if (flag) return false;
//});
//if (flag) {
// util.__tip("请将没有勾选无需测量的列填写完整!", "warning");
// return false;
//}
var noMeasureIds = JSON.stringify($("#noMeasureIds").val() ? $("#noMeasureIds").val().split("|") : []);//无需测量的列
//尺码信息列表
var sizeInfoList = [];
... ... @@ -129,22 +129,25 @@ var Bll = {
}
//商品参考尺码
var productSizeReferList = [];
for (var i = 0; i < $(".refInfo").length; i++) {
var ref = $($(".refInfo")[i]);
for (var i = 0; i < $(".refInfo").length/2; i++) {
var ref1 = $($(".refInfo1")[i]);
var ref2 = $($(".refInfo2")[i]);
productSizeReferList.push({
sizeId: grid.rows[ref.data("index")].sizeId,
sizeId: grid.rows[ref1.data("index")].sizeId,
gender: item.gender,
referenceName: ref.val()
referenceName: ref1.val()+'/'+ref2.val()
});
}
var data={
productSkn: item.productSkn,
noMeasureIds: noMeasureIds,
sizeInfoList: JSON.stringify(sizeInfoList),
productSizeReferList: JSON.stringify(productSizeReferList)
};
console.log("最终数据data",data);
common.util.__ajax({
url: url,
data: {
productSkn: item.productSkn,
noMeasureIds: noMeasureIds,
sizeInfoList: JSON.stringify(sizeInfoList),
productSizeReferList: JSON.stringify(productSizeReferList)
}
data: data
}, function (res) {
if (res.code == '200') {
g.reload();
... ... @@ -168,9 +171,11 @@ var Bll = {
if (item.sizeRelationsList.length > 0) {
headList.push({display: "尺码", name: "sizeName"});//尺码
headList.push({
display: "参考尺码(" + item.genderName + ")", name: "referenceName", render: function (item) {//参考尺码列
var refName = item.referenceName ? item.referenceName : "";//非空判断
return '<input class="form-control refInfo" data-index="' + item.__index + '"' + 'value="' + refName + '"/>';
display: "参考尺码(" + item.genderName + ")", name: "referenceName", render: function (item1) {//参考尺码列
var refName = item1.referenceName ? item1.referenceName : "";//非空判断
var a =refName.split(/[,|/]/g);
var refName1=a[0]||"",refName2=a[1]||"";
return '<input class="col-sm-2 refInfo refInfo1" data-index="' + item1.__index + '"' + 'value="' + refName1 + '"/>'+'<div class="col-sm-1">'+'/</div>'+'<input class="col-sm-2 refInfo refInfo2" data-index="' + item1.__index + '"' + 'value="' + refName2 + '"/>';
}
});
for (var i = 0; i < item.sizeRelationsList[0].prdSizeAttributeBoList.length; i++) {//尺码列
... ... @@ -179,18 +184,17 @@ var Bll = {
headList.push({
display: sizeAttributes.sizeAttributeName + "<br>" + chkbox,
name: "sizeValue",
render: function (item) {
var prdList = item.prdSizeAttributeBoList;
render: function (item1) {
var prdList = item1.prdSizeAttributeBoList;
if (j == prdList.length) j = 0;//防止越界
var sizeVal = prdList[j].sizeValue ? prdList[j].sizeValue : "";
//j++;//
return '<input class="form-control sizeInfo ' + prdList[j++].sizeAttributeId
+ '" data-index="' + item.__index + '"' + 'value="' + sizeVal + '"/>';
+ '" data-index="' + item1.__index + '"' + 'value="' + sizeVal + '"/>';
}
});
}
}
var grid = new common.grid({
el: "#faGrid",
hash: false,
... ... @@ -208,5 +212,8 @@ $(document).on('click', '#filter-btn', function () {
$(document).on('click', '.add2', function () {
var item = g.rows[$(this).data("index")];
//拼接分类字符串
var a=item.productType.replace(/<br>/g, "/");
item.productType= a.substring(0, a.length-1);
Bll.toast("/meterManage/productSize/saveProdSizeInfo", item, "修改尺码");
});
\ No newline at end of file
... ...
... ... @@ -41,7 +41,7 @@ var g = new common.grid({
g.init("/meterManage/tryInfo/index2");
var modelLists = [];
//根据productSkn获取所有试穿信息并拼接返回
var getAllInfo = function (productSkn, maxSortId,callback) {
var getAllInfo = function (productSkn, maxSortId, callback) {
common.util.__ajax({url: '/meterManage/tryInfo/info1', data: {productSkn: productSkn}}, function (data) {
var feelIds = {
1: "合适",
... ... @@ -73,16 +73,18 @@ var getAllInfo = function (productSkn, maxSortId,callback) {
}
}
callback(modelLists);
var e = new common.edit("#baseInfo");
e.init();
new common.dropDown({
el: '.fit_size',
ajax: 'sortsize2',
params: function(){
params: function () {
return {
"sortId" : maxSortId
"sortId": maxSortId
};
}
});
new common.dropDown({el: '.feel_id'})
new common.dropDown({el: '.feel_id'});
}, true);
};
//整合修改后的所有试穿信息
... ... @@ -91,10 +93,10 @@ var getNewLists = function (modelLists, callback) {
for (var i = 0; i < modelLists.length; i++) {
newList[i] = {};
newList[i].model_id = modelLists[i].id;
if (modelLists[i].tryInfo.feel_id||modelLists[i].tryInfo.fit_size|| modelLists[i].tryInfo.fit_remark) {
newList[i].feel_id = modelLists[i].tryInfo.feel_id||"";
newList[i].fit_size = modelLists[i].tryInfo.fit_size||"";
newList[i].fit_remark = modelLists[i].tryInfo.fit_remark||"";
if (modelLists[i].tryInfo.feel_id || modelLists[i].tryInfo.fit_size || modelLists[i].tryInfo.fit_remark) {
newList[i].feel_id = modelLists[i].tryInfo.feel_id || "";
newList[i].fit_size = modelLists[i].tryInfo.fit_size || "";
newList[i].fit_remark = modelLists[i].tryInfo.fit_remark || "";
}
else {
newList[i].feel_id = "";
... ... @@ -108,7 +110,7 @@ var getNewLists = function (modelLists, callback) {
//详情模态
var Bll = {
toast: function (url, item) {
getAllInfo(item.productSkn, item.maxSortId,function (data) {
getAllInfo(item.productSkn, item.maxSortId, function (data) {
var a = new common.dialog({
title: "试穿信息",
width: '80%',
... ... @@ -161,10 +163,10 @@ $(document).on("change", ".tryInfo1", function () {
var _index = $(this).data("index");
var item = modelLists[_index].tryInfo;
var name = $(this).data('name');
if(name=='fit_size'){
item[name]=$(this).find("option[value='"+$(this).val()+"']").text();
if (name == 'fit_size') {
item[name] = $(this).find("option[value='" + $(this).val() + "']").text();
}
else{
else {
item[name] = $(this).val();
}
console.log(item);
... ...
... ... @@ -178,7 +178,7 @@ $('tbody').on('click', '.close-brand', function() {
var item=g.rows[$(this).data("index")];
common.util.__ajax({
url:'/erpproduct/brandfolder/close',
data:{id:item.id}
data:{id:item.id, type: item.type}
},function(){
g.reload();
});
... ... @@ -189,7 +189,7 @@ $('tbody').on('click', '.open-brand', function() {
var item=g.rows[$(this).data("index")];
common.util.__ajax({
url:'/erpproduct/brandfolder/open',
data:{id:item.id}
data:{id:item.id, type: item.type}
},function(){
g.reload();
});
... ...
... ... @@ -67,6 +67,7 @@ g.init("/shotManage/proPhoto/index2");
var Bll = {
pictureBoList: [],
selectedBoId: [],
clonePics:[],
//重新渲染图片列表
rendBoList: function (pictureBoList) {
$(".image-list").html('');
... ... @@ -76,11 +77,6 @@ var Bll = {
}
));
},
//获取图片原始名称
getFileName: function (file) {
var pos = file.lastIndexOf("\\");
return file.substring(pos + 1);
},
//获取编辑时新增的图片
getNewPics:function(pictureBoList){
var newPic=[];
... ... @@ -93,7 +89,7 @@ var Bll = {
}
return newPic
},
//模态
toast: function (url, item, datacall) {
Bll.pictureBoList = item.pictureBoList||[];
Bll.selectedBoId = [];
... ... @@ -106,9 +102,9 @@ var Bll = {
value: "提交", callback: function () {
var data={};
if(item.__state=='add'){
data = datacall && datacall(Bll.pictureBoList, Bll.selectedBoId);
data = datacall && datacall(Bll.clonePics, Bll.selectedBoId);
}else{
data = datacall && datacall(Bll.getNewPics(Bll.pictureBoList), Bll.selectedBoId);
data = datacall && datacall(Bll.getNewPics(Bll.clonePics), Bll.selectedBoId);
}
console.log("最终提交数据data",data);
common.util.__ajax({
... ... @@ -138,21 +134,23 @@ var Bll = {
valid_extensions: ['png', 'jpg', 'jpeg'],
onComplete: function (response) {
if (response.status && response.code == 200) {
var file = $("#picfile").val();
var fileName = Bll.getFileName(file);
var data = {
"fileName": response.data,
"originalName": fileName
};
Bll.pictureBoList.push(data);
Bll.rendBoList(Bll.pictureBoList);
for(var i=0;i<response.data.length;i++){
Bll.pictureBoList.push({
"fileName": response.data[i],
"originalName": response.names[i]
});
Bll.clonePics.push({
"fileName": response.data[i],
"originalName": response.names[i]
})
}
Bll.rendBoList(Bll.clonePics);
}
else {
common.util.__tip(response.message, 'warning');
}
}
});
}
};
//上传图片--点击事件
... ... @@ -160,6 +158,7 @@ $('#upload-btn').on('click', function () {
var item = {
__state: "add"
};
Bll.clonePics=[];
Bll.toast('/shotManage/proPhoto/add', item, function (pictureBoList, selectedBoId) {
return {
productPhotoAddStrList: JSON.stringify(pictureBoList)
... ... @@ -171,6 +170,8 @@ $('#upload-btn').on('click', function () {
$(document).on('click', '.update', function () {
var item = g.rows[$(this).data("index")];
item.__state = "update";
Bll.clonePics=[];
Array.prototype.push.apply(Bll.clonePics,item.pictureBoList);
Bll.toast('/shotManage/proPhoto/add', item, function (pictureBoList, selectedBoId) {
return {
productSkn: item.productSkn,
... ... @@ -183,11 +184,11 @@ $(document).on('click', '.update', function () {
//删除单张图片
$(document).on('click', '.remove1', function () {
var index = $(this).data("index");
if(Bll.pictureBoList[index].id){
Bll.selectedBoId.push(Bll.pictureBoList[index].id);
if(Bll.clonePics[index].id){
Bll.selectedBoId.push(Bll.clonePics[index].id);
}
Bll.pictureBoList.splice(index, 1);
Bll.rendBoList(Bll.pictureBoList);
Bll.clonePics.splice(index, 1);
Bll.rendBoList(Bll.clonePics);
});
//查询按钮--点击事件
... ...
... ... @@ -18,8 +18,8 @@ var config = {
// domain: 'http://172.16.6.214:8088/platform',//陈超
//http://172.16.6.124:8088/platform/product/queryAllProductAttr
//domain: 'http://172.16.6.146:8088/platform', //玛丽
domain: 'http://192.168.102.202:8088/platform',
// domain:'http://172.16.6.157:8080/yohobuy-platform-web',//葛超
// domain: 'http://192.168.102.202:8088/platform',
domain:'http://172.16.6.157:8080/yohobuy-platform-web',//葛超
//domain: 'http://172.16.6.239:8080', //孙杰翔
// domain:'http://172.16.6.189:8088/platform', //李健1
//domain:'http://192.168.102.216:8180/platform', //李健2
... ...
... ... @@ -162,6 +162,9 @@ exports.res = [
{
name: 'id',
type: 'Number',
}, {
name: 'type',
type: 'Number',
}
],
src:'/product/brandModels'
... ... @@ -175,18 +178,8 @@ exports.res = [
{
name: 'id',
type: 'Number',
}
],
src:'/product/brandModels'
},
{ //查询
route: '/erpproduct/brandfolder/open',
method: 'POST',
url: '/brandSeries/open',
params:[
{
name: 'id',
}, {
name: 'type',
type: 'Number',
}
],
... ...
... ... @@ -67,7 +67,8 @@ exports.res = [
{name: 'status', type: 'Number'},//模特状态:0 禁用 1 启用
{name: 'vitalStatistics', type: 'string'},//三围
{name: 'weight', type: 'Number'},//体重
{name: 'avatar', type: 'string'}//头像
{name: 'avatar', type: 'string'},//头像
{name: 'modelCard', type: 'string'}//模特卡
]
}
];
\ No newline at end of file
... ...
... ... @@ -10,44 +10,55 @@ var oldUploadUrl = 'http://upload.static.yohobuy.com';
//上传异常的信息
var errBackMsg = {
code: "500",
message: "接口异常"
};
code: "500",
message: "接口异常"
};
//var domain = 'http://172.16.6.227:8088/platform'; //马力
// var domain = 'http://172.16.6.162:8088/platform';
//var domain = 'http://172.16.6.240:8088/platform';
exports.uploadFile = function(req, res) {
exports.uploadFile = function (req, res) {
var headers = {};
if (req.session && req.session.user) {
var ipObject = ipaddr.process(req.ip).octets
var ipObject = ipaddr.process(req.ip).octets;
var ip = ipObject ? ipObject.join('.') : req.ip;
headers = {
'x-user-id': req.session.user.auth.pid,
'x-user-name': req.session.user.auth.account,
'x-site-type': 1,
'x-client-ip': ip
};
}else{
}
else {
res.json({
code: "501",
message: "用户失效,请重新登录"
});
code: "501",
message: "用户失效,请重新登录"
});
}
if (req.is("multipart/form-data")) {
console.log(req.body);
var url=[];
for(var key in req.body){
url.push(key+"="+req.body[key]);
var url = [];
for (var key in req.body) {
url.push(key + "=" + req.body[key]);
}
//req.body.file = fs.createReadStream(req.files[req.body.filename].path);
var files = req.files[req.body.filename];
//判断是单张传还是多张传
var flag = Object.prototype.toString.call(files) === '[object Array]';
//如果是单张,则数组化
if (!flag) {
files = [];
files.push(req.files[req.body.filename]);
}
req.body.files = [];
req.body.fileNames = [];
for (var index = 0; index < files.length; index++) {
req.body.files[index] = fs.createReadStream(files[index].path);
req.body.fileNames[index] = files[index].name;
}
req.body.file = fs.createReadStream(req.files[req.body.filename].path);
if (req.body.__type == "batch-import") {
request.post({
url: domain + '/batch/import?'+url.join("&"),
url: domain + '/batch/import?' + url.join("&"),
formData: req.body,
headers: headers
}, function optionalCallback(error, httpResponse, body) {
... ... @@ -57,46 +68,49 @@ exports.uploadFile = function(req, res) {
if (!error && httpResponse.statusCode == 200) {
var json = JSON.parse(body);
json.status = true;
// console.log(json);
res.json(json);
} else {
res.json(errBackMsg);
}
});
} else {
//如果是goodsimg(商品)的图片,灰度到老系统的上传地址
if(req.body.bucket === 'goodsimg') {
req.body.filename = req.files[req.body.filename].path;
if (req.body.bucket === 'goodsimg') {
//req.body.filename = req.files[req.body.filename].path;
request.post({
url: oldUploadUrl,
formData:{
fileData:req.body.file,
project:req.body.bucket
formData: {
fileData: req.body.files,
project: req.body.bucket
}
},function(error,resd,body) {
if(!error && resd.statusCode == 200) {
}, function (error, resd, body) {
if (!error && resd.statusCode == 200) {
var ret = JSON.parse(body);
if(ret.code === 200) {
var imgUrl = ret.data.imagesList[0];
if (ret.code === 200) {
//var imgUrl = ret.data.imagesList[0];
var imgs = ret.data.imagesList || [];
var datas = [];
for (var i = 0; i < imgs.length; i++) {
datas.push(joinimg(imgs[i]))
}
res.json({
code:200,
data:joinimg(imgUrl),
message:'上传成功',
status:true
code: 200,
data: datas,
names: req.body.fileNames,
message: '上传成功',
status: true
});
return;
}
}
}
res.json(errBackMsg);
});
} else {
req.body.file = fs.createReadStream(req.files[req.body.filename].path);
request.post({
url: domain + '/fileupload/upload',
formData: req.body
}, function optionalCallback(error, httpResponse, body) {
console.log(body);
if (!error && httpResponse.statusCode == 200) {
var json = JSON.parse(body);
json.status = true;
... ... @@ -113,7 +127,7 @@ exports.uploadFile = function(req, res) {
message: "请求类型错误"
});
}
}
};
/**
* 组合全路径的图片地址
... ... @@ -121,12 +135,12 @@ exports.uploadFile = function(req, res) {
function joinimg(url) {
var urlArr = url.split('/');
var domain = 'static.yhbimg.com/goodsimg';
var num = urlArr[urlArr.length-1].substr(1,1);
var url = domain + url;
if(num == 1) {
return 'http://img11.' + url;
var num = urlArr[urlArr.length - 1].substr(1, 1);
var url1 = domain + url;
if (num == 1) {
return 'http://img11.' + url1;
} else {
return 'http://img12.'+ url;
return 'http://img12.' + url1;
}
}
... ... @@ -154,7 +168,7 @@ function joinimg(url) {
exports.ueditor = function(req, res) {
var headers = {};
if (req.session && req.session.user) {
var ipObject = ipaddr.process(req.ip).octets
var ipObject = ipaddr.process(req.ip).octets;
var ip = ipObject ? ipObject.join('.') : req.ip;
headers = {
... ... @@ -170,8 +184,6 @@ exports.ueditor = function(req, res) {
message: "用户失效,请重新登录"
});
}
console.log(req.files);
if (req.is("multipart/form-data")) {
req.body.file = fs.createReadStream(req.files.upfile.path);
req.body.bucket="goodsimg";
... ...
... ... @@ -38,7 +38,7 @@
<div id="content-list"></div>
<div id="add-saveArea">
<a class="btn btn-success" id="add-saveBtn" href="">保存</a>
<a class="btn btn-primary" href="/meterManage/meterSize/index">返回</a>
<a class="btn btn-primary" href="/meterManage/meterSize/index">取消</a>
</div>
</div>
</div>
... ... @@ -47,16 +47,11 @@
<div id="base-form">
<table style="width: 100%">
<tr>
<th>SKN</th>
<td width="60px;">[[productSkn]]</td>
<th> 名称:</th>
<td>[[productName]]</td>
<th> 品牌:</th>
<td>[[brandName]]</td>
<th> 分类:</th>
<td>[[maxSortName]]</td>
<th> 性别:</th>
<td>[[genderName]]</td>
<th>SKN[[productSkn]]</th>
<th> 名称:[[productName]]</th>
<th> 品牌:[[brandName]]</th>
<th>分类:[[productType]]</th>
<th> 性别:[[genderName]]</th>
<input type="hidden" id="productSkn" value="[[productSkn]]" />
</tr>
</table>
... ...
... ... @@ -38,7 +38,7 @@
<tr>
<td>说明:</td>
<td colspan="2">
1、上传文件必须是<span style="color:red;">.csv</span>文件<br>
1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br>
2、第一行标题栏:<span style="color: red;">试穿模特ID|sku|试穿描述|试穿备注</span><br>
3、<a href="/ajax/link/productModelTry">下载样例</a>
</td>
... ...
... ... @@ -99,7 +99,7 @@
<th>SKN[[productSkn]]</th>
<th> 名称:[[productName]]</th>
<th> 品牌:[[brandName]]</th>
<th>分类:[[maxSortName]]</th>
<th>分类:[[productType]]</th>
<th> 性别:[[genderName]]</th>
<input type="hidden" id="productSkn" value="[[productSkn]]" />
</tr>
... ...
... ... @@ -57,7 +57,7 @@
<span class="col-sm-6 pull-left">产品名称:&nbsp;[[productName]]</span>
<br>
</div>
<table class="table table-bordered">
<table class="table table-bordered" id="baseInfo">
<thead>
<tr>
<th>模特名</th>
... ... @@ -78,25 +78,15 @@
</select>
</th>
<th>
[[if item.tryInfo.feel_id]]
<select name="status" data-name="feel_id" data-index="[[index]]" title="" class="select2-offscreen brandBtn-group feel_id tryInfo1">
<option value="[[item.tryInfo.feel_id]]">[[item.tryInfo.fell_name]]</option>
<select name="feel_id" value="[[item.tryInfo.feel_id]]" data-name="feel_id" data-index="[[index]]" title="" class="select2-offscreen brandBtn-group feel_id tryInfo1">
<option value="-1">[['请选择试穿描述']]</option>
<option value="1">[['合适']]</option>
<option value="2">[['偏大']]</option>
<option value="3">[['偏小']]</option>
</select>
[[else]]
<select name="status" data-name="feel_id" data-index="[[index]]" title="" class="select2-offscreen brandBtn-group feel_id tryInfo1">
<option value="-1">[['请选择试穿描述']]</option>
<option value="1">[['合适']]</option>
<option value="2">[['偏大']]</option>
<option value="3">[['偏小']]</option>
</select>
[[/if]]
</th>
<th>
<input type="text" data-name="fit_remark" data-index="[[index]]" value="[[item.tryInfo.fit_remark]]" name="fit_remark" id="fit_remark" class="tryInfo1 "
<input type="text" data-name="fit_remark" data-index="[[index]]" value="[[item.tryInfo.fit_remark]]" name="fit_remark" id="fit_remark" class="tryInfo1 " maxlength="12"
placeholder="添加备注,不超过12字">
</th>
</tr>
... ...
... ... @@ -108,7 +108,7 @@
</label>
<div class="panel-col">
<select name="type" id="type" value="[[type]]" tabindex="-1" required="required" title="" class="form-control height40">
<select name="type" id="type" value="[[type]]" disabled="true" tabindex="-1" required="required" title="" class="form-control height40">
<option value="-1">类型</option>
<option value="1">品牌款型</option>
<option value="2">品牌系列</option>
... ...
... ... @@ -58,7 +58,7 @@
<!--上传图片-->
<script type="text/template" id="template1">
<div class="rows" style="height: 400px;overflow: auto">
<div class="rows">
[[if __state=='update']]
<div class="form-group">
<label class="col-sm-2">SKN</label>
... ... @@ -75,7 +75,7 @@
<li class="cover-image-item fileinput-button">
<div class="goods-img">
<a class="fileinput-button-icon" href="javascript:void(0);">+</a>
<input type="file" class="goods-img-upload picfile" name="picfile" required="required" id="picfile" placeholder="图片">
<input type="file" class="goods-img-upload picfile" name="picfile" required="required" id="picfile" placeholder="图片" multiple="true">
</div>
</li>
</ul>
... ...