Authored by 姜敏

分离试穿模特和拍摄模特界面

/**
* Created by JiangMin on 2016/3/17.
* 模特管理
*/
var $ = require('jquery');
var common = require('../common/common');
//日期插件
$('.hasDatepicker').fdatepicker({
format: 'yyyy-mm-dd'
});
/**
* 列表显示数据
* @type {common.grid}
*/
var g = new common.grid({
el: '#content-list',
hash: false,
//查询参数
parms: function () {
return {
modelName: common.util.__input('content-filter1'),
englishName: common.util.__input('content-filter2'),
status: common.util.__input('status-filter'),
startTime: $('#starttime').val(),
endTime: $('#endtime').val(),
modelType: parseInt($("#aa").val()),
status: parseInt($("#bb").val())
};
},
//列表显示
columns: [
{display: "ID", name: "id"},
{display: "姓名", name: "modelName"},
{
display: "头像", name: "avatar", render: function (item) {
return '<img src="' + item.avatar + '" width="100" height="60"/>'
}
},//图片显示
{display: "身高", name: "height"},
{display: "体重", name: "weight"},
{
display: "胸围", render: function (item) {
var a = item.vitalStatistics.split(/[,|/]/g);
return a[0];
}
},
{
display: "腰围", render: function (item) {
var a = item.vitalStatistics.split(/[,|/]/g);
return a[1];
}
},
{
display: "臀围", render: function (item) {
var a = item.vitalStatistics.split(/[,|/]/g);
return a[2];
}
},
{
display: "创建时间", name: "createTime",
render: function (item) {
var t = new Date(item.createTime * 1000);
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
return "<p>" + formatted + "</p>";
}
},
{
display: "操作", name: "", render: function (item) {
var arr = [];
arr.push('<a class="btn btn-info update" data-index="' + item.__index + '">修改</a>');
arr.push('<a class="btn btn-danger delete" data-index="' + item.__index + '">删除</a>');
return arr.join('');
}
}
]
});
g.init("/meterManage/tryModel/index1");
var Bll = {
toast: function (url, item, hint) {
var e = new common.edit("#baseform", {
bucket: "modelCard"//真实的
//bucket: "goodsimg"//测试
});
//验证英文名
e.on("validate", function () {
var englishName = $.trim($("#englishName").val());
var a = (/^[a-zA-Z]+$/).test(englishName);
if (!a) {
return "英文名有误"
}
return true;
});
var a = common.dialog.confirm(hint,
common.util.__template2($("#template").html(), item),
function () {
e.submit(url, function (option) {
option.data.modelType = parseInt($("#aa").val());//模特类型,1拍摄模特,2试穿模特
option.data.status = 1;//模特状态,默认启用
option.data.height = parseInt($("#height").val());//模特身高
option.data.weight = parseInt($("#weight").val());//模特体重
option.data.status = parseInt($("#status").val());//模特状态,默认启用
option.data.vitalStatistics = $("#Bust").val() + '|' + $("#waist").val() + "|" + $("#hips").val();//模特三围,拼接字符串
//console.log("option.data", option.data);
//option.debug = true;//调试状态
option.success = function (res) {
//判断接口请求状态
if (res.data.code == '200') {
g.reload();//重新加载界面
a.close();//关闭模态框
}
else {
//提示出错信息
e.$tip(res.data.message);
}
};
option.error = function () {
};
});
return false;
});
e.init();
}
};
//添加模特--点击事件
$('#add-content').on('click', function () {
var item = {
"__state": "add"
};
Bll.toast('/meterManage/tryModel/addModel', item, "添加模特");
});
var STATUS = {
'1': "启用",
'2': "禁用"
};
//修改模特--点击事件
$(document).on('click', '.update', function () {
var item = g.rows[$(this).data("index")];
item.__state = "update";
var a = item.vitalStatistics.split(/[,|/]/g);
item.Bust = a[0];
item.waist = a[1];
item.hips = a[2];
item.statusname = STATUS[item.status];
Bll.toast('/meterManage/tryModel/updateModel', item, "修改模特");
});
//删除--点击事件
$(document).on('click', '.delete', function () {
var item = g.rows[$(this).data("index")];
common.dialog.confirm("警告",
"确认删除?",
function () {
item.status = 0;
common.util.__ajax({
url: '/meterManage/tryModel/updateModel',
data: item
}, function () {
g.reload(1);
});
});
});
//查询按钮--点击事件
$(document).on('click', '#filter-btn', function () {
g.reload(1);
});
... ...
... ... @@ -4,6 +4,10 @@
*/
var $ = require('jquery');
var common = require('../common/common');
//日期插件
$('.hasDatepicker').fdatepicker({
format: 'yyyy-mm-dd'
});
/**
* 列表显示数据
* @type {common.grid}
... ... @@ -17,12 +21,15 @@ var g = new common.grid({
modelName: common.util.__input('content-filter1'),
englishName: common.util.__input('content-filter2'),
status: common.util.__input('status-filter'),
startTime: $('#starttime').val(),
endTime: $('#endtime').val(),
modelType: parseInt($("#aa").val())
};
},
//列表显示
columns: [
{display:"ID",name:"id"},
{display: "姓名", name: "modelName"},
{display: "英文名", name: "englishName"},
{
... ... @@ -30,7 +37,7 @@ var g = new common.grid({
return '<img src="' + item.avatar + '" width="100" height="60"/>'
}
},//图片显示
{display: "国籍", name: "nationality"},
{display: "国籍", name: "nationality" },
{display: "身高", name: "height"},
{display: "体重", name: "weight"},
{
... ... @@ -53,22 +60,22 @@ var g = new common.grid({
},
{display: "鞋码", name: "shoeSize"},
{display: "衣服尺码", name: "dressSize"},
{
display: "模特卡", name: "modelCard ",hidden:parseInt($("#aa").val())==2 ,render: function (item) {
return '<img src="' + item.modelCard + '" width="100" height="60"/>'
display: "模特卡", name: "modelCard ", render: function (item) {
return '<img src="' + item.modelCard + '" width="100" height="60"/>'
}
},
{
display: "状态", name: "status", render: function (item) {
if (item.status == 1) {
return status = "启用"
display: "状态", name: "status",render: function (item) {
if (item.status == 1) {
return status = "启用"
}
else {
return status = "禁用"
}
}
else {
return status = "禁用"
}
}
},
{
display: "操作", name: "", render: function (item) {
var arr = [];
... ... @@ -103,8 +110,9 @@ var Bll = {
option.data.status = 1;//模特状态,默认启用
option.data.height = parseInt($("#height").val());//模特身高
option.data.weight = parseInt($("#weight").val());//模特体重
option.data.status = 1;//模特状态,默认启用
option.data.status = parseInt($("#status").val());//模特状态,默认启用
option.data.vitalStatistics = $("#Bust").val() + '|' + $("#waist").val() + "|" + $("#hips").val();//模特三围,拼接字符串
//console.log("option.data", option.data);
//option.debug = true;//调试状态
option.success = function (res) {
//判断接口请求状态
... ... @@ -129,16 +137,25 @@ var Bll = {
//添加模特--点击事件
$('#add-content').on('click', function () {
var item = {};
var item = {
"__state":"add"
};
Bll.toast('/shotManage/model/addModel', item, "添加模特");
});
var STATUS = {
'1': "启用",
'2': "禁用"
};
//修改模特--点击事件
$(document).on('click', '.update', function () {
var item = g.rows[$(this).data("index")];
item.__state="update";
var a = item.vitalStatistics.split(/[,|/]/g);
item.Bust = a[0];
item.waist = a[1];
item.hips = a[2];
item.statusname = STATUS[item.status];
Bll.toast('/shotManage/model/updateModel', item, "修改模特");
});
//查询按钮--点击事件
... ...
... ... @@ -8,6 +8,8 @@ var common = require('../common/common');
$('.hasDatepicker').fdatepicker({
format: 'yyyy-mm-dd'
});
var starttime=new Date($('#starttime').val()).getTime();
var endtime=new Date($('#endtime').val()).getTime();
/**
* 列表显示数据
* @type {common.grid}
... ... @@ -21,18 +23,18 @@ var g = new common.grid({
productSkn: common.util.__input('content-filter1'),
productSkc: common.util.__input('content-filter2'),
productSku: common.util.__input('content-filter3'),
startTime: common.util.__input('starttime'),
endTime: common.util.__input('endtime')
startTime: $('#starttime').val(),
endTime: $('#endtime').val()
};
},
//列表显示
columns: [
{display: "SKN", name: "productSkn"},
{
display: "最后上传时间", name: "updateTime",
display: "最后上传时间", name: "lastAddTime",
render: function (item) {
var t = new Date(item.updateTime * 1000);
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd ");
var t = new Date(item.lastAddTime * 1000);
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh/mm/ss");
return "<p>" + formatted + "</p>";
}
},
... ...
... ... @@ -14,6 +14,7 @@ exports.res = [
view: 'pages/shotManage/model',//视图
src: '/shotManage/model',//控制层
data:{
search:true,
type:1,
typeName:'拍摄模特管理'
}
... ...
... ... @@ -11,21 +11,24 @@ exports.res = [
{
route: '/meterManage/tryModel/index',//访问路由
method: 'GET',//方法
view: 'pages/shotManage/model',//视图
src: '/shotManage/model',//控制层
view: 'pages/meterManage/tryModel',//视图
src: '/meterManage/tryModel',//控制层
data: {
search:false,
type: 2,
typeName:'试穿模特管理'
typeName:'试穿模特管理',
status:1
}
},
//api请求数据
{
route: '/shotManage/model/getAllModels',
route: '/meterManage/tryModel/index1',
method: 'POST',
url: '/model/queryModelList',
params: [
{name: 'englishName', type: 'string'},//英文名
{name: 'modelName', type: 'string'},//名称
{name: 'beginTime', type: 'Number'},
{name: 'endTime', type: 'Number'},
{name: 'status', type: 'Number'},//模特状态:0 禁用 1 启用
{name: 'page', type: 'Number'},
{name: 'size', type: 'Number'}
... ... @@ -33,7 +36,7 @@ exports.res = [
},
//新增模特
{
route: '/shotManage/model/addModel',
route: '/meterManage/tryModel/addModel',
method: 'POST',
url: '/model/addModel',
params: [
... ... @@ -53,7 +56,7 @@ exports.res = [
},
//修改模特
{
route: '/shotManage/model/updateModel',
route: '/meterManage/tryModel/updateModel',
method: 'POST',
url: '/model/updateModel',
params: [
... ...
<!--模特管理界面-->
<div class="pageheader">
<div class="media">
<div class="pageicon pull-left">
<i class="fa fa-th-list"></i>
</div>
<div class="media-body">
<ul class="breadcrumb">
<li><a href=""><i class="glyphicon glyphicon-home"></i></a></li>
<li><a href="">模特管理</a></li>
<li>模特管理</li>
</ul>
<div>
<div style="width: 30%;float: left;">
<h4>{{typeName}}</h4>
</div>
</div>
</div>
</div>
</div>
<div class="contentpanel">
<div class="panel panel-default" style="...">
<div class="panel-heading">
<a class="btn btn-success " id="add-content"><i class="fa fa-plus"></i> 添加</a>
</div>
<div class="panel-body">
<div class="row">
<div class="panel-col2">
<input type="text" id="starttime" class="form-control panel-input hasDatepicker time" name="start_time"
placeholder="开始时间" value="" >
</div>
<div class="panel-col2">
<input type="text" id="endtime" class="form-control panel-input hasDatepicker time" name="end_time"
placeholder="结束时间" value="" >
</div>
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2">
<input type="text" value="" name="modelName" id="content-filter1" placeholder="姓名"
class="form-control">
</div>
<a id="filter-btn" href="javascript:;" class="btn btn-info">查询</a>
</div>
</div>
</div>
<div id="content-list"></div>
<input type="hidden" id="aa" value="{{type}}"/>
<input type="hidden" id="bb" value="{{status}}"/>
</div>
<script type="text/template" id="template">
<div class="rows" id="baseform" >
<div class="form-group">
<label class="col-sm-2 control-label" for="avatar">头像</label>
<input type="hidden" value="[[id]]" id="id"/>
<div class="col-sm-6">
<input type="file" value="[[avatar]]" class="form-control avatar" id="avatar" name="avatar" placeholder="头像" required="required"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="modelName">姓名</label>
<div class="col-sm-3">
<input type="text" value="[[modelName]]" class="form-control" id="modelName" placeholder="姓名" required="required"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="height">身高</label>
<div class="col-sm-3">
<input type="number" value="[[height]]" class="form-control" id="height"
match="numbers" placeholder="身高(cm)" required="required"/>
</div>
<label class="col-sm-2 control-label" for="weight">体重</label>
<div class="col-sm-3">
<input type="number" value="[[weight]]" class="form-control" id="weight"
match="numbers" placeholder="体重(kg)" required="required"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">三围</label>
<div class="col-sm-3">
<input type="number" value="[[Bust]]" class="form-control" id="Bust"
match="numbers" placeholder="胸围(cm)" required="required"/>
</div>
<div class="col-sm-3">
<input type="number" value="[[waist]]" class="form-control" id="waist"
match="numbers" placeholder="腰围(cm)" required="required"/>
</div>
<div class="col-sm-3">
<input type="number" value="[[hips]]" class="form-control" id="hips"
match="numbers" placeholder="臀围(cm)" required="required"/>
</div>
</div>
</div>
</script>
... ...
... ... @@ -66,13 +66,16 @@
<div class="col-sm-3">
<input type="text" value="[[modelName]]" class="form-control" id="modelName" placeholder="姓名" required="required"/>
</div>
<label class="col-sm-2 control-label" for="englishName">英文名</label>
<div class="col-sm-3">
<input type="text" value="[[englishName]]" class="form-control" id="englishName" placeholder="英文名" required="required"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="nationality">国籍</label>
... ... @@ -81,6 +84,7 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="height">身高</label>
... ... @@ -125,7 +129,6 @@
match="numbers" placeholder="臀围(cm)" required="required"/>
</div>
</div>
[[if {{type}}==1]]
<div class="form-group">
<label class="col-sm-2 control-label" for="modelCard">模特卡</label>
... ... @@ -133,6 +136,15 @@
<input type="file" value="[[modelCard]]" class="form-control modelCard" id="modelCard" name="modelCard" placeholder="模特卡" required="required"/>
</div>
</div>
[[if __state=='update']]
<div class="form-group">
<label class="col-sm-2 control-label">状态</label>
<div class="col-sm-8">
<label style="cursor: pointer;"><input type="radio" name="status" value="1">启用</label>
<label style="cursor: pointer;"><input type="radio" name="status" value="2">禁用</label>
</div>
<input type="hidden" id="status" value="[[status]]" for="radio">
</div>
[[/if]]
</div>
</script>
... ...
... ... @@ -23,14 +23,14 @@
<div class="panel panel-default" style="...">
<div class="panel-body">
<div class="row">
<!--<div class="panel-col2">-->
<!--<input type="text" id="starttime" class="form-control panel-input hasDatepicker" name="start_time"-->
<!--placeholder="开始时间" value="">-->
<!--</div>-->
<!--<div class="panel-col2">-->
<!--<input type="text" id="endtime" class="form-control panel-input hasDatepicker" name="end_time"-->
<!--placeholder="结束时间" value="">-->
<!--</div>-->
<div class="panel-col2">
<input type="text" id="starttime" class="form-control panel-input hasDatepicker time" name="start_time"
placeholder="开始时间" value="">
</div>
<div class="panel-col2">
<input type="text" id="endtime" class="form-control panel-input hasDatepicker time" name="end_time"
placeholder="结束时间" value="">
</div>
<div class="panel-col">
<input type="text" value="" name="productSkn" id="content-filter1" placeholder="skn"
class="form-control">
... ...
... ... @@ -36,8 +36,8 @@
<!--</div>-->
<div class="panel-col">
<select name="type" id="type-filter" tabindex="-1" title=""
class="form-control">
<option value="">类型</option>
class="form-control" required="required">
<option value="-1">类型</option>
<option value="1">拍摄类型</option>
<option value="2">拍摄风格</option>
<option value="3">模特类型</option>
... ...