Files
pasd_app/pages/cas/callback.vue

42 lines
1.1 KiB
Vue
Raw Normal View History

2026-03-13 14:32:24 +08:00
<template>
<view class="cas-callback">
<text>正在处理统一认证登录...</text>
</view>
</template>
<script>
import appConfig from '@/config'
import { casUnifiedLogin } from '@/api/login'
export default {
onLoad(options) {
// H5 环境下 options 可携带 ticket 参数
const ticket = options?.ticket || (this.$route && this.$route.query && this.$route.query.ticket)
if (!ticket) {
this.$modal.msgError('CAS 未返回票据')
this.$tab.reLaunch('/pages/login')
return
}
// 使用移动端CAS登录API,因为现在Nginx会根据User-Agent和请求参数自动路由
this.$store.dispatch('CasAppLogin', ticket).then(() => {
// 拉取用户信息并进入工作台
this.$store.dispatch('GetInfo').then(() => {
this.$tab.reLaunch('/pages/work/index')
}).catch(() => {
this.$tab.reLaunch('/pages/work/index')
})
}).catch(err => {
this.$modal.msgError('移动端CAS登录失败:' + (err && err.toString ? err.toString() : '未知错误'))
this.$tab.reLaunch('/pages/login')
})
}
}
</script>
<style>
.cas-callback {
padding: 40rpx;
color: #666;
}
</style>