Skip to content

Commit

Permalink
Fix: 修复会话不存在导致删除好友有误的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
KiWi233333 committed Feb 12, 2025
1 parent 7327f97 commit 4ce88bb
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 50 deletions.
14 changes: 7 additions & 7 deletions components/Chat/Friend/MainType/User.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,19 @@ function deleteFriend(userId: string) {
lockScroll: false,
callback: async (action: string) => {
if (action === "confirm") {
const contactInfoRes = await getSelfContactInfoByFriendUid(userId, store.getToken);
if (!contactInfoRes)
return;
if (contactInfoRes && contactInfoRes.code !== StatusCode.SUCCESS)
return ElMessage.error(contactInfoRes ? contactInfoRes.message : "没有找到对应好友!");
const res = await deleteFriendById(userId, store.getToken);
if (res.code === StatusCode.SUCCESS) {
ElNotification.success("删除成功!");
chat.setTheFriendOpt(FriendOptType.Empty, {});
chat.setDelUserId(userId);// 删除的好友 好友列表也前端移除
chat.setIsAddNewFriend(true);// 设置未非好友
chat.removeContact(contactInfoRes.data.roomId); // 清除对应会话
const contactInfoRes = await getSelfContactInfoByFriendUid(userId, store.getToken);
if (contactInfoRes && contactInfoRes.code !== StatusCode.SUCCESS) {
return ElMessage.closeAll("error");
}
else {
chat.removeContact(contactInfoRes.data.roomId); // 清除对应会话
}
}
chat.setIsAddNewFriend(true);
}
Expand Down
9 changes: 5 additions & 4 deletions components/User/safe/EmailForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ async function getEmailCode() {
class="form"
@submit.prevent="() => {}"
>
<h3 mb-4 mt-2 text-center tracking-0.2em>
<div mb-4 mt-2 text-center text-lg font-500 tracking-0.2em>
{{ user.userInfo.isEmailVerified ? "更换" : "绑定" }}邮箱
</h3>
</div>
<el-form-item type="newEmail" label="" prop="newEmail" class="animated">
<el-input
v-model.trim="form.newEmail"
Expand Down Expand Up @@ -145,8 +145,8 @@ async function getEmailCode() {
<el-form-item mt-1em>
<el-button
type="primary"
size="large"
class="submit w-full"
style="padding: 1.2em 0;"
@keyup.enter="onUpdatePhone(formRef)"
@click="onUpdatePhone(formRef)"
>
Expand Down Expand Up @@ -230,7 +230,8 @@ async function getEmailCode() {
}
.submit {
font-size: 1.2em;
font-size: 1em;
letter-spacing: 0.2em;
transition: 0.3s;
cursor: pointer;
Expand Down
24 changes: 7 additions & 17 deletions components/User/safe/PhoneForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ async function getPhoneCode() {
class="form"
@submit.prevent="() => {}"
>
<h3 mb-4 mt-2 text-center tracking-0.2em>
<div mb-4 mt-2 text-center text-lg font-500 tracking-0.2em>
{{ user.userInfo.isPhoneVerified ? "更换" : "绑定" }}手机号
</h3>
</div>
<el-form-item label="" prop="newPhone" class="animated">
<el-input
v-model.trim="form.newPhone"
Expand Down Expand Up @@ -145,8 +145,8 @@ async function getPhoneCode() {
<el-form-item>
<el-button
type="primary"
size="large"
class="submit w-full"
style="padding: 1.2em 0;"
class="submit"
@keyup.enter="onUpdatePhone(formRef)"
@click="onUpdatePhone(formRef)"
>
Expand All @@ -158,16 +158,7 @@ async function getPhoneCode() {

<style scoped lang="scss">
.form {
width: 360px;
display: block;
padding: 1em 2em;
background-color: #ffffff98;
border-radius: var(--el-border-radius-base);
backdrop-filter: blur(5px);
border: 1px solid rgba(109, 109, 109, 0.2);
box-shadow: rgba(0, 0, 0, 0.2) 0px 1px 4px;
overflow: hidden;
animation-delay: 0.1s;
--at-apply: "sm:w-360px w-95vw block overflow-hidden border-default-hover backdrop-blur-5px card-default p-1.2em";
:deep(.el-input__wrapper) {
padding: 0.3em 1em;
Expand Down Expand Up @@ -230,9 +221,8 @@ async function getPhoneCode() {
}
.submit {
font-size: 1.1em;
transition: 0.3s;
cursor: pointer;
--at-apply: "mb-4 w-full shadow-sm text-1em transition-300 "
letter-spacing: 0.2em;
:deep(.el-input__wrapper) {
background-color: var(--el-color-danger);
Expand Down
38 changes: 19 additions & 19 deletions components/User/safe/PwdForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ async function getCheckCodeReq(type?: CheckTypeEnum) {
:model="userForm"
class="form"
>
<h3 mb-4 mt-2 text-center tracking-0.2em>
<div my-2 text-center text-lg font-500 tracking-0.2em>
密码修改
</h3>
</div>
<transition-group :name="setting.settingPage.isCloseAllTransition ? '' : 'group-list'" mode="ease-in-out" class="relative">
<!-- 二步验证 -->
<el-form-item v-if="isSecondCheck" type="password" :label="`${chooseType === CheckTypeEnum.PHONE ? '手机号' : '邮箱'}`" prop="password" class="animated">
Expand All @@ -207,7 +207,7 @@ async function getCheckCodeReq(type?: CheckTypeEnum) {
@keyup.enter="onUpdatePwd(userFormRefs)"
>
<template #append>
<el-button type="primary" :disabled="codeStorage > 0" @click="getCheckCodeReq(chooseType)">
<el-button type="primary" class="code-btn" :disabled="codeStorage > 0" @click="getCheckCodeReq(chooseType)">
{{ codeStorage > 0 ? `${codeStorage}s后重新发送` : "获取验证码" }}
</el-button>
</template>
Expand Down Expand Up @@ -270,8 +270,8 @@ async function getCheckCodeReq(type?: CheckTypeEnum) {
<el-form-item mt-1em>
<el-button
type="danger"
class="submit mb-4 w-full"
style="padding: 1em 0"
class="submit"
style="padding: 1.2em 0"
@keyup.enter="onUpdatePwd(userFormRefs)"
@click="onUpdatePwd(userFormRefs)"
>
Expand All @@ -284,16 +284,13 @@ async function getCheckCodeReq(type?: CheckTypeEnum) {

<style scoped lang="scss">
.form {
width: 360px;
display: block;
padding: 1em 0;
background-color: #ffffff98;
border-radius: var(--el-border-radius-base);
backdrop-filter: blur(5px);
border: 1px solid rgba(109, 109, 109, 0.2);
box-shadow: rgba(0, 0, 0, 0.2) 0px 1px 4px;
overflow: hidden;
animation-delay: 0.1s;
--at-apply: "sm:w-360px w-95vw block overflow-hidden border-default-hover backdrop-blur-5px card-default py-2em";
:deep(.el-input-group__append) {
.el-button {
--at-apply: "h-full text-[--el-color-danger]";
}
}
:deep(.el-input__wrapper) {
padding: 0 1em;
Expand All @@ -304,8 +301,13 @@ async function getCheckCodeReq(type?: CheckTypeEnum) {
margin-left: auto;
.el-radio {
height: fit-content;
border-right: 1px solid #ffffff98;
--at-apply: "border-default-r";
padding-right: 1em;
&.is-checked {
.el-radio__label {
color: var(--el-color-danger);
}
}
&:nth-last-child(1) {
border: none;
padding-right: 2.4em;
Expand Down Expand Up @@ -376,9 +378,7 @@ async function getCheckCodeReq(type?: CheckTypeEnum) {
}
.submit {
font-size: 1.2em;
transition: 0.3s;
cursor: pointer;
--at-apply: "mb-4 w-full shadow-sm text-1em transition-300 "
:deep(.el-input__wrapper) {
background-color: var(--el-color-danger);
Expand Down
4 changes: 2 additions & 2 deletions pages/index/setting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const {
</script>

<template>
<main v-loading.fullscreen.lock="isFullLoading" class="h-full w-full flex flex-1 flex-col p-4 p-6 pt-12 card-bg-color-2">
<main v-loading.fullscreen.lock="isFullLoading" class="h-full w-full flex flex-1 flex-col p-4 pt-12 card-bg-color-2 sm:p-6">
<h3 flex items-center>
系统设置
<i i-solar:settings-bold ml-2 inline-block p0.6em opacity-60 hover:animate-spin />
Expand Down Expand Up @@ -166,7 +166,7 @@ const {
<ElButton
v-if="setting.isDesktop"
class="flex-row-c-c cursor-pointer transition-all"
round plain
plain round
style="height: 2em;padding: 0 0.8em;"
:type="setting.appUploader.isUpdating ? 'warning' : 'info'"
@click="!setting.appUploader.isCheckUpdatateLoad && setting.checkUpdates(true)"
Expand Down
2 changes: 1 addition & 1 deletion pages/index/user/safe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ useSeoMeta({
</script>

<template>
<main v-loading.fullscreen.lock="isLoading" class="w-full flex flex-1 flex-col p-4 p-6 pt-12 card-bg-color-2">
<main v-loading.fullscreen.lock="isLoading" class="w-full flex flex-1 flex-col p-4 pt-12 card-bg-color-2 sm:p-6">
<h3 flex items-center>
账户与安全
<i i-solar:devices-bold-duotone ml-2 inline-block p0.6em opacity-60 />
Expand Down

0 comments on commit 4ce88bb

Please sign in to comment.