优化账号绑定功能及消息提示组件
This commit is contained in:
@ -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()
|
||||
|
||||
Reference in New Issue
Block a user