f
This commit is contained in:
1
.env
1
.env
@@ -7,6 +7,7 @@ VITE_APP_NAME=真爱查
|
|||||||
VITE_INQUIRE_AES_KEY=ff83609b2b24fc73196aac3d3dfb874f
|
VITE_INQUIRE_AES_KEY=ff83609b2b24fc73196aac3d3dfb874f
|
||||||
|
|
||||||
VITE_WECHAT_APP_ID=wx442ee1ac1ee75917
|
VITE_WECHAT_APP_ID=wx442ee1ac1ee75917
|
||||||
|
VITE_WECHAT_REDIRECT_DOMAIN=https://www.zhinengcha.cn
|
||||||
|
|
||||||
VITE_ICP_RECORD=琼ICP备2025059533号-2
|
VITE_ICP_RECORD=琼ICP备2025059533号-2
|
||||||
VITE_PUBLIC_SECURITY_RECORD=琼公网安备46010002000584号
|
VITE_PUBLIC_SECURITY_RECORD=琼公网安备46010002000584号
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ VITE_SERVICE_URL=https://work.weixin.qq.com/kfid/kfc82d4424e4b19e5f3
|
|||||||
VITE_INQUIRE_AES_KEY=ff83609b2b24fc73196aac3d3dfb874f
|
VITE_INQUIRE_AES_KEY=ff83609b2b24fc73196aac3d3dfb874f
|
||||||
|
|
||||||
VITE_WECHAT_APP_ID=wx442ee1ac1ee75917
|
VITE_WECHAT_APP_ID=wx442ee1ac1ee75917
|
||||||
|
# 微信授权回调域名(必须与微信后台配置的授权回调域名一致)
|
||||||
|
# 例如:https://www.quannengcha.com 或 https://www.zhenaicha.com
|
||||||
|
# 如果不配置,则使用当前访问的域名(window.location.origin)
|
||||||
|
VITE_WECHAT_REDIRECT_DOMAIN=https://www.zhinengcha.cn
|
||||||
|
|
||||||
|
|
||||||
VITE_CHAT_AES_KEY=qw5w6SFE2D1jmxyd
|
VITE_CHAT_AES_KEY=qw5w6SFE2D1jmxyd
|
||||||
|
|||||||
12
src/App.vue
12
src/App.vue
@@ -298,9 +298,19 @@ const getWeixinAuthUrl = () => {
|
|||||||
const params = new URLSearchParams(url.search);
|
const params = new URLSearchParams(url.search);
|
||||||
params.delete("code");
|
params.delete("code");
|
||||||
params.delete("state");
|
params.delete("state");
|
||||||
const cleanUrl = `${url.origin}${url.pathname}${params.toString() ? "?" + params.toString() : ""
|
|
||||||
|
// 使用配置的固定域名,如果没有配置则使用当前域名
|
||||||
|
const redirectDomain = import.meta.env.VITE_WECHAT_REDIRECT_DOMAIN || url.origin;
|
||||||
|
const cleanUrl = `${redirectDomain}${url.pathname}${params.toString() ? "?" + params.toString() : ""
|
||||||
}`;
|
}`;
|
||||||
const redirectUri = encodeURIComponent(cleanUrl);
|
const redirectUri = encodeURIComponent(cleanUrl);
|
||||||
|
|
||||||
|
console.log("🔗 WeChat redirectUri config:", {
|
||||||
|
configuredDomain: import.meta.env.VITE_WECHAT_REDIRECT_DOMAIN || "未配置(使用当前域名)",
|
||||||
|
currentOrigin: url.origin,
|
||||||
|
finalRedirectDomain: redirectDomain,
|
||||||
|
redirectUri: cleanUrl
|
||||||
|
});
|
||||||
const weixinAuthUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirectUri}&response_type=code&scope=snsapi_base&state=snsapi_base#wechat_redirect`;
|
const weixinAuthUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirectUri}&response_type=code&scope=snsapi_base&state=snsapi_base#wechat_redirect`;
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
|
|||||||
Reference in New Issue
Block a user