Commit f4387953 authored by youjie's avatar youjie

no message

parent abda0016
import { enCountries } from './countries' import { enCountries } from './countries'
import customFieldsEn from './fields/custom-fields-en.json' import customFieldsEn from './fields/custom-fields-en.json'
import pageFieldsEn from './page/page-title-en.json' import pageTitleEn from './page/page-title-en.json'
export default { export default {
// 国家名称(基于ISO2代码) // 国家名称(基于ISO2代码)
...@@ -256,6 +256,6 @@ export default { ...@@ -256,6 +256,6 @@ export default {
// Custom form fields // Custom form fields
...customFieldsEn, ...customFieldsEn,
// Page form fields // Page title
...pageFieldsEn, ...pageTitleEn,
} }
\ No newline at end of file
import { viCountries } from './countries' import { viCountries } from './countries'
import customFieldsVi from './fields/custom-fields-vi.json' import customFieldsVi from './fields/custom-fields-vi.json'
import pageFieldsVi from './page/page-title-vi.json' import pageTitleVi from './page/page-title-vi.json'
export default { export default {
// 国家名称(基于ISO2代码) // 国家名称(基于ISO2代码)
...@@ -257,5 +257,5 @@ export default { ...@@ -257,5 +257,5 @@ export default {
// Trường biểu mẫu tùy chỉnh // Trường biểu mẫu tùy chỉnh
...customFieldsVi, ...customFieldsVi,
// Các trang // Các trang
...pageFieldsVi, ...pageTitleVi,
} }
\ No newline at end of file
import { zhCNCountries } from './countries' import { zhCNCountries } from './countries'
import customFieldsZhCN from './fields/custom-fields-zh-CN.json' import customFieldsZhCN from './fields/custom-fields-zh-CN.json'
import pageFieldsZhCN from './page/page-title-zh-CN.json' import pageTitleZhCN from './page/page-title-zh-CN.json'
export default { export default {
// 国家名称(基于ISO2代码) // 国家名称(基于ISO2代码)
...@@ -256,6 +256,6 @@ export default { ...@@ -256,6 +256,6 @@ export default {
// 自定义表单字段 // 自定义表单字段
...customFieldsZhCN, ...customFieldsZhCN,
// 页面表单字段 // 页面标题
...pageFieldsZhCN, ...pageTitleZhCN,
} }
\ No newline at end of file
import { zhTWCountries } from './countries' import { zhTWCountries } from './countries'
import customFieldsZhTW from './fields/custom-fields-zh-TW.json' import customFieldsZhTW from './fields/custom-fields-zh-TW.json'
import pageFieldsZhTW from './page/page-title-zh-TW.json' import pageTitleZhTW from './page/page-title-zh-TW.json'
export default { export default {
// 国家名称(基于ISO2代码) // 国家名称(基于ISO2代码)
...@@ -256,5 +256,5 @@ export default { ...@@ -256,5 +256,5 @@ export default {
// 自定義表單欄位 // 自定義表單欄位
...customFieldsZhTW, ...customFieldsZhTW,
// 頁面標題 // 頁面標題
...pageFieldsZhTW, ...pageTitleZhTW,
}; };
\ No newline at end of file
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
<div class="customColor-text-7">{{ t('personal.bindWechatTip') }}</div> <div class="customColor-text-7">{{ t('personal.bindWechatTip') }}</div>
</div> </div>
<div class="flex-1 flex justify-end items-end"> <div class="flex-1 flex justify-end items-end">
<a-button @click="WeChatInfor?unBindWeChatAccount(2):getAppIdRedirectUri()" <a-button @click="WeChatInfor?unBindWeChatAccount(2):getAppIdRedirectUri(providerTypeEnum.WECHAT.value)"
type="primary" type="primary"
size="large" size="large"
class="acc-button !h-[34px] !rounded-[8px] !text-sm !px-[13px]"> class="acc-button !h-[34px] !rounded-[8px] !text-sm !px-[13px]">
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
<div class="customColor-text-7">{{ t('personal.bindLineTip') }}</div> <div class="customColor-text-7">{{ t('personal.bindLineTip') }}</div>
</div> </div>
<div class="flex-1 flex justify-end items-end"> <div class="flex-1 flex justify-end items-end">
<a-button @click="LnlineInfor?unBindWeChatAccount(3):''" <a-button @click="LnlineInfor?unBindWeChatAccount(3):getAppIdRedirectUri(providerTypeEnum.LINE.value)"
type="primary" type="primary"
size="large" size="large"
class="acc-button !h-[34px] !rounded-[8px] !text-sm !px-[13px]"> class="acc-button !h-[34px] !rounded-[8px] !text-sm !px-[13px]">
...@@ -234,23 +234,49 @@ const getPersonalInfor = async () => { ...@@ -234,23 +234,49 @@ const getPersonalInfor = async () => {
const response = await UserService.memberCenterAsync(systemConfig.tenantId) const response = await UserService.memberCenterAsync(systemConfig.tenantId)
userStore.updateProfile(response) userStore.updateProfile(response)
} }
// 获取微信绑定AppID 域名 重定向页面
const getAppIdRedirectUri = async () => { // 随机生成 state 参数
const generateState = () => {
return Math.random().toString(36).substring(2); // 简单的生成随机字符串
}
// line授权
const loginWithLine = () => {
const channelId = openInfo.value.appId; // 替换为你的 LINE Channel ID
const redirectUri = encodeURIComponent(openInfo.value.redirectUri || 'https://www.oytour.com/#/login'); // 替换为你的重定向 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`;
// 跳转到 LINE 登录页面
window.location.href = lineLoginUrl;
}
// 微信授权登录
const loginWechat = () => {
const redirect_url = openInfo.value.redirectUri || 'https://www.oytour.com/#/login'
const url = `https://open.weixin.qq.com/connect/qrconnect?appid=${appId}&redirect_uri=${encodeURIComponent(redirect_url)}&response_type=code&scope=snsapi_login&state=${1}&wechat_redirect=${redirect_url}`;
window.location.href = url;
}
// 获取绑定AppID 域名 重定向页面
const getAppIdRedirectUri = async (providerType: string) => {
// const { AppID, State, OpenRedirectUri } = openInfo.value; // const { AppID, State, OpenRedirectUri } = openInfo.value;
// let redirect_uri = OpenRedirectUri; // let redirect_uri = OpenRedirectUri;
// const url = `https://open.weixin.qq.com/connect/qrconnect?appid=${AppID}&redirect_uri=${encodeURIComponent('https://www.oytour.com/#/login')}&response_type=code&scope=snsapi_login&state=${State}&wechat_redirect=${redirect_uri}`; // const url = `https://open.weixin.qq.com/connect/qrconnect?appid=${AppID}&redirect_uri=${encodeURIComponent('https://www.oytour.com/#/login')}&response_type=code&scope=snsapi_login&state=${State}&wechat_redirect=${redirect_uri}`;
// window.location.href = url; // window.location.href = url;
// return
loading.value = true loading.value = true
try { try {
// 获取微信绑定AppID 域名 // 获取微信绑定AppID 域名
const response = await userStore.getUserWechatAppIdAsync(systemConfig.tenantId?.toString() || '',providerTypeEnum.WECHAT.value) const response = await userStore.getUserWechatAppIdAsync(systemConfig.tenantId?.toString() || '',providerType)
if (response.status == 'SUCCESS') { if (response.status == 'SUCCESS') {
openInfo.value = response.data[0] openInfo.value = response.data[0]
const { appId, redirectUri } = openInfo.value; if(openInfo.value?.appId){
const redirect_url = redirectUri?redirectUri:'https://www.oytour.com/#/login' console.log(openInfo.value,'----------')
const url = `https://open.weixin.qq.com/connect/qrconnect?appid=${appId}&redirect_uri=${encodeURIComponent(redirect_url)}&response_type=code&scope=snsapi_login&state=${1}&wechat_redirect=${redirect_url}`; if(providerType==providerTypeEnum.WECHAT.value){
window.location.href = url; loginWechat()
}else if(providerType==providerTypeEnum.GOOGLE.value){
renderGoogleButton(openInfo.value.appId)
}else if(providerType==providerTypeEnum.LINE.value){
loginWithLine()
}
}
} }
}catch (error: any) { }catch (error: any) {
Message.error(error.message) Message.error(error.message)
...@@ -277,12 +303,12 @@ const useWechatBind = async(code:string) => { ...@@ -277,12 +303,12 @@ const useWechatBind = async(code:string) => {
} }
} }
// 渲染 Google 登录按钮 // 渲染 Google 按钮
const renderGoogleButton = () => { const renderGoogleButton = (client_id:string) => {
try { try {
// 渲染 Google 登录按钮 // 渲染 Google 按钮
window.google.accounts.id.initialize({ window.google.accounts.id.initialize({
client_id: '532164762940-vk65sge5jab1eq8mgbv1srh672ehnkff.apps.googleusercontent.com', client_id,// '532164762940-vk65sge5jab1eq8mgbv1srh672ehnkff.apps.googleusercontent.com'
callback: handleSignInSuccess, callback: handleSignInSuccess,
error_callback: handleSignInError, error_callback: handleSignInError,
ux_mode: 'popup' // 可选:popup/redirect ux_mode: 'popup' // 可选:popup/redirect
...@@ -293,10 +319,6 @@ const renderGoogleButton = () => { ...@@ -293,10 +319,6 @@ const renderGoogleButton = () => {
{ theme: 'outline', size: 'large' } { theme: 'outline', size: 'large' }
); );
// window.google.accounts.id.configure({
// language: locale.value // 支持的语言代码
// });
} catch (error) { } catch (error) {
console.error('Error rendering Google Sign-In button:', error); console.error('Error rendering Google Sign-In button:', error);
} }
...@@ -353,7 +375,7 @@ onMounted(async () => { ...@@ -353,7 +375,7 @@ onMounted(async () => {
await initGoogleSDK(); await initGoogleSDK();
// 确保 SDK 加载完成后渲染按钮 // 确保 SDK 加载完成后渲染按钮
await new Promise(resolve => setTimeout(resolve)); await new Promise(resolve => setTimeout(resolve));
renderGoogleButton() getAppIdRedirectUri(providerTypeEnum.GOOGLE.value)
} }
} catch (error) { } catch (error) {
......
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