|
@@ -1,31 +1,34 @@
|
|
|
<template>
|
|
|
<div id="test01">
|
|
|
<!-- test01 -->
|
|
|
- <p>{{ cookies.name }}</p>
|
|
|
- <p>{{ cookies.value }}</p>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import axios from 'axios'
|
|
|
+import { getToken, setToken, removeToken } from '@/utils/auth'
|
|
|
export default {
|
|
|
data () {
|
|
|
- return {
|
|
|
- cookies: {}
|
|
|
- }
|
|
|
+ return {}
|
|
|
},
|
|
|
created() {
|
|
|
- axios.get('https://test-sy.derom.com/ruoyi-admin/login/getCookie').then(res => {
|
|
|
- if (res.data.code === 200) {
|
|
|
- let arr = res.data.cookies
|
|
|
- this.cookies = arr.find(item => item.name == 'yonyou_uid')
|
|
|
- }
|
|
|
- })
|
|
|
+ this.jump()
|
|
|
},
|
|
|
mounted() {
|
|
|
},
|
|
|
methods: {
|
|
|
-
|
|
|
+ jump() {
|
|
|
+ axios.post('https://test-sy.derom.com/ruoyi-admin/login/sso').then(res => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ let token = res.data.token
|
|
|
+ setToken(token)
|
|
|
+ this.$store.commit('SET_TOKEN', token)
|
|
|
+ this.$store.dispatch("GetInfo").then(() => {})
|
|
|
+ this.$store.dispatch("GenerateRoutes").then(() => {})
|
|
|
+ this.$router.push({ path: "/system/user" })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|