Authored by xuhongyun

build project

This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -43,7 +43,7 @@ var Iaccount = {
var apiCofig = {
//root:__dirname,
EnvConst:{
domain:"http://192.168.102.210:8088/platform",
domain:"http://192.168.102.202:8088/platform",
bigdata:"http://192.168.102.210:8091/bigdata",
// bigdata:"http://172.16.6.169:8080",//钟文
// bigdata:"http://172.16.6.189:8080/bigdata",//李建
... ...
... ... @@ -130,7 +130,25 @@ module.exports={
result={code: "501",message: "用户失效,请重新登录"};
return callback(null, result);
}
req.body.files = [fs.createReadStream(req.files.upfile.path)];
var files = req.files.upfile;
console.log(req.files);
//判断是单张传还是多张传
var flag = Object.prototype.toString.call(files) === '[object Array]';
//如果是单张,则数组化
if (!flag) {
files = [];
files.push(req.files.upfile);
}
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].filename;
}
// req.body.files = [fs.createReadStream(req.files.upfile.path)];
req.body.bucket="goodsimg";
request.post({
url: "http://upload.static.yohobuy.com",
... ... @@ -142,21 +160,27 @@ module.exports={
if (!error && httpResponse.statusCode == 200) {
var ret = JSON.parse(body);
if (ret.code === 200) {
var imgUrl = ret.data.imagesList[0];
imgUrl=Utils.joinImg(imgUrl);
result={};
result = [];
for (var i = 0; i < ret.data.imagesList.length; i++) {
var imgUrl = ret.data.imagesList[i];
var rest = {};
imgUrl = Utils.joinImg(imgUrl);
if(imgUrl){
result.originalName=Date.now();
result.name=Date.now();
result.url=imgUrl;
result.type=imgUrl.substring(imgUrl.lastIndexOf('.'));
result.state="SUCCESS";
rest.originalName = Date.now();
rest.name = Date.now();
rest.url = imgUrl;
rest.type = imgUrl.substring(imgUrl.lastIndexOf('.'));
rest.state = "SUCCESS";
}else{
result.state="FAIL";
rest.state = "FAIL";
}
result.push(rest);
}
}
return callback(null, result);
}
});
},
downExcel:function(req, callback){
... ...
... ... @@ -70,7 +70,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 fenmianfile" name="fenmianfile" data-index=[[index]]>
<input type="file" class="goods-img-upload fenmianfile" name="fenmianfile" data-index=[[index]] multiple="true">
</div>
</li>
</ul>
... ...