常用总结

一、关于SVN

右键--->TortoiseSVN--->Repo-browser--->找到对应路径右键--->add folder--->上传成功
****每次重新登录之前要update一下,避免出错***

二、常用代码

//获取url后面的参数
function getQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null)
    return unescape(r[2]);
    return null;
}


//获取code,parentid
var guestId = getQueryString("guest_id") 
console.log(guestId)
$(function(){
//确定提交
    $('.submitBtn').click(function(){
        var phoneReg = /^1(3|4|5|6|7|8|9)\d{9}$/,
        telVal=$('#telNumber').val().replace(/\s/g,''),
        flag = phoneReg.test(telVal),
        code = $('#verifyCode').val().replace(/\s/g,'')
        if(!flag){
            alertMsg("请填写正确手机号码");
            return false;
        }
        else if(code==''){
            alertMsg("请输入验证码");
            return false;
        }else{        
            var $this = $(this);
            var primevalValue = $(this).val();  
            var phone = $("#telNumber").val();
            var securitycode = $("#verifyCode").val();         
            $(this).prop('disabled', true).val("正在提交...");//loading 
            var params = {
                'xxxxxx'//后台接口名称 :phone,
                'xxxxxx'//后台接口名称 : guestId,
                'xxxxxx'//后台接口名称 : securitycode
            }
            var paramsObj=JSON.stringify(params);
            $.ajax({  
                contentType:'application/json;charset=UTF-8',
                url: 'xxxxxxxxxxxxxxxxxxxxxxxxx',
                data: paramsObj,
                type:'post',
                dataType:'json',
                success: function(res){
                    if(res.code=='0'){                               
                        window.location.href='xxxxxxxxx';   
                        console.log(res);                  
                    }else{
                        alert(res.msg);
                        $this.prop('disabled', false).val(primevalValue);   
                    } 
                },
                error:function(error){
                    alert(error);
                    $this.prop('disabled', false).val(primevalValue);
                }
            })
        }
    });  
});



//发送短信验证码
var InterValObj; //timer变量,控制时间 
var count = 60; //倒计时 
var curCount;//当前剩余秒数
function getCode() { 

  curCount = count;

    var phoneReg = /^1(3|4|5|6|7|8|9)\d{9}$/,
    telVal=$('#telNumber').val().replace(/\s/g,''),
    flag = phoneReg.test(telVal);
    if(telVal==""||!flag){
        alertMsg("请填写正确手机号码");
        return false;
    }else{
        var phone = ($("#telNumber").val()); 
        phoneObj={
            'xxxxx'//后台接口名称 : phone,
            'xxxxx'//后台接口名称 : guestId
        };
        phoneParams=JSON.stringify(phoneObj)
        $.ajax({
            contentType:'application/json;charset=UTF-8',
            url: 'xxxxxxxxxxx',
            data: phoneParams,
            type: 'post',
            dataType:'json',
            success: function(res){
                if(res.code=='0'){
                     console.log(res);
                     tokenV = res.data.smsToken;
                    //开始计时 
                     $(".getCode").attr("disabled", true).val(curCount + "s");
                     InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器
                }else{
                    alert(res.msg)
                }
            },
            error:function(error){
                alert("请求失败")
                $(".getCode").attr("disabled", false).val("重新获取");
            }
        })        
      }
 } 
 
 
 
 //timer处理函数 
    function SetRemainTime() { 
      if (curCount == 0) {         
        window.clearInterval(InterValObj);//停止计时器 
        $(".getCode").removeAttr("disabled").val("重新获取");//启用按钮 
      } 
      else { 
        curCount--; 
        $(".getCode").val(curCount + "s"); 
      } 
    } 
    
    
    //通用提示
    function alertMsg(txt){
        $('body').append("
"+txt+"
"); $('.alert_msg').stop().fadeIn(400,function(){ $(this).delay(700).fadeOut(300,function(){ $(this).remove(); }); }); } //登录验证 function myfunction(){ var username=document.getElementById("username").value; var password=document.getElementById("password").value; if (username.length == 0) { return; } if (password.length == 0) { return; } var userName = $("#username").val(), password = $("#password").val(); loginObj={ 'xxxxx'//后台接口名称 : userName, 'xxxxx'//后台接口名称 : password }; loginParams=JSON.stringify(loginObj) $.ajax({ contentType:'application/json;charset=UTF-8', url: "xxxxxxxxxxxxxxxxxxxx", type: "post", data: loginParams, dataType: "json", success: function (res) { if (res.code == "0") { var sessid = res.data.sessid; console.log(sessid); window.location.href="xxxxx.html?sessid=" + sessid; } else { alert(res.msg) } }, }); } //左侧选择栏(可收缩) //html部分
//jquery部分: $(function() { //nav收缩展开 $('#aat').on('click','.nav-item>a',function(){ if (!$('.nav').hasClass('nav-mini')) { if ($(this).next().css('display') == "none") { //展开未展开 $('.nav-item').children('ul').slideUp(300); $(this).next('ul').slideDown(300); $(this).parent('li').addClass('nav-show').siblings('li').removeClass('nav-show'); }else{ //收缩已展开 $(this).next('ul').slideUp(300); $('.nav-item.nav-show').removeClass('nav-show'); } } }); // 标志点击样式 $('#aat').on('click','.nav-item>ul>li',function(){ $(this).addClass("act").siblings().removeClass("act"); $(this).parents(".nav-item").siblings().find(">ul>li").removeClass("act"); console.log($(this).text()) }) //nav-mini切换 $('#mini').on('click',function(){ if (!$('.nav').hasClass('nav-mini')) { $('.nav-item.nav-show').removeClass('nav-show'); $('.nav-item').children('ul').removeAttr('style'); $('.nav').addClass('nav-mini'); $('.nav').css('overflow','visible'); }else{ $('.nav').removeClass('nav-mini'); $('.nav').css('overflow','auto'); } }); });

你可能感兴趣的:(javascript)