Authored by ZhongW

Merge branch 'dev_vedio' into test5.2

网销 视频
# Conflicts:
#	code/index.js
... ... @@ -86,6 +86,25 @@ module.exports = {
return callback(null,errBackMsg);
}
});
}//上传文件
else if(req.body.__type == "import-video"){
req.body.file = fs.createReadStream(req.files[req.body.filename].path);
request.post({
url: config.domain+"/fileupload/uploadFile",
formData: req.body,
headers: httpHeader
}, function optionalCallback(error, httpResponse, body) {
if (error) {
return callback(null,error);
}
if (!error && httpResponse.statusCode == 200) {
var json = JSON.parse(body);
json.status = true;
return callback(null,json)
} else {
return callback(null,errBackMsg);
}
});
}
//上传图片
else {
... ...
... ... @@ -13,8 +13,8 @@ module.exports = function (app) {
}
});
//产品图片数据列表
//app.post("/shotManage/proPhoto/index2", "shootMeter_queryProductPhotoList");
//视频列表
app.post("/video/queryVideosList", "video_queryVideosList");
//添加产品图片
//app.post("/shotManage/proPhoto/add", "shootMeter_addProductBatchPhoto");
... ...
... ... @@ -8,18 +8,14 @@ module.exports = {
apis: {
/************************************产品视频管理*************************************/
queryProductPhotoList: {
title: "产品图片数据列表",
url: "/productPhoto/queryProductPhotoList",
queryVideosList: {
title: "视频列表",
url: "/videos/queryVideosList",
params: {
page: {type: Number},
size: {type: Number},
productSkn: {type: Number},
productSku: {type: Number},
productSkc: {type: Number},
startTime: {type: Number},
shopId: {type: Number},
endTime: {type: Number}
skn:{type: String},
videoName: {type: String}
}
}
}
... ...
... ... @@ -5,7 +5,7 @@
<div class="contentpanel">
<div class="panel panel-default" style="...">
<div class="panel-body" style="padding-bottom: 0">
<a id="upload-btn" href="javascript:;" class="btn btn-success"><span class="glyphicon glyphicon-cloud-upload"></span> 添加新视频 </a>
<a id="addVideo" href="javascript:;" class="btn btn-success"><span class="glyphicon glyphicon-cloud-upload"></span> 添加新视频 </a>
</div>
<div class="panel-body">
<div class="row">
... ... @@ -21,7 +21,7 @@
<div class="panel-col2">
<a id="filter-btn" href="javascript:;" class="btn btn-info">查询</a>
<a id="filter-all" href="/shotManage/proPhoto/index" class="btn btn-info">全部</a>
<a id="filter-all" href="/video/index" class="btn btn-info">全部</a>
</div>
</div>
</div>
... ... @@ -29,6 +29,54 @@
<div id="content-list"></div>
</div>
<script type="text/template" id="template">
<div class="rows">
<div class="form-group">
<label class="col-sm-2 control-label" for="englishName">视频名称<span class="red">*</span></label>
<div class="col-sm-3">
<input type="text" value="[[englishName]]" class="form-control observe" id="englishName"
placeholder="视频名称" required="required" data-field="englishName"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="avatar">视频<span class="red">*</span></label>
<div class="col-sm-6">
<div class="cover-image-list col-sm-10">
<ul class="cover-image-list col-sm-10" id="addPic" style="padding: 0;margin: 0;">
<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="图片" multiple="true">
</div>
</li>
</ul>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="englishName">关联SKN<span class="red">*</span></label>
<div class="col-sm-3">
<input type="text" value="[[englishName]]" class="form-control observe" id="englishName"
placeholder="关联SKN" required="required" data-field="englishName"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="englishName">备注<span class="red">*</span></label>
<div class="col-sm-3">
<input type="text" value="[[englishName]]" class="form-control observe" id="englishName"
placeholder="备注" required="required" data-field="englishName"/>
</div>
</div>
</div>
</script>
<!--上传图片-->
<script type="text/template" id="template1">
<div class="rows">
... ...
... ... @@ -44,10 +44,8 @@ var apiCofig = {
//root:__dirname,
EnvConst:{
// domain:"http://192.168.102.48:8088/platform",
//domain:"http://127.0.0.1:8080/platform",
// domain:"http://172.16.6.200:8088/platform",
domain:"http://192.168.102.202:8088/platform",
domain:"http://127.0.0.1:8080/platform",
// domain:"http://172.16.6.200:8088/platform",
yohoSearch: 'http://192.168.102.216:8080/yohosearch',
system:Iaccount
},
... ...
... ... @@ -7800,7 +7800,7 @@ var jQuery = require('jquery');
'<img ' + (id ? 'id="' + id + '"' : '') + ' width="' + width + '" height="' + height + '" _url="' + url + '" class="edui-faked-video"' +
' src="' + me.options.UMEDITOR_HOME_URL + 'static/assets/images/spacer.gif" style="background:url(' + me.options.UMEDITOR_HOME_URL + 'static/assets/images/videologo.gif) no-repeat center center; border:1px solid gray;' + (align ? 'float:' + align + ';' : '') + '" />'
: '<div class="video-placeholder"><video playsinline="" webkit-playsinline="" poster='+ url +'?vframe/jpg/offset/0' + ' controls="controls" style="width: 100%;height: auto;" width="' + width + '" height="' + height + '" >' +
: '<div class="video-placeholder"><video playsinline="" webkit-playsinline="" poster='+ url +'?vframe/jpg/offset/0' + ' controls="controls" width="' + width + '" height="' + height + '" >' +
'<source src=' + url +' type="video/mp4"></video></div>';
}
... ...
/**
* Created by zw on 2016/11/3.
* 产品图片管理
* 视频管理
*/
var $ = require('jquery');
var common = require('../../common/common');
... ... @@ -20,43 +20,46 @@ var g = new common.grid({
},
parms: function () {
return {
//查询参数
productSkn: common.util.__input('content-filter1'),
productSkc: common.util.__input('content-filter2'),
productSku: common.util.__input('content-filter3'),
startTime: ((new Date($('#starttime').val())).getTime()) / 1000,
endTime: ((new Date($('#endtime').val())).getTime()) / 1000,
shopId: common.util.__input("shopId")
skn: common.util.__input('content-filter1'),
videoName: common.util.__input('content-filter2')
};
},
//列表显示
columns: [
{display: "SKN", name: "productSkn"},
{display: "视频名称", name: "videoName"},
{display: "关联SKN", name: "skn"},
{
display: "最后上传时间", name: "lastAddTime",
render: function (item) {
var t = new Date(item.lastAddTime * 1000);
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
return "<p>" + formatted + "</p>";
display: '视频',
name: 'url',
render: function (item) {
if (item.url) {
return '<img height="140" width="80" src="' + item.url +'?vframe/jpg/offset/0'+ '">';
} else {
return '';
}
}
},
},
{display: "视频大小", name: "videoSize",render:function(item) { return item.videoSize+"M"}},
{display: "备注", name: "note"},
{
display: "操作", name: "", render: function (item) {
var arr = [];
arr.push('<a class="btn btn-xs btn-info update" data-index="' + item.__index + '">编辑</a>');
return arr.join('');
}
var arr = [];
arr.push('<a class="btn btn-xs btn-info update" data-index="' + item.__index + '">编辑</a>');
arr.push('<a class="btn btn-xs btn-danger delete" data-index="' + item.__index + '">删除</a>');
return arr.join('');
}
}
]
});
// g.init("/shotManage/proPhoto/index2");
g.init("/video/queryVideosList");
//
var Bll = {
pictureBoList: [],
selectedBoId: [],
clonePics: [],
//重新渲染图片列表
newVideo: {},
selectedBoId = [],
rendBoList: function (pictureBoList) {
$(".image-list").html('');
$("#addPic").prepend(common.util.__template2($("#template2").html(),
... ... @@ -65,35 +68,23 @@ var Bll = {
}
));
},
//获取编辑时新增的图片
getNewPics: function (pictureBoList) {
var newPic = [];
if (pictureBoList.length > 0) {
for (var i = 0; i < pictureBoList.length; i++) {
if (!pictureBoList[i].id) {
newPic.push(pictureBoList[i])
}
}
}
return newPic
},
//模态
toast: function (url, item, datacall) {
Bll.pictureBoList = item.pictureBoList || [];
Bll.selectedBoId = [];
var a = new common.dialog({
title: "图片",
width: '80%',
content: common.util.__template2($("#template1").html(), item),
title: "添加视频",
width: '50%',
content: common.util.__template2($("#template").html(), item),
button: [
{
value: "提交", callback: function () {
var data = {};
if (item.__state == 'add') {
data = datacall && datacall(Bll.clonePics, Bll.selectedBoId);
data = datacall && datacall(Bll.newVideo, Bll.selectedBoId);
} else {
data = datacall && datacall(Bll.getNewPics(Bll.clonePics), Bll.selectedBoId);
}
console.log("ajax提交的参数:"+data)
common.util.__ajax({
url: url,
data: data
... ... @@ -119,20 +110,23 @@ var Bll = {
}
]
});
Bll.rendBoList(Bll.pictureBoList);
/*Bll.rendBoList(Bll.pictureBoList);*/
common.edit.ajaxfileupload(".picfile", {
params: {
__type: "upload",
bucket: "goodsimg"
__type: "import-video",
bucket: "goodsvideo"
},
valid_extensions: ['png', 'jpg', 'jpeg'],
valid_extensions: ['mp4'],
onComplete: function (response) {
if (response.status && response.code == 200) {
for (var i = 0; i < response.datas.length; i++) {
console.log("批量接口返回数据",response);
if (response.status && response.code == 200) {
Bll.newVideo.url=response.data.url;
Bll.newVideo.fileName=response.data.fileName;
/*for (var i = 0; i < response.datas.length; i++) {
var name = response.names[i];
var index = name.indexOf('.');
var name1 = name.substr(0, index);
//判断图片名称是否符合标准
//判断图片名称是否符合标准
if ((/^[0-9]+[_][0-9]+$/).test(name1) || (/^[1-9]\d*$/).test(name1)) {
Bll.pictureBoList.push({
"fileName": response.datas[i],
... ... @@ -147,7 +141,7 @@ var Bll = {
common.util.__tip("图片应以sku命名", "warning");
}
}
Bll.rendBoList(Bll.clonePics);
Bll.rendBoList(Bll.clonePics);*/
}
else {
common.util.__tip(response.message, 'warning');
... ... @@ -156,54 +150,33 @@ var Bll = {
});
}
};
//上传图片--点击事件
$('#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)
}
});
});
/*下拉选择*/
new common.dropDown({
el: "#shopId",
ajax: "queryShopPass",
hash: true
});
//编辑
$(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) {
//添加
$('#addVideo').on('click', function () {
var item = {
"__state": "add",
'englishName': "",//英文名
'height': "",//身高
'dressSize': "",//穿衣尺码
'modelName': "",//名称
'modelType': 1,//模特类型:1 拍摄模特 2 试穿模特
'nationality': "",//国籍
'status': 1,//模特状态:0 禁用 1 启用
'shoeSize': "",//鞋尺码
'vitalStatistics': "",//三围
"Bust": "",//胸围
"waist": "",//腰围
"hips": "",//臀围
'weight': "",//体重
'avatar': "",//头像
'modelCard': ""//模特卡
};
Bll.toast('/shotManage/model/addModel', item, function(){
return {
productSkn: item.productSkn,
ids: JSON.stringify(selectedBoId),
productPhotoAddStrList: JSON.stringify(pictureBoList)
}
});
});
//删除单张图片
$(document).on('click', '.remove1', function () {
var index = $(this).data("index");
if (Bll.clonePics[index].id) {
Bll.selectedBoId.push(Bll.clonePics[index].id);
}
Bll.clonePics.splice(index, 1);
Bll.rendBoList(Bll.clonePics);
});
//查询按钮--点击事件
$(document).on('click', '#filter-btn', function () {
g.reload(1);
});
});
\ No newline at end of file
... ...