peternameyakj
2024-10-15 19d0fd2c0e7860e2d5d075f926df0d190ebb34cc
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<%@ page language="java" pageEncoding="utf-8" isELIgnored="false"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<jsp:useBean id="security" class="security.web.BaseSecurityAction" scope="page" />
 
<%@ include file="include/pagetop.jsp"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="include/head.jsp"%>
</head>
<body>
    <%@ include file="include/loading.jsp"%>
<%--     <%@ include file="include/top.jsp"%> --%>
<%--     <%@ include file="include/menu_left.jsp"%> --%>
    <!-- //////////////////////////////////////////////////////////////////////////// -->
    <!-- START CONTENT -->
    <div class="ifr-dody">
 
        <!-- //////////////////////////////////////////////////////////////////////////// -->
        <!-- START CONTAINER -->
        <div class="ifr-con">
            <h3>系统配置
            </h3>
            <%@ include file="include/alert.jsp"%>
            <!-- //////////////////////////////////////////////////////////////////////////// -->
            <!-- START queryForm -->
            <form action="<%=basePath%>normal/adminSysparaAction!list.action"
                method="post" id="queryForm">
                <input type="hidden" name="pageNo" id="pageNo"
                    value="${pageNo}">
            </form>
            <!-- END queryForm -->
            <!-- //////////////////////////////////////////////////////////////////////////// -->
            <div class="row">
                <div class="col-md-12 col-lg-12">
                    <div class="panel panel-default">
 
                        <div class="panel-title">
                            admin谷歌验证器
                            <ul class="panel-tools">
                                <li><a class="icon minimise-tool"><i
                                        class="fa fa-minus"></i></a></li>
                                <li><a class="icon expand-tool"><i class="fa fa-expand"></i></a></li>
                            </ul>
                        </div>
 
                        <div class="panel-body">
                            <form class="form-horizontal"
                                action="<%=basePath%>normal/adminGoogleAuthAction!adminGoogleAuthBind.action"
                                method="post" name="mainForm" id="mainForm">
                                
                                <c:choose>
 
                                <c:when test="${!google_auth_bind}">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label form-label">密匙</label>
                                        <div class="col-sm-4">
                                            <input id="google_auth_secret" name="google_auth_secret" class="form-control" readOnly="readOnly" value="${google_auth_secret}" />
                                            <input type="hidden" name="google_auth_url" id="google_auth_url" value="${google_auth_url}" />
                                        </div>
                                        <c:if test="${!google_auth_bind}">
                                        <div class="col-sm-1">
                                            <a href="javascript:picture();" class="btn btn-light" style="margin-bottom: 10px">生成</a>
                                        </div>
                                        </c:if>
                                    </div>
                                    <div class="form-group" style="display:none;" id="show_img">
                                        <label class="col-sm-2 control-label form-label"></label>
                                        <div class="col-sm-4" >
                                            <img width="90px" height="90px" id="load_img" style="float: left;"
                                             src="<%=basePath%>img/chat/loading.gif"  alt="加载中..." />
                                            <a href="#" target="_blank" ><img width="90px" height="90px" id="show_thumb" style="float: left;"
                                             src=""  alt="资讯图片" /> </a>  
                                        </div>
                                    </div>
                                    
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label form-label">谷歌验证码</label>
                                        <div class="col-sm-4">
                                            <input id="google_auth_code" name="google_auth_code" class="form-control" placeholder="谷歌验证码" />
                                        </div>
                                    </div>
                                </c:when>
                                <c:otherwise>
                                <label class="col-sm-2 control-label form-label"></label><p class="ballon color1">已绑定</p>
                                </c:otherwise>
                                  
                                </c:choose>
                                
                                
                                <div class="form-group">
                                    <label class="col-sm-2 control-label form-label">超级谷歌验证码</label>
                                    <div class="col-sm-4">
                                        <input id="super_google_auth_code" name="super_google_auth_code" class="form-control" placeholder="超级谷歌验证码" />
                                    </div>
                                </div>
 
 
 
                                <div class="form-group">
                                    <div class="col-sm-offset-2 col-sm-10">
                                        <a href="javascript:goUrl(${pageNo})"
                                            class="btn">取消</a> 
                                            
                                                                                        <c:choose>
 
                                            <c:when test="${google_auth_bind}">
                                                <a href="javascript:unbind()" class="btn btn-default">解绑</a>
                                            </c:when>
                                            <c:otherwise>
                                                <a href="javascript:bind()" class="btn btn-default">绑定</a>
                                            </c:otherwise>
                                              
                                            </c:choose>
                                            
                                    </div>
                                </div>
                            
                            </form>
                        </div>
 
                    </div>
                </div>
            </div>
 
 
        </div>
        <!-- END CONTAINER -->
        <!-- //////////////////////////////////////////////////////////////////////////// -->
 
 
        <%@ include file="include/footer.jsp"%>
 
 
    </div>
    <!-- End Content -->
    <!-- //////////////////////////////////////////////////////////////////////////// -->
 
 
 
 
 
    <%@ include file="include/js.jsp"%>
    <script src="<%=basePath%>js/util.js" type="text/javascript"></script>
    <script type="text/javascript">
    $.fn.datetimepicker.dates['zh'] = {
            days : [ "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日" ],
            daysShort : [ "日", "一", "二", "三", "四", "五", "六", "日" ],
            daysMin : [ "日", "一", "二", "三", "四", "五", "六", "日" ],
            months : [ "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月",
                    "十月", "十一月", "十二月" ],
            monthsShort : [ "一", "二", "三", "四", "五", "六", "七", "八", "九", "十",
                    "十一", "十二" ],
            meridiem : [ "上午", "下午" ],
            //suffix:      ["st", "nd", "rd", "th"],  
            today : "今天",
            clear : "清空"
        };
    $(function() {
        $('#report_time').datetimepicker({
            format : 'yyyy-mm-dd hh:ii:00',
            minuteStep:1,
            language : 'zh',
            weekStart : 1,
            todayBtn : 1,
            autoclose : 1,
            todayHighlight : 1,
            startView : 2,
            clearBtn : true
//                minView : 2,
//                pickerPosition: "bottom-left"
        });
        init();
    });
    </script>
    <script type="text/javascript">
        function bind() {
            swal({
                title : "是否绑定?",
                text : "",
                type : "warning",
                showCancelButton : true,
                confirmButtonColor : "#DD6B55",
                confirmButtonText : "确认",
                closeOnConfirm : false
            }, function() {
                document.getElementById("mainForm").submit();
            });
 
        }
        function unbind() {
            swal({
                title : "是否解绑?",
                text : "",
                type : "warning",
                showCancelButton : true,
                confirmButtonColor : "#DD6B55",
                confirmButtonText : "确认",
                closeOnConfirm : false
            }, function() {
                $("#mainForm").attr("action","<%=basePath%>normal/adminGoogleAuthAction!adminGoogleAuthUnBind.action");
                document.getElementById("mainForm").submit();
            });
 
        }
        function init(){
            if($("#google_auth_url").val()){
                
                $("#show_thumb").attr("src",$("#google_auth_url").val());
                $("#show_thumb").parents("a").attr("href",$("#google_auth_url").val());
                $("#load_img").hide();
                $("#show_thumb").show();
                $("#show_img").show();
//                 getSecret();
//                 $("#load_img").hide();
//                 $("#show_thumb").show();
//                 $("#show_img").show();
            }
        }
        function picture(){
            $("#load_img").show();
            $("#show_thumb").hide();
            
//             $("#show_thumb").attr("src",$("#thumb").val());
//             $("#show_thumb").parents("a").attr("href",$("#thumb").val());
            getSecret();
            $("#show_thumb").load(function(){
                $("#load_img").hide();
                $("#show_thumb").show();
            });
            $("#show_thumb").error(function(){
                $("#show_thumb").attr("src","");
                $("#load_img").hide();
                $("#show_thumb").show();
            });
            $("#show_img").show();
        }
        
    </script>
<script type="text/javascript">
    
    function getSecret(){
        var url = "<%=basePath%>normal/adminGoogleAuthAction!getAdminSecret.action";
         var data = {};
         goAjaxUrl(url,data,function(tmp){
             $("#google_auth_secret").val(tmp.google_auth_secret);
             $("#google_auth_url").val(tmp.google_auth_url+"&v="+new Date().getTime());
             $("#show_thumb").attr("src",tmp.google_auth_url+"&v="+new Date().getTime());
            $("#show_thumb").parents("a").attr("href",tmp.google_auth_url+"&v="+new Date().getTime());
            
         },function(){
         }); 
     }
    
    function goAjaxUrl(targetUrl,data,Func,Fail){
        $.ajax({
            url:targetUrl,
            data:data,
            type : 'get',
            dataType : "json",
            success: function (res) {
                // var tmp = $.parseJSON(res)
                var tmp = res
                if(tmp.code==200){
                    Func(tmp);
                }else if(tmp.code==500){
                    Fail();
                    swal({
                        title : tmp.message,
                        text : "",
                        type : "warning",
                        showCancelButton : true,
                        confirmButtonColor : "#DD6B55",
                        confirmButtonText : "确认",
                        closeOnConfirm : false
                    });
                }
              },
                error : function(XMLHttpRequest, textStatus,
                        errorThrown) {
                    swal({
                        title : "请求错误",
                        text : "",
                        type : "warning",
                        showCancelButton : true,
                        confirmButtonColor : "#DD6B55",
                        confirmButtonText : "确认",
                        closeOnConfirm : false
                    });
                    console.log("请求错误");
                }
        });
    }
    </script>
</body>
</html>