Showing
4 changed files
with
109 additions
and
117 deletions
@@ -16,7 +16,12 @@ module.exports = function (app) { | @@ -16,7 +16,12 @@ module.exports = function (app) { | ||
16 | //视频列表 | 16 | //视频列表 |
17 | app.post("/video/queryVideosList", "video_queryVideosList"); | 17 | app.post("/video/queryVideosList", "video_queryVideosList"); |
18 | 18 | ||
19 | - //添加产品图片 | ||
20 | - //app.post("/shotManage/proPhoto/add", "shootMeter_addProductBatchPhoto"); | 19 | + //添加视频 |
20 | + app.post("/video/addVideo", "video_addVideo"); | ||
21 | + | ||
22 | + //删除视频 | ||
23 | + app.post("/video/delVideo", "video_delVideo"); | ||
24 | + | ||
25 | + | ||
21 | 26 | ||
22 | }; | 27 | }; |
@@ -17,6 +17,26 @@ module.exports = { | @@ -17,6 +17,26 @@ module.exports = { | ||
17 | skn:{type: String}, | 17 | skn:{type: String}, |
18 | videoName: {type: String} | 18 | videoName: {type: String} |
19 | } | 19 | } |
20 | + }, | ||
21 | + addVideo: { | ||
22 | + title: "添加视频", | ||
23 | + url: "/videos/editVideo", | ||
24 | + params: { | ||
25 | + id: {type: Number}, | ||
26 | + videoName: {type: String}, | ||
27 | + skn: {type: String}, | ||
28 | + url:{type: String}, | ||
29 | + fileName: {type: String}, | ||
30 | + videoSize:{type: String}, | ||
31 | + note:{type: String} | ||
32 | + } | ||
33 | + }, | ||
34 | + delVideo: { | ||
35 | + title: "删除视频", | ||
36 | + url: "/videos/batchDeleteVideo", | ||
37 | + params: { | ||
38 | + id: {type: Number} | ||
39 | + } | ||
20 | } | 40 | } |
21 | } | 41 | } |
22 | }; | 42 | }; |
@@ -33,11 +33,11 @@ | @@ -33,11 +33,11 @@ | ||
33 | <script type="text/template" id="template"> | 33 | <script type="text/template" id="template"> |
34 | <div class="rows"> | 34 | <div class="rows"> |
35 | <div class="form-group"> | 35 | <div class="form-group"> |
36 | - <label class="col-sm-2 control-label" for="englishName">视频名称<span class="red">*</span></label> | 36 | + <label class="col-sm-2 control-label" for="videoName">视频名称<span class="red">*</span></label> |
37 | 37 | ||
38 | <div class="col-sm-3"> | 38 | <div class="col-sm-3"> |
39 | - <input type="text" value="[[englishName]]" class="form-control observe" id="englishName" | ||
40 | - placeholder="视频名称" required="required" data-field="englishName"/> | 39 | + <input type="text" value="[[videoName]]" class="form-control observe" id="videoName" |
40 | + placeholder="视频名称" required="required" data-field="videoName"/> | ||
41 | </div> | 41 | </div> |
42 | </div> | 42 | </div> |
43 | <div class="form-group"> | 43 | <div class="form-group"> |
@@ -47,73 +47,35 @@ | @@ -47,73 +47,35 @@ | ||
47 | <ul class="cover-image-list col-sm-10" id="addPic" style="padding: 0;margin: 0;"> | 47 | <ul class="cover-image-list col-sm-10" id="addPic" style="padding: 0;margin: 0;"> |
48 | <li class="cover-image-item fileinput-button"> | 48 | <li class="cover-image-item fileinput-button"> |
49 | <div class="goods-img"> | 49 | <div class="goods-img"> |
50 | - <a class="fileinput-button-icon" href="javascript:void(0);">+</a> | 50 | + <a class="fileinput-button-icon" id="imgATag" href="javascript:void(0);">+</a> |
51 | <input type="file" class="goods-img-upload picfile" name="picfile" required="required" id="picfile" placeholder="图片" multiple="true"> | 51 | <input type="file" class="goods-img-upload picfile" name="picfile" required="required" id="picfile" placeholder="图片" multiple="true"> |
52 | - | 52 | + <img id="imgTag" width="106" height="146" src="[[url]]" > |
53 | </div> | 53 | </div> |
54 | </li> | 54 | </li> |
55 | </ul> | 55 | </ul> |
56 | + <label class="col-sm-8 control-label" for="avatar"><span class="red">ps:只支持MP4格式</span></label> | ||
56 | </div> | 57 | </div> |
57 | </div> | 58 | </div> |
59 | + | ||
58 | </div> | 60 | </div> |
59 | 61 | ||
60 | <div class="form-group"> | 62 | <div class="form-group"> |
61 | - <label class="col-sm-2 control-label" for="englishName">关联SKN<span class="red">*</span></label> | 63 | + <label class="col-sm-2 control-label" for="skn">关联SKN<span class="red">*</span></label> |
62 | 64 | ||
63 | <div class="col-sm-3"> | 65 | <div class="col-sm-3"> |
64 | - <input type="text" value="[[englishName]]" class="form-control observe" id="englishName" | ||
65 | - placeholder="关联SKN" required="required" data-field="englishName"/> | 66 | + <input type="text" value="[[skn]]" class="form-control observe" id="skn" |
67 | + placeholder="关联SKN" required="required" data-field="skn"/> | ||
66 | </div> | 68 | </div> |
69 | + <label class="col-sm-2 control-label" style="margin-top:13px"><span class="red">多个SKN以逗号分隔</span></label> | ||
67 | </div> | 70 | </div> |
68 | <div class="form-group"> | 71 | <div class="form-group"> |
69 | - <label class="col-sm-2 control-label" for="englishName">备注<span class="red">*</span></label> | 72 | + <label class="col-sm-2 control-label" for="note">备注<span class="red"></span></label> |
70 | 73 | ||
71 | <div class="col-sm-3"> | 74 | <div class="col-sm-3"> |
72 | - <input type="text" value="[[englishName]]" class="form-control observe" id="englishName" | ||
73 | - placeholder="备注" required="required" data-field="englishName"/> | 75 | + <input type="text" value="[[note]]" class="form-control observe" id="note" |
76 | + placeholder="备注" required="required" data-field="note"/> | ||
74 | </div> | 77 | </div> |
75 | </div> | 78 | </div> |
76 | 79 | ||
77 | </div> | 80 | </div> |
78 | </script> | 81 | </script> |
79 | - | ||
80 | -<!--上传图片--> | ||
81 | -<script type="text/template" id="template1"> | ||
82 | - <div class="rows"> | ||
83 | - [[if __state=='update']] | ||
84 | - <div class="form-group"> | ||
85 | - <label class="col-sm-2">SKN</label> | ||
86 | - | ||
87 | - <div class="col-sm-6"> | ||
88 | - <input type="text" value=[[productSkn]] class="form-control" disabled="disabled"> | ||
89 | - </div> | ||
90 | - </div> | ||
91 | - [[/if]] | ||
92 | - <div class="form-group"> | ||
93 | - <label class="col-sm-2 control-label">图片</label> | ||
94 | - <div class="cover-image-list col-sm-10"> | ||
95 | - <ul class="cover-image-list col-sm-10" id="addPic" style="padding: 0;margin: 0;"> | ||
96 | - <li class="cover-image-item fileinput-button"> | ||
97 | - <div class="goods-img"> | ||
98 | - <a class="fileinput-button-icon" href="javascript:void(0);">+</a> | ||
99 | - <input type="file" class="goods-img-upload picfile" name="picfile" required="required" id="picfile" placeholder="图片" multiple="true"> | ||
100 | - </div> | ||
101 | - </li> | ||
102 | - </ul> | ||
103 | - </div> | ||
104 | - </div> | ||
105 | - </div> | ||
106 | -</script> | ||
107 | -<!--图片列表--> | ||
108 | -<script type="text/template" id="template2"> | ||
109 | - [[each pictureBoList as _item _index]] | ||
110 | - <li class="cover-image-item image-list" data-index=[[_index]]> | ||
111 | - <div class="goods-img"> | ||
112 | - <a class="fileinput-button-icon" href="javascript:void(0);"> | ||
113 | - <img src="[[_item.fileName]]?imageView/2/w/100/h/100"> | ||
114 | - </a> | ||
115 | - <i class="remove-item-btn remove1 glyphicon glyphicon-remove-circle" data-index="[[_index]]"></i> | ||
116 | - </div> | ||
117 | - </li> | ||
118 | - [[/each]] | ||
119 | -</script> |
@@ -59,44 +59,38 @@ g.init("/video/queryVideosList"); | @@ -59,44 +59,38 @@ g.init("/video/queryVideosList"); | ||
59 | // | 59 | // |
60 | var Bll = { | 60 | var Bll = { |
61 | newVideo: {}, | 61 | newVideo: {}, |
62 | - selectedBoId = [], | ||
63 | - rendBoList: function (pictureBoList) { | ||
64 | - $(".image-list").html(''); | ||
65 | - $("#addPic").prepend(common.util.__template2($("#template2").html(), | ||
66 | - { | ||
67 | - pictureBoList: pictureBoList | ||
68 | - } | ||
69 | - )); | 62 | + rendBoList: function (obj) { |
63 | + $("#imgTag").attr("src",obj.url+"?vframe/jpg/offset/0"); | ||
64 | + $("#imgTag").show(); | ||
65 | + $("#imgATag").hide(); | ||
70 | }, | 66 | }, |
71 | toast: function (url, item, datacall) { | 67 | toast: function (url, item, datacall) { |
72 | - Bll.selectedBoId = []; | ||
73 | var a = new common.dialog({ | 68 | var a = new common.dialog({ |
74 | - title: "添加视频", | 69 | + title: "视频", |
75 | width: '50%', | 70 | width: '50%', |
76 | content: common.util.__template2($("#template").html(), item), | 71 | content: common.util.__template2($("#template").html(), item), |
77 | button: [ | 72 | button: [ |
78 | { | 73 | { |
79 | value: "提交", callback: function () { | 74 | value: "提交", callback: function () { |
80 | var data = {}; | 75 | var data = {}; |
81 | - if (item.__state == 'add') { | ||
82 | - data = datacall && datacall(Bll.newVideo, Bll.selectedBoId); | ||
83 | - } else { | ||
84 | - data = datacall && datacall(Bll.getNewPics(Bll.clonePics), Bll.selectedBoId); | ||
85 | - } | 76 | + /*if(item.__state == "edit" ){ |
77 | + Bll.newVideo.url=item.url; | ||
78 | + Bll.newVideo.fileName=item.fileName; | ||
79 | + Bll.newVideo.videoSize=item.fileSize; | ||
80 | + }*/ | ||
86 | 81 | ||
87 | - console.log("ajax提交的参数:"+data) | 82 | + Bll.newVideo.id=item.id; |
83 | + Bll.newVideo.videoName = $.trim($("#videoName").val()); | ||
84 | + Bll.newVideo.skn = $.trim($("#skn").val()); | ||
85 | + Bll.newVideo.note = $.trim($("#note").val()); | ||
86 | + | ||
87 | + console.log("提交的参数:"+JSON.stringify(Bll.newVideo)); | ||
88 | common.util.__ajax({ | 88 | common.util.__ajax({ |
89 | url: url, | 89 | url: url, |
90 | - data: data | 90 | + data: Bll.newVideo |
91 | }, function (res) { | 91 | }, function (res) { |
92 | if (res.code == '200') { | 92 | if (res.code == '200') { |
93 | - if (res.data.length > 0) { | ||
94 | - var mess = "失败列表:"; | ||
95 | - for (var i = 0; i < res.data.length; i++) { | ||
96 | - mess = mess + '<p>' + res.data[i].originalName + ';' + '</p>'; | ||
97 | - } | ||
98 | - common.util.__tip(mess, 'warning'); | ||
99 | - } | 93 | + /*common.util.__tip("上传成功", 'success');*/ |
100 | g.reload(); | 94 | g.reload(); |
101 | a.close(); | 95 | a.close(); |
102 | } | 96 | } |
@@ -110,38 +104,27 @@ var Bll = { | @@ -110,38 +104,27 @@ var Bll = { | ||
110 | } | 104 | } |
111 | ] | 105 | ] |
112 | }); | 106 | }); |
113 | - /*Bll.rendBoList(Bll.pictureBoList);*/ | 107 | + //Bll.rendBoList(Bll.pictureBoList); |
108 | + // var loadModal = null; | ||
114 | common.edit.ajaxfileupload(".picfile", { | 109 | common.edit.ajaxfileupload(".picfile", { |
115 | params: { | 110 | params: { |
116 | __type: "import-video", | 111 | __type: "import-video", |
117 | bucket: "goodsvideo" | 112 | bucket: "goodsvideo" |
118 | }, | 113 | }, |
119 | valid_extensions: ['mp4'], | 114 | valid_extensions: ['mp4'], |
115 | + // onStart: function(params) { | ||
116 | + // loadModal = common.dialog.load(); | ||
117 | + // }, | ||
120 | onComplete: function (response) { | 118 | onComplete: function (response) { |
121 | console.log("批量接口返回数据",response); | 119 | console.log("批量接口返回数据",response); |
122 | if (response.status && response.code == 200) { | 120 | if (response.status && response.code == 200) { |
123 | Bll.newVideo.url=response.data.url; | 121 | Bll.newVideo.url=response.data.url; |
124 | Bll.newVideo.fileName=response.data.fileName; | 122 | Bll.newVideo.fileName=response.data.fileName; |
125 | - /*for (var i = 0; i < response.datas.length; i++) { | ||
126 | - var name = response.names[i]; | ||
127 | - var index = name.indexOf('.'); | ||
128 | - var name1 = name.substr(0, index); | ||
129 | - //判断图片名称是否符合标准 | ||
130 | - if ((/^[0-9]+[_][0-9]+$/).test(name1) || (/^[1-9]\d*$/).test(name1)) { | ||
131 | - Bll.pictureBoList.push({ | ||
132 | - "fileName": response.datas[i], | ||
133 | - "originalName": response.names[i] | ||
134 | - }); | ||
135 | - Bll.clonePics.push({ | ||
136 | - "fileName": response.datas[i], | ||
137 | - "originalName": response.names[i] | ||
138 | - }) | ||
139 | - } | ||
140 | - else { | ||
141 | - common.util.__tip("图片应以sku命名", "warning"); | ||
142 | - } | ||
143 | - } | ||
144 | - Bll.rendBoList(Bll.clonePics);*/ | 123 | + Bll.newVideo.videoSize=response.data.fileSize; |
124 | + // if (loadModal) { | ||
125 | + // loadModal.close(); | ||
126 | + // } | ||
127 | + Bll.rendBoList(Bll.newVideo); | ||
145 | } | 128 | } |
146 | else { | 129 | else { |
147 | common.util.__tip(response.message, 'warning'); | 130 | common.util.__tip(response.message, 'warning'); |
@@ -157,26 +140,48 @@ var Bll = { | @@ -157,26 +140,48 @@ var Bll = { | ||
157 | //添加 | 140 | //添加 |
158 | $('#addVideo').on('click', function () { | 141 | $('#addVideo').on('click', function () { |
159 | var item = { | 142 | var item = { |
160 | - "__state": "add", | ||
161 | - 'englishName': "",//英文名 | ||
162 | - 'height': "",//身高 | ||
163 | - 'dressSize': "",//穿衣尺码 | ||
164 | - 'modelName': "",//名称 | ||
165 | - 'modelType': 1,//模特类型:1 拍摄模特 2 试穿模特 | ||
166 | - 'nationality': "",//国籍 | ||
167 | - 'status': 1,//模特状态:0 禁用 1 启用 | ||
168 | - 'shoeSize': "",//鞋尺码 | ||
169 | - 'vitalStatistics': "",//三围 | ||
170 | - "Bust": "",//胸围 | ||
171 | - "waist": "",//腰围 | ||
172 | - "hips": "",//臀围 | ||
173 | - 'weight': "",//体重 | ||
174 | - 'avatar': "",//头像 | ||
175 | - 'modelCard': ""//模特卡 | 143 | + "__state":"add", |
144 | + "videoName": "", | ||
145 | + 'skn': "", | ||
146 | + 'url': "", | ||
147 | + 'note': "" | ||
176 | }; | 148 | }; |
177 | - Bll.toast('/shotManage/model/addModel', item, function(){ | 149 | + |
150 | + Bll.toast('/video/addVideo', item, function(){ | ||
178 | return { | 151 | return { |
179 | - productPhotoAddStrList: JSON.stringify(pictureBoList) | 152 | + productPhotoAddStrList: "32423" |
180 | } | 153 | } |
181 | }); | 154 | }); |
182 | }); | 155 | }); |
156 | + | ||
157 | + | ||
158 | +//查询按钮--点击事件 | ||
159 | +$(document).on('click', '#filter-btn', function () { | ||
160 | + g.reload(1); | ||
161 | +}); | ||
162 | + | ||
163 | +//删除--点击事件 | ||
164 | +$(document).on('click', '.delete', function () { | ||
165 | + var item = g.rows[$(this).data("index")]; | ||
166 | + common.dialog.confirm("警告", | ||
167 | + "确认删除?", | ||
168 | + function () { | ||
169 | + common.util.__ajax({ | ||
170 | + url: '/video/delVideo', | ||
171 | + data: { | ||
172 | + id: item.id | ||
173 | + } | ||
174 | + }, function () { | ||
175 | + g.reload(1); | ||
176 | + }); | ||
177 | + }); | ||
178 | +}); | ||
179 | + | ||
180 | +//修改--点击事件 | ||
181 | +$(document).on('click', '.update', function () { | ||
182 | + var item = g.rows[$(this).data("index")]; | ||
183 | + item.__state="edit"; | ||
184 | + console.log("修改"+ item.url); | ||
185 | + | ||
186 | + Bll.toast('/video/addVideo', item, "修改视频"); | ||
187 | +}); |
-
Please register or login to post a comment