Index.js
5.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/**
* Created by zw on 2016/11/3.
* 视频管理
*/
var $ = require('jquery');
var common = require('../../common/common');
/**
* 列表显示数据
* @type {common.grid}
*/
var g = new common.grid({
el: '#content-list',
hash: false,
complete: function () {
$('#content-list').poptrox({
usePopupCaption: true
});
},
parms: function () {
return {
skn: common.util.__input('content-filter1'),
videoName: common.util.__input('content-filter2')
};
},
//列表显示
columns: [
{display: "视频名称", name: "videoName"},
{display: "关联SKN", name: "skn"},
{
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>');
arr.push('<a class="btn btn-xs btn-danger delete" data-index="' + item.__index + '">删除</a>');
return arr.join('');
}
}
]
});
g.init("/video/queryVideosList");
//
var Bll = {
toast: function (url, item, datacall) {
Bll.pictureBoList = item.pictureBoList || [];
Bll.selectedBoId = [];
var a = new common.dialog({
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);
} else {
data = datacall && datacall(Bll.getNewPics(Bll.clonePics), Bll.selectedBoId);
}
common.util.__ajax({
url: url,
data: data
}, 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');
}
g.reload();
a.close();
}
});
return false;
}, css: "btn-primary"
},
{
"value": "取消",
css: "btn-info"
}
]
});
/*Bll.rendBoList(Bll.pictureBoList);*/
common.edit.ajaxfileupload(".picfile", {
params: {
__type: "import-video",
bucket: "goodsvideo"
},
valid_extensions: ['mp4'],
onComplete: function (response) {
console.log("批量接口返回数据",response);
if (response.status && response.code == 200) {
alert(" 上传成功")
/*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);*/
}
else {
common.util.__tip(response.message, 'warning');
}
}
});
}
};
//添加
$('#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, "添加视频");
});