用户编辑前端修改等

This commit is contained in:
linfeng 2022-11-04 09:53:00 +08:00
parent 6e14f98912
commit 247ca3e65d
7 changed files with 57 additions and 77 deletions

View File

@ -0,0 +1,21 @@
package io.linfeng.common.utils;
/**
* 对象工具类
* @author linfeng
* @date 2022/11/4 9:49
*/
public class ObjectUtil {
/**
* @Title: isEmpty
* @Description: 判断对象是否为空
* @param obj
* @return
* @return Integer
*/
public static boolean isEmpty(Object obj) {
return null == obj || "".equals(obj);
}
}

View File

@ -74,14 +74,5 @@ public class WechatUtil {
return null; return null;
} }
/**
* @Title: isEmpty
* @Description: 判断对象是否为空
* @param obj
* @return
* @return Integer
*/
public static boolean isEmpty(Object obj) {
return null == obj || "".equals(obj);
}
} }

View File

@ -78,7 +78,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
QueryWrapper<AppUserEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<AppUserEntity> queryWrapper = new QueryWrapper<>();
//模糊查询 //模糊查询
String key = (String) params.get("key"); String key = (String) params.get("key");
if (!WechatUtil.isEmpty(key)) { if (!ObjectUtil.isEmpty(key)) {
params.put("page", "1");//如果是查询分页重置为第一页 params.put("page", "1");//如果是查询分页重置为第一页
queryWrapper.like("username", key).or().like("mobile", key); queryWrapper.like("username", key).or().like("mobile", key);
} }
@ -192,7 +192,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
@Override @Override
public void updateAppUserInfo(AppUserUpdateForm appUserUpdateForm, AppUserEntity user) { public void updateAppUserInfo(AppUserUpdateForm appUserUpdateForm, AppUserEntity user) {
if (!WechatUtil.isEmpty(appUserUpdateForm.getAvatar())) { if (!ObjectUtil.isEmpty(appUserUpdateForm.getAvatar())) {
user.setAvatar(appUserUpdateForm.getAvatar()); user.setAvatar(appUserUpdateForm.getAvatar());
} }
baseMapper.updateById(user); baseMapper.updateById(user);
@ -313,8 +313,6 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
//新注册用户 //新注册用户
AppUserEntity appUser = new AppUserEntity(); AppUserEntity appUser = new AppUserEntity();
appUser.setGender(0); appUser.setGender(0);
// appUser.setAvatar(form.getAvatar());
// appUser.setUsername(form.getUsername());
appUser.setAvatar(Constant.DEAULT_HEAD); appUser.setAvatar(Constant.DEAULT_HEAD);
appUser.setUsername("LF_wx" + RandomUtil.randomNumbers(8)); appUser.setUsername("LF_wx" + RandomUtil.randomNumbers(8));
appUser.setCreateTime(DateUtil.nowDateTime()); appUser.setCreateTime(DateUtil.nowDateTime());

View File

@ -63,11 +63,11 @@ public class PostServiceImpl extends ServiceImpl<PostDao, PostEntity> implements
//条件查询 //条件查询
String key = (String)params.get("key"); String key = (String)params.get("key");
String status = (String)params.get("status"); String status = (String)params.get("status");
if(!WechatUtil.isEmpty(key)){ if(!ObjectUtil.isEmpty(key)){
params.put("page","1");//如果是查询分页重置为第一页 params.put("page","1");//如果是查询分页重置为第一页
queryWrapper.like("content", key).or().like("title",key); queryWrapper.like("content", key).or().like("title",key);
} }
if(!WechatUtil.isEmpty(status)){ if(!ObjectUtil.isEmpty(status)){
params.put("page","1");//如果是查询分页重置为第一页 params.put("page","1");//如果是查询分页重置为第一页
queryWrapper.eq("status", Integer.parseInt(status)); queryWrapper.eq("status", Integer.parseInt(status));
} }

View File

@ -17,13 +17,6 @@
"style": { "style": {
"navigationBarTitleText": "我的" "navigationBarTitleText": "我的"
} }
},
{
"path": "pages/message/message",
"style": {
"enablePullDownRefresh": true,
"navigationBarTitleText": "消息"
}
} }
,{ ,{
"path" : "pages/post/post", "path" : "pages/post/post",

View File

@ -1,22 +0,0 @@
<template>
<view>
消息
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

View File

@ -10,17 +10,16 @@
:disabled="true" 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="showGender = true" :placeholder="userInfo.gender" <u-input @click="showGender = true" :placeholder="userInfo.gender" :disabled="true"
:disabled="true" 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 @click="jump(userInfo.intro,'intro')" :placeholder="userInfo.intro" :disabled="true" <u-input @click="jump(userInfo.intro,'intro')" :placeholder="userInfo.intro" :disabled="true"
input-align="right" /> input-align="right" />
</u-form-item> </u-form-item>
</u-form> </u-form>
</view> </view>
<view> <view class="out-btn">
<u-button :custom-style="btnStyle" @click="outlogin">退出登录</u-button> <u-button :custom-style="btnStyle" @click="outlogin">退出登录</u-button>
</view> </view>
<!-- 性别选择 --> <!-- 性别选择 -->
@ -38,19 +37,18 @@
}, },
form: {}, form: {},
userInfo: {}, userInfo: {},
showGender:false, showGender: false,
gender:[ gender: [{
{ value: 1,
value:1, label: "男"
label:"男"
}, },
{ {
value:2, value: 2,
label:"女" label: "女"
}, },
{ {
value:0, value: 0,
label:"保密" label: "保密"
} }
] ]
}; };
@ -60,29 +58,28 @@
}, },
methods: { methods: {
// //
saveGender(index){ saveGender(index) {
let gender = this.gender[index[0]].value; let gender = index[0].value;
this.$H.post("user/userInfoEdit", { this.$H.post("user/userInfoEdit", {
gender:gender gender: gender
}).then(res => { }).then(res => {
if(res.code == 0){ if (res.code == 0) {
this.userInfo.gender = this.gender[index[0]].lable this.userInfo.gender = index[0].label
} }
}) })
}, },
getUserInfo() { getUserInfo() {
this.$H.get("user/userInfo").then(res => { this.$H.get("user/userInfo").then(res => {
this.userInfo = res.result this.userInfo = res.result
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) {
this.userInfo.gender='女' this.userInfo.gender = '女'
}else{ } else {
this.userInfo.gender='保密' this.userInfo.gender = '保密'
} }
}) })
}, },
jump(value, type) { jump(value, type) {
@ -106,8 +103,8 @@
sourceType: ['album'], sourceType: ['album'],
success: function(res) { success: function(res) {
uni.showLoading({ uni.showLoading({
mask:true, mask: true,
title:"上传头像中" title: "上传头像中"
}) })
uni.uploadFile({ uni.uploadFile({
url: that.$c.domain + 'common/upload', url: that.$c.domain + 'common/upload',
@ -128,9 +125,9 @@
}); });
}, },
updateAvatar(avatar){ updateAvatar(avatar) {
this.$H.post("user/userInfoEdit", { this.$H.post("user/userInfoEdit", {
avatar:avatar avatar: avatar
}).then(res => { }).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.userInfo.avatar = avatar; this.userInfo.avatar = avatar;
@ -146,5 +143,7 @@
background-color: #FFFFFF; background-color: #FFFFFF;
} }
.out-btn {
margin: 40rpx 30rpx;
}
</style> </style>