|
@@ -3,6 +3,7 @@
|
3
|
3
|
<script lang="ts" setup>
|
4
|
4
|
import { getQueryString } from '@/utils/common'
|
5
|
5
|
import { ref, onBeforeMount, getCurrentInstance } from "vue";
|
|
6
|
+import { Toast } from 'vant';
|
6
|
7
|
const { proxy } = getCurrentInstance();
|
7
|
8
|
onBeforeMount(() => {//组件挂载之前
|
8
|
9
|
if (getQueryString('againJump')) {
|
|
@@ -10,6 +11,7 @@ onBeforeMount(() => {//组件挂载之前
|
10
|
11
|
} else {//获取用户信息
|
11
|
12
|
let redirect_uri = encodeURIComponent(window.location.href + '&againJump=true')
|
12
|
13
|
let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${getQueryString('corpid')}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=1&agentid=1000012#wechat_redirect`;
|
|
14
|
+ goUrl(url)
|
13
|
15
|
}
|
14
|
16
|
});
|
15
|
17
|
const getUserInfo = () => {
|
|
@@ -19,12 +21,21 @@ const getUserInfo = () => {
|
19
|
21
|
state: getQueryString('state')
|
20
|
22
|
}, true).then((res) => {
|
21
|
23
|
if (res.rst) {
|
22
|
|
- // now_res.external_userid = res.rst.external_userid
|
23
|
|
- // now_res.openid = res.rst.openid
|
24
|
|
- // now_res.device_id = res.rst.device_id
|
25
|
|
- // behaviorReport(1, UUID.value)
|
|
24
|
+ if (getQueryString('jumpLink')) {
|
|
25
|
+ let url = decodeURIComponent(getQueryString('jumpLink')) + '&external_userid=' + res.rst.external_userid;
|
|
26
|
+ goUrl(url)
|
|
27
|
+ } else {
|
|
28
|
+ Toast('无回跳链接!')
|
|
29
|
+ }
|
26
|
30
|
}
|
27
|
31
|
}).catch((err) => {
|
28
|
32
|
})
|
29
|
33
|
}
|
|
34
|
+function goUrl(url) {
|
|
35
|
+ let link = document.createElement("a");
|
|
36
|
+ link.href = url;
|
|
37
|
+ document.body.appendChild(link);
|
|
38
|
+ link.click();
|
|
39
|
+ document.body.removeChild(link);
|
|
40
|
+}
|
30
|
41
|
</script>
|