operations.officialAccounts.Index.js
2.63 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
webpackJsonp([107],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
/*
*@time: 2016.09.13
*@author: LiQZ
*/
var $ = __webpack_require__(1), common = __webpack_require__(2);
var locations = [];
locations["guang_detail_wechat"] = "逛页面";
locations["pay_success_wechat"] = "支付完成页";
locations["yoho_sign_wechat"] = "YOHO币页面";
var tableGird = new common.grid({
el: "#officialAccounts-table-box",
parms: function() {
return {
module: "wechat"
}
},
columns: [
{ display: "ID", name: "id" },
{ display: "公众号名称", render: function(items) {
var data = JSON.parse(items.contentData);
var item = [];
for (var i = 0, l = data.length; i < l; i++) {
var v = data[i];
item.push(v.wechat_name);
}
return item.join(',');
}},
{ display: "微信号", render: function(items) {
var data = JSON.parse(items.contentData);
var item = [];
for (var i = 0, l = data.length; i < l; i++) {
var v = data[i];
item.push(v.wechat_id);
}
return item.join(',');
}},
{ display: "页面", render: function(items) {
return locations[items.templateKey];
}},
{ display: "操作", render: function(items) {
var HtmArr = [];
if (items.status) {
HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-danger btn-xs close-btn">关闭</a>');
} else {
HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-success btn-xs open-btn">开启</a>');
}
HtmArr.push('<a href="/resources/officialAccounts/' + items.id + '" data-id="' + items.id + '" class="btn btn-primary btn-xs">编辑</a>');
return HtmArr.join('');
}
}]
});
tableGird.init('/resources/listSingleResource');
//开启公众号
$('#officialAccounts-table-box').on('click', '.open-btn', function() {
var param = {
id: $(this).data('id'),
status: '1'
}
common.util.__ajax({
url: '/resources/triggerSingleResource',
data: param
}, function(res) {
tableGird.reload();
});
});
//关闭公众号
$('#officialAccounts-table-box').on('click', '.close-btn', function() {
var param = {
id: $(this).data('id'),
status: '0'
}
common.util.__ajax({
url: '/resources/triggerSingleResource',
data: param
}, function(res) {
tableGird.reload();
});
});
/***/ }
]);