Showing
4 changed files
with
257 additions
and
1 deletions
client/js/sourceManage/resourceManage.js
0 → 100644
1 | +/** | ||
2 | + * Created by ty on 2016/3/30. | ||
3 | + * 资源管理 | ||
4 | + */ | ||
5 | + | ||
6 | +var $ = require('jquery'), | ||
7 | + common = require('../common/common'), | ||
8 | + util = require('../common/util'); | ||
9 | + | ||
10 | +/*导航栏筛选*/ | ||
11 | +common.util.__ajax({ | ||
12 | + url: "/resources/resourceManage/getResSorts",//获取所有资源 | ||
13 | + data: {} | ||
14 | +},function(res) { | ||
15 | + $("#category-content").html(common.util.__template2($("#search-category").html(), res)); | ||
16 | + new common.dropDown({el: "#choose-category"}); | ||
17 | +},true); | ||
18 | + | ||
19 | +common.util.__ajax({ | ||
20 | + url: "/resources/resourceManage/getResPlatforms",//获取所有平台 | ||
21 | + data: {} | ||
22 | +},function(res) { | ||
23 | + $("#platform-content").html(common.util.__template2($("#search-platform").html(), res)); | ||
24 | + new common.dropDown({el: "#choose-platform"}); | ||
25 | +},true); | ||
26 | + | ||
27 | +var g = new common.grid({ | ||
28 | + el: "#content-list", | ||
29 | + hash: false, | ||
30 | + parms: function () { | ||
31 | + return { | ||
32 | + name: common.util.__input('inputResourceName'), | ||
33 | + sortId: common.util.__input('choose-category'), | ||
34 | + platformId: common.util.__input('choose-platform') | ||
35 | + }; | ||
36 | + }, | ||
37 | + columns:[ | ||
38 | + {display: "ID", name: "id"}, | ||
39 | + {display: "资源", name: "name"}, | ||
40 | + {display: "分类", name: "sortName"}, | ||
41 | + {display: "平台", name: "platformName"}, | ||
42 | + {display: "位置码", name: "code"}, | ||
43 | + {display: "匹配码", name: "matchCode"}, | ||
44 | + {display: "创建时间", name: "", render: function(item) { | ||
45 | + return Bll.getLocalTime(item.createTime); | ||
46 | + }}, | ||
47 | + {display: "操作", name: "",render: function(item) { | ||
48 | + var arr = []; | ||
49 | + arr.push('<a class="btn btn-primary contentManage" data-index="' + item.__index + '">内容管理</a>'); | ||
50 | + arr.push('<a class="btn btn-primary add2" data-index="' + item.__index + '">编辑</a>'); | ||
51 | + arr.push('<a class="btn btn-primary delbtn" data-index="' + item.__index + '">删除</a>'); | ||
52 | + return arr.join(""); | ||
53 | + }} | ||
54 | + ] | ||
55 | +}); | ||
56 | + | ||
57 | +g.init("/resources/resourceManage/queryResource"); | ||
58 | + | ||
59 | + | ||
60 | +var Bll = { | ||
61 | + getLocalTime:function(nS) { | ||
62 | + var date = new Date(parseInt(nS) * 1000); | ||
63 | + var mm = date.getMonth() + 1; | ||
64 | + var dd = date.getDate(); | ||
65 | + var h = date.getHours(); | ||
66 | + var min = date.getMinutes(); | ||
67 | + var second = date.getSeconds(); | ||
68 | + return date.getFullYear() + "-" + (mm < 10 ? "0" + mm : mm) + "-" + (dd < 10 ? "0" + dd : dd) + " " + (h < 10 ? "0" + h : h) + ":" | ||
69 | + + (min < 10 ? "0" + min : min) + ":" + (second < 10 ? "0" + second : second); | ||
70 | + }, | ||
71 | + toast: function (url, item, hint) { | ||
72 | + var e = new common.edit("#base-form"); | ||
73 | + var dialog=common.dialog.confirm(hint, | ||
74 | + common.util.__template2($("#edit-template").html(), item), | ||
75 | + function() { | ||
76 | + e.submit(url,function(option){ | ||
77 | + //option.data; | ||
78 | + //console.log(option.data); | ||
79 | + option.success=function(res){ | ||
80 | + dialog.close(); | ||
81 | + util.__tip(res.data.message, 'success'); | ||
82 | + Bll.init(); | ||
83 | + }; | ||
84 | + option.error=function(res){ | ||
85 | + dialog.close(); | ||
86 | + util.__tip(res.data.message); | ||
87 | + } | ||
88 | + }); | ||
89 | + return false; | ||
90 | + }); | ||
91 | + // | ||
92 | + | ||
93 | + e.init(); | ||
94 | + } | ||
95 | +} | ||
96 | + | ||
97 | +$(document).on("click", "#add-resource", function () { | ||
98 | + var item = {}; | ||
99 | + Bll.toast("11", item, "新增资源"); | ||
100 | +}); | ||
101 | + | ||
102 | +$(document).on("click", "#filter-btn",function() { | ||
103 | + g.reload(1); | ||
104 | +}); |
@@ -68,7 +68,7 @@ var Bll = { | @@ -68,7 +68,7 @@ var Bll = { | ||
68 | function() { | 68 | function() { |
69 | e.submit(url,function(option){ | 69 | e.submit(url,function(option){ |
70 | //option.data; | 70 | //option.data; |
71 | - console.log(option.data); | 71 | + //console.log(option.data); |
72 | option.success=function(res){ | 72 | option.success=function(res){ |
73 | dialog.close(); | 73 | dialog.close(); |
74 | util.__tip(res.data.message, 'success'); | 74 | util.__tip(res.data.message, 'success'); |
server/interface/resourceManage.js
0 → 100644
1 | +/** | ||
2 | + * Created by ty on 2016/3/30. | ||
3 | + * 资源管理路由 | ||
4 | + */ | ||
5 | + | ||
6 | +//exports.domain = require('../config/common.js').domain; | ||
7 | +exports.domain = 'http://172.16.6.115:8080/platform';//王伟 | ||
8 | +//exports.domain = 'http://192.168.102.216:8180/platform'; //测试环境 | ||
9 | + | ||
10 | +exports.res = [ | ||
11 | + { | ||
12 | + route: "/resource/index/index1", | ||
13 | + method: "GET", | ||
14 | + view: "pages/sourceManage/resourceManage", | ||
15 | + src: "/sourceManage/resourceManage" | ||
16 | + }, | ||
17 | + { | ||
18 | + route: "/resources/resourceManage/queryResource", | ||
19 | + method: "POST", | ||
20 | + url: "/resources/queryResource", | ||
21 | + params: [ | ||
22 | + {name: "name", type: "string"}, | ||
23 | + {name: "sortId", type: "number"}, | ||
24 | + {name: "platformId", type: "number"}, | ||
25 | + {name: "page", type: "number"} | ||
26 | + ] | ||
27 | + }, | ||
28 | + { | ||
29 | + route: "/resources/resourceManage/getResSorts", | ||
30 | + method: "POST", | ||
31 | + url: "/resources/getResSorts", | ||
32 | + params: [] | ||
33 | + }, | ||
34 | + { | ||
35 | + route: "/resources/resourceManage/getResPlatforms", | ||
36 | + method: "POST", | ||
37 | + url: "/resources/getResPlatforms", | ||
38 | + params: [] | ||
39 | + } | ||
40 | +]; |
1 | +<div class="pageheader"> | ||
2 | + <div class="media"> | ||
3 | + <div class="pageicon pull-left"> | ||
4 | + <i class="fa fa-th-list"></i> | ||
5 | + </div> | ||
6 | + <div class="media-body"> | ||
7 | + <ul class="breadcrumb"> | ||
8 | + <li><a href=""><i class="glyphicon glyphicon-home"></i></a></li> | ||
9 | + <li><a href="">资源管理</a></li> | ||
10 | + <li>资源管理</li> | ||
11 | + </ul> | ||
12 | + | ||
13 | + <div> | ||
14 | + <div style="width: 30%;float: left;"> | ||
15 | + <h4>资源管理</h4> | ||
16 | + </div> | ||
17 | + </div> | ||
18 | + </div> | ||
19 | + </div> | ||
20 | +</div> | ||
21 | +<div class="panel panel-default" style="margin-bottom:10px;"> | ||
22 | + <div class="panel-heading"> | ||
23 | + <a class="btn btn-success " id="add-resource"><i class="fa fa-plus"></i> 添加资源位</a> | ||
24 | + </div> | ||
25 | + <div class="panel-body"> | ||
26 | + <div class="row"> | ||
27 | + <div class="panel-col"> | ||
28 | + <input type="text" id="inputResourceName" placeholder="请输入资源名" class="form-control" /> | ||
29 | + </div> | ||
30 | + <div class="panel-col" id="category-content"> | ||
31 | + | ||
32 | + </div> | ||
33 | + <div class="panel-col" id="platform-content"> | ||
34 | + </div> | ||
35 | + <a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a> | ||
36 | + <a id="filter-all" href="/resource/index/index1" class="btn btn-info">全部</a> | ||
37 | + </div> | ||
38 | + </div> | ||
39 | +</div> | ||
40 | + | ||
41 | +<div class="contentpanel"> | ||
42 | + <div class="panel panel-default" style="margin-bottom: 10px"> | ||
43 | + <input type="hidden" id="url" value="/runManage/subjectManage/subjectList"/> | ||
44 | + <div id="content-list"></div> | ||
45 | + </div> | ||
46 | +</div> | ||
47 | + | ||
48 | +<script type="text/template" id="search-category"> | ||
49 | + <select id="choose-category" title="" class="select2-offscreen brandBtn-group"> | ||
50 | + <option value="">选择分类</option> | ||
51 | + [[each data as item index]] | ||
52 | + <option value="[[item.sortId]]">[[item.sortName]]</option> | ||
53 | + [[/each]] | ||
54 | + </select> | ||
55 | +</script> | ||
56 | + | ||
57 | +<script type="text/template" id="search-platform"> | ||
58 | + <select id="choose-platform" title="" class="select2-offscreen brandBtn-group"> | ||
59 | + <option value="">选择平台</option> | ||
60 | + [[each data as item index]] | ||
61 | + <option value="[[item.platformId]]">[[item.platformName]]</option> | ||
62 | + [[/each]] | ||
63 | + </select> | ||
64 | +</script> | ||
65 | + | ||
66 | +<script type="text/template" id="edit-template"> | ||
67 | + <div class="modal-body" id="base-form"> | ||
68 | + <div class="form-group"> | ||
69 | + <label class="col-sm-2 control-label">名称</label> | ||
70 | + <div class="col-sm-8"> | ||
71 | + <input type="text" id="name" name="name" value="[[name]]" class="form-control"> | ||
72 | + </div> | ||
73 | + </div><!-- form-group --> | ||
74 | + <div class="form-group"> | ||
75 | + <label class="col-sm-2 control-label">分类</label> | ||
76 | + <div class="col-sm-8"> | ||
77 | + <select id="sortId" name="sortId"> | ||
78 | + <option value="0">请选择资源分类</option> | ||
79 | + </select> | ||
80 | + </div> | ||
81 | + </div><!-- form-group --> | ||
82 | + | ||
83 | + <div class="form-group"> | ||
84 | + <label class="col-sm-2 control-label">平台</label> | ||
85 | + <div class="col-sm-8"> | ||
86 | + <select id="platformId" name="platformId"> | ||
87 | + <option value="0">请选择资源平台</option> | ||
88 | + <option selected="" value="1">yohoApp</option> | ||
89 | + <option value="5">web</option> | ||
90 | + <option value="6">yohoipad</option> | ||
91 | + <option value="9">wap</option> | ||
92 | + </select> | ||
93 | + </div> | ||
94 | + </div><!-- form-group --> | ||
95 | + | ||
96 | + <div class="form-group" hidden> | ||
97 | + <label class="col-sm-2 control-label">位置码</label> | ||
98 | + <div class="col-sm-8"> | ||
99 | + <input type="text" disabled="disabled" value="[[code]]" class="form-control"> | ||
100 | + </div> | ||
101 | + </div><!-- form-group --> | ||
102 | + | ||
103 | + <div class="form-group"> | ||
104 | + <label class="col-sm-2 control-label">匹配码</label> | ||
105 | + <div class="col-sm-8"> | ||
106 | + <input type="text" id="matchCode" value="[[matchCode]]" class="form-control"> | ||
107 | + </div> | ||
108 | + </div><!-- form-group --> | ||
109 | + | ||
110 | + <input type="hidden" id="id" value="[[id]]"> | ||
111 | + </div> | ||
112 | +</script> |
-
Please register or login to post a comment