Showing
11 changed files
with
607 additions
and
3 deletions
code/apps/operations/controllers/icon.js
0 → 100644
1 | +/** | ||
2 | + * Created by ty on 2016/7/5. | ||
3 | + * app图标管理 | ||
4 | + */ | ||
5 | + | ||
6 | +module.exports=function(app) { | ||
7 | + | ||
8 | + /*图标管理首页*/ | ||
9 | + app.get("/operations/icon/index","operations.icon.Index", function () { | ||
10 | + this.$extend = { | ||
11 | + moduleName: "图标管理", | ||
12 | + pageName: "图标管理" | ||
13 | + } | ||
14 | + }); | ||
15 | + | ||
16 | + /*列表*/ | ||
17 | + app.post("/icon/getList","icon_getList"); | ||
18 | + | ||
19 | + /*添加图标*/ | ||
20 | + app.post("/icon/addIcon","icon_addIcon"); | ||
21 | + | ||
22 | + /*根据ID获取图标信息*/ | ||
23 | + app.post("/icon/getOneIcon","icon_getOneIcon"); | ||
24 | + | ||
25 | + /*更新图标信息*/ | ||
26 | + app.post("/icon/updateIcon","icon_updateIcon"); | ||
27 | + | ||
28 | + /*开启图标入口*/ | ||
29 | + app.post("/icon/publishIcon","icon_publishIcon"); | ||
30 | + | ||
31 | + /*关闭图标信息入口*/ | ||
32 | + app.post("/icon/closeIcon","icon_closeIcon"); | ||
33 | +} |
code/apps/operations/controllers/ziplist.js
0 → 100644
1 | +/** | ||
2 | + * Created by ty on 2016/7/5. | ||
3 | + * app图片包 | ||
4 | + */ | ||
5 | + | ||
6 | +module.exports=function(app) { | ||
7 | + | ||
8 | + /*图片包首页*/ | ||
9 | + app.get("/operations/icon/ziplist","operations.ziplist.Index", function () { | ||
10 | + this.$extend = { | ||
11 | + moduleName: "图片包管理", | ||
12 | + pageName: "图片包管理" | ||
13 | + } | ||
14 | + }); | ||
15 | + | ||
16 | + /*列表*/ | ||
17 | + app.post("/icon/getZipList","ziplist_getZipList"); | ||
18 | + | ||
19 | + /*上传图片包*/ | ||
20 | + app.post("/icon/addZip","ziplist_addZip"); | ||
21 | + | ||
22 | + /*启用图片包*/ | ||
23 | + app.post("/icon/publishZip","ziplist_publishZip"); | ||
24 | + | ||
25 | + /*关闭图片包*/ | ||
26 | + app.post("/icon/closeZip","ziplist_closeZip"); | ||
27 | +} |
code/apps/operations/interfaces/icon.js
0 → 100644
1 | +/** | ||
2 | + * Created by ty on 2016/7/5. | ||
3 | + * app图标管理 | ||
4 | + */ | ||
5 | + | ||
6 | +module.exports={ | ||
7 | + namespace:"icon", | ||
8 | + apis:{ | ||
9 | + getList:{ | ||
10 | + title: "查询图标列表", | ||
11 | + url: '/icon/getList', | ||
12 | + params: [ | ||
13 | + {name: 'type', type: 'Number'}, | ||
14 | + {name: 'status', type: 'Number'} | ||
15 | + ] | ||
16 | + }, | ||
17 | + addIcon:{ | ||
18 | + title: "添加图标", | ||
19 | + url: '/icon/addIcon', | ||
20 | + params: [ | ||
21 | + {name: 'icoName', type: 'string'}, | ||
22 | + {name: 'defaultIco', type: 'string'}, | ||
23 | + {name: 'ico', type: 'string'}, | ||
24 | + {name: 'icoKey', type: 'string'}, | ||
25 | + {name: 'type', type: 'number'} | ||
26 | + ] | ||
27 | + }, | ||
28 | + getOneIcon:{ | ||
29 | + title: "根据ID获取图标信息", | ||
30 | + url: '/icon/getOneIcon', | ||
31 | + params: [ | ||
32 | + {name: 'id', type: 'number'} | ||
33 | + ] | ||
34 | + }, | ||
35 | + updateIcon:{ | ||
36 | + title: "更新图标信息", | ||
37 | + url: '/icon/updateIcon', | ||
38 | + params: [ | ||
39 | + {name: 'id', type: 'number'}, | ||
40 | + {name: 'icoName', type: 'string'}, | ||
41 | + {name: 'defaultIco', type: 'string'}, | ||
42 | + {name: 'ico', type: 'string'}, | ||
43 | + {name: 'icoKey', type: 'string'}, | ||
44 | + {name: 'type', type: 'number'} | ||
45 | + ] | ||
46 | + }, | ||
47 | + publishIcon:{ | ||
48 | + title: "开启图标入口", | ||
49 | + url: '/icon/publishIcon', | ||
50 | + params: [ | ||
51 | + {name: 'id', type: 'number'} | ||
52 | + ] | ||
53 | + }, | ||
54 | + closeIcon:{ | ||
55 | + title: "关闭图标入口", | ||
56 | + url: '/icon/closeIcon', | ||
57 | + params: [ | ||
58 | + {name: 'id', type: 'number'} | ||
59 | + ] | ||
60 | + } | ||
61 | + } | ||
62 | +} |
code/apps/operations/interfaces/ziplist.js
0 → 100644
1 | +/** | ||
2 | + * Created by ty on 2016/7/5. | ||
3 | + * app图片包 | ||
4 | + */ | ||
5 | + | ||
6 | +module.exports={ | ||
7 | + namespace:"ziplist", | ||
8 | + apis:{ | ||
9 | + getZipList:{ | ||
10 | + title: "加载图片包列表", | ||
11 | + url: '/icon/getZipList', | ||
12 | + params: [ | ||
13 | + {name: 'platform', type: 'string'}, | ||
14 | + {name: 'status', type: 'Number'} | ||
15 | + ] | ||
16 | + }, | ||
17 | + addZip:{ | ||
18 | + title: "上传图片包", | ||
19 | + url: '/icon/addZip', | ||
20 | + params: [ | ||
21 | + {name: 'zip', type: 'string'}, | ||
22 | + {name: 'platform', type: 'string'} | ||
23 | + ] | ||
24 | + }, | ||
25 | + publishZip:{ | ||
26 | + title: "启用图片包", | ||
27 | + url: '/icon/publishZip', | ||
28 | + params: [ | ||
29 | + {name: 'id', type: 'number'} | ||
30 | + ] | ||
31 | + }, | ||
32 | + closeZip:{ | ||
33 | + title: "关闭图片包", | ||
34 | + url: '/icon/closeZip', | ||
35 | + params: [ | ||
36 | + {name: 'id', type: 'number'} | ||
37 | + ] | ||
38 | + } | ||
39 | + } | ||
40 | +} |
@@ -32,7 +32,7 @@ | @@ -32,7 +32,7 @@ | ||
32 | <label class="col-sm-1 control-label">上传图片</label> | 32 | <label class="col-sm-1 control-label">上传图片</label> |
33 | <div class="col-sm-8"> | 33 | <div class="col-sm-8"> |
34 | <input type="text" name="image" id="image" class="form-control observe" placeholder="图片地址" value="[[image]]" data-field="image"> | 34 | <input type="text" name="image" id="image" class="form-control observe" placeholder="图片地址" value="[[image]]" data-field="image"> |
35 | - <input id="uploadBox" name="图片" type="file" style="position: absolute; top: 0;left: 0;" hidden> | 35 | + <input id="uploadBox" name="图片" type="file" style="position: absolute; top: 0;left: 0;z-index: -999"> |
36 | <div id="chooseFile" class="file-name btn btn-success">请选择文件</div> | 36 | <div id="chooseFile" class="file-name btn btn-success">请选择文件</div> |
37 | </div> | 37 | </div> |
38 | </div> | 38 | </div> |
code/apps/operations/views/icon/Index.html
0 → 100644
1 | +<%include '../../../common/views/__ui/header'%> | ||
2 | +<%include '../../../common/views/__partail/ListHeader'%> | ||
3 | + | ||
4 | +<div class="contentpanel"> | ||
5 | + <div class="panel panel-default" style="margin-bottom:10px;"> | ||
6 | + <div class="panel-heading"> | ||
7 | + <a class="btn btn-info btn-xs" id="addInfo">添加信息</a> | ||
8 | + </div><!-- panel-heading --> | ||
9 | + <div class="panel-body"> | ||
10 | + <div class="panel-col"> | ||
11 | + <select name="status" id="status-filter" tabindex="-1" class="form-control"> | ||
12 | + <option value="">请选择状态</option> | ||
13 | + <option value="0">关闭</option> | ||
14 | + <option value="1">开启</option> | ||
15 | + </select> | ||
16 | + </div> | ||
17 | + <div class="panel-col"> | ||
18 | + <select name="type" id="type-filter" class="form-control"> | ||
19 | + <option value="" selected="">请选择类别</option> | ||
20 | + <option value="0">通用</option> | ||
21 | + <option value="1">男生 BOYS</option> | ||
22 | + <option value="2">女生 GIRLS</option> | ||
23 | + <option value="3">潮童 KIDS</option> | ||
24 | + <option value="4">创意生活 LIFE STYLE</option> | ||
25 | + </select> | ||
26 | + </div> | ||
27 | + <a class="btn btn-info" id="filter-btn">筛选</a> | ||
28 | + <a href="/operations/icon/index"><button class="btn btn-info" type="button">全部</button></a> | ||
29 | + </div> | ||
30 | + </div> | ||
31 | + <div id="content-list"></div> | ||
32 | +</div> | ||
33 | + | ||
34 | +<script type="text/template" id="toast-template"> | ||
35 | + <div class="panel-body" id="base-form"> | ||
36 | + <div class="row"> | ||
37 | + <div class="form-group"> | ||
38 | + <label class="col-sm-2 control-label">名称</label> | ||
39 | + <div class="col-sm-10"> | ||
40 | + <input type="text" name="ico_name" class="form-control observe" placeholder="名称" required value="[[icoName]]" data-field="icoName"> | ||
41 | + <input type="hidden" name="id" class="form-control" value="[[id]]"> | ||
42 | + </div> | ||
43 | + </div><!-- form-group --> | ||
44 | + <div class="form-group"> | ||
45 | + <label class="col-sm-2 control-label">默认图片名称</label> | ||
46 | + <div class="col-sm-10"> | ||
47 | + <input type="text" name="default_ico" placeholder="默认图片名称" value="[[defaultIco]]" class="form-control observe" data-field="defaultIco" required> | ||
48 | + <p style="color:#999">注:文件名一经设置,请谨慎修改。文件名示例:123.png</p> | ||
49 | + </div> | ||
50 | + </div> | ||
51 | + <div class="form-group"> | ||
52 | + <label class="col-sm-2 control-label">高亮图片名称</label> | ||
53 | + <div class="col-sm-10"> | ||
54 | + <input type="text" name="ico" placeholder="高亮图片名称" value="[[ico]]" class="form-control observe" data-field="ico" required> | ||
55 | + <p style="color:#999">注:文件名一经设置,请谨慎修改。文件名示例:123.png</p> | ||
56 | + </div> | ||
57 | + </div> | ||
58 | + | ||
59 | + <div class="form-group"> | ||
60 | + <label class="col-sm-2 control-label">频道</label> | ||
61 | + <div class="col-sm-10"> | ||
62 | + <select name="type" id="type" style="width:150px;height:40px;" class="form-control observe" value="[[type]]" data-field="type" required> | ||
63 | + <option value="" selected="">请选择频道</option> | ||
64 | + <option value="0">通用</option> | ||
65 | + <option value="1">男生 BOYS</option> | ||
66 | + <option value="2">女生 GIRLS</option> | ||
67 | + <option value="3">潮童 KIDS</option> | ||
68 | + <option value="4">创意生活 LIFE STYLE</option> | ||
69 | + </select> | ||
70 | + </div> | ||
71 | + </div><!-- form-group --> | ||
72 | + <div class="form-group"> | ||
73 | + <label class="col-sm-2 control-label">key</label> | ||
74 | + <div class="col-sm-10"> | ||
75 | + <select name="ico_key" id="ico_key" class="form-control observe" style="width:150px;height:40px;" value="[[icoKey]]" data-field="icoKey" required> | ||
76 | + <option value="" selected="">请选择key</option> | ||
77 | + <option value="home">首页</option> | ||
78 | + <option value="category">分类</option> | ||
79 | + <option value="guang">逛</option> | ||
80 | + <option value="shoppingCart">购物车</option> | ||
81 | + <option value="profile">我的</option> | ||
82 | + <option value="logoCh">中文logo</option> | ||
83 | + <option value="logoEn">英文logo</option> | ||
84 | + <option value="setting">设置按钮</option> | ||
85 | + <option value="message">消息中心</option> | ||
86 | + <option value="address">地址管理</option> | ||
87 | + <option value="myguang">我的逛</option> | ||
88 | + <option value="yohoCoin">YOHO币</option> | ||
89 | + <option value="coupon">优惠券</option> | ||
90 | + <option value="feedback">意见反馈</option> | ||
91 | + <option value="invite">邀请好友</option> | ||
92 | + <option value="online">在线客服</option> | ||
93 | + <option value="willDeliver">待发货</option> | ||
94 | + <option value="willPay">待付款</option> | ||
95 | + <option value="willComment">待评价</option> | ||
96 | + <option value="willReceived">待收货</option> | ||
97 | + <option value="reback">退/换货</option> | ||
98 | + <option value="vipBill">会员账单</option> | ||
99 | + <option value="myList">我的晒单</option> | ||
100 | + <option value="globalBuy">全球购</option> | ||
101 | + <option value="myLimitCode">我的限购码</option> | ||
102 | + <option value="suggestion">服务与反馈</option> | ||
103 | + <option value="helpCenter"> 帮助中心</option> | ||
104 | + </select> | ||
105 | + </div> | ||
106 | + </div><!-- form-group --> | ||
107 | + </div><!-- row --> | ||
108 | + </div> | ||
109 | +</script> |
1 | +<%include '../../../common/views/__ui/header'%> | ||
2 | +<%include '../../../common/views/__partail/ListHeader'%> | ||
3 | + | ||
4 | +<div class="contentpanel"> | ||
5 | + <div class="panel panel-default" style="margin-bottom:10px;"> | ||
6 | + <div class="panel-heading"> | ||
7 | + <a class="btn btn-info btn-xs" id="uploadZip">上传图片包</a> | ||
8 | + </div><!-- panel-heading --> | ||
9 | + <div class="panel-body"> | ||
10 | + <div class="panel-col"> | ||
11 | + <select name="status" id="status-filter" tabindex="-1" class="form-control"> | ||
12 | + <option value="">请选择状态</option> | ||
13 | + <option value="0">关闭</option> | ||
14 | + <option value="1">开启</option> | ||
15 | + </select> | ||
16 | + </div> | ||
17 | + <div class="panel-col"> | ||
18 | + <select name="platform" id="platform-filter" tabindex="-1" class="form-control"> | ||
19 | + <option value="" selected="">请选择平台</option> | ||
20 | + <option value="iphone">IOS手机</option> | ||
21 | + <option value="ipad">IOS Pad</option> | ||
22 | + <option value="android">安卓手机</option> | ||
23 | + <option value="androidpad">安卓Pad</option> | ||
24 | + <option value="h5">手机网站</option> | ||
25 | + <option value="web">网站</option> | ||
26 | + <option value="platform">平台</option> | ||
27 | + </select> | ||
28 | + </div> | ||
29 | + <a class="btn btn-info" id="filter-btn">筛选</a> | ||
30 | + <a href="/operations/icon/index"><button class="btn btn-info" type="button">全部</button></a> | ||
31 | + </div> | ||
32 | + </div> | ||
33 | + <div id="content-list"></div> | ||
34 | +</div> | ||
35 | + | ||
36 | +<script type="text/template" id="toast-template"> | ||
37 | + <div class="panel-body" id="base-form"> | ||
38 | + <div class="row"> | ||
39 | + <div class="form-group"> | ||
40 | + <label class="col-sm-2 control-label">上传文件</label> | ||
41 | + <div class="col-sm-10"> | ||
42 | + <input type="text" name="zip" id="zip" class="form-control" required prompt="图片包"> | ||
43 | + <input id="uploadBox" name="图片包" type="file" style="position: absolute; top: 0;left: 0;z-index: -999"> | ||
44 | + <div id="chooseFile" class="file-name btn btn-success">上传图片包</div> | ||
45 | + </div> | ||
46 | + </div> | ||
47 | + <div class="form-group"> | ||
48 | + <label class="col-sm-2 control-label">类别</label> | ||
49 | + <div class="col-sm-10"> | ||
50 | + <select name="platform" id="platform" style="width:150px;" tabindex="-1" title="" class="form-control"> | ||
51 | + <option value="iphone">IOS手机</option> | ||
52 | + <option value="ipad">IOS Pad</option> | ||
53 | + <option value="android">安卓手机</option> | ||
54 | + <option value="androidpad">安卓Pad</option> | ||
55 | + <option value="h5">手机网站</option> | ||
56 | + <option value="web">网站</option> | ||
57 | + <option value="platform">平台</option> | ||
58 | + </select> | ||
59 | + </div> | ||
60 | + </div><!-- form-group --> | ||
61 | + </div><!-- row --> | ||
62 | + </div> | ||
63 | +</script> |
@@ -42,7 +42,8 @@ var Iaccount = { | @@ -42,7 +42,8 @@ var Iaccount = { | ||
42 | var apiCofig = { | 42 | var apiCofig = { |
43 | //root:__dirname, | 43 | //root:__dirname, |
44 | EnvConst:{ | 44 | EnvConst:{ |
45 | - domain:"http://192.168.102.210:8088/platform", | 45 | + //domain:"http://192.168.102.210:8088/platform", |
46 | + domain:"http://172.16.6.225:8080/platform", | ||
46 | yohoSearch: 'http://192.168.102.216:8080/yohosearch', | 47 | yohoSearch: 'http://192.168.102.216:8080/yohosearch', |
47 | system:Iaccount | 48 | system:Iaccount |
48 | }, | 49 | }, |
@@ -41,7 +41,7 @@ $("#uploadBox").ajaxfileupload({ | @@ -41,7 +41,7 @@ $("#uploadBox").ajaxfileupload({ | ||
41 | common.util.__tip(response.message); | 41 | common.util.__tip(response.message); |
42 | } | 42 | } |
43 | } | 43 | } |
44 | -}) | 44 | +}); |
45 | 45 | ||
46 | $(document).on("click", "#addUrl", function () { | 46 | $(document).on("click", "#addUrl", function () { |
47 | var urlIndex = '","url":"'; | 47 | var urlIndex = '","url":"'; |
1 | +/** | ||
2 | + * Created by ty on 2016/7/5. | ||
3 | + * app图标管理 | ||
4 | + */ | ||
5 | + | ||
6 | +var $ = require('jquery'), | ||
7 | + common = require('../../../common/common'); | ||
8 | + | ||
9 | +var channelArr = ["通用","男生","女生","潮童","创意生活"]; | ||
10 | +var module = {}; | ||
11 | +var edit = new common.edit2("#base-form"); | ||
12 | + | ||
13 | +new common.dropDown({el: "#status-filter"}); | ||
14 | +new common.dropDown({el: "#type-filter"}); | ||
15 | + | ||
16 | +var Bll = { | ||
17 | + toast: function (item, prefix, url) { | ||
18 | + var dialog = common.dialog.confirm(prefix + "图标信息", | ||
19 | + common.util.__template2($("#toast-template").html(), item), | ||
20 | + function () { | ||
21 | + if(edit.validate()) { | ||
22 | + common.util.__ajax({ | ||
23 | + url: url, | ||
24 | + data: module | ||
25 | + }, function () { | ||
26 | + dialog.close(); | ||
27 | + g.reload(); | ||
28 | + }); | ||
29 | + } | ||
30 | + //console.log(item); | ||
31 | + return false; | ||
32 | + }); | ||
33 | + edit.init(); | ||
34 | + new common.dropDown({el: "#type"}); | ||
35 | + new common.dropDown({el: "#ico_key"}); | ||
36 | + } | ||
37 | +}; | ||
38 | + | ||
39 | +var g = new common.grid({ | ||
40 | + el: "#content-list", | ||
41 | + parms: function() { | ||
42 | + return { | ||
43 | + type: common.util.__input("type-filter"), | ||
44 | + status: common.util.__input("status-filter") | ||
45 | + } | ||
46 | + }, | ||
47 | + columns: [ | ||
48 | + {display: "ID", name: 'id'}, | ||
49 | + {display: "名称", name: 'icoName'}, | ||
50 | + {display: "默认图片名称", name: 'defaultIco'}, | ||
51 | + {display: "高亮图片名称", name: 'ico'}, | ||
52 | + {display: "频道", render: function (item) { | ||
53 | + return channelArr[item.type]; | ||
54 | + }}, | ||
55 | + {display: "key", name: 'icoKey'}, | ||
56 | + {display: "状态", render: function (item) { | ||
57 | + if(item.status == 1) { | ||
58 | + return "已开启"; | ||
59 | + } else { | ||
60 | + return "已关闭"; | ||
61 | + } | ||
62 | + }}, | ||
63 | + {display: "操作", | ||
64 | + render: function(items) { | ||
65 | + var HtmArr = []; | ||
66 | + HtmArr.push('<a data-index="' + items.__index + '" class="btn btn-info btn-xs edit">编辑</a>'); | ||
67 | + if(items.status == 1) { | ||
68 | + HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-danger btn-xs closeStatus">关闭入口</a>'); | ||
69 | + } else { | ||
70 | + HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-info btn-xs publishStatus">开启入口</a>'); | ||
71 | + } | ||
72 | + return HtmArr.join(''); | ||
73 | + } | ||
74 | + } | ||
75 | + ] | ||
76 | +}); | ||
77 | + | ||
78 | +g.init("/icon/getList"); | ||
79 | + | ||
80 | + | ||
81 | +//筛选 | ||
82 | +$(document).on("click", "#filter-btn", function () { | ||
83 | + g.reload(1); | ||
84 | +}); | ||
85 | + | ||
86 | +//关闭图标入口 | ||
87 | +$(document).on("click", ".closeStatus", function () { | ||
88 | + common.util.__ajax({ | ||
89 | + url: "/icon/closeIcon", | ||
90 | + data: {id: $(this).data("id")} | ||
91 | + }, function () { | ||
92 | + g.reload(); | ||
93 | + }); | ||
94 | +}); | ||
95 | + | ||
96 | +//开启图标入口 | ||
97 | +$(document).on("click", ".publishStatus", function () { | ||
98 | + common.util.__ajax({ | ||
99 | + url: "/icon/publishIcon", | ||
100 | + data: {id: $(this).data("id")} | ||
101 | + }, function () { | ||
102 | + g.reload(); | ||
103 | + }); | ||
104 | +}); | ||
105 | + | ||
106 | +//添加信息 | ||
107 | +$(document).on("click", "#addInfo", function () { | ||
108 | + module = {}; | ||
109 | + Bll.toast(module, "添加", "/icon/addIcon"); | ||
110 | +}); | ||
111 | + | ||
112 | +//编辑 | ||
113 | +$(document).on("click", ".edit", function () { | ||
114 | + module = g.rows[$(this).data("index")]; | ||
115 | + Bll.toast(module, "编辑", "/icon/updateIcon"); | ||
116 | +}); | ||
117 | + | ||
118 | +//监听数据变化 | ||
119 | +$(document).on("change", ".observe", function () { | ||
120 | + module[$(this).data("field")] = $(this).val(); | ||
121 | +}); | ||
122 | + | ||
123 | +$(document).on("click", "#chooseFile", function () { | ||
124 | + $("#uploadBox").click(); | ||
125 | +}); |
1 | +/** | ||
2 | + * Created by ty on 2016/7/5. | ||
3 | + * app图片包 | ||
4 | + */ | ||
5 | + | ||
6 | +var $ = require('jquery'), | ||
7 | + common = require('../../../common/common'); | ||
8 | + | ||
9 | +new common.dropDown({el: "#status-filter"}); | ||
10 | +new common.dropDown({el: "#platform-filter"}); | ||
11 | +var edit = new common.edit2("#base-form"); | ||
12 | + | ||
13 | +var Bll = { | ||
14 | + __time: function (time) { | ||
15 | + var t = new Date(time * 1000); | ||
16 | + var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss"); | ||
17 | + return formatted; | ||
18 | + }, | ||
19 | + platformArr: { | ||
20 | + iphone:"IOS手机", | ||
21 | + ipad:"IOS Pad", | ||
22 | + android:"安卓手机", | ||
23 | + androidpad:"安卓Pad", | ||
24 | + h5:"手机网站", | ||
25 | + web:"网站", | ||
26 | + platform:"平台", | ||
27 | + }, | ||
28 | + toast: function (url) { | ||
29 | + var dialog = common.dialog.confirm("上传图片包", | ||
30 | + common.util.__template2($("#toast-template").html(), {}), | ||
31 | + function () { | ||
32 | + if(edit.validate()) { | ||
33 | + common.util.__ajax({ | ||
34 | + url: url, | ||
35 | + data: {zip: $("#zip").val(), platform: $("#platform").val()} | ||
36 | + }, function () { | ||
37 | + dialog.close(); | ||
38 | + g.reload(); | ||
39 | + }); | ||
40 | + } | ||
41 | + return false; | ||
42 | + }); | ||
43 | + new common.dropDown({el: "#platform"}); | ||
44 | + $("#uploadBox").ajaxfileupload({ | ||
45 | + 'action': '/ajax/upload', | ||
46 | + 'params': { | ||
47 | + bucket: "yhb-iconZip01", | ||
48 | + __type: "upload" | ||
49 | + }, | ||
50 | + onComplete: function (response) { | ||
51 | + if (response.status && response.code == 200) { | ||
52 | + if(response.data){ | ||
53 | + common.util.__tip(response.message, "success"); | ||
54 | + $("#zip").val(response.data); | ||
55 | + } | ||
56 | + } else { | ||
57 | + common.util.__tip(response.message); | ||
58 | + } | ||
59 | + }, | ||
60 | + valid_extensions: ["zip"] | ||
61 | + }); | ||
62 | + } | ||
63 | +}; | ||
64 | + | ||
65 | +var g = new common.grid({ | ||
66 | + el: "#content-list", | ||
67 | + parms: function() { | ||
68 | + return { | ||
69 | + platform: common.util.__input("platform-filter"), | ||
70 | + status: common.util.__input("status-filter") | ||
71 | + } | ||
72 | + }, | ||
73 | + columns: [ | ||
74 | + {display: "ID", name: 'id'}, | ||
75 | + {display: "zip包路径", name: 'zip'}, | ||
76 | + {display: "显示平台", render: function (item) { | ||
77 | + return Bll.platformArr[item.platform]; | ||
78 | + }}, | ||
79 | + {display: "添加时间", render: function (item) { | ||
80 | + if(item.createTime) { | ||
81 | + return Bll.__time(item.createTime); | ||
82 | + } | ||
83 | + }}, | ||
84 | + {display: "更新时间", render: function (item) { | ||
85 | + if(item.updateTime) { | ||
86 | + return Bll.__time(item.updateTime); | ||
87 | + } | ||
88 | + }}, | ||
89 | + {display: "状态", render: function (item) { | ||
90 | + if(item.status == 1) { | ||
91 | + return "已开启"; | ||
92 | + } else { | ||
93 | + return "已关闭"; | ||
94 | + } | ||
95 | + }}, | ||
96 | + {display: "操作", | ||
97 | + render: function(items) { | ||
98 | + var HtmArr = []; | ||
99 | + if(items.status == 1) { | ||
100 | + HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-danger btn-xs closeStatus">关闭</a>'); | ||
101 | + } else { | ||
102 | + HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-info btn-xs publishStatus">启用</a>'); | ||
103 | + } | ||
104 | + return HtmArr.join(''); | ||
105 | + } | ||
106 | + } | ||
107 | + ] | ||
108 | +}); | ||
109 | + | ||
110 | +g.init("/icon/getZipList"); | ||
111 | + | ||
112 | +//筛选 | ||
113 | +$(document).on("click", "#filter-btn", function () { | ||
114 | + g.reload(1); | ||
115 | +}); | ||
116 | + | ||
117 | +//关闭图片包 | ||
118 | +$(document).on("click", ".closeStatus", function () { | ||
119 | + common.util.__ajax({ | ||
120 | + url: "/icon/closeZip", | ||
121 | + data: {id: $(this).data("id")} | ||
122 | + }, function () { | ||
123 | + g.reload(); | ||
124 | + }); | ||
125 | +}); | ||
126 | + | ||
127 | +//启用图片包 | ||
128 | +$(document).on("click", ".publishStatus", function () { | ||
129 | + common.util.__ajax({ | ||
130 | + url: "/icon/publishZip", | ||
131 | + data: {id: $(this).data("id")} | ||
132 | + }, function () { | ||
133 | + g.reload(); | ||
134 | + }); | ||
135 | +}); | ||
136 | + | ||
137 | +//弹窗 | ||
138 | +$(document).on("click", "#uploadZip", function () { | ||
139 | + Bll.toast("/icon/addZip"); | ||
140 | +}); | ||
141 | + | ||
142 | +$(document).on("click", "#chooseFile", function () { | ||
143 | + $("#uploadBox").click(); | ||
144 | +}); |
-
Please register or login to post a comment