Authored by weiqingting

提交

... ... @@ -133,7 +133,12 @@ edit.prototype={
Temp+='<li class="fileinput-button">';
Temp+='<a class="fileinput-button-icon" href="javascript:void(0);">';
if(src){
Temp+='<img width="76" height="80" src="'+src+'">';
var ext = src.split('.').pop().toLowerCase();
if(ext=="mp4"){
Temp+='<img width="76" height="80" src="'+src+'">';
}else{
Temp+='<video width="76" height="80" src="'+src+'"></video>';
}
}else{
Temp+='+';
}
... ...
var request=require('request');
var fs=require('fs');
var domain = require('../../config/common.js').domain;
//var domain = require('../../config/common.js').domain;
//var domain = 'http://172.16.6.227:8083/yohobuy-platform-web';
//var domain = 'http://192.168.102.202:8088/platform';
//var domain = 'http://172.16.6.240:8088/platform';
var domain = 'http://172.16.6.240:8088/platform';
var env = process.env.NODE_ENV || 'development';
exports.uploadFile=function(req,res){
// TODO 代理上传
// 方法1
if(env==="development"){
res.json({
"code":200,
"data" : "https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq/it/u=1444256491,538988776&fm=80",
"message":"success"
});
}else{
if(req.is("multipart/form-data")){
req.body.file=fs.createReadStream(req.files[req.body.filename].path);
if(req.body.__type=="batch-import"){
request.post({url:domain+'/batch/import',formData:req.body},function optionalCallback(err, httpResponse, body){
res.json(JSON.parse(body));
});
}else{
request.post({url:domain+'/fileupload/upload',formData:req.body},function optionalCallback(err, httpResponse, body){
res.json(JSON.parse(body));
});
}
if(req.is("multipart/form-data")){
req.body.file=fs.createReadStream(req.files[req.body.filename].path);
if(req.body.__type=="batch-import"){
request.post({url:domain+'/batch/import',formData:req.body},function optionalCallback(err, httpResponse, body){
res.json(JSON.parse(body));
});
}else{
res.json({code:"500",message:"请求类型错误"});
request.post({url:domain+'/fileupload/upload',formData:req.body},function optionalCallback(err, httpResponse, body){
res.json(JSON.parse(body));
});
}
}else{
res.json({code:"500",message:"请求类型错误"});
}
//
}
\ No newline at end of file
... ...
... ... @@ -113,13 +113,13 @@
<script type="text/template" id="picDialogTemp">
<div class="row">
<div id="upload-wrapper" class="col-md-3">
<input id="imgVideo" type="file" class="btn btn-primary ml10" value="{attachUrl}">
<input id="imgVideo" name="imgVideo" type="file" class="btn btn-primary ml10" value="{attachUrl}">
</div>
<div class="col-md-9">
<div class="row">
<label class="pull-left control-label height40">{name}链接</label>
<div class="pull-left ml10">
<input class="form-control" id="imgVideoText" type="text" placeholder="{name}链接" value="{attachUrl}">
<input class="form-control" id="imgVideoText" type="text" placeholder="{name}链接" value="{attachUrl}">
</div>
</div>
... ...