优化账号绑定功能及消息提示组件

This commit is contained in:
wangqiao
2025-09-14 10:55:19 +08:00
parent a0a44b4551
commit d096ebb83c
2 changed files with 88 additions and 1 deletions

View File

@ -42,6 +42,8 @@
import { handleLoginQQ, handleLoginWechat } from '~/utils/login'
import { getUserInfo, cancelSocialBind } from '~/api/personal-center/index'
import type { UserExtendRespVO } from '~/api/personal-center/types'
import { useMessage } from '~/composables/useMessage'
const message = useMessage()
onMounted(() => {
getUser()
})
@ -53,9 +55,11 @@
user.value = res.data
}
const handleBind = (type: string) => {
const handleBind = async (type: string) => {
if (type === 'qq') {
if (user.value.qqOpenId) {
const res = await message.confirm('确定解绑QQ吗', '提示')
if (!res) return
cancelSocialBind({ type: 35, openid: user.value.qqOpenId }).then((res) => {
if (res.code === 0) {
ElMessage.success('解绑成功')
@ -68,6 +72,8 @@
}
if (type === 'wx') {
if (user.value.wxOpenId) {
const res = await message.confirm('确定解绑微信吗?', '提示')
if (!res) return
cancelSocialBind({ type: 32, openid: user.value.wxOpenId }).then((res) => {
if (res.code === 0) {
getUser()