index.php
5.81 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
<?php
use yii\helpers\Url;
use app\ht\widgets\LinkPager;
$this->title = '小程序广告设置';
$this->params['breadcrumbs'][] = '平台设置';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="panel panel-default">
<div class="panel-heading">
<a class="btn btn-primary" id="batch-disable">批量禁用</a>
<a href="<?php echo Url::toRoute('/setting/user-ads/create'); ?>" class="btn btn-success pull-right">添加广告</a>
<div class="clearfix"></div>
</div>
<div class="panel-body">
<ul id="countryTab" class="nav nav-tabs" style="margin-bottom: 20px">
<li class="active"><a href="<?=Url::toRoute("/setting/user-ads/index")?>" >已启用</a></li>
<li><a href="<?=Url::toRoute("/setting/user-ads/disabled")?>" >已禁用</a></li>
</ul>
<?php if (!empty($userAdses)) : ?>
<table class="table table-striped table-bordered" id="brand-table">
<thead>
<tr>
<th style="width:5%;" class="text-center align-middle hqy-all-select"><input type="checkbox" class="select-on-check-all" name="selection_all" value="1"></th>
<th style="width:10%;">图片</th>
<th style="width:6%;">终端</th>
<th style="width:12%;">标题</th>
<th style="width:8%;">链接方式</th>
<th style="width:10%;">链接网址</th>
<th style="width:10%;">小程序AppId</th>
<th style="width:15%;">小程序页面路径</th>
<th style="width:5%;">状态</th>
<th style="width:5%;">排序</th>
<th style="width:15%;">操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($userAdses as $userAds) : ?>
<tr>
<td class="text-center align-middle hqy-row-select"><input type="checkbox" name="selection[]" value="<?= $userAds['id'] ?>"></td>
<td ><img src="<?= $userAds['logo'] ?>" height="75" /></td>
<td ><?= $userAds['client'] ?></td>
<td >
<?= $userAds['title'] ?>
</td>
<td ><?php echo $userAds['link_mode_label'] ?></td>
<td >
<?php echo $userAds['url'] ?>
</td>
<td ><?php echo $userAds['appid'] ?></td>
<td >
<?php echo $userAds['path'] ?>
</td>
<td >
<?php echo $userAds['status'] ?>
</td>
<td >
<?php echo $userAds['sort_order'] ?>
</td>
<td >
<a href="<?php echo Url::toRoute(['/setting/user-ads/update', 'id' => $userAds['id']]) ?>">编辑</a> |
<a href="<?php echo Url::toRoute(['/setting/user-ads/enable', 'id' => $userAds['id']]) ?>"><?php echo $userAds['enable'] ?></a> |
<a onclick="confirmRedirect('<?php echo Url::toRoute(['/setting/user-ads/delete', 'id' => $userAds['id']]) ?>')" title="删除" href="javascript:void(0)">删除</a> |
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else : ?>
<p class="text-center">
没有找到数据
</p>
<?php endif; ?>
</div>
<div class="panel-footer">
<div class="hqy-panel-pager">
<?= LinkPager::widget([
'pagination' => $pages,
]); ?>
<div class="clearfix"></div>
</div>
</div>
</div>
<script>
// 全部选中
seajs.use("base/1.0.0/unit/utils/utils-1.0.0",function (a) {
a.hqySelectRow('brand-table', 'warning');
})
//关闭
$("#batch-disable").click(function() {
var ids = "";
$("input[name='selection[]']").each(function() {
if ($(this).prop("checked") == true) {
var id = $(this).attr("value");
ids = ids + id + ",";
}
});
if (ids == "") {
alert('请选择广告')
return false;
}
var url = "<?php echo Url::toRoute('/setting/user-ads/batch-disable'); ?>?ids=" + ids;
$('#url4').val(url);//给会话中的隐藏属性URL赋值
$('#myModal4').modal();
});
function batchDisableSubmit(url){
var url=$.trim($("#url4").val());//获取会话中的隐藏属性URL
window.location.href=url;
}
</script>
<!-- 模态框(Modal) -->
<div class="modal fade" id="myModal4" tabindex="-1" role="dialog" aria-labelledby="myModalLabel4" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">关闭</button>
<h4 class="modal-title" id="myModalLabel4">
提示
</h4>
</div>
<div class="modal-body">
确定禁用所选广告吗?
</div>
<div class="modal-footer">
<input type="hidden" id="url4"/>
<a onclick="batchDisableSubmit()" class="btn btn-primary" data-dismiss="modal">确定</a>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
</div>
</div><!-- /.modal-title -->
</div><!-- /.modal -->
</div>