forked from likeyun/liKeYun_TbkTool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactivezjy.php
228 lines (214 loc) · 6.7 KB
/
activezjy.php
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script src="js/jquery.min.js"></script>
<script src="js/clipboard.min.js"></script>
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0,viewport-fit=cover">
<style type="text/css">
*{
margin:0;
padding:0;
font-family: -apple-system-font,BlinkMacSystemFont,"Helvetica Neue","PingFang SC","Hiragino Sans GB","Microsoft YaHei UI","Microsoft YaHei",Arial,sans-serif;
}
body{
background: #f3f3f3;
}
#top{
width: 100%;
height: 50px;
background-image: linear-gradient(to right, #ff9569 0%, #e92758 100%);
position: fixed;
top: 0;
text-align: center;
line-height: 50px;
font-size: 16px;
color: #fff;
font-weight: bold;
}
#pic{
width: 88%;
margin:0 auto 10px;
/*background: #f00;*/
}
#pic img{
width: 100%;
border-radius: 10px;
overflow: hidden;
}
/*项目内容区*/
#project_content{
width: 90%;
background: #fff;
padding:22px 0;
border-radius: 10px;
margin:18px auto 0;
box-shadow: 0 0 5px #eee;
}
#project_content .project_text{
width: 80%;
background: #f5f5f5;
border-radius: 10px;
margin:0 auto;
padding:20px 20px;
}
#copy{
width: 90%;
height: 45px;
background-image: linear-gradient(to bottom right, #f77062, #fe5196);
border-radius: 6px;
text-align: center;
line-height: 45px;
font-size: 17px;
font-weight: bold;
margin:15px auto 5px;
color: #fff;
-webkit-tap-highlight-color:rgba(255,0,0,0);
border:none;
display: block;
}
#tips{
text-align: center;
margin-top: 30px;
font-size: 15px;
color: #999;
}
#copytips{
display: none;
}
#copytips .success{
width: 160px;
height: 85px;
line-height: 85px;
background: rgba(0,0,0,0.5);
margin:20px auto;
color: #fff;
font-size: 17px;
text-align: center;
border-radius: 10px;
position: fixed;
top: 260px;
left: 0;
right: 0;
}
#notfoundicon{
width: 130px;
height: 130px;
margin:80px auto 20px;
}
#notfoundicon img{
width: 130px;
height: 130px;
}
</style>
</head>
<body>
<?php
header("Content-Type:text/html;charset=utf-8");
// 获得activeid
$activeid = trim($_GET['activeid']);
// 没有activeid参数传进来
if (empty($activeid)) {
die("参数错误");
}
// 引入数据库配置
include './Db_Connect.php';
// 创建连接
$conn = new mysqli($db_url, $db_user, $db_pwd, $db_name);
// 检查连接
if ($conn->connect_error) {
die("连接失败: " . $conn->connect_error);
}
// 更新访问量
mysqli_query($conn,"UPDATE tbk_active_zjy SET active_pv=active_pv+1 WHERE active_id='$activeid'");
// 获取当前中间页的标题
$sql_title = "SELECT * FROM tbk_active_zjy WHERE active_id='$activeid'";
$result_title = $conn->query($sql_title);
if ($result_title->num_rows > 0) {
while($row_title = $result_title->fetch_assoc()) {
$zjy_title = $row_title["active_title"];
}
}else{
echo '<title>链接失效</title>';
echo '<div id="notfoundicon">
<img src="./images/notfound.png" />
</div>
<p style="text-align:center;font-size:17px;color:#999;">该链接已被管理员删除</p>';
exit;
}
// 查询数据
$sql = "SELECT * FROM tbk_active_project WHERE active_id='$activeid' ORDER BY ID ASC";
$result = $conn->query($sql);
// 遍历并输出数据
if ($result->num_rows > 0) {
echo '<div id="top">'.$zjy_title.'</div>';
echo '<title>活动详情</title>';
echo '<div style="width:100%;height:50px;margin:0 auto;"></div>';
while($row = $result->fetch_assoc()) {
$id = $row["id"];
$pro_id = "pro_".$id;
$active_text = $row["active_text"];
$active_pic = $row["active_pic"];
$copy_status = $row["active_copy"];
// 遍历输出所有项目
echo '<div id="project_content">';
if (trim(empty($active_pic))) {
//
}else{
echo '<div id="pic"><img src="'.$active_pic.'"/></div>';
}
echo '<div class="project_text" id="'.$pro_id.'">'.$active_text.'</div>';
// 获取复制按钮开启状态
if ($copy_status == 1) {
echo '<button id="copy" data-clipboard-action="copy" data-clipboard-target="#'.$pro_id.'">一键复制</button>';
}else{
// 不显示复制按钮
}
echo '</div>';
}
// 复制提示
echo '<div id="copytips"><p class="success">复制成功</p></div>';
echo "<br/><br/><br/>";
} else {
echo '<title>温馨提示</title>';
echo '<div id="notfoundicon">
<img src="./images/notfound.png" />
</div>
<p style="text-align:center;font-size:17px;color:#999;">暂无活动项目</p>';
exit;
}
// 断开数据库连接
$conn->close();
?>
</body>
<!-- 原生JS复制 -->
<script type="text/javascript">
// 隐藏copytips
function hidetips(){
document.getElementById("copytips").style.display="none";
}
// clipboard
$(document).ready(function(){
var clipboard = new Clipboard('#copy');
clipboard.on('success', function(e) {
document.getElementById("copytips").style.display="block";
setTimeout('hidetips()', 2000);
e.clearSelection();
});
});
//隐藏分享等按钮
function onBridgeReady() {
WeixinJSBridge.call('hideOptionMenu');
}
if (typeof WeixinJSBridge == "undefined") {
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
} else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
}
} else {
onBridgeReady();
}
</script>
</html>