operations.webshare.Index.js
2.82 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
webpackJsonp([135],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
/**
* Created by ty on 2016/7/6.
* 活动分享管理
*/
var $ = __webpack_require__(1),
common = __webpack_require__(2);
new common.dropDown({el:"#status-filter"});
var statusEnum = ["开启", "关闭"];
var g = new common.grid({
el: '#content-list',
parms: function () {
return {
id: common.util.__input("shareId-filter"),
status: common.util.__input("status-filter"),
title: common.util.__input("title-filter")
};
},
columns: [
{display: "ID", name: "id"},
{display: "标题", name: "title"},
{display: "分享主标题", name: "shareTitleMain"},
{display: "分享副标题", name: "shareTitleSub"},
{display: "分享图片", render: function (item) {
if(item.shareImage) {
var src = item.shareImage.replace("{mode}", "2").replace("{width}", "80").replace("{height}", "80");
return '<img src="'+ src +'" width="80px" height="80px" />';
}
}},
{display: "状态", render: function (item) {
if(item.status == 1) {
return "已开启";
} else {
return "已关闭";
}
}},
{display: "创建时间", render: function (item) {
return common.util.__dateFormat(new Date(item.createTime * 1000), "yyyy-MM-dd hh:mm:ss");
}},
{
display: '操作',
render: function (item) {
var HtmArr = [];
HtmArr.push('<a href="/operations/webshare/edit/'+ item.id +'" class="btn btn-primary btn-xs">编辑</a>');
if(item.status==0){
HtmArr.push('<a data-index="'+ item.__index +'" class="btn btn-success btn-xs auditStatus">'+ statusEnum[item.status] +'</a>');
}else{
HtmArr.push('<a data-index="'+ item.__index +'" class="btn btn-danger btn-xs auditStatus">'+ statusEnum[item.status] +'</a>');
}
return HtmArr.join('');
}
}
]
});
/**
* 全局对象
*/
var Bll = {
getTime: function (time) {//时间格式转换
var t = new Date(time * 1000);
return common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
}
};
g.init("/webShare/getWebShareList");
//筛选
$(document).on("click", "#filter-btn", function () {
g.reload(1);
});
//更改状态
$(document).on("click", ".auditStatus", function () {
var item = g.rows[$(this).data("index")];
item.status = 1 - item.status;
common.util.__ajax({
url: "/webShare/updateWebShare",
data: item
}, function () {
g.reload();
});
});
/***/ }
]);