修复历史遗留问题

This commit is contained in:
柏码の讲师 2023-10-28 02:28:09 +08:00
parent 0bc34bd784
commit 09f889145e
5 changed files with 24 additions and 4 deletions

View File

@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
public class AccountDetails implements BaseData { public class AccountDetails implements BaseData {
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
Integer id; Integer id;
int gender; int gender = 0;
String phone; String phone;
String qq; String qq;
String wx; String wx;

View File

@ -3,8 +3,12 @@ package com.example.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.entity.dto.Account; import com.example.entity.dto.Account;
import com.example.entity.dto.AccountDetails;
import com.example.entity.dto.AccountPrivacy;
import com.example.entity.vo.request.*; import com.example.entity.vo.request.*;
import com.example.mapper.AccountDetailsMapper;
import com.example.mapper.AccountMapper; import com.example.mapper.AccountMapper;
import com.example.mapper.AccountPrivacyMapper;
import com.example.service.AccountService; import com.example.service.AccountService;
import com.example.utils.Const; import com.example.utils.Const;
import com.example.utils.FlowUtils; import com.example.utils.FlowUtils;
@ -45,6 +49,12 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
@Resource @Resource
FlowUtils flow; FlowUtils flow;
@Resource
AccountDetailsMapper detailsMapper;
@Resource
AccountPrivacyMapper privacyMapper;
/** /**
* 从数据库中通过用户名或邮箱查找用户详细信息 * 从数据库中通过用户名或邮箱查找用户详细信息
* @param username 用户名 * @param username 用户名
@ -104,6 +114,10 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
return "内部错误,注册失败"; return "内部错误,注册失败";
} else { } else {
this.deleteEmailVerifyCode(email); this.deleteEmailVerifyCode(email);
privacyMapper.insert(new AccountPrivacy(account.getId()));
AccountDetails details = new AccountDetails();
details.setId(account.getId());
detailsMapper.insert(details);
return null; return null;
} }
} }

View File

@ -30,6 +30,12 @@ export const useStore = defineStore('general', {
return type; return type;
} }
return null return null
},
userAvatarUrl(avatar) {
if(avatar)
return `${axios.defaults.baseURL}/images${avatar}`
else
return 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png'
} }
} }
}) })

View File

@ -100,7 +100,7 @@ function deleteComment(id) {
</div> </div>
<div class="topic-main"> <div class="topic-main">
<div class="topic-main-left"> <div class="topic-main-left">
<el-avatar :src="axios.defaults.baseURL + '/images' + topic.data.user.avatar" <el-avatar :src="store.userAvatarUrl(topic.data.user.avatar)"
:size="60"></el-avatar> :size="60"></el-avatar>
<div style="margin-left: 10px"> <div style="margin-left: 10px">
<div style="font-weight: bold;font-size: 18px"> <div style="font-weight: bold;font-size: 18px">
@ -150,7 +150,7 @@ function deleteComment(id) {
<div v-if="topic.comments"> <div v-if="topic.comments">
<div class="topic-main" style="margin-top: 10px" v-for="item in topic.comments"> <div class="topic-main" style="margin-top: 10px" v-for="item in topic.comments">
<div class="topic-main-left"> <div class="topic-main-left">
<el-avatar :src="axios.defaults.baseURL + '/images' + item.user.avatar" <el-avatar :src="store.userAvatarUrl(item.user.avatar)"
:size="60"></el-avatar> :size="60"></el-avatar>
<div style="margin-left: 10px"> <div style="margin-left: 10px">
<div style="font-weight: bold;font-size: 18px"> <div style="font-weight: bold;font-size: 18px">

View File

@ -136,7 +136,7 @@ navigator.geolocation.getCurrentPosition(position => {
@click="router.push('/index/post-detail/' + item.id)"> @click="router.push('/index/post-detail/' + item.id)">
<div style="display: flex"> <div style="display: flex">
<div> <div>
<el-avatar :size="30" :src="`${axios.defaults.baseURL}/images${item.avatar}`"/> <el-avatar :size="30" :src="store.userAvatarUrl(item.avatar)"/>
</div> </div>
<div style="margin-left: 7px;transform: translateY(-2px)"> <div style="margin-left: 7px;transform: translateY(-2px)">
<div style="font-size: 13px;font-weight: bold">{{item.username}}</div> <div style="font-size: 13px;font-weight: bold">{{item.username}}</div>