|
@@ -0,0 +1,30 @@
|
|
1
|
+<template>
|
|
2
|
+</template>
|
|
3
|
+<script lang="ts" setup>
|
|
4
|
+import { getQueryString } from '@/utils/common'
|
|
5
|
+import { ref, onBeforeMount, getCurrentInstance } from "vue";
|
|
6
|
+const { proxy } = getCurrentInstance();
|
|
7
|
+onBeforeMount(() => {//组件挂载之前
|
|
8
|
+ if (getQueryString('againJump')) {
|
|
9
|
+ getUserInfo()
|
|
10
|
+ } else {//获取用户信息
|
|
11
|
+ let redirect_uri = encodeURIComponent(window.location.href + '&againJump=true')
|
|
12
|
+ 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`;
|
|
13
|
+ }
|
|
14
|
+});
|
|
15
|
+const getUserInfo = () => {
|
|
16
|
+ (proxy as any).$axios.get('/api/oauth2/userInfo', {
|
|
17
|
+ corpid: getQueryString('corpid'),
|
|
18
|
+ code: getQueryString('code'),
|
|
19
|
+ state: getQueryString('state')
|
|
20
|
+ }, true).then((res) => {
|
|
21
|
+ 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)
|
|
26
|
+ }
|
|
27
|
+ }).catch((err) => {
|
|
28
|
+ })
|
|
29
|
+}
|
|
30
|
+</script>
|