Authored by ZhongW

视频管理,增删查

... ... @@ -16,7 +16,12 @@ module.exports = function (app) {
//视频列表
app.post("/video/queryVideosList", "video_queryVideosList");
//添加产品图片
//app.post("/shotManage/proPhoto/add", "shootMeter_addProductBatchPhoto");
//添加视频
app.post("/video/addVideo", "video_addVideo");
//删除视频
app.post("/video/delVideo", "video_delVideo");
};
\ No newline at end of file
... ...
... ... @@ -17,6 +17,26 @@ module.exports = {
skn:{type: String},
videoName: {type: String}
}
},
addVideo: {
title: "添加视频",
url: "/videos/editVideo",
params: {
id: {type: Number},
videoName: {type: String},
skn: {type: String},
url:{type: String},
fileName: {type: String},
videoSize:{type: String},
note:{type: String}
}
},
delVideo: {
title: "删除视频",
url: "/videos/batchDeleteVideo",
params: {
id: {type: Number}
}
}
}
};
\ No newline at end of file
... ...
... ... @@ -33,11 +33,11 @@
<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>
<label class="col-sm-2 control-label" for="videoName">视频名称<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"/>
<input type="text" value="[[videoName]]" class="form-control observe" id="videoName"
placeholder="视频名称" required="required" data-field="videoName"/>
</div>
</div>
<div class="form-group">
... ... @@ -47,73 +47,35 @@
<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>
<a class="fileinput-button-icon" id="imgATag" href="javascript:void(0);">+</a>
<input type="file" class="goods-img-upload picfile" name="picfile" required="required" id="picfile" placeholder="图片" multiple="true">
</div>
<img id="imgTag" width="106" height="146" src="[[url]]" >
</div>
</li>
</ul>
</ul>
<label class="col-sm-8 control-label" for="avatar"><span class="red">ps:只支持MP4格式</span></label>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="englishName">关联SKN<span class="red">*</span></label>
<label class="col-sm-2 control-label" for="skn">关联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"/>
<input type="text" value="[[skn]]" class="form-control observe" id="skn"
placeholder="关联SKN" required="required" data-field="skn"/>
</div>
<label class="col-sm-2 control-label" style="margin-top:13px"><span class="red">多个SKN以逗号分隔</span></label>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="englishName">备注<span class="red">*</span></label>
<label class="col-sm-2 control-label" for="note">备注<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"/>
<input type="text" value="[[note]]" class="form-control observe" id="note"
placeholder="备注" required="required" data-field="note"/>
</div>
</div>
</div>
</script>
<!--上传图片-->
<script type="text/template" id="template1">
<div class="rows">
[[if __state=='update']]
<div class="form-group">
<label class="col-sm-2">SKN</label>
<div class="col-sm-6">
<input type="text" value=[[productSkn]] class="form-control" disabled="disabled">
</div>
</div>
[[/if]]
<div class="form-group">
<label class="col-sm-2 control-label">图片</label>
<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>
</script>
<!--图片列表-->
<script type="text/template" id="template2">
[[each pictureBoList as _item _index]]
<li class="cover-image-item image-list" data-index=[[_index]]>
<div class="goods-img">
<a class="fileinput-button-icon" href="javascript:void(0);">
<img src="[[_item.fileName]]?imageView/2/w/100/h/100">
</a>
<i class="remove-item-btn remove1 glyphicon glyphicon-remove-circle" data-index="[[_index]]"></i>
</div>
</li>
[[/each]]
</script>
</script>
\ No newline at end of file
... ...
... ... @@ -59,44 +59,38 @@ g.init("/video/queryVideosList");
//
var Bll = {
newVideo: {},
selectedBoId = [],
rendBoList: function (pictureBoList) {
$(".image-list").html('');
$("#addPic").prepend(common.util.__template2($("#template2").html(),
{
pictureBoList: pictureBoList
}
));
rendBoList: function (obj) {
$("#imgTag").attr("src",obj.url+"?vframe/jpg/offset/0");
$("#imgTag").show();
$("#imgATag").hide();
},
toast: function (url, item, datacall) {
Bll.selectedBoId = [];
var a = new common.dialog({
title: "添加视频",
title: "视频",
width: '50%',
content: common.util.__template2($("#template").html(), item),
button: [
{
value: "提交", callback: function () {
var data = {};
if (item.__state == 'add') {
data = datacall && datacall(Bll.newVideo, Bll.selectedBoId);
} else {
data = datacall && datacall(Bll.getNewPics(Bll.clonePics), Bll.selectedBoId);
}
/*if(item.__state == "edit" ){
Bll.newVideo.url=item.url;
Bll.newVideo.fileName=item.fileName;
Bll.newVideo.videoSize=item.fileSize;
}*/
Bll.newVideo.id=item.id;
Bll.newVideo.videoName = $.trim($("#videoName").val());
Bll.newVideo.skn = $.trim($("#skn").val());
Bll.newVideo.note = $.trim($("#note").val());
console.log("ajax提交的参数:"+data)
console.log("提交的参数:"+JSON.stringify(Bll.newVideo));
common.util.__ajax({
url: url,
data: data
data: Bll.newVideo
}, function (res) {
if (res.code == '200') {
if (res.data.length > 0) {
var mess = "失败列表:";
for (var i = 0; i < res.data.length; i++) {
mess = mess + '<p>' + res.data[i].originalName + ';' + '</p>';
}
common.util.__tip(mess, 'warning');
}
/*common.util.__tip("上传成功", 'success');*/
g.reload();
a.close();
}
... ... @@ -110,38 +104,27 @@ var Bll = {
}
]
});
/*Bll.rendBoList(Bll.pictureBoList);*/
//Bll.rendBoList(Bll.pictureBoList);
// var loadModal = null;
common.edit.ajaxfileupload(".picfile", {
params: {
__type: "import-video",
bucket: "goodsvideo"
},
valid_extensions: ['mp4'],
// onStart: function(params) {
// loadModal = common.dialog.load();
// },
onComplete: function (response) {
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],
"originalName": response.names[i]
});
Bll.clonePics.push({
"fileName": response.datas[i],
"originalName": response.names[i]
})
}
else {
common.util.__tip("图片应以sku命名", "warning");
}
}
Bll.rendBoList(Bll.clonePics);*/
Bll.newVideo.videoSize=response.data.fileSize;
// if (loadModal) {
// loadModal.close();
// }
Bll.rendBoList(Bll.newVideo);
}
else {
common.util.__tip(response.message, 'warning');
... ... @@ -157,26 +140,48 @@ var Bll = {
//添加
$('#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': ""//模特卡
"__state":"add",
"videoName": "",
'skn': "",
'url': "",
'note': ""
};
Bll.toast('/shotManage/model/addModel', item, function(){
Bll.toast('/video/addVideo', item, function(){
return {
productPhotoAddStrList: JSON.stringify(pictureBoList)
productPhotoAddStrList: "32423"
}
});
});
//查询按钮--点击事件
$(document).on('click', '#filter-btn', function () {
g.reload(1);
});
//删除--点击事件
$(document).on('click', '.delete', function () {
var item = g.rows[$(this).data("index")];
common.dialog.confirm("警告",
"确认删除?",
function () {
common.util.__ajax({
url: '/video/delVideo',
data: {
id: item.id
}
}, function () {
g.reload(1);
});
});
});
//修改--点击事件
$(document).on('click', '.update', function () {
var item = g.rows[$(this).data("index")];
item.__state="edit";
console.log("修改"+ item.url);
Bll.toast('/video/addVideo', item, "修改视频");
});
\ No newline at end of file
... ...