diff --git a/my-project-backend/src/main/java/com/example/entity/dto/AccountDetails.java b/my-project-backend/src/main/java/com/example/entity/dto/AccountDetails.java index b68253a..01ccf0b 100644 --- a/my-project-backend/src/main/java/com/example/entity/dto/AccountDetails.java +++ b/my-project-backend/src/main/java/com/example/entity/dto/AccountDetails.java @@ -16,7 +16,7 @@ import lombok.NoArgsConstructor; public class AccountDetails implements BaseData { @TableId(type = IdType.AUTO) Integer id; - int gender; + int gender = 0; String phone; String qq; String wx; diff --git a/my-project-backend/src/main/java/com/example/service/impl/AccountServiceImpl.java b/my-project-backend/src/main/java/com/example/service/impl/AccountServiceImpl.java index 288177f..6d6bcd6 100644 --- a/my-project-backend/src/main/java/com/example/service/impl/AccountServiceImpl.java +++ b/my-project-backend/src/main/java/com/example/service/impl/AccountServiceImpl.java @@ -3,8 +3,12 @@ package com.example.service.impl; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.mapper.AccountDetailsMapper; import com.example.mapper.AccountMapper; +import com.example.mapper.AccountPrivacyMapper; import com.example.service.AccountService; import com.example.utils.Const; import com.example.utils.FlowUtils; @@ -45,6 +49,12 @@ public class AccountServiceImpl extends ServiceImpl impl @Resource FlowUtils flow; + @Resource + AccountDetailsMapper detailsMapper; + + @Resource + AccountPrivacyMapper privacyMapper; + /** * 从数据库中通过用户名或邮箱查找用户详细信息 * @param username 用户名 @@ -104,6 +114,10 @@ public class AccountServiceImpl extends ServiceImpl impl return "内部错误,注册失败"; } else { this.deleteEmailVerifyCode(email); + privacyMapper.insert(new AccountPrivacy(account.getId())); + AccountDetails details = new AccountDetails(); + details.setId(account.getId()); + detailsMapper.insert(details); return null; } } diff --git a/my-project-frontend/src/store/index.js b/my-project-frontend/src/store/index.js index 9af6664..4d2765a 100644 --- a/my-project-frontend/src/store/index.js +++ b/my-project-frontend/src/store/index.js @@ -30,6 +30,12 @@ export const useStore = defineStore('general', { return type; } return null + }, + userAvatarUrl(avatar) { + if(avatar) + return `${axios.defaults.baseURL}/images${avatar}` + else + return 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png' } } }) diff --git a/my-project-frontend/src/views/forum/TopicDetail.vue b/my-project-frontend/src/views/forum/TopicDetail.vue index c809576..6746ce8 100644 --- a/my-project-frontend/src/views/forum/TopicDetail.vue +++ b/my-project-frontend/src/views/forum/TopicDetail.vue @@ -100,7 +100,7 @@ function deleteComment(id) {
-
@@ -150,7 +150,7 @@ function deleteComment(id) {
-
diff --git a/my-project-frontend/src/views/forum/TopicList.vue b/my-project-frontend/src/views/forum/TopicList.vue index d6b282c..342c2b5 100644 --- a/my-project-frontend/src/views/forum/TopicList.vue +++ b/my-project-frontend/src/views/forum/TopicList.vue @@ -136,7 +136,7 @@ navigator.geolocation.getCurrentPosition(position => { @click="router.push('/index/post-detail/' + item.id)">
- +
{{item.username}}