Authored by 陶雨

app图标管理、app图片包管理

/**
* Created by ty on 2016/7/5.
* app图标管理
*/
module.exports=function(app) {
/*图标管理首页*/
app.get("/operations/icon/index","operations.icon.Index", function () {
this.$extend = {
moduleName: "图标管理",
pageName: "图标管理"
}
});
/*列表*/
app.post("/icon/getList","icon_getList");
/*添加图标*/
app.post("/icon/addIcon","icon_addIcon");
/*根据ID获取图标信息*/
app.post("/icon/getOneIcon","icon_getOneIcon");
/*更新图标信息*/
app.post("/icon/updateIcon","icon_updateIcon");
/*开启图标入口*/
app.post("/icon/publishIcon","icon_publishIcon");
/*关闭图标信息入口*/
app.post("/icon/closeIcon","icon_closeIcon");
}
\ No newline at end of file
... ...
/**
* Created by ty on 2016/7/5.
* app图片包
*/
module.exports=function(app) {
/*图片包首页*/
app.get("/operations/icon/ziplist","operations.ziplist.Index", function () {
this.$extend = {
moduleName: "图片包管理",
pageName: "图片包管理"
}
});
/*列表*/
app.post("/icon/getZipList","ziplist_getZipList");
/*上传图片包*/
app.post("/icon/addZip","ziplist_addZip");
/*启用图片包*/
app.post("/icon/publishZip","ziplist_publishZip");
/*关闭图片包*/
app.post("/icon/closeZip","ziplist_closeZip");
}
\ No newline at end of file
... ...
/**
* Created by ty on 2016/7/5.
* app图标管理
*/
module.exports={
namespace:"icon",
apis:{
getList:{
title: "查询图标列表",
url: '/icon/getList',
params: [
{name: 'type', type: 'Number'},
{name: 'status', type: 'Number'}
]
},
addIcon:{
title: "添加图标",
url: '/icon/addIcon',
params: [
{name: 'icoName', type: 'string'},
{name: 'defaultIco', type: 'string'},
{name: 'ico', type: 'string'},
{name: 'icoKey', type: 'string'},
{name: 'type', type: 'number'}
]
},
getOneIcon:{
title: "根据ID获取图标信息",
url: '/icon/getOneIcon',
params: [
{name: 'id', type: 'number'}
]
},
updateIcon:{
title: "更新图标信息",
url: '/icon/updateIcon',
params: [
{name: 'id', type: 'number'},
{name: 'icoName', type: 'string'},
{name: 'defaultIco', type: 'string'},
{name: 'ico', type: 'string'},
{name: 'icoKey', type: 'string'},
{name: 'type', type: 'number'}
]
},
publishIcon:{
title: "开启图标入口",
url: '/icon/publishIcon',
params: [
{name: 'id', type: 'number'}
]
},
closeIcon:{
title: "关闭图标入口",
url: '/icon/closeIcon',
params: [
{name: 'id', type: 'number'}
]
}
}
}
\ No newline at end of file
... ...
/**
* Created by ty on 2016/7/5.
* app图片包
*/
module.exports={
namespace:"ziplist",
apis:{
getZipList:{
title: "加载图片包列表",
url: '/icon/getZipList',
params: [
{name: 'platform', type: 'string'},
{name: 'status', type: 'Number'}
]
},
addZip:{
title: "上传图片包",
url: '/icon/addZip',
params: [
{name: 'zip', type: 'string'},
{name: 'platform', type: 'string'}
]
},
publishZip:{
title: "启用图片包",
url: '/icon/publishZip',
params: [
{name: 'id', type: 'number'}
]
},
closeZip:{
title: "关闭图片包",
url: '/icon/closeZip',
params: [
{name: 'id', type: 'number'}
]
}
}
}
\ No newline at end of file
... ...
... ... @@ -32,7 +32,7 @@
<label class="col-sm-1 control-label">上传图片</label>
<div class="col-sm-8">
<input type="text" name="image" id="image" class="form-control observe" placeholder="图片地址" value="[[image]]" data-field="image">
<input id="uploadBox" name="图片" type="file" style="position: absolute; top: 0;left: 0;" hidden>
<input id="uploadBox" name="图片" type="file" style="position: absolute; top: 0;left: 0;z-index: -999">
<div id="chooseFile" class="file-name btn btn-success">请选择文件</div>
</div>
</div>
... ...
<%include '../../../common/views/__ui/header'%>
<%include '../../../common/views/__partail/ListHeader'%>
<div class="contentpanel">
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-heading">
<a class="btn btn-info btn-xs" id="addInfo">添加信息</a>
</div><!-- panel-heading -->
<div class="panel-body">
<div class="panel-col">
<select name="status" id="status-filter" tabindex="-1" class="form-control">
<option value="">请选择状态</option>
<option value="0">关闭</option>
<option value="1">开启</option>
</select>
</div>
<div class="panel-col">
<select name="type" id="type-filter" class="form-control">
<option value="" selected="">请选择类别</option>
<option value="0">通用</option>
<option value="1">男生 BOYS</option>
<option value="2">女生 GIRLS</option>
<option value="3">潮童 KIDS</option>
<option value="4">创意生活 LIFE STYLE</option>
</select>
</div>
<a class="btn btn-info" id="filter-btn">筛选</a>
<a href="/operations/icon/index"><button class="btn btn-info" type="button">全部</button></a>
</div>
</div>
<div id="content-list"></div>
</div>
<script type="text/template" id="toast-template">
<div class="panel-body" id="base-form">
<div class="row">
<div class="form-group">
<label class="col-sm-2 control-label">名称</label>
<div class="col-sm-10">
<input type="text" name="ico_name" class="form-control observe" placeholder="名称" required value="[[icoName]]" data-field="icoName">
<input type="hidden" name="id" class="form-control" value="[[id]]">
</div>
</div><!-- form-group -->
<div class="form-group">
<label class="col-sm-2 control-label">默认图片名称</label>
<div class="col-sm-10">
<input type="text" name="default_ico" placeholder="默认图片名称" value="[[defaultIco]]" class="form-control observe" data-field="defaultIco" required>
<p style="color:#999">注:文件名一经设置,请谨慎修改。文件名示例:123.png</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">高亮图片名称</label>
<div class="col-sm-10">
<input type="text" name="ico" placeholder="高亮图片名称" value="[[ico]]" class="form-control observe" data-field="ico" required>
<p style="color:#999">注:文件名一经设置,请谨慎修改。文件名示例:123.png</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">频道</label>
<div class="col-sm-10">
<select name="type" id="type" style="width:150px;height:40px;" class="form-control observe" value="[[type]]" data-field="type" required>
<option value="" selected="">请选择频道</option>
<option value="0">通用</option>
<option value="1">男生 BOYS</option>
<option value="2">女生 GIRLS</option>
<option value="3">潮童 KIDS</option>
<option value="4">创意生活 LIFE STYLE</option>
</select>
</div>
</div><!-- form-group -->
<div class="form-group">
<label class="col-sm-2 control-label">key</label>
<div class="col-sm-10">
<select name="ico_key" id="ico_key" class="form-control observe" style="width:150px;height:40px;" value="[[icoKey]]" data-field="icoKey" required>
<option value="" selected="">请选择key</option>
<option value="home">首页</option>
<option value="category">分类</option>
<option value="guang"></option>
<option value="shoppingCart">购物车</option>
<option value="profile">我的</option>
<option value="logoCh">中文logo</option>
<option value="logoEn">英文logo</option>
<option value="setting">设置按钮</option>
<option value="message">消息中心</option>
<option value="address">地址管理</option>
<option value="myguang">我的逛</option>
<option value="yohoCoin">YOHO</option>
<option value="coupon">优惠券</option>
<option value="feedback">意见反馈</option>
<option value="invite">邀请好友</option>
<option value="online">在线客服</option>
<option value="willDeliver">待发货</option>
<option value="willPay">待付款</option>
<option value="willComment">待评价</option>
<option value="willReceived">待收货</option>
<option value="reback">退/换货</option>
<option value="vipBill">会员账单</option>
<option value="myList">我的晒单</option>
<option value="globalBuy">全球购</option>
<option value="myLimitCode">我的限购码</option>
<option value="suggestion">服务与反馈</option>
<option value="helpCenter"> 帮助中心</option>
</select>
</div>
</div><!-- form-group -->
</div><!-- row -->
</div>
</script>
\ No newline at end of file
... ...
<%include '../../../common/views/__ui/header'%>
<%include '../../../common/views/__partail/ListHeader'%>
<div class="contentpanel">
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-heading">
<a class="btn btn-info btn-xs" id="uploadZip">上传图片包</a>
</div><!-- panel-heading -->
<div class="panel-body">
<div class="panel-col">
<select name="status" id="status-filter" tabindex="-1" class="form-control">
<option value="">请选择状态</option>
<option value="0">关闭</option>
<option value="1">开启</option>
</select>
</div>
<div class="panel-col">
<select name="platform" id="platform-filter" tabindex="-1" class="form-control">
<option value="" selected="">请选择平台</option>
<option value="iphone">IOS手机</option>
<option value="ipad">IOS Pad</option>
<option value="android">安卓手机</option>
<option value="androidpad">安卓Pad</option>
<option value="h5">手机网站</option>
<option value="web">网站</option>
<option value="platform">平台</option>
</select>
</div>
<a class="btn btn-info" id="filter-btn">筛选</a>
<a href="/operations/icon/index"><button class="btn btn-info" type="button">全部</button></a>
</div>
</div>
<div id="content-list"></div>
</div>
<script type="text/template" id="toast-template">
<div class="panel-body" id="base-form">
<div class="row">
<div class="form-group">
<label class="col-sm-2 control-label">上传文件</label>
<div class="col-sm-10">
<input type="text" name="zip" id="zip" class="form-control" required prompt="图片包">
<input id="uploadBox" name="图片包" type="file" style="position: absolute; top: 0;left: 0;z-index: -999">
<div id="chooseFile" class="file-name btn btn-success">上传图片包</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">类别</label>
<div class="col-sm-10">
<select name="platform" id="platform" style="width:150px;" tabindex="-1" title="" class="form-control">
<option value="iphone">IOS手机</option>
<option value="ipad">IOS Pad</option>
<option value="android">安卓手机</option>
<option value="androidpad">安卓Pad</option>
<option value="h5">手机网站</option>
<option value="web">网站</option>
<option value="platform">平台</option>
</select>
</div>
</div><!-- form-group -->
</div><!-- row -->
</div>
</script>
\ No newline at end of file
... ...
... ... @@ -42,7 +42,8 @@ var Iaccount = {
var apiCofig = {
//root:__dirname,
EnvConst:{
domain:"http://192.168.102.210:8088/platform",
//domain:"http://192.168.102.210:8088/platform",
domain:"http://172.16.6.225:8080/platform",
yohoSearch: 'http://192.168.102.216:8080/yohosearch',
system:Iaccount
},
... ...
... ... @@ -41,7 +41,7 @@ $("#uploadBox").ajaxfileupload({
common.util.__tip(response.message);
}
}
})
});
$(document).on("click", "#addUrl", function () {
var urlIndex = '","url":"';
... ...
/**
* Created by ty on 2016/7/5.
* app图标管理
*/
var $ = require('jquery'),
common = require('../../../common/common');
var channelArr = ["通用","男生","女生","潮童","创意生活"];
var module = {};
var edit = new common.edit2("#base-form");
new common.dropDown({el: "#status-filter"});
new common.dropDown({el: "#type-filter"});
var Bll = {
toast: function (item, prefix, url) {
var dialog = common.dialog.confirm(prefix + "图标信息",
common.util.__template2($("#toast-template").html(), item),
function () {
if(edit.validate()) {
common.util.__ajax({
url: url,
data: module
}, function () {
dialog.close();
g.reload();
});
}
//console.log(item);
return false;
});
edit.init();
new common.dropDown({el: "#type"});
new common.dropDown({el: "#ico_key"});
}
};
var g = new common.grid({
el: "#content-list",
parms: function() {
return {
type: common.util.__input("type-filter"),
status: common.util.__input("status-filter")
}
},
columns: [
{display: "ID", name: 'id'},
{display: "名称", name: 'icoName'},
{display: "默认图片名称", name: 'defaultIco'},
{display: "高亮图片名称", name: 'ico'},
{display: "频道", render: function (item) {
return channelArr[item.type];
}},
{display: "key", name: 'icoKey'},
{display: "状态", render: function (item) {
if(item.status == 1) {
return "已开启";
} else {
return "已关闭";
}
}},
{display: "操作",
render: function(items) {
var HtmArr = [];
HtmArr.push('<a data-index="' + items.__index + '" class="btn btn-info btn-xs edit">编辑</a>');
if(items.status == 1) {
HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-danger btn-xs closeStatus">关闭入口</a>');
} else {
HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-info btn-xs publishStatus">开启入口</a>');
}
return HtmArr.join('');
}
}
]
});
g.init("/icon/getList");
//筛选
$(document).on("click", "#filter-btn", function () {
g.reload(1);
});
//关闭图标入口
$(document).on("click", ".closeStatus", function () {
common.util.__ajax({
url: "/icon/closeIcon",
data: {id: $(this).data("id")}
}, function () {
g.reload();
});
});
//开启图标入口
$(document).on("click", ".publishStatus", function () {
common.util.__ajax({
url: "/icon/publishIcon",
data: {id: $(this).data("id")}
}, function () {
g.reload();
});
});
//添加信息
$(document).on("click", "#addInfo", function () {
module = {};
Bll.toast(module, "添加", "/icon/addIcon");
});
//编辑
$(document).on("click", ".edit", function () {
module = g.rows[$(this).data("index")];
Bll.toast(module, "编辑", "/icon/updateIcon");
});
//监听数据变化
$(document).on("change", ".observe", function () {
module[$(this).data("field")] = $(this).val();
});
$(document).on("click", "#chooseFile", function () {
$("#uploadBox").click();
});
\ No newline at end of file
... ...
/**
* Created by ty on 2016/7/5.
* app图片包
*/
var $ = require('jquery'),
common = require('../../../common/common');
new common.dropDown({el: "#status-filter"});
new common.dropDown({el: "#platform-filter"});
var edit = new common.edit2("#base-form");
var Bll = {
__time: function (time) {
var t = new Date(time * 1000);
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
return formatted;
},
platformArr: {
iphone:"IOS手机",
ipad:"IOS Pad",
android:"安卓手机",
androidpad:"安卓Pad",
h5:"手机网站",
web:"网站",
platform:"平台",
},
toast: function (url) {
var dialog = common.dialog.confirm("上传图片包",
common.util.__template2($("#toast-template").html(), {}),
function () {
if(edit.validate()) {
common.util.__ajax({
url: url,
data: {zip: $("#zip").val(), platform: $("#platform").val()}
}, function () {
dialog.close();
g.reload();
});
}
return false;
});
new common.dropDown({el: "#platform"});
$("#uploadBox").ajaxfileupload({
'action': '/ajax/upload',
'params': {
bucket: "yhb-iconZip01",
__type: "upload"
},
onComplete: function (response) {
if (response.status && response.code == 200) {
if(response.data){
common.util.__tip(response.message, "success");
$("#zip").val(response.data);
}
} else {
common.util.__tip(response.message);
}
},
valid_extensions: ["zip"]
});
}
};
var g = new common.grid({
el: "#content-list",
parms: function() {
return {
platform: common.util.__input("platform-filter"),
status: common.util.__input("status-filter")
}
},
columns: [
{display: "ID", name: 'id'},
{display: "zip包路径", name: 'zip'},
{display: "显示平台", render: function (item) {
return Bll.platformArr[item.platform];
}},
{display: "添加时间", render: function (item) {
if(item.createTime) {
return Bll.__time(item.createTime);
}
}},
{display: "更新时间", render: function (item) {
if(item.updateTime) {
return Bll.__time(item.updateTime);
}
}},
{display: "状态", render: function (item) {
if(item.status == 1) {
return "已开启";
} else {
return "已关闭";
}
}},
{display: "操作",
render: function(items) {
var HtmArr = [];
if(items.status == 1) {
HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-danger btn-xs closeStatus">关闭</a>');
} else {
HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-info btn-xs publishStatus">启用</a>');
}
return HtmArr.join('');
}
}
]
});
g.init("/icon/getZipList");
//筛选
$(document).on("click", "#filter-btn", function () {
g.reload(1);
});
//关闭图片包
$(document).on("click", ".closeStatus", function () {
common.util.__ajax({
url: "/icon/closeZip",
data: {id: $(this).data("id")}
}, function () {
g.reload();
});
});
//启用图片包
$(document).on("click", ".publishStatus", function () {
common.util.__ajax({
url: "/icon/publishZip",
data: {id: $(this).data("id")}
}, function () {
g.reload();
});
});
//弹窗
$(document).on("click", "#uploadZip", function () {
Bll.toast("/icon/addZip");
});
$(document).on("click", "#chooseFile", function () {
$("#uploadBox").click();
});
\ No newline at end of file
... ...