PageSourceSearch

https://www.shannan.gov.cn/images/PromptBox.js

js shannan.gov.cn collected 2026-10-02 16:51:17 UTC 22,580 bytes, 674 lines download raw bytes

1
2/* 
3    附件上传+意见征集详情实名提交以及修改密码+弹窗
4    2018-10-26
5*/
6
7// 2018.1.6 附件上传文件的相关变量 
8var attachs;
9var fileTYpeArray = ['swf', 'jpg', 'jpeg', 'bmp', 'gif', 'png', 'wmv', 'avi', 'wma', 'mp3', 'mid', 'zip', 'rar', 'txt', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'mp4', 'm4a'];
10var UPLOADFILE;//存储上传文件
11
12/*
13 *
14  实名登录模块
15 *
16*/
17// 登录检查
18function funCookie() {
19    if ($.cookie("nickName")) {
20        $(".real-login-changel").show();
21        $(".real-login-changef").hide();
22        $(".real-login-captchas").hide();
23        $("#realNameLo").val($.cookie("nickName"));
24        // 解密
25        // var decodePsd=$.base64.decode($.cookie("psd"));  
26    }
27
28};
29// 登陆请求
30$("#realLogin").click(function() {
31    var realName = $("#realName");
32    var realPwd = $("#realPwd");
33    var realCaptcha = $("#realCaptcha");
34    // 加密验证码
35    // var realPwdBase = $.base64.encode(realPwd.val());
36    // 该验证码是最新需求修改,由于wcm现在可能在修改,所有的请求都无法进行。
37    // var realCaptcha = $("#realCaptcha");
38    if (!(realName.val() == "" || realName.val() == null)) {
39        if (!(realPwd.val() == "" || realPwd.val() == null)) {
40            if (!(realCaptcha.val() == "" || realCaptcha.val() == null)) {
41                $.ajax({
42                    type: "POST",
43                    url: "/IGI/nbhd/netizenLogin.do",
44                    text: "json",
45                    data: {
46                        siteId: EsiteId,
47                        loginCaptcha: $("#realCaptcha").val(),
48                        userName: $("#realName").val(),
49                        passWord: '__encoded__' + realPwd.val(),
50                        method: 'login'
51                    },
52                    success: function (result) {
53                        console.log(result);
54                        // 登陆成功执行显示下面函数显示对应的内容;
55                        if (result.statusCode == 200) {
56                            maxPromptBox(result.message);
57                            loginNameChange(result);
58                            loadimage();
59                        }
60                        if (result.statusCode == 400) {
61                            var statu = result.message;
62                            maxPromptBox(statu);
63                            loadimage();
64                        }
65                    },
66                    error: function (jqXHR) {
67                        var statu = jqXHR.status
68                        maxPromptBox(statu);
69                        loadimage();
70                    }
71                })
72            } else {
73                var TxtNo1 = "验证码不能为空!";
74                maxPromptBox(TxtNo1);
75                loadimage();
76            }
77        } else {
78            var TxtNo2 = "密码不能为空!";
79            maxPromptBox(TxtNo2);
80            loadimage();
81        }
82    } else {
83        var TxtNo3 = "用户名不能为空!";
84        maxPromptBox(TxtNo3);
85        loadimage();
86    }
87})
88
89// 登录之后改变页面显示情况
90function loginNameChange(data) {
91    var realPwd = $("#realPwd");
92    // var realPwdBase = $.base64.encode(realPwd.val());
93    $("#real-login-before").hide();
94    $("#real-login-After").show();
95    $("#realCaptcha").val('');
96    // $(".real-login-captchas").hide();
97    // 登陆的用户名
98    $("#realNameLo").val(data.datas.truename);
99    // 存入cookie,关闭浏览器既失效
100    $.cookie("name", data.datas.username, {});
101    $.cookie("truename", data.datas.truename, {});
102    $.cookie("psd", realPwd.val(), {});
103}
104
105//退出登录
106$("#realOutLogin").click(function () {
107    $.ajax({
108        type: "GET",
109        url: "/IGI/nbhd/netizenLogin.do?method=logoutUser",
110        dataType: "json",
111        success: function (result) {
112            var statu = result.message;
113            maxPromptBox(statu);
114            $.cookie("name", '', { expires: -1 });
115            $.cookie("truename", '', { expires: -1 });
116            $.cookie("psd", '', { expires: -1 });
117            loadimage();
118            $("#real-login-After").hide();
119            $("#real-login-before").show();
120        },
121        error: function (jqXHR) {
122            var statu = jqXHR.status
123            maxPromptBox(statu);
124        }
125    })
126})
127
128
129// 实名提交意见
130$("#realSubmit").click(function () {
131    if (!$.cookie('truename')) {
132        var txt = "请先登录!";
133        maxPromptBox(txt);
134        return;
135    }
136    // var realNameLo = $("#realNameLo");//登陆后的用户名
137    var realTelLo = $("#realTelLo");//联系方式
138    var realCompanyLo = $("#realCompanyLo");//单位
139
140    var realContents = $("#realContents");//反馈内容
141    if (!($.trim(realContents.val()) == "")) {
142        if ($.trim(realContents.val()).length > 255) {
143            maxPromptBox("反馈内容不能超过255个字");
144            return;
145        }
146        var datajson = { siteId: EsiteId,userName: $.cookie('truename') ? $.cookie('truename') : '',collectionId: interviewId,content: realContents.val(),htmlContent: realContents.val(),phone: realTelLo.val() ? realTelLo.val() : '',attachs: attachs ? attachs : ''};
147        submitFeedback(datajson);
148    } else {
149        var txtl1 = "反馈内容不能为空!";
150        maxPromptBox(txtl1);
151    }
152});
153
154//提交反馈意见
155function submitFeedback(datajson) {
156    $.ajax({
157        type:"POST",
158        datatype:"json",
159        url:"/IGI/opinion/web/save?",
160        data:datajson,
161        success: function (result) {
162            if(result.statusCode==200){
163                // $(".xs-back-tab").hide();
164                maxPromptBox("提交成功!");
165                $("#realContents").val('');
166                $("#file-name").text("");
167                $("#file-name").attr("href", "");
168                attachs = '';
169                $("#wait-file-name").css("display", "none");
170                $("#wait-upload").css("display", "none");
171                //提示信息
172                var txt = data.message;
173                maxPromptBox(txt);
174            }else{
175                maxPromptBox("提交失败,请重试" + result.statusMessage);
176            }
177        },
178        error : function(jqXHR) {
179            maxPromptBox(jsXHR.status);
180        }
181    });
182}
183// 匿名意见提交参数检查
184function netCheckParam(userName,captcha,content,phone){
185    var phonereg=/(^1[3|4|5|7|8]\d{9}$)|(^\++\d{2,}$)/;
186    var emailreg=/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/;
187    if(userName==""||userName==null)
188    {
189          minPromptBox("对不起,姓名不能为空!");
190          return false;
191    }else if(content==""||content==null){
192          minPromptBox("对不起,反馈内容不能为空!");
193          return false;
194    }else if(phone==""||phone==null){
195          minPromptBox("对不起,手机号不能为空!");
196          return false;
197    }else if(!phonereg.test(phone)){
198          minPromptBox("对不起,手机号错误!");
199          return false;
200    }else if(captcha==""||captcha==null){
201          minPromptBox("对不起,验证码不能为空!");
202          return false;
203    }else{
204        return true;
205    }
206}
207
208/*
209 *
210  文件上传模块
211 *
212*/
213
214//文件上传-->文件选择
215$("#uploadFile").click(function(){
216    //2018.1.5 文件上传功能
217    var inputObj = document.createElement('input');
218    inputObj.setAttribute('id', 'upload_file');
219    inputObj.setAttribute('type', 'file');
220    inputObj.setAttribute("style", 'visibility:hidden');
221    // inputObj.setAttribute("multiple", "multiple");//选择多个文件
222    document.body.appendChild(inputObj);
223    inputObj.click();
224    $(inputObj).on("change", function () {
225         //文件大小检查
226        if (this.files[0].size > 10 * 1000 * 1000) {
227            maxPromptBox("请选择小于10M的文件");
228            return;
229        }
230        //检查文件格式
231        if (checkFileType(getFileType(this.files[0].name), fileTYpeArray)) {
232            attachs = '';//清空值
233            showFile(false, '', '', $("#file-name"));
234            UPLOADFILE = this.files[0];
235            isShowUpload(true, this.files[0].name);
236        } else {
237            maxPromptBox("不支持该文件格式");
238        } 
239    });
240});
241
242// 动态添加属性 --> wait-upload --> click
243$(document).on('click', '#wait-upload', function () {
244    $("#loading").css("display", "inline-block");
245    btnDisabled(true,$("#wait-upload"));
246    uploadFile(UPLOADFILE);
247})
248
249/**
250 * [checkFileType 判断文件类型]
251 * @param {*} fileType 
252 * @param {*} typeArray 
253 */
254function checkFileType(fileType, typeArray) {
255    for (var i = 0; i < typeArray.length; i++) {
256        if (typeArray[i] == fileType)
257            return true;
258    }
259    return false;
260}
261
262/**
263* [getFileType 截取文件类型]
264* @param {*} fileName 
265*/
266function getFileType(fileName) {
267    var pos = fileName.lastIndexOf(".") + 1;
268    var fileType = fileName.substring(pos, fileName.length);
269    return fileType;
270}
271
272/**
273 * [showFile 展示已上传文件]
274 * @param {*} fileName 
275 * @param {*} path 
276 * @param {*} target 
277 */
278function showFile(isShow, fileName, path, target) {
279    if (isShow) {
280        target.css("display", "inline-block");
281        target.text(fileName);
282        target.attr('href', path);
283    } else {
284        target.css("display", "none");
285    }
286
287}
288
289/**
290 * 是否展示上传按钮
291 * @param {*} isShow 
292 * @param {*} txt 
293 */
294function isShowUpload(isShow, txt) {
295    if (isShow) {
296        $("#wait-file-name").css("display", "inline-block");
297        $("#wait-upload").css("display", "inline-block");
298        if (txt) $("#wait-file-name").text(txt);
299    } else {
300        $("#wait-file-name").css("display", "none");
301        $("#wait-upload").css("display", "none");
302    }
303}
304
305/**
306 * uploadFile 单击wait-upload上传文件
307 * @param {*} file 
308 */
309function uploadFile(file) {
310    var formData = new FormData();
311    formData.append("file", file);
312    console.log(formData);
313    $.ajax({
314        type: "post",
315        url: "/IGI/file/doUploadAppendix",
316        timeout: 30*1000,//时间超时设置30s
317        data: formData,
318        processData: false,
319        contentType: false,
320        success: function (data) {
321            data = JSON.parse(data);
322            $("#loading").css("display", "none");
323            isShowUpload(false);
324            showFile(true, data.datas[0].fileName, data.datas[0].filePath, $("#file-name"));
325            attachs = data.datas[0].appendixId;//设置文件id
326            btnDisabled(false,$("#wait-upload"));
327        },
328        error: function (e) {
329            isShowUpload(true);
330            $("#loading").css("display", "none");
331            maxPromptBox("上传失败,请稍后重试");
332            btnDisabled(false,$("#wait-upload"));
333        }
334    });
335}
336
337
338/**
339 * 附件上传按钮禁用  隐藏target
340 * @param {*} isDisabled 
341 * @param {*} target 
342 */
343function btnDisabled(isDisabled,target){
344    if(isDisabled){
345        target.prop("disabled","disabled");
346        target.css({
347            'background':'#ccc',
348            'cursor':'not-allowed'
349        });
350    }else{
351        target.removeAttr("disabled");
352        target.css({
353            'background':'#3f68c4',
354            'cursor':'pointer'
355        });
356    }
357}
358
359/*
360 *
361  忘记密码模块
362 *
363*/
364
365//忘记密码模块的参数
366var phoneKey = false, //电话是否符合要求
367pwdKey = false, //密码是否符合要求
368sendMsgUse = true; //发送按钮是否能用
369// 忘记密码模块
370
371//点击忘记密码 显示弹窗
372$("#forgetPwdBtn").click(function () {
373    $(".forget-pwd-bg").show();
374    $(".forget-pwd-box").show();
375});
376
377//点击取消 隐藏弹窗
378$(".forget-pwd-exit").click(function(){
379    $(".forget-pwd-bg").hide();
380    $(".forget-pwd-box").hide();
381});
382
383//电话号码检测
384$("#forgetTel").blur(function () {
385    if ($.trim($(this).val())) {
386        if (!(/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57]|199)[0-9]{8}$/.test($(this).val()))) {
387            phoneKey = false;
388            removeBind();
389            fgtPrt("ph", "手机号码不正确");
390            return false;
391        } else { //通过
392            $(".forget-prompt-txt").hide();
393            phoneKey = true;
394            canIUseClick();
395        }
396    } else {
397        phoneKey = false;
398        removeBind();
399        fgtPrt("ph", "请输入手机号码");
400    }
401
402});
403
404//新密码检测
405$("#forgetPwd").blur(function () {
406    // $(".forget-prompt-txt").hide();
407    if (!$.trim($("#forgetPwd").val())) {
408        pwdKey = false;
409        removeBind();
410        fgtPrt("pwd", "请输入密码");
411    } else if ($.trim($("#forgetPwd").val()).length < 6 || $.trim($("#forgetPwd").val()).length > 22) {
412        pwdKey = false;
413        removeBind();
414        fgtPrt("pwd", "密码长度在6-20位");
415    } else if ($.trim($("#forgetPwds").val()) && ($.base64.encode($.trim($("#forgetPwd").val()))) != ($.base64.encode($.trim($("#forgetPwds").val())))) {
416        pwdKey = false;
417        removeBind();
418        fgtPrt("pwds", "密码不一致");
419    } else if (!$.trim($("#forgetPwds").val())) {
420        //不响应
421    } else {
422        pwdKey = true;
423        canIUseClick();
424    }
425});
426
427//确认密码检测
428$("#forgetPwds").blur(function () {
429    if (!$.trim($("#forgetPwd").val())) {
430        pwdKey = false;
431        removeBind();
432        fgtPrt("pwd", "请输入密码");
433    } else if ($.trim($("#forgetPwd").val()).length < 6 || $.trim($("#forgetPwd").val()).length > 22) {
434        pwdKey = false;
435        removeBind();
436        fgtPrt("pwd", "密码长度在6-20位");
437    } else if ($.trim($("#forgetPwds").val()) && ($.base64.encode($.trim($("#forgetPwd").val()))) != ($.base64.encode($.trim($("#forgetPwds").val())))) {
438        pwdKey = false;
439        removeBind();
440        fgtPrt("pwds", "密码不一致");
441
442    } else {
443        pwdKey = true;
444        canIUseClick();
445    }
446});
447
448//忘记密码 提交按钮
449$(".forget-pwd-submit").click(function () {
450    var tel = $.trim($("#forgetTel").val());
451    var pwd = $.trim($("#forgetPwd").val());
452    var pwds = $.trim($("#forgetPwds").val());
453    var val = $.trim($("#forgetCaptcha").val());
454    if (tel == "") {
455        fgtPrt("ph", "请输入手机号码");
456    } else if (!phoneKey) {
457        fgtPrt("ph", "手机号码不正确");
458    } else if (pwd == "") {
459        fgtPrt("pwd", "请输入密码");
460    } else if (pwd.length < 6 || pwd.length > 20) {
461        fgtPrt("pwd", "密码长度在6-20位");
462    } else if (pwds == "") {
463        fgtPrt("pwds", "请输入确认密码");
464    } else if (!pwdKey) {
465        fgtPrt("pwds", "密码不一致");
466    } else if (pwdKey && phoneKey) {
467        if (val == "") {
468            fgtPrt("val", "请输入验证码");
469        } else if (val.length != 4) {
470            fgtPrt("val", "验证码格式正确");
471        } else {
472            $.ajax({
473                type: "POST",
474                url: "/IGI/nbhd/netizenLogin.do",
475                dataType: "json",
476                data: {
477                    siteId: 4,
478                    method: "resetPassword",
479                    username: tel,
480                    resetCaptcha: val,
481                    newPasword: '__encoded__' + $.base64.encode(pwd),
482                    repeatPassword: '__encoded__' + $.base64.encode(pwd)
483                },
484                success: function (data) {
485                    $(".forget-error-prompt").show()
486                    $(".forget-error-prompt p").text(data.message);
487                    setTimeout(function () {
488                        $(".forget-error-prompt").hide();
489                        if (data.statusCode == 200) {
490                            $(".forget-pwd-bg").hide();
491                            $(".forget-pwd-box").hide();
492                        }
493                    }, 2000)
494
495                },
496                error: function (jqXHR) {
497                    $(".forget-error-prompt").show()
498                    $(".forget-error-prompt p").text(jqXHR.status)
499                    setTimeout(function () { $(".forget-error-prompt").hide() }, 2000);
500                }
501            })
502        }
503    }
504});
505
506function isExit() {
507    var temp;
508    $.ajax({
509        type: "POST",
510        url: "/IGI/nbhd/netizenLogin.do",
511        async: false,
512        dataType: "json",
513        data: {
514            method: "checkUser",
515            username: $.trim($("#forgetTel").val())
516        },
517        success: function (data) {
518            if (data.statusCode == 200) {
519                temp = data.datas;
520            } else {
521                $(".forget-error-prompt").show();
522                $(".forget-error-prompt p").text(data.message);
523                setTimeout(function () { $(".forget-error-prompt").hide() }, 2000);
524                temp = 2;
525            }
526        },
527        error: function (jqXHR) {
528            $(".forget-error-prompt").show();
529            $(".forget-error-prompt p").text(jqXHR.status);
530            setTimeout(function () { $(".forget-error-prompt").hide() }, 2000);
531            temp = 2;
532        }
533    });
534    return temp;
535}
536
537//发送按钮是否能用 提交密码的按钮
538function canIUseClick() { 
539    if ($.trim($("#forgetPwds").val()) && sendMsgUse && phoneKey && pwdKey) {
540        // $("#forgetCaptchaBtn").removeAttr("class");
541        $("#forgetCaptchaBtn").css({ "background": "#F00", "color": "#fff" });
542        $("#forgetCaptchaBtn").unbind();
543        //请求事件绑定
544        $("#forgetCaptchaBtn").click(function () {
545            var isExited = isExit();
546            if (isExited == 1) {
547                $(".forget-error-prompt").show()
548                $(".forget-error-prompt p").text("该用户不存在");
549                setTimeout(function () { $(".forget-error-prompt").hide() }, 2000);
550                return;
551            } else if (isExited == 2) {
552                return;
553            }
554            $.ajax({
555                type: "GET",
556                url: "/IGI/nbhd/netizenLogin.do",
557                dataType: "json",
558                data: {
559                    method: "getSmsCaptcha",
560                    username: $.trim($("#forgetTel").val())
561                },
562                success: function (data) {
563                    if (data.statusCode == 200) {
564                        removeBind("请稍后在试");
565                        $("#forgetCaptchaBtn").text("60秒后可点击发送");
566                        var countTime = 60;
567                        lateSend($("#forgetCaptchaBtn")); //延时发送
568                        function lateSend(target) {
569                            if (countTime == 0 || countTime < 0) {
570                                sendMsgUse == true;
571                                // $("#forgetCaptchaBtn").removeAttr("class");
572                                $("#forgetCaptchaBtn").css({ "background": "#F00", "color": "#fff" });
573                                target.text("点击获取短信验证码");
574                                canIUseClick();
575                                return;
576                            } else {
577                                countTime--;
578                                target.text(countTime + "秒后可点击发送");
579                            }
580                            setTimeout(function () {
581                                lateSend(target);
582                            }, 1000);
583                        }
584                    } else {
585                        $(".forget-error-prompt").show();
586                        $(".forget-error-prompt p").text(data.message);
587                        setTimeout(function () { $(".forget-error-prompt").hide() }, 2000);
588                    }
589                },
590                error: function (jqXHR) {
591                    $(".forget-error-prompt").show()
592                    $(".forget-error-prompt p").text(jqXHR.status)
593                    setTimeout(function () { $(".forget-error-prompt").hide() }, 2000)
594                }
595            });
596        })
597
598    } else {
599        removeBind();
600    }
601}
602
603//移除发送请求事件绑定
604function removeBind(text) { 
605    var alertText = text || "请完成上面要求";
606    $("#forgetCaptchaBtn").unbind();
607    $("#forgetCaptchaBtn").click(function () {
608        $(".forget-error-prompt").show();
609        $(".forget-error-prompt p").text(alertText);
610        setTimeout(function () { $(".forget-error-prompt").hide() }, 2000);
611    });
612    //css样式
613    // $("#forgetCaptchaBtn").attr("class", "unUse-zjd");
614    $("#forgetCaptchaBtn").css({ "background": "#e6e6e6", "color": "#555" });
615}
616
617/*
618 *@function 警告标签
619 *@position 可传参数ph、pwd、pwds、val(验证码)
620 *@text 警告文本
621 */
622function fgtPrt(position, text) {
623    var y = 60;
624    switch (position) {
625        case "val":
626            y = 270;
627            break;
628        case "pwd":
629            y = 130;
630            break;
631        case "pwds":
632            y = 200;
633            break;
634        default:
635            y = 60;
636    }
637    $(".forget-prompt-txt").show().css({ 'top': y });
638    $(".forget-icons").text(text);
639    setTimeout(function () {
640        $(".forget-prompt-txt").hide()
641    }, 2000);
642}
643    
644//确认按钮,点击关闭
645$(".com-prompt-btnlf").click(function () {
646    $(".com-prompt-box").hide();
647    $(".forget-pwd-bg").hide();
648    // getImgCodeiIview();
649});
650// 关闭按钮--提示框隐藏
651$(".com-prompt-btnft").click(function () {
652    $(".com-prompt-box").hide();
653    $(".forget-pwd-bg").hide();
654});
655// 提示框背景隐藏
656$(".forget-pwd-bg").click(function () {
657    $(this).hide();
658    $(".com-prompt-box").hide();
659});
660
661// 提示窗
662function minPromptBox(txt){
663    $("#addBox").html(txt);
664    // $(".forget-pwd-bg").show();
665    $ ('#addBox').show ().delay (2000).fadeOut ();
666}
667// 弹窗
668function maxPromptBox(txt) {
669    $(".forget-pwd-bg").show();
670    $(".com-prompt-box").show();
671    $(".com-prompt-lists").empty();
672    var proStr = "<p class='com-prompt-item'>" + txt + "</p>"
673    $(".com-prompt-lists").append(proStr);
674}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.