This commit is contained in:
bb_pan 2025-05-14 17:34:40 +08:00
parent f3b8460a99
commit b835708340
1 changed files with 49 additions and 3 deletions

View File

@ -103,6 +103,7 @@
<script>
import { getReceiveApplyApi } from '@/api/receive-apply/index.js'
import { getToken, setToken, setExpiresIn } from '@/utils/auth'
export default {
name: 'Receive-apply',
@ -140,9 +141,54 @@ export default {
]
}
},
created() {
this.userId = sessionStorage.getItem('userId')
this.getList()
async created() {
const origin = window.location.href
console.log(origin.split('ticket')[1], 'origin')
const token = getToken()
console.log('🚀 ~ created ~ shh:', token)
if (origin.indexOf('ticket') != -1 && !token) {
this.isIws = true
const loading = this.$loading({
lock: true,
text: '登录中',
})
try {
const res = await iwsLogin({
ticket: origin.split('ticket%3D')[1].split('%26')[0] || origin.split('ticket=')[1].split('&')[0],
sysType: 0
})
console.log('🚀 ~ created ~ res:', res)
if (res.code == 200) {
setToken(res.data.access_token)
this.$store.commit('SET_TOKEN', res.data.access_token)
setExpiresIn(1800)
this.$store.commit('SET_EXPIRES_IN', 1800)
}
// setExpiresIn(res.data.expires_in)
// this.$store.commit('SET_EXPIRES_IN', res.data.expires_in)
loading.close()
setTimeout(() => {
this.userId = sessionStorage.getItem('userId')
this.getList()
}, 300)
} catch (error) {
console.log('🚀 ~ created ~ error:', error)
this.$message({
message: '登录失败, 即将关闭页面',
type: 'error'
})
loading.close()
setTimeout(() => {
//
window.close()
}, 1500)
}
} else {
this.userId = sessionStorage.getItem('userId')
this.getList()
}
},
methods: {
//