Commit 105ac837 authored by youjie's avatar youjie

no message

parent 6af1a7db
......@@ -98,6 +98,7 @@ export default {
resetSuccess: '密码重置成功',
resetFailed: '密码重置失败',
emailRequiredReset: '请输入邮箱',
wechatLoginFailed: '微信登录失败',
},
common: {
language: '语言',
......
......@@ -143,7 +143,7 @@ export const useUserStore = defineStore('user', {
}
} catch (error: any) {
console.error('Google login error:', error)
ResultMessage.Error(error.message)
ResultMessage.Error(error.message|| i18n.global.t('login.wechatLoginFailed'))
return {
status: 'ERROR',
verify: false
......
......@@ -435,3 +435,16 @@ export function enumToOptions<T extends Record<string, string | number>>(
value: value as T[keyof T],
}))
}
export function query (url?:string){
url = url??location.href
let str = url.substr(url.indexOf('?') + 1)
const arr = str.split('&')
let json = {} as any
for(let i = 0; i < arr.length; i++) {
let item = arr[i].split('=')
json[item[0]] = item[1]
}
return json
}
......@@ -139,10 +139,11 @@ import f from '@/assets/images/login/login_f.png'
import G from '@/assets/images/login/login_G.png'
import tel from '@/assets/images/login/login_tel.png'
import line from '@/assets/images/login/login_line.png'
import { query } from '@/utils/common'
const { t,locale } = useI18n();
const { t } = useI18n();
const userStore = useUserStore()
const systemConfigStore = useSystemConfigStore()
......@@ -150,6 +151,7 @@ const loading = ref(false)
const router = useRouter()
const googleButtonContainer = ref(null);
const loginMsg = reactive({
tenantId: systemConfigStore.tenantId || null,
reType: 0,//登录方式 0账号密码 1谷歌授权 3LINE授权 7FaceBook授权
......@@ -213,11 +215,6 @@ const openInfo = ref({
openId: '',
})
// 获取微信登录OpenID
const getOpenIdByCode = async (code:string) => {
console.log(code,'---------code')
// useWechatLogin(code)
}
// 获取微信登录AppID 域名 重定向页面
const getAppIdRedirectUri = async () => {
......@@ -248,7 +245,6 @@ const getAppIdRedirectUri = async () => {
const useWechatLogin = async(code:string) => {
loading.value = true
try {
// 获取授权码
const response = await userStore.setUserWechatLoginAsync(loginMsg.tenantId?.toString() || '', code, loginMsg.distributorId,loginMsg.parentId,loginMsg.redirectUri)
if (response.status == 'SUCCESS') {
Message.success(t('login.loginSuccess'))
......@@ -389,7 +385,7 @@ const handleLogin = async () => {
// 初始化
const init = async () => {
// 如果已经登录且是正常代理商,直接跳转到仪表盘
// 如果已经登录且是正常用户,直接跳转到首页
if (userStore.getUserToken && userStore.getUser) {
router.replace('/')
}
......@@ -398,15 +394,19 @@ const init = async () => {
init()
onMounted(async () => {
const queryParams = query()
const code = queryParams.code
if (code) {
console.log(queryParams,'---------code')
useWechatLogin(code)
}
try {
await initGoogleSDK();
// 确保 SDK 加载完成后渲染按钮
await new Promise(resolve => setTimeout(resolve));
renderGoogleButton()
const code = router.query?.code || null
if (code) {
getOpenIdByCode(code)
}
} catch (error) {
console.error('SDK 初始化失败:', error);
......
......@@ -49,7 +49,7 @@
<div class="flex justify-between items-center text-base relative">
<div class="flex">
<div v-for="(item,index) in orderList"
class="myOrder-status px-[13px] py-[22px] cursor-pointer relative text-base"
class="myOrder-status px-[13px] py-[22px] cursor-pointer relative"
:class="[currentStatus==item.value?'active font-medium':'font-light']"
@click="changeStatus(item.value)">{{ item.label }}
<div class="myOrder-status-border absolute left-0 bottom-0 w-full flex justify-center">
......
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