From bf170a0d40b01660a0c23f44b967e240a24556ea Mon Sep 17 00:00:00 2001 From: ww Date: Wed, 7 Aug 2024 19:15:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E5=88=86=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/user.ts | 104 -------------------------------------- 1 file changed, 104 deletions(-) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index b2676a6..214a405 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -74,7 +74,6 @@ const useUserStore = defineStore('User', { message: '登录成功!', title: `Hi ${getTime()}!`, }) -<<<<<<< HEAD return 'ok' } else { ElNotification({ @@ -120,109 +119,6 @@ const useUserStore = defineStore('User', { this.routes = '' usePermissionStore.removeRouter() location.reload() -======= - - if (res.code === 200) { - // @ts-expect-error - this.token = res.data.token as string - // @ts-expect-error - - SET_TKOEN('TOKEN', this.token) - // localStorage.setItem('TOKEN', this.token) - ElNotification({ - type: 'success', - message: '登录成功!', - title: `Hi ${getTime()}!`, - }) - return 'ok' - } else { - // ElNotification({ - // // type: 'error', - // message: res.message, - // }) - ElMessage.error(res.message) - return Promise.reject(new Error(res.data.message)) - } - }, - //手机号登录 - async userPhoneLogin(data: loginType) { - const res: any = await userPhoneLoginService(data) - console.log(res, 11111) - if (res.code === 200) { - // @ts-expect-error - - this.token = res.data.token as string //接收返回的token - // @ts-expect-error - - SET_TKOEN('TOKEN', this.token) - // localStorage.setItem('TOKEN', this.token) - ElNotification({ - type: 'success', - message: '登录成功!', - title: `Hi ${getTime()}!`, - }) - return 'ok' - } else { - ElNotification({ - type: 'error', - message: res.message, - }) - return Promise.reject(new Error(res.data.message)) - } - }, - // 获取用户信息事件 - async getUserInfo() { - const result: any = await userGetInfoService(GET_TKOEN('TOKEN')) - if (result.code === 200) { - const res = await userIdenService(result.data.id) - console.log(res, 'huonghu') - - // @ts-expect-error - console.log(res.data, 'res.data') - - this.userInfo = res.data - console.log(this.userInfo, 'this.userInfo') - // @ts-expect-error - - this.data = result.data - console.log(result, '123') - // @ts-expect-error - - this.userName = result.data.username - // this.avatar = result.data.checkUser.avatar - // @ts-expect-error - - this.routes = result.data.permissions - return { - result, - } - } else { - return Promise.reject('登录过期') - } - }, - // 退出登录事件 - logout() { - const usePermissionStore = permissionStore() - console.log(usePermissionStore) - // 清除token - REMOVE_TOKEN('TOKEN'), - // ;(this.userName = ''), (this.avatar = '') - // @ts-expect-error - - (this.userName = ''), - // @ts-expect-error - - (this.avatar = '') - // @ts-expect-error - - this.token = '' - // @ts-expect-error - - this.routes = '' - usePermissionStore.removeRouter() - location.reload() - }, ->>>>>>> 0b7db324dad8347654933e91ae7e6ca8d2dabd05 }, }, getters: {},