Procházet zdrojové kódy

bug: fix url multi code

zjxpcyc před 6 roky
rodič
revize
7ba4b88087
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 2
    1
      src/util/util.js

+ 2
- 1
src/util/util.js Zobrazit soubor

@@ -41,7 +41,8 @@ const toolClass = {
41 41
   },
42 42
   getCode: (appid) => {
43 43
     wechatConfig.appid = appid
44
-    let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(window.location.href)}&response_type=${wechatConfig.response_type}&scope=${wechatConfig.scope}&state=${wechatConfig.state}#wechat_redirect`
44
+    const refer = window.encodeURIComponent(window.location.href.replace(/code=[^?&=]+/, '').replace(/state=[^?&=]+/, '').replace('?&', '?'))
45
+    let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${refer}&response_type=${wechatConfig.response_type}&scope=${wechatConfig.scope}&state=${wechatConfig.state}#wechat_redirect`
45 46
     window.location.href = url
46 47
   },
47 48
   upload (item) {