Authored by 梁志锋

Merge remote-tracking branch 'origin/dev_vedio' into dev_vedio

@@ -86,6 +86,25 @@ module.exports = { @@ -86,6 +86,25 @@ module.exports = {
86 return callback(null,errBackMsg); 86 return callback(null,errBackMsg);
87 } 87 }
88 }); 88 });
  89 + }//上传文件
  90 + else if(req.body.__type == "import-video"){
  91 + req.body.file = fs.createReadStream(req.files[req.body.filename].path);
  92 + request.post({
  93 + url: config.domain+"/fileupload/uploadFile",
  94 + formData: req.body,
  95 + headers: httpHeader
  96 + }, function optionalCallback(error, httpResponse, body) {
  97 + if (error) {
  98 + return callback(null,error);
  99 + }
  100 + if (!error && httpResponse.statusCode == 200) {
  101 + var json = JSON.parse(body);
  102 + json.status = true;
  103 + return callback(null,json)
  104 + } else {
  105 + return callback(null,errBackMsg);
  106 + }
  107 + });
89 } 108 }
90 //上传图片 109 //上传图片
91 else { 110 else {
  1 +/**
  2 + * Created by zw on 2016/6/20.
  3 + */
  4 +module.exports = function (app) {
  5 +
  6 +
  7 + /*************************************视频管理*************************************/
  8 + //列表页
  9 + app.get("/video/index", "video.Index",function(){
  10 + this.$extend={
  11 + moduleName:'视频管理',
  12 + pageName:'视频管理'
  13 + }
  14 + });
  15 +
  16 + //视频列表
  17 + app.post("/video/queryVideosList", "video_queryVideosList");
  18 +
  19 + //添加产品图片
  20 + //app.post("/shotManage/proPhoto/add", "shootMeter_addProductBatchPhoto");
  21 +
  22 +};
  1 +/**
  2 + * Created by zw on 2016/11/3.
  3 + * 视频管理
  4 + */
  5 +
  6 +module.exports = {
  7 + namespace: "video",
  8 + apis: {
  9 +
  10 + /************************************产品视频管理*************************************/
  11 + queryVideosList: {
  12 + title: "视频列表",
  13 + url: "/videos/queryVideosList",
  14 + params: {
  15 + page: {type: Number},
  16 + size: {type: Number},
  17 + skn:{type: String},
  18 + videoName: {type: String}
  19 + }
  20 + }
  21 + }
  22 +};
  1 +<%include '../../common/views/__ui/header'%>
  2 +
  3 +<%include '../../common/views/__partail/ListHeader'%>
  4 +
  5 +<div class="contentpanel">
  6 + <div class="panel panel-default" style="...">
  7 + <div class="panel-body" style="padding-bottom: 0">
  8 + <a id="addVideo" href="javascript:;" class="btn btn-success"><span class="glyphicon glyphicon-cloud-upload"></span> 添加新视频 </a>
  9 + </div>
  10 + <div class="panel-body">
  11 + <div class="row">
  12 +
  13 + <div class="panel-col">
  14 + <input type="text" value="" name="productSkn" id="content-filter1" placeholder="SKN"
  15 + class="form-control">
  16 + </div>
  17 + <div class="panel-col">
  18 + <input type="text" value="" name="videoName" id="content-filter2" placeholder="视频名称"
  19 + class="form-control">
  20 + </div>
  21 +
  22 + <div class="panel-col2">
  23 + <a id="filter-btn" href="javascript:;" class="btn btn-info">查询</a>
  24 + <a id="filter-all" href="/video/index" class="btn btn-info">全部</a>
  25 + </div>
  26 + </div>
  27 + </div>
  28 + </div>
  29 + <div id="content-list"></div>
  30 +</div>
  31 +
  32 +
  33 +<script type="text/template" id="template">
  34 + <div class="rows">
  35 + <div class="form-group">
  36 + <label class="col-sm-2 control-label" for="englishName">视频名称<span class="red">*</span></label>
  37 +
  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"/>
  41 + </div>
  42 + </div>
  43 + <div class="form-group">
  44 + <label class="col-sm-2 control-label" for="avatar">视频<span class="red">*</span></label>
  45 + <div class="col-sm-6">
  46 + <div class="cover-image-list col-sm-10">
  47 + <ul class="cover-image-list col-sm-10" id="addPic" style="padding: 0;margin: 0;">
  48 + <li class="cover-image-item fileinput-button">
  49 + <div class="goods-img">
  50 + <a class="fileinput-button-icon" href="javascript:void(0);">+</a>
  51 + <input type="file" class="goods-img-upload picfile" name="picfile" required="required" id="picfile" placeholder="图片" multiple="true">
  52 +
  53 + </div>
  54 + </li>
  55 + <span style="font-color:red">ps:只支持MP4格式</span>
  56 + </ul>
  57 + </div>
  58 + </div>
  59 + </div>
  60 +
  61 + <div class="form-group">
  62 + <label class="col-sm-2 control-label" for="englishName">关联SKN<span class="red">*</span></label>
  63 +
  64 + <div class="col-sm-3">
  65 + <input type="text" value="[[englishName]]" class="form-control observe" id="englishName"
  66 + placeholder="关联SKN" required="required" data-field="englishName"/>
  67 + </div>
  68 + </div>
  69 + <div class="form-group">
  70 + <label class="col-sm-2 control-label" for="englishName">备注<span class="red">*</span></label>
  71 +
  72 + <div class="col-sm-3">
  73 + <input type="text" value="[[englishName]]" class="form-control observe" id="englishName"
  74 + placeholder="备注" required="required" data-field="englishName"/>
  75 + </div>
  76 + </div>
  77 +
  78 + </div>
  79 +</script>
  80 +
  81 +<!--上传图片-->
  82 +<script type="text/template" id="template1">
  83 + <div class="rows">
  84 + [[if __state=='update']]
  85 + <div class="form-group">
  86 + <label class="col-sm-2">SKN</label>
  87 +
  88 + <div class="col-sm-6">
  89 + <input type="text" value=[[productSkn]] class="form-control" disabled="disabled">
  90 + </div>
  91 + </div>
  92 + [[/if]]
  93 + <div class="form-group">
  94 + <label class="col-sm-2 control-label">图片</label>
  95 + <div class="cover-image-list col-sm-10">
  96 + <ul class="cover-image-list col-sm-10" id="addPic" style="padding: 0;margin: 0;">
  97 + <li class="cover-image-item fileinput-button">
  98 + <div class="goods-img">
  99 + <a class="fileinput-button-icon" href="javascript:void(0);">+</a>
  100 + <input type="file" class="goods-img-upload picfile" name="picfile" required="required" id="picfile" placeholder="图片" multiple="true">
  101 + </div>
  102 + </li>
  103 + </ul>
  104 + </div>
  105 + </div>
  106 + </div>
  107 +</script>
  108 +<!--图片列表-->
  109 +<script type="text/template" id="template2">
  110 + [[each pictureBoList as _item _index]]
  111 + <li class="cover-image-item image-list" data-index=[[_index]]>
  112 + <div class="goods-img">
  113 + <a class="fileinput-button-icon" href="javascript:void(0);">
  114 + <img src="[[_item.fileName]]?imageView/2/w/100/h/100">
  115 + </a>
  116 + <i class="remove-item-btn remove1 glyphicon glyphicon-remove-circle" data-index="[[_index]]"></i>
  117 + </div>
  118 + </li>
  119 + [[/each]]
  120 +</script>
@@ -44,8 +44,8 @@ var apiCofig = { @@ -44,8 +44,8 @@ var apiCofig = {
44 //root:__dirname, 44 //root:__dirname,
45 EnvConst:{ 45 EnvConst:{
46 // domain:"http://192.168.102.48:8088/platform", 46 // domain:"http://192.168.102.48:8088/platform",
47 - //domain:"http://127.0.0.1:8080/platform",  
48 - domain:"http://172.16.6.200:8088/platform", 47 + domain:"http://127.0.0.1:8080/platform",
  48 + // domain:"http://172.16.6.200:8088/platform",
49 yohoSearch: 'http://192.168.102.216:8080/yohosearch', 49 yohoSearch: 'http://192.168.102.216:8080/yohosearch',
50 system:Iaccount 50 system:Iaccount
51 }, 51 },
  1 +/**
  2 + * Created by zw on 2016/11/3.
  3 + * 视频管理
  4 + */
  5 +var $ = require('jquery');
  6 +var common = require('../../common/common');
  7 +
  8 +
  9 +/**
  10 + * 列表显示数据
  11 + * @type {common.grid}
  12 + */
  13 +var g = new common.grid({
  14 + el: '#content-list',
  15 + hash: false,
  16 + complete: function () {
  17 + $('#content-list').poptrox({
  18 + usePopupCaption: true
  19 + });
  20 + },
  21 + parms: function () {
  22 + return {
  23 + skn: common.util.__input('content-filter1'),
  24 + videoName: common.util.__input('content-filter2')
  25 + };
  26 + },
  27 +//列表显示
  28 + columns: [
  29 + {display: "视频名称", name: "videoName"},
  30 + {display: "关联SKN", name: "skn"},
  31 + {
  32 + display: '视频',
  33 + name: 'url',
  34 + render: function (item) {
  35 + if (item.url) {
  36 + return '<img height="140" width="80" src="' + item.url +'?vframe/jpg/offset/0'+ '">';
  37 + } else {
  38 + return '';
  39 + }
  40 +
  41 + }
  42 + },
  43 + {display: "视频大小", name: "videoSize",render:function(item) { return item.videoSize+"M"}},
  44 + {display: "备注", name: "note"},
  45 + {
  46 + display: "操作", name: "", render: function (item) {
  47 + var arr = [];
  48 + arr.push('<a class="btn btn-xs btn-info update" data-index="' + item.__index + '">编辑</a>');
  49 + arr.push('<a class="btn btn-xs btn-danger delete" data-index="' + item.__index + '">删除</a>');
  50 + return arr.join('');
  51 + }
  52 + }
  53 + ]
  54 +});
  55 +g.init("/video/queryVideosList");
  56 +
  57 +
  58 +
  59 +//
  60 +var Bll = {
  61 + toast: function (url, item, datacall) {
  62 + Bll.pictureBoList = item.pictureBoList || [];
  63 + Bll.selectedBoId = [];
  64 + var a = new common.dialog({
  65 + title: "添加视频",
  66 + width: '50%',
  67 + content: common.util.__template2($("#template").html(), item),
  68 + button: [
  69 + {
  70 + value: "提交", callback: function () {
  71 + var data = {};
  72 + if (item.__state == 'add') {
  73 + data = datacall && datacall(Bll.clonePics, Bll.selectedBoId);
  74 + } else {
  75 + data = datacall && datacall(Bll.getNewPics(Bll.clonePics), Bll.selectedBoId);
  76 + }
  77 + common.util.__ajax({
  78 + url: url,
  79 + data: data
  80 + }, function (res) {
  81 + if (res.code == '200') {
  82 + if (res.data.length > 0) {
  83 + var mess = "失败列表:";
  84 + for (var i = 0; i < res.data.length; i++) {
  85 + mess = mess + '<p>' + res.data[i].originalName + ';' + '</p>';
  86 + }
  87 + common.util.__tip(mess, 'warning');
  88 + }
  89 + g.reload();
  90 + a.close();
  91 + }
  92 + });
  93 + return false;
  94 + }, css: "btn-primary"
  95 + },
  96 + {
  97 + "value": "取消",
  98 + css: "btn-info"
  99 + }
  100 + ]
  101 + });
  102 + /*Bll.rendBoList(Bll.pictureBoList);*/
  103 + common.edit.ajaxfileupload(".picfile", {
  104 + params: {
  105 + __type: "import-video",
  106 + bucket: "goodsvideo"
  107 + },
  108 + valid_extensions: ['mp4'],
  109 + onComplete: function (response) {
  110 + console.log("批量接口返回数据",response);
  111 + if (response.status && response.code == 200) {
  112 + alert(" 上传成功")
  113 + /*for (var i = 0; i < response.datas.length; i++) {
  114 + var name = response.names[i];
  115 + var index = name.indexOf('.');
  116 + var name1 = name.substr(0, index);
  117 + //判断图片名称是否符合标准
  118 + if ((/^[0-9]+[_][0-9]+$/).test(name1) || (/^[1-9]\d*$/).test(name1)) {
  119 + Bll.pictureBoList.push({
  120 + "fileName": response.datas[i],
  121 + "originalName": response.names[i]
  122 + });
  123 + Bll.clonePics.push({
  124 + "fileName": response.datas[i],
  125 + "originalName": response.names[i]
  126 + })
  127 + }
  128 + else {
  129 + common.util.__tip("图片应以sku命名", "warning");
  130 + }
  131 + }
  132 + Bll.rendBoList(Bll.clonePics);*/
  133 + }
  134 + else {
  135 + common.util.__tip(response.message, 'warning');
  136 + }
  137 + }
  138 + });
  139 + }
  140 +};
  141 +
  142 +//添加
  143 +$('#addVideo').on('click', function () {
  144 + var item = {
  145 + "__state": "add",
  146 + 'englishName': "",//英文名
  147 + 'height': "",//身高
  148 + 'dressSize': "",//穿衣尺码
  149 + 'modelName': "",//名称
  150 + 'modelType': 1,//模特类型:1 拍摄模特 2 试穿模特
  151 + 'nationality': "",//国籍
  152 + 'status': 1,//模特状态:0 禁用 1 启用
  153 + 'shoeSize': "",//鞋尺码
  154 + 'vitalStatistics': "",//三围
  155 + "Bust": "",//胸围
  156 + "waist": "",//腰围
  157 + "hips": "",//臀围
  158 + 'weight': "",//体重
  159 + 'avatar': "",//头像
  160 + 'modelCard': ""//模特卡
  161 + };
  162 + Bll.toast('/shotManage/model/addModel', item, "添加视频");
  163 +});