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

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())){ if(!ObjectUtil.isEmpty(appUserUpdateForm.getGender())){
user.setGender(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); baseMapper.updateById(user);
redisUtils.delete(RedisKeys.getUserKey(user.getUid())); redisUtils.delete(RedisKeys.getUserKey(user.getUid()));
} }

View File

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

View File

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

View File

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

View File

@ -24,19 +24,19 @@
<u-grid :col="4" :border="false" style="margin: 20rpx 0;" @click="toNav"> <u-grid :col="4" :border="false" style="margin: 20rpx 0;" @click="toNav">
<u-grid-item index="/pages/my/user?type=2"> <u-grid-item index="/pages/my/user?type=2">
<text>{{ userInfo.fans || 0}}</text> <text>{{ userInfo.fans || 0}}</text>
<view class="grid-text">粉丝</view> <view class="nav-text">粉丝</view>
</u-grid-item> </u-grid-item>
<u-grid-item index="/pages/my/user?type=1"> <u-grid-item index="/pages/my/user?type=1">
<text>{{ userInfo.follow || 0 }}</text> <text>{{ userInfo.follow || 0 }}</text>
<view class="grid-text">关注</view> <view class="nav-text">关注</view>
</u-grid-item> </u-grid-item>
<u-grid-item index="/pages/my/post?type=2"> <u-grid-item index="/pages/my/post?type=2">
<text>{{ userInfo.postNum || 0 }}</text> <text>{{ userInfo.postNum || 0 }}</text>
<view class="grid-text">帖子</view> <view class="nav-text">帖子</view>
</u-grid-item> </u-grid-item>
<u-grid-item index=""> <u-grid-item index="">
<text>{{ userInfo.integral || 0 }}</text> <text>{{ userInfo.integral || 0 }}</text>
<view class="grid-text">积分</view> <view class="nav-text">积分</view>
</u-grid-item> </u-grid-item>
</u-grid> </u-grid>
</view> </view>
@ -78,6 +78,15 @@
</u-grid-item> </u-grid-item>
</u-grid> </u-grid>
</view> </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> <add-post-tag></add-post-tag>
</view> </view>
@ -207,6 +216,12 @@
margin-left: 20rpx; margin-left: 20rpx;
} }
.nav-text {
color: #999;
font-size: 14px;
margin-bottom: 20rpx;
}
.grid-text { .grid-text {
color: #999; color: #999;
font-size: 12px; font-size: 12px;
@ -275,4 +290,20 @@
padding: 20rpx; 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> </style>