Commit 54f9d787 authored by youjie's avatar youjie

重定向页面

parent 9b3ff8f5
......@@ -3,6 +3,7 @@ VITE_OTA_API_BASE_URL=http://localhost:19002/api/app/
VITE_ERP_API_BASE_URL=http://192.168.5.204/
VITE_FILEUPLOAD_API_BASE_URL=http://192.168.5.214:8120/
VITE_FILEPREVIEW_API_BASE_URL=http://192.168.5.214:8130/
VITE_APP_BASE_URL=http://localhost:8002
# 开发环境特定配置
VITE_APP_TITLE=Ttenjoy (开发)
VITE_APP_VERSION=1.0.0-dev
......
# 生产环境配置
VITE_OTA_API_BASE_URL=http://192.168.5.204:19001/api/app/
VITE_ERP_API_BASE_URL=http://192.168.5.214:8700/
VITE_FILEUPLOAD_API_BASE_URL=http://192.168.5.214:8120/
VITE_FILEPREVIEW_API_BASE_URL=http://192.168.5.214:8130/
VITE_OTA_API_BASE_URL=http://byotaapi.oytour.com/api/app/
VITE_ERP_API_BASE_URL=http://byapi.oytour.com/
VITE_FILEUPLOAD_API_BASE_URL=https://upload.oytour.com/
VITE_FILEPREVIEW_API_BASE_URL=http://imgfile.oytour.com/
VITE_APP_BASE_URL=ota.oytour.com
# 其他生产环境配置
VITE_APP_TITLE=Ttenjoy
VITE_APP_VERSION=1.0.0
\ No newline at end of file
......@@ -268,7 +268,6 @@ export interface GeneralResponseDto {
*/
export interface WechatAppIdResponseDto {
appId?: string
redirectUri?: string
}
/**
......
......@@ -222,7 +222,7 @@ const generateState = () => {
// line授权登录
const loginWithLine = () => {
const channelId = openInfo.value.appId; // 替换为你的 LINE Channel ID
const redirectUri = encodeURIComponent(openInfo.value.redirectUri || 'http://localhost:8002/login/3'); // 替换为你的重定向 URI
const redirectUri = encodeURIComponent(`${import.meta.env.VITE_APP_BASE_URL}/login/3`); // 替换为你的重定向 URI
const state = generateState(); // 防止 CSRF 攻击,生成随机的 state 参数
// 构造 LINE 授权 URL
const lineLoginUrl = `https://access.line.me/oauth2/v2.1/authorize?response_type=code&client_id=${channelId}&redirect_uri=${redirectUri}&state=${state}&scope=openid%20profile`;
......@@ -252,7 +252,7 @@ const useLineLogin = async(code:string) => {
}
// 微信授权登录
const loginWechat = () => {
const redirect_url = openInfo.value.redirectUri || 'http://localhost:8002/login/2'
const redirect_url = `${import.meta.env.VITE_APP_BASE_URL}/login/2`
const url = `https://open.weixin.qq.com/connect/qrconnect?appid=${openInfo.value.appId}&redirect_uri=${encodeURIComponent(redirect_url)}&response_type=code&scope=snsapi_login&state=${1}&wechat_redirect=${redirect_url}`;
window.location.href = url;
}
......@@ -329,7 +329,7 @@ const loginHandler = async ({ values, errors }: any) => {
const loginWithGoogle = () => {
// 手动构建授权URL(适用于无第三方库的简单场景)
const clientId = openInfo.value.appId //'532164762940-vk65sge5jab1eq8mgbv1srh672ehnkff.apps.googleusercontent.com';
const redirectUri = encodeURIComponent(openInfo.value.redirectUri || 'http://localhost:8002/login/1'); // 必须与Google控制台配置的一致
const redirectUri = encodeURIComponent(`${import.meta.env.VITE_APP_BASE_URL}/login/1`); // 必须与Google控制台配置的一致
const scope = encodeURIComponent('profile email'); // 请求的权限范围
const authUrl = `https://accounts.google.com/o/oauth2/v2/auth?client_id=${clientId}&redirect_uri=${redirectUri}&response_type=code&scope=${scope}&access_type=offline`;
window.location.href = authUrl;
......
......@@ -240,7 +240,7 @@ const loginWithLine = () => {
// https://www.oytour.com/#/login/2/3
console.log(openInfo.value,'----------')
// return
const redirectUri = encodeURIComponent(openInfo.value.redirectUri || 'http://localhost:8002/personalCenter/accountCenter/account/3'); // 替换为你的重定向 URI
const redirectUri = encodeURIComponent(`${import.meta.env.VITE_APP_BASE_URL}/personalCenter/accountCenter/account/3`); // 替换为你的重定向 URI
const state = generateState(); // 防止 CSRF 攻击,生成随机的 state 参数
// 构造 LINE 授权 URL
const lineLoginUrl = `https://access.line.me/oauth2/v2.1/authorize?response_type=code&client_id=${channelId}&redirect_uri=${redirectUri}&state=${state}&scope=openid%20profile`;
......@@ -267,7 +267,7 @@ const useLineBind = async(code:string) => {
}
// 微信授权
const loginWechat = () => {
const redirect_url = openInfo.value.redirectUri || 'https://www.oytour.com/#/login/2' ||'http://localhost:8002/personalCenter/accountCenter/account/2'
const redirect_url = `${import.meta.env.VITE_APP_BASE_URL}/personalCenter/accountCenter/account/2`
const url = `https://open.weixin.qq.com/connect/qrconnect?appid=${openInfo.value.appId}&redirect_uri=${encodeURIComponent(redirect_url)}&response_type=code&scope=snsapi_login&state=${1}&wechat_redirect=${redirect_url}`;
window.location.href = url;
}
......
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