修改Socket路径问题
This commit is contained in:
14
src/App.vue
14
src/App.vue
@@ -9,16 +9,20 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||
import useSetTheme from '@/utils/setTheme'
|
||||
import { onMounted } from 'vue'
|
||||
useSetTheme()
|
||||
onMounted(async () => {
|
||||
const fetchMqttUrl = async () => {
|
||||
const response = await fetch('/')
|
||||
const WebSocketUrl:any = response.headers.get('X-WebSocket-Url')
|
||||
const WebSocketUrl2:any = response.headers.get('X-WebSocket-Url2')
|
||||
const WebSocketUrl3:any = response.headers.get('X-WebSocket-Url3')
|
||||
const MqttUrl:any = response.headers.get('X-MqttUrl-Url')
|
||||
const WebSocketUrl: any = response.headers.get('X-WebSocket-Url')
|
||||
const WebSocketUrl2: any = response.headers.get('X-WebSocket-Url2')
|
||||
const WebSocketUrl3: any = response.headers.get('X-WebSocket-Url3')
|
||||
const MqttUrl: any = response.headers.get('X-MqttUrl-Url')
|
||||
localStorage.setItem('WebSocketUrl', WebSocketUrl)
|
||||
localStorage.setItem('WebSocketUrl2', WebSocketUrl2)
|
||||
localStorage.setItem('WebSocketUrl3', WebSocketUrl3)
|
||||
localStorage.setItem('MqttUrl', MqttUrl)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchMqttUrl()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div v-if='!VITE_FLAG' @keyup.enter="onSubmit(formRef)">
|
||||
<div v-if="!VITE_FLAG" @keyup.enter="onSubmit(formRef)">
|
||||
<div @contextmenu.stop="" id="bubble" class="bubble">
|
||||
<canvas id="bubble-canvas" class="bubble-canvas"></canvas>
|
||||
</div>
|
||||
@@ -115,8 +115,20 @@ const focusInput = () => {
|
||||
passwordRef.value!.focus()
|
||||
}
|
||||
}
|
||||
const fetchMqttUrl = async () => {
|
||||
const response = await fetch('/')
|
||||
const WebSocketUrl: any = response.headers.get('X-WebSocket-Url')
|
||||
const WebSocketUrl2: any = response.headers.get('X-WebSocket-Url2')
|
||||
const WebSocketUrl3: any = response.headers.get('X-WebSocket-Url3')
|
||||
const MqttUrl: any = response.headers.get('X-MqttUrl-Url')
|
||||
localStorage.setItem('WebSocketUrl', WebSocketUrl)
|
||||
localStorage.setItem('WebSocketUrl2', WebSocketUrl2)
|
||||
localStorage.setItem('WebSocketUrl3', WebSocketUrl3)
|
||||
localStorage.setItem('MqttUrl', MqttUrl)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchMqttUrl()
|
||||
if (VITE_FLAG) {
|
||||
LNonSubmit()
|
||||
}
|
||||
@@ -215,7 +227,7 @@ const onSubmit = async (formEl: FormInstance | undefined) => {
|
||||
const LNonSubmit = async () => {
|
||||
// 先检查是否是 CAS 回调
|
||||
if (handleCasCallback()) {
|
||||
console.log("进入回调")
|
||||
console.log('进入回调')
|
||||
return
|
||||
}
|
||||
// 没有 token,触发 CAS 登录流程
|
||||
@@ -237,26 +249,27 @@ const handleCasCallback = () => {
|
||||
// 清理 URL 中的 flag 参数,防止刷新重复触发
|
||||
const cleanHash = hash.substring(0, queryIndex)
|
||||
window.history.replaceState(null, '', cleanHash)
|
||||
if(hashParams && hashParams.get("flag") == 1){
|
||||
if (hashParams && hashParams.get('flag') == 1) {
|
||||
state.submitLoading = true
|
||||
let data = {clientId:"njcn",clientSecret:"njcnpqs"}
|
||||
loginLNqr(data).then(res => {
|
||||
//拿到token了,可以正常操作页面
|
||||
userInfo.dataFill(res.data)
|
||||
state.submitLoading = false
|
||||
getSysConfig().then(res => {
|
||||
window.localStorage.setItem('sysdata', JSON.stringify(res.data))
|
||||
let data = { clientId: 'njcn', clientSecret: 'njcnpqs' }
|
||||
loginLNqr(data)
|
||||
.then(res => {
|
||||
//拿到token了,可以正常操作页面
|
||||
userInfo.dataFill(res.data)
|
||||
state.submitLoading = false
|
||||
getSysConfig().then(res => {
|
||||
window.localStorage.setItem('sysdata', JSON.stringify(res.data))
|
||||
})
|
||||
router.push({
|
||||
path: '/'
|
||||
})
|
||||
})
|
||||
router.push({
|
||||
path: '/'
|
||||
.catch(err => {
|
||||
console.log('---------')
|
||||
console.log(err)
|
||||
state.submitLoading = false
|
||||
})
|
||||
|
||||
}).catch(err => {
|
||||
console.log("---------")
|
||||
console.log(err)
|
||||
state.submitLoading = false
|
||||
})
|
||||
}else {
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@@ -418,5 +431,3 @@ defineExpose({ VITE_FLAG })
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user