支持昵称和签名修改&&个人页面样式优化

This commit is contained in:
linfeng 2024-06-17 16:25:07 +08:00
parent da953520cb
commit 9f5a894cd2
5 changed files with 91 additions and 21 deletions

View File

@ -229,6 +229,12 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
if(!ObjectUtil.isEmpty(appUserUpdateForm.getGender())){
user.setGender(appUserUpdateForm.getGender());
}
if(!ObjectUtil.isEmpty(appUserUpdateForm.getUsername())){
user.setUsername(appUserUpdateForm.getUsername());
}
if(!ObjectUtil.isEmpty(appUserUpdateForm.getIntro())){
user.setIntro(appUserUpdateForm.getIntro());
}
baseMapper.updateById(user);
redisUtils.delete(RedisKeys.getUserKey(user.getUid()));
}

View File

@ -15,18 +15,21 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* app用户信息修改
*
*/
@Data
@ApiModel(value = "app用户信息修改")
@ApiModel(value = "app用户信息修改请求体")
public class AppUserUpdateForm {
@ApiModelProperty(value = "头像")
@ApiModelProperty(value = "LF头像")
private String avatar;
@ApiModelProperty(value = "性别")
@ApiModelProperty(value = "LF昵称")
private String username;
@ApiModelProperty(value = "LF个性签名")
private String intro;
@ApiModelProperty(value = "LF性别")
private Integer gender;
}

View File

@ -68,7 +68,7 @@
"path" : "pages/user/edit",
"style" :
{
"navigationBarTitleText": "",
"navigationBarTitleText": "个人信息维护",
"enablePullDownRefresh": false
}

View File

@ -6,19 +6,22 @@
<u-avatar @click="onAvatar" mode="square" slot="right" :src="userInfo.avatar" size="100"></u-avatar>
</u-form-item>
<u-form-item label="昵称" right-icon="arrow-right">
<u-input :placeholder="userInfo.username"
input-align="right" :disabled="true" />
<u-input v-model="username"
input-align="right"/>
</u-form-item>
<u-form-item label="性别" right-icon="arrow-right">
<u-input @click="openGender" :placeholder="userInfo.gender"
input-align="right" />
input-align="right"/>
</u-form-item>
<u-form-item label="个性签名" right-icon="arrow-right">
<u-input :placeholder="userInfo.intro" :disabled="true"
input-align="right" />
<u-input v-model="intro"
input-align="right"/>
</u-form-item>
</u-form>
</view>
<view class="save-btn">
<u-button :custom-style="saveBtnStyle" @click="saveInfo">保存个人信息</u-button>
</view>
<view class="out-btn">
<u-button :custom-style="btnStyle" @click="outlogin">退出登录</u-button>
</view>
@ -31,6 +34,10 @@
export default {
data() {
return {
saveBtnStyle: {
color: "#fff",
backgroundColor: '#8f8fd6'
},
btnStyle: {
color: "#fff",
backgroundColor: '#333333'
@ -50,7 +57,9 @@
value: 0,
label: "保密"
}
]
],
username:"",
intro:""
};
},
onShow(options) {
@ -60,6 +69,24 @@
openGender(){
this.showGender = true
},
saveInfo(){
if (!this.username) {
this.$u.toast('昵称不能为空');
return;
}
if (!this.intro) {
this.$u.toast('个性签名不能为空');
return;
}
this.$H.post("user/userInfoEdit", {
username: this.username,
intro: this.intro
}).then(res => {
if (res.code == 0) {
this.$u.toast('个人信息更新成功');
}
})
},
//
saveGender(index) {
let gender = index[0].value;
@ -68,12 +95,15 @@
}).then(res => {
if (res.code == 0) {
this.userInfo.gender = index[0].label
this.$u.toast('性别更新成功');
}
})
},
getUserInfo() {
this.$H.get("user/userInfo").then(res => {
this.userInfo = res.result
this.username=res.result.username
this.intro=res.result.intro
if (res.result.gender === 1) {
this.userInfo.gender = '男'
} else if (res.result.gender === 2) {
@ -81,8 +111,6 @@
} else {
this.userInfo.gender = '保密'
}
})
},
outlogin() {
@ -140,7 +168,9 @@
padding: 20rpx;
background-color: #FFFFFF;
}
.save-btn {
margin: 40rpx 30rpx;
}
.out-btn {
margin: 40rpx 30rpx;
}

View File

@ -24,19 +24,19 @@
<u-grid :col="4" :border="false" style="margin: 20rpx 0;" @click="toNav">
<u-grid-item index="/pages/my/user?type=2">
<text>{{ userInfo.fans || 0}}</text>
<view class="grid-text">粉丝</view>
<view class="nav-text">粉丝</view>
</u-grid-item>
<u-grid-item index="/pages/my/user?type=1">
<text>{{ userInfo.follow || 0 }}</text>
<view class="grid-text">关注</view>
<view class="nav-text">关注</view>
</u-grid-item>
<u-grid-item index="/pages/my/post?type=2">
<text>{{ userInfo.postNum || 0 }}</text>
<view class="grid-text">帖子</view>
<view class="nav-text">帖子</view>
</u-grid-item>
<u-grid-item index="">
<text>{{ userInfo.integral || 0 }}</text>
<view class="grid-text">积分</view>
<view class="nav-text">积分</view>
</u-grid-item>
</u-grid>
</view>
@ -78,6 +78,15 @@
</u-grid-item>
</u-grid>
</view>
<view @click="commercialLink">
<view class="bottom-info">
林风社交论坛开源版
</view>
<view class="bottom-info-t">
© www.linfengtech.cn
</view>
</view>
<!-- 发贴入口 -->
<add-post-tag></add-post-tag>
</view>
@ -207,6 +216,12 @@
margin-left: 20rpx;
}
.nav-text {
color: #999;
font-size: 14px;
margin-bottom: 20rpx;
}
.grid-text {
color: #999;
font-size: 12px;
@ -275,4 +290,20 @@
padding: 20rpx;
}
}
.bottom-info {
display: flex;
align-items: center;
justify-content: center;
color: #737373;
font-size: 32rpx;
font-weight: 600;
}
.bottom-info-t{
display: flex;
align-items: center;
justify-content: center;
color: #1f1f1f;
font-size: 28rpx;
font-weight: 400;
}
</style>