zoukankan      html  css  js  c++  java
  • 单页面登录——编码传参(oa会对#号会进行截断)

    /**
     * querystring有四种方法:注意queryString与query-string不是同一个依赖包
     *  querystring.stringify 序列化;
     *  querystring.parse 反序列化;
     *  querystring.escape 编码;//encodeURIComponent(),不使用escape()只编译汉字,encodeURI()不编译特殊符号
     *  querystring.unescape 解码;//decodeURIComponent,对应:unescape()、decodeURI()
     *query-string:字符串与对象互转(简写qs)
     *  qs.stringify:{foo: false}//=> 'foo=false'
     *  qs.parse:'likes=cake&name=bob&likes=icecream'//=> {likes: ['cake', 'icecream'], name: 'bob'}
     */

    【清除本地缓存】:

    let keys = document.cookie.match(/[^ =;]+(?==)/g);//清除当前域名下cookie
    if (keys) {
      for (let i = keys.length; i--;) {
        document.cookie = keys[i] + '=0;path=/;expires=' + new Date(0).toUTCString();//清除当前域名下的cookie,例如:kp.oa.com
        document.cookie = keys[i] + '=0;path=/;domain=' + document.domain + ';expires=' + new Date(0).toUTCString();//清除当前域名下的,例如 .kp.oa.com
        document.cookie = keys[i] + '=0;path=/;domain=kevis.com;expires=' + new Date(0).toUTCString();//清除一级域名下的或指定的,例如 .oa.com
      }
    }
    localStorage.removeItem("usern"); //清除本地用户信息
    this.$store.dispatch("setUserCurinfo", null);//清除

    let authObj = {
    protocol: 'http:',
    host: 'passport.oa.com',
    pathname: '/modules/passport/signin.ashx',
    query: {
    url:`${location.href}`
    }
    };
    console.log(`http://passport.oa.com/modules/passport/signout.ashx?url=${location.href}&title=HADES`,"模板字符串")
    import _url from "url";
    console.log(_url.format(authObj),"模板字符串")
    注意点:oa系统不识别#后面的值,需要改变路由模式。
  • 相关阅读:
    桟错误分析方法
    gstreamer调试命令
    sqlite的事务和锁,很透彻的讲解 【转】
    严重: Exception starting filter struts2 java.lang.NullPointerException (转载)
    eclipse 快捷键
    POJ 1099 Square Ice
    HDU 1013 Digital Roots
    HDU 1087 Super Jumping! Jumping! Jumping!(动态规划)
    HDU 1159 Common Subsequence
    HDU 1069 Monkey and Banana(动态规划)
  • 原文地址:https://www.cnblogs.com/wheatCatcher/p/10496558.html
Copyright © 2011-2022 走看看