| New file |
| | |
| | | <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: string) => { |
| | | 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> |