Commit a9038b00 authored by xinzhedeai's avatar xinzhedeai

add: 山西华远跳转 token接收

parent e4d8f181
...@@ -74,7 +74,7 @@ VITE_STORAGE_PREFIX=SOY_ ...@@ -74,7 +74,7 @@ VITE_STORAGE_PREFIX=SOY_
# ============================================ old # ============================================ old
# 开发环境 - 视频流地址 # 开发环境 - 视频流地址
VITE_VIDEO_URL=ws://192.168.2.16:9999 VITE_VIDEO_URL=ws://192.168.2.18:9999
# 开发环境 - 所有服务接口地址 # 开发环境 - 所有服务接口地址
VITE_SERVICE_URL=http://192.168.2.16:9998 VITE_SERVICE_URL=http://192.168.2.16:9998
......
File added
...@@ -41,6 +41,12 @@ export function createRouteGuard(router: Router) { ...@@ -41,6 +41,12 @@ export function createRouteGuard(router: Router) {
// 是否存在 TOKEN 登录 与否 // 是否存在 TOKEN 登录 与否
const AdminToken = new URLSearchParams(window.location.search).get('Admin')
if(AdminToken){
localStg.set('token',AdminToken);
localStg.set('refreshToken', AdminToken);
}
const isLogin = Boolean(localStg.get('token')); const isLogin = Boolean(localStg.get('token'));
// 留存过期前信息 // 留存过期前信息
......
...@@ -15,9 +15,19 @@ export async function handleRefreshToken(axiosConfig: AxiosRequestConfig) { ...@@ -15,9 +15,19 @@ export async function handleRefreshToken(axiosConfig: AxiosRequestConfig) {
const refreshToken = localStg.get('refreshToken') || ''; const refreshToken = localStg.get('refreshToken') || '';
const { error, data } = await fetchRefreshToken(refreshToken); const { error, data } = await fetchRefreshToken(refreshToken);
const AdminToken = new URLSearchParams(window.location.search).get('Admin')
alert('adminToken')
if (!error) { if (!error) {
localStg.set('token', data.token);
localStg.set('refreshToken', data.refreshToken); if(AdminToken){
localStg.set('token',AdminToken);
localStg.set('refreshToken', AdminToken);
}else{
localStg.set('token', data.token);
localStg.set('refreshToken', data.refreshToken);
}
const config = { ...axiosConfig }; const config = { ...axiosConfig };
if (config.headers) { if (config.headers) {
......
...@@ -477,9 +477,9 @@ const submitCallback = async () => { ...@@ -477,9 +477,9 @@ const submitCallback = async () => {
return message.error('摄像头分组必选!'); return message.error('摄像头分组必选!');
} }
if (!preview) { // if (!preview) {
return message.error('请选择摄像头预览图片!'); // return message.error('请选择摄像头预览图片!');
} // }
if (isEdit.value) { if (isEdit.value) {
await api_addCameras(formWebCam.value).then(async res => { await api_addCameras(formWebCam.value).then(async res => {
......
...@@ -4,7 +4,7 @@ import { defineConfig, loadEnv } from 'vite'; ...@@ -4,7 +4,7 @@ import { defineConfig, loadEnv } from 'vite';
import { setupVitePlugins } from './build/plugins'; import { setupVitePlugins } from './build/plugins';
import { createViteProxy, getBuildTime } from './build/config'; import { createViteProxy, getBuildTime } from './build/config';
// export const proxyTarget = 'http://192.168.2.16:9996'; // export const proxyTarget = 'http://192.168.2.16:9998';
// export const proxyTarget = 'http://192.168.2.16:9998'; // export const proxyTarget = 'http://192.168.2.16:9998';
export const proxyTarget = 'http://192.168.2.16:9998'; export const proxyTarget = 'http://192.168.2.16:9998';
...@@ -13,13 +13,13 @@ export const proxyTarget = 'http://192.168.2.16:9998'; ...@@ -13,13 +13,13 @@ export const proxyTarget = 'http://192.168.2.16:9998';
// 视频地址 // 视频地址
export const videdUrl = 'ws://192.168.2.16:9999'; export const videdUrl = 'ws://192.168.2.18:9999';
// 固定接口地址 // 固定接口地址
export const apiUrl = 'http://192.168.2.16:9998'; export const apiUrl = 'http://192.168.2.16:9998';
// WS 地址 // WS 地址
export const wsUrl = 'ws://192.168.2.16:9999'; export const wsUrl = 'ws://192.168.2.18:9999';
export default defineConfig(configEnv => { export default defineConfig(configEnv => {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment