operations.ziplist.Index.js
4.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
webpackJsonp([136],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
/**
* Created by ty on 2016/7/5.
* app图片包
*/
var $ = __webpack_require__(1),
common = __webpack_require__(2);
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-success 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();
});
/***/ }
]);