Showing
5 changed files
with
40 additions
and
25 deletions
@@ -130,20 +130,36 @@ module.exports={ | @@ -130,20 +130,36 @@ module.exports={ | ||
130 | result={code: "501",message: "用户失效,请重新登录"}; | 130 | result={code: "501",message: "用户失效,请重新登录"}; |
131 | return callback(null, result); | 131 | return callback(null, result); |
132 | } | 132 | } |
133 | - req.body.file = fs.createReadStream(req.files.upfile.path); | 133 | + req.body.files = [fs.createReadStream(req.files.upfile.path)]; |
134 | req.body.bucket="goodsimg"; | 134 | req.body.bucket="goodsimg"; |
135 | request.post({ | 135 | request.post({ |
136 | url: config.domain + '/fileupload/upload', | 136 | url: config.domain + '/fileupload/upload', |
137 | - formData: req.body | 137 | + formData: { |
138 | + fileData: req.body.files, | ||
139 | + project: req.body.bucket | ||
140 | + } | ||
138 | }, function optionalCallback(error, httpResponse, rebody) { | 141 | }, function optionalCallback(error, httpResponse, rebody) { |
139 | if (!error && httpResponse.statusCode == 200) { | 142 | if (!error && httpResponse.statusCode == 200) { |
140 | - var json = JSON.parse(rebody); | ||
141 | - result={}; | ||
142 | - result.originalName=json.data.substring(json.data.lastIndexOf('/')+1); | ||
143 | - result.name=result.originalName; | ||
144 | - result.url=json.data; | ||
145 | - result.type=json.data.substring(json.data.lastIndexOf('.')); | ||
146 | - result.state=json.message=="上传成功"?"SUCCESS":"FAIL"; | 143 | + var ret = JSON.parse(body); |
144 | + if (ret.code === 200) { | ||
145 | + //var imgUrl = ret.data.imagesList[0]; | ||
146 | + var imgs = ret.data.imagesList || []; | ||
147 | + var datas = []; | ||
148 | + for (var i = 0; i < imgs.length; i++) { | ||
149 | + datas.push(joinimg(imgs[i])) | ||
150 | + } | ||
151 | + | ||
152 | + var result={}; | ||
153 | + if(datas.length>0&&datas[0]){ | ||
154 | + result.originalName=Date.now(); | ||
155 | + result.name=Date.now(); | ||
156 | + result.url=datas[0]; | ||
157 | + result.type=datas[0].substring(datas[0].lastIndexOf('.')); | ||
158 | + result.state="SUCCESS"; | ||
159 | + }else{ | ||
160 | + result.state="FAIL"; | ||
161 | + } | ||
162 | + } | ||
147 | } | 163 | } |
148 | return callback(null, result); | 164 | return callback(null, result); |
149 | }); | 165 | }); |
@@ -54,9 +54,6 @@ module.exports=function(app) { | @@ -54,9 +54,6 @@ module.exports=function(app) { | ||
54 | app.post("/productColor/queryProductColors","basegoods_queryProductColors"); | 54 | app.post("/productColor/queryProductColors","basegoods_queryProductColors"); |
55 | 55 | ||
56 | /*获取(非)销售属性*/ | 56 | /*获取(非)销售属性*/ |
57 | - app.post("/standard/queryAllBySortId4Html","basegoods_queryAllProductAttr"); | ||
58 | - | ||
59 | - app.post("/product/queryMaterialList","basegoods_queryMaterialList"); | ||
60 | 57 | ||
61 | app.post("/product/querySortBySmallSort","basegoods_querySortBySmallSort"); | 58 | app.post("/product/querySortBySmallSort","basegoods_querySortBySmallSort"); |
62 | 59 |
@@ -82,6 +82,7 @@ Controller.prototype.__define=function(method,router,view,apis,callback,clientmo | @@ -82,6 +82,7 @@ Controller.prototype.__define=function(method,router,view,apis,callback,clientmo | ||
82 | } else { | 82 | } else { |
83 | res.json(model); | 83 | res.json(model); |
84 | } | 84 | } |
85 | + return; | ||
85 | }); | 86 | }); |
86 | //调用接口获取数据 | 87 | //调用接口获取数据 |
87 | me.interfaces.require.apply(me.interfaces,[apis].concat(args)); | 88 | me.interfaces.require.apply(me.interfaces,[apis].concat(args)); |
@@ -158,6 +158,7 @@ Interfacer.prototype.require=function(mos,req,res,cb){ | @@ -158,6 +158,7 @@ Interfacer.prototype.require=function(mos,req,res,cb){ | ||
158 | console.error(results); | 158 | console.error(results); |
159 | return cb(err,results,names); | 159 | return cb(err,results,names); |
160 | } | 160 | } |
161 | + console.log(names); | ||
161 | return cb(null, results, names); | 162 | return cb(null, results, names); |
162 | }); | 163 | }); |
163 | }; | 164 | }; |
@@ -66,8 +66,8 @@ | @@ -66,8 +66,8 @@ | ||
66 | margin: 0; | 66 | margin: 0; |
67 | padding:0; | 67 | padding:0; |
68 | background-repeat: no-repeat; | 68 | background-repeat: no-repeat; |
69 | - background-image: url(../images/icons.png); | ||
70 | - background-image: url(../images/icons.gif) \9; | 69 | + background-image: url(assets/images/icons.png); |
70 | + background-image: url(assets/images/icons.gif) \9; | ||
71 | } | 71 | } |
72 | 72 | ||
73 | /*状态反射*/ | 73 | /*状态反射*/ |
@@ -230,8 +230,8 @@ | @@ -230,8 +230,8 @@ | ||
230 | *zoom:1; | 230 | *zoom:1; |
231 | width: 8px; | 231 | width: 8px; |
232 | height: 20px; | 232 | height: 20px; |
233 | - background: url(../images/icons.png) -741px 0; | ||
234 | - _background: url(../images/icons.gif) -741px 0; | 233 | + background: url(assets/images/icons.png) -741px 0; |
234 | + _background: url(assets/images/icons.gif) -741px 0; | ||
235 | } | 235 | } |
236 | 236 | ||
237 | .edui-btn-toolbar .edui-splitbutton, | 237 | .edui-btn-toolbar .edui-splitbutton, |
@@ -295,8 +295,8 @@ | @@ -295,8 +295,8 @@ | ||
295 | width: 12px; | 295 | width: 12px; |
296 | margin: 0; | 296 | margin: 0; |
297 | padding: 0; | 297 | padding: 0; |
298 | - background: url(../images/icons.png) -741px 0; | ||
299 | - _background: url(../images/icons.gif) -741px 0; | 298 | + background: url(assets/images/icons.png) -741px 0; |
299 | + _background: url(assets/images/icons.gif) -741px 0; | ||
300 | } | 300 | } |
301 | .edui-btn-toolbar .edui-combobox.edui-disabled{ | 301 | .edui-btn-toolbar .edui-combobox.edui-disabled{ |
302 | opacity: 0.2; | 302 | opacity: 0.2; |
@@ -352,7 +352,7 @@ | @@ -352,7 +352,7 @@ | ||
352 | height: 25px; | 352 | height: 25px; |
353 | background: red; | 353 | background: red; |
354 | vertical-align: bottom; | 354 | vertical-align: bottom; |
355 | - background: url(../images/ok.gif) no-repeat 1000px 1000px; | 355 | + background: url(assets/images/ok.gif) no-repeat 1000px 1000px; |
356 | } | 356 | } |
357 | 357 | ||
358 | .edui-combobox-menu .edui-combobox-checked .edui-combobox-icon { | 358 | .edui-combobox-menu .edui-combobox-checked .edui-combobox-icon { |
@@ -514,7 +514,7 @@ | @@ -514,7 +514,7 @@ | ||
514 | margin-top: 2px; | 514 | margin-top: 2px; |
515 | padding: 1px; | 515 | padding: 1px; |
516 | border: 0; | 516 | border: 0; |
517 | - background: url("../images/close.png") no-repeat center center; | 517 | + background: url("assets/images/close.png") no-repeat center center; |
518 | cursor: pointer; | 518 | cursor: pointer; |
519 | } | 519 | } |
520 | .edui-modal-header .edui-close.edui-hover { | 520 | .edui-modal-header .edui-close.edui-hover { |
@@ -604,7 +604,7 @@ | @@ -604,7 +604,7 @@ | ||
604 | } | 604 | } |
605 | .edui-popup{ | 605 | .edui-popup{ |
606 | display: none; | 606 | display: none; |
607 | - background: url('../images/pop-bg.png') repeat #fff; | 607 | + background: url('assets/images/pop-bg.png') repeat #fff; |
608 | padding: 2px; | 608 | padding: 2px; |
609 | } | 609 | } |
610 | .edui-popup .edui-popup-body{ | 610 | .edui-popup .edui-popup-body{ |
@@ -616,10 +616,10 @@ | @@ -616,10 +616,10 @@ | ||
616 | height: 11px; | 616 | height: 11px; |
617 | } | 617 | } |
618 | .edui-popup .edui-popup-caret.up{ | 618 | .edui-popup .edui-popup-caret.up{ |
619 | - background:url('../images/caret.png') no-repeat 0 0; | 619 | + background:url('assets/images/caret.png') no-repeat 0 0; |
620 | } | 620 | } |
621 | .edui-popup .edui-popup-caret.down{ | 621 | .edui-popup .edui-popup-caret.down{ |
622 | - background:url('../images/caret.png') no-repeat 0 0; | 622 | + background:url('assets/images/caret.png') no-repeat 0 0; |
623 | } | 623 | } |
624 | 624 | ||
625 | 625 | ||
@@ -762,8 +762,8 @@ | @@ -762,8 +762,8 @@ | ||
762 | width: 2px; | 762 | width: 2px; |
763 | height: 20px; | 763 | height: 20px; |
764 | padding: 1px 2px; | 764 | padding: 1px 2px; |
765 | - background: url(../images/icons.png) -179px 1px; | ||
766 | - background: url(../images/icons.gif) -179px 1px \9; | 765 | + background: url(assets/images/icons.png) -179px 1px; |
766 | + background: url(assets/images/icons.gif) -179px 1px \9; | ||
767 | display: inline-block ; | 767 | display: inline-block ; |
768 | vertical-align: top; | 768 | vertical-align: top; |
769 | *display: inline ; | 769 | *display: inline ; |
-
Please register or login to post a comment