Commit f4387953 authored by youjie's avatar youjie

no message

parent abda0016
import { enCountries } from './countries'
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 {
// 国家名称(基于ISO2代码)
......@@ -256,6 +256,6 @@ export default {
// Custom form fields
...customFieldsEn,
// Page form fields
...pageFieldsEn,
// Page title
...pageTitleEn,
}
\ No newline at end of file
import { viCountries } from './countries'
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 {
// 国家名称(基于ISO2代码)
......@@ -257,5 +257,5 @@ export default {
// Trường biểu mẫu tùy chỉnh
...customFieldsVi,
// Các trang
...pageFieldsVi,
...pageTitleVi,
}
\ No newline at end of file
import { zhCNCountries } from './countries'
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 {
// 国家名称(基于ISO2代码)
......@@ -256,6 +256,6 @@ export default {
// 自定义表单字段
...customFieldsZhCN,
// 页面表单字段
...pageFieldsZhCN,
// 页面标题
...pageTitleZhCN,
}
\ No newline at end of file
import { zhTWCountries } from './countries'
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 {
// 国家名称(基于ISO2代码)
......@@ -256,5 +256,5 @@ export default {
// 自定義表單欄位
...customFieldsZhTW,
// 頁面標題
...pageFieldsZhTW,
...pageTitleZhTW,
};
\ No newline at end of file
......@@ -96,7 +96,7 @@
<div class="customColor-text-7">{{ t('personal.bindWechatTip') }}</div>
</div>
<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"
size="large"
class="acc-button !h-[34px] !rounded-[8px] !text-sm !px-[13px]">
......@@ -143,7 +143,7 @@
<div class="customColor-text-7">{{ t('personal.bindLineTip') }}</div>
</div>
<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"
size="large"
class="acc-button !h-[34px] !rounded-[8px] !text-sm !px-[13px]">
......@@ -234,23 +234,49 @@ const getPersonalInfor = async () => {
const response = await UserService.memberCenterAsync(systemConfig.tenantId)
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;
// 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}`;
// window.location.href = url;
// return
loading.value = true
try {
// 获取微信绑定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') {
openInfo.value = response.data[0]
const { appId, redirectUri } = openInfo.value;
const redirect_url = redirectUri?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;
if(openInfo.value?.appId){
console.log(openInfo.value,'----------')
if(providerType==providerTypeEnum.WECHAT.value){
loginWechat()
}else if(providerType==providerTypeEnum.GOOGLE.value){
renderGoogleButton(openInfo.value.appId)
}else if(providerType==providerTypeEnum.LINE.value){
loginWithLine()
}
}
}
}catch (error: any) {
Message.error(error.message)
......@@ -277,12 +303,12 @@ const useWechatBind = async(code:string) => {
}
}
// 渲染 Google 登录按钮
const renderGoogleButton = () => {
// 渲染 Google 按钮
const renderGoogleButton = (client_id:string) => {
try {
// 渲染 Google 登录按钮
// 渲染 Google 按钮
window.google.accounts.id.initialize({
client_id: '532164762940-vk65sge5jab1eq8mgbv1srh672ehnkff.apps.googleusercontent.com',
client_id,// '532164762940-vk65sge5jab1eq8mgbv1srh672ehnkff.apps.googleusercontent.com'
callback: handleSignInSuccess,
error_callback: handleSignInError,
ux_mode: 'popup' // 可选:popup/redirect
......@@ -292,10 +318,6 @@ const renderGoogleButton = () => {
googleButtonContainer.value,
{ theme: 'outline', size: 'large' }
);
// window.google.accounts.id.configure({
// language: locale.value // 支持的语言代码
// });
} catch (error) {
console.error('Error rendering Google Sign-In button:', error);
......@@ -353,7 +375,7 @@ onMounted(async () => {
await initGoogleSDK();
// 确保 SDK 加载完成后渲染按钮
await new Promise(resolve => setTimeout(resolve));
renderGoogleButton()
getAppIdRedirectUri(providerTypeEnum.GOOGLE.value)
}
} 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