Code Bye

遇到一个好麻烦。的问题

微信JSSDK上传图片;
    var mk = 0;
    
        function uploadimg() {
            loadfun(true);
            var count = OpinionLocalIds.length;
            wx.uploadImage({
                localId: OpinionLocalIds[mk],
                isShowProgressTips: 0,
                success: function (res) {
                    mk++;
                    var serverId = res.serverId;
                    OpinionServerId.push(serverId);
                    $("#querynext").text("").text("已经上传第" + mk + "张");
                    if (OpinionServerId.length < count) {
                        //clearTimeout(timerup);
                        //submit();
                        uploadimg();
                    } else {
                        //timerup = setTimeout("uploadimg()", 1000);
                        submit();
                    }
                }
            });
            $("#querynext").removeAttr("disabled");
        }
  function submit() {
            loadfun(false);
            
                var wfnr = $("#txtdes").val();
        
                var lrrwx = WeChatNumber;
               
                var xm = $("#txtname").val();
                var sex = $("input[name=sample-radio]:checked").val();
                var lrrxm = xm + sex;
                //alert(lrrxm);
           
                var phone = $("#txtsjhm").val();
                //图片ID
                var jbtp1 = "";
                var jbtp2 = "";
                var jbtp3 = "";
                var jbtp4 = "";
                var jbtp5 = "";
                var jbtp6 = "";
                var jbtp7 = "";
                var jbtp8 = "";
                var jbtp9 = "";
                jbtp1 = OpinionServerId[0];
                if (OpinionServerId.length > 1) {
                    jbtp2 = OpinionServerId[1];
                }
                if (OpinionServerId.length > 2) {
                    jbtp3 = OpinionServerId[2];
                }
                if (OpinionServerId.length > 3) {
                    jbtp4 = OpinionServerId[3];
                }
                if (OpinionServerId.length > 4) {
                    jbtp5 = OpinionServerId[4];
                }
                if (OpinionServerId.length > 5) {
                    jbtp6 = OpinionServerId[5];
                }
                if (OpinionServerId.length > 6) {
                    jbtp7 = OpinionServerId[6];
                }
                if (OpinionServerId.length > 7) {
                    jbtp8 = OpinionServerId[7];
                }
                if (OpinionServerId.length > 8) {
                    jbtp9 = OpinionServerId[8];
                }
                var url = "http://wx.zsbadminton.com/OpDownload/OpDownload?" +
             "&UserWeChat=" + encodeURIComponent(lrrwx) +
             "&UserName=" + encodeURIComponent(lrrxm) +
             "&IllegalItems=" + encodeURIComponent(wfnr) +
              "&Photo1=" + jbtp1 +
              "&Photo2=" + jbtp2 +
              "&Photo3=" + jbtp3 +
              "&Photo4=" + jbtp4 +
              "&Photo5=" + jbtp5 +
              "&Photo6=" + jbtp6 +
              "&Photo7=" + jbtp7 +
              "&Photo8=" + jbtp8 +
              "&Photo9=" + jbtp9 +
              "&PhoneNumber=" + phone;
                //当前页面打开URL页面 
                location.href = url;
                //alert("url是:" + url);
        }
 // 正在上传loadding
        function loadfun(bool) {
            if (bool == true) {
                if ($("#querynext").text() == "正在提交中") {
                    return;
                }
                $("#querynext").unbind().text("").text("正在提交中");
                //关闭弹出框
                swal({ title: "", text: "", closeOnConfirm: false, imageUrl: baseurl + "ImageWeChat/loadding.gif" });
                $(".sweet-alert button").hide();
                $(".sweet-alert").css("background-color", "transparent");
            } else {
                //关闭弹出框
                swal({ title: "", text: "", timer: 10 });
                $("#querynext").text("").text("提交成功,跳转中");
                //querynext();
            }
        }

主要是以上的页面代码了,问题是:    location.href = url; 以后,跳到了提交页面后,出现了重复提交现像.就是一次插入条记录;后台的代码,本人已经加了很多限制了(包括本人先查一次库里能否有这条记录,本人再插),但还是重复提交,不知出现了什么问题,请大家帮帮忙!

解决方案

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明遇到一个好麻烦。的问题