zhanghua
2 天以前 d2f78cb12354eb8a3606b24c3d0cac7bdc4226e5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<template>
  <div id="content" class="content">
  </div>
</template>
<script setup name="Oss" lang="ts">
import { useRoute } from 'vue-router';
import { rztLogin } from '@/api/system/user';
import { setToken, removeToken,setPlat } from '@/utils/auth';
 
import { ElMessage } from 'element-plus';
import { any } from 'vue-types';
 
const getUserData = async (code: any) => {
  await rztLogin({
    code: code
  })
    .then((res: any) => {
      console.log("____________res:" + JSON.stringify(res));
      if (res) {
        var data = { value: res, expirse: new Date().getTime() };
 
        setToken(JSON.stringify(data));
        window.location.href = '/index';
      } else {
        ElMessage({ message: '无权访问', type: 'error' });
        setTimeout(() => {
          window.location.href = '/rzt_login';
        }, 3000);
      }
    })
    .catch((e: any) => {
      setTimeout(() => {
        window.location.href = '/rzt_login';
      }, 3000);
    });
};
onMounted(() => {
  setPlat('rzt');
  removeToken()
  const router = useRoute();
  let code = router.query.code;
  if (code) {
    getUserData(code);
  } else {
    var mode = 'openid corpid';
 
    window.location.href =
      // 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww9904fd98c1b0df9e&redirect_uri=http://171.221.173.53:8801/rzt_login&response_type=code&scope=SCOPE&agentid=1000128&state=STATE#wechat_redirect';
      'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wwa1a67ed0008261d9&redirect_uri=' + encodeURI('http://171.221.173.53:8801/rzt_login') + '&response_type=code&scope=SCOPE&agentid=1000414&state=STATE#wechat_redirect';
 
  }
});
</script>
 
<style lang="scss" scoped>
.content {
  display: flex;
  align-items: center;
  justify-content: center;
}
 
.self-defined-classname {
  // width: 300px;
  // height: 300px;
}
</style>