diff --git a/im-platform/src/main/java/com/lx/implatform/controller/FileController.java b/im-platform/src/main/java/com/lx/implatform/controller/FileController.java index 13b4be6..5706e07 100644 --- a/im-platform/src/main/java/com/lx/implatform/controller/FileController.java +++ b/im-platform/src/main/java/com/lx/implatform/controller/FileController.java @@ -3,6 +3,7 @@ package com.lx.implatform.controller; import com.lx.common.result.Result; import com.lx.common.result.ResultUtils; import com.lx.implatform.service.thirdparty.FileService; +import com.lx.implatform.vo.UploadImageVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; @@ -28,15 +29,10 @@ public class FileController { @ApiOperation(value = "上传图片",notes="上传图片") @PostMapping("/image/upload") - public Result upload(MultipartFile file) { + public Result upload(MultipartFile file) { return ResultUtils.success(fileService.uploadImage(file)); } - @GetMapping("/online") - @ApiOperation(value = "查找用户",notes="根据昵称查找用户") - public Result checkOnline(){ - return ResultUtils.success(""); - } } \ No newline at end of file diff --git a/im-platform/src/main/java/com/lx/implatform/controller/FriendsController.java b/im-platform/src/main/java/com/lx/implatform/controller/FriendsController.java index dbb2c64..7cc302a 100644 --- a/im-platform/src/main/java/com/lx/implatform/controller/FriendsController.java +++ b/im-platform/src/main/java/com/lx/implatform/controller/FriendsController.java @@ -13,6 +13,7 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.validation.Valid; import javax.validation.constraints.NotEmpty; import java.util.List; import java.util.stream.Collectors; @@ -27,7 +28,7 @@ public class FriendsController { @GetMapping("/list") @ApiOperation(value = "好友列表",notes="获取好友列表") - public Result findFriends(){ + public Result< List> findFriends(){ List friendsList = friendsService.findFriendsByUserId(SessionContext.getSession().getId()); List vos = friendsList.stream().map(f->{ FriendsVO vo = BeanUtils.copyProperties(f,FriendsVO.class); @@ -52,6 +53,12 @@ public class FriendsController { return ResultUtils.success(); } + @PutMapping("/update") + @ApiOperation(value = "更新好友信息",notes="更新好友头像或昵称") + public Result delFriends(@Valid @RequestBody FriendsVO vo){ + friendsService.update(vo); + return ResultUtils.success(); + } } diff --git a/im-platform/src/main/java/com/lx/implatform/controller/UserController.java b/im-platform/src/main/java/com/lx/implatform/controller/UserController.java index 8896ea5..9154ad7 100644 --- a/im-platform/src/main/java/com/lx/implatform/controller/UserController.java +++ b/im-platform/src/main/java/com/lx/implatform/controller/UserController.java @@ -14,6 +14,7 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.validation.Valid; import javax.validation.constraints.NotEmpty; import java.util.List; @@ -52,6 +53,15 @@ public class UserController { return ResultUtils.success(userVO); } + @PutMapping("/update") + @ApiOperation(value = "修改用户信息",notes="修改用户信息,仅允许修改登录用户信息") + public Result update(@Valid @RequestBody UserVO vo){ + userService.update(vo); + return ResultUtils.success(); + } + + + @GetMapping("/findByNickName") @ApiOperation(value = "查找用户",notes="根据昵称查找用户") diff --git a/im-platform/src/main/java/com/lx/implatform/entity/User.java b/im-platform/src/main/java/com/lx/implatform/entity/User.java index 7902f7c..5a8f613 100644 --- a/im-platform/src/main/java/com/lx/implatform/entity/User.java +++ b/im-platform/src/main/java/com/lx/implatform/entity/User.java @@ -45,11 +45,29 @@ public class User extends Model { private String nickName; /** - * 用户名 + * 性别 + */ + @TableField("sex") + private Integer sex; + + /** + * 头像 */ @TableField("head_image") private String headImage; + /** + * 头像缩略图 + */ + @TableField("head_image_thumb") + private String headImageThumb; + + + /** + * 个性签名 + */ + @TableField("signature") + private String signature; /** * 密码(明文) */ diff --git a/im-platform/src/main/java/com/lx/implatform/service/IFriendsService.java b/im-platform/src/main/java/com/lx/implatform/service/IFriendsService.java index d8d4a3e..52b0676 100644 --- a/im-platform/src/main/java/com/lx/implatform/service/IFriendsService.java +++ b/im-platform/src/main/java/com/lx/implatform/service/IFriendsService.java @@ -2,6 +2,7 @@ package com.lx.implatform.service; import com.baomidou.mybatisplus.extension.service.IService; import com.lx.implatform.entity.Friends; +import com.lx.implatform.vo.FriendsVO; import java.util.List; @@ -23,4 +24,6 @@ public interface IFriendsService extends IService { void delFriends(long friendId); + void update(FriendsVO vo); + } diff --git a/im-platform/src/main/java/com/lx/implatform/service/IUserService.java b/im-platform/src/main/java/com/lx/implatform/service/IUserService.java index 516ab61..07c74af 100644 --- a/im-platform/src/main/java/com/lx/implatform/service/IUserService.java +++ b/im-platform/src/main/java/com/lx/implatform/service/IUserService.java @@ -21,6 +21,8 @@ public interface IUserService extends IService { User findUserByName(String username); + void update(UserVO vo); + List findUserByNickName(String nickname); List checkOnline(String userIds); diff --git a/im-platform/src/main/java/com/lx/implatform/service/impl/FriendsServiceImpl.java b/im-platform/src/main/java/com/lx/implatform/service/impl/FriendsServiceImpl.java index 2185a8c..71d01a1 100644 --- a/im-platform/src/main/java/com/lx/implatform/service/impl/FriendsServiceImpl.java +++ b/im-platform/src/main/java/com/lx/implatform/service/impl/FriendsServiceImpl.java @@ -10,6 +10,7 @@ import com.lx.implatform.mapper.FriendsMapper; import com.lx.implatform.service.IFriendsService; import com.lx.implatform.service.IUserService; import com.lx.implatform.session.SessionContext; +import com.lx.implatform.vo.FriendsVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -72,6 +73,25 @@ public class FriendsServiceImpl extends ServiceImpl impl return this.count(queryWrapper) > 0; } + + @Override + public void update(FriendsVO vo) { + long userId = SessionContext.getSession().getId(); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda() + .eq(Friends::getUserId,userId) + .eq(Friends::getFriendId,vo.getFriendId()); + + Friends f = this.getOne(queryWrapper); + if(f == null){ + throw new GlobalException(ResultCode.PROGRAM_ERROR,"对方不是您的好友"); + } + + f.setFriendHeadImage(vo.getFriendHeadImage()); + f.setFriendNickName(vo.getFriendNickName()); + this.updateById(f); + } + private void bindFriends(long userId, long friendsId) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.lambda() diff --git a/im-platform/src/main/java/com/lx/implatform/service/impl/UserServiceImpl.java b/im-platform/src/main/java/com/lx/implatform/service/impl/UserServiceImpl.java index e40c332..5f33202 100644 --- a/im-platform/src/main/java/com/lx/implatform/service/impl/UserServiceImpl.java +++ b/im-platform/src/main/java/com/lx/implatform/service/impl/UserServiceImpl.java @@ -9,6 +9,8 @@ import com.lx.implatform.entity.User; import com.lx.implatform.exception.GlobalException; import com.lx.implatform.mapper.UserMapper; import com.lx.implatform.service.IUserService; +import com.lx.implatform.session.SessionContext; +import com.lx.implatform.session.UserSession; import com.lx.implatform.vo.RegisterVO; import com.lx.implatform.vo.UserVO; import org.apache.commons.lang3.StringUtils; @@ -57,6 +59,25 @@ public class UserServiceImpl extends ServiceImpl implements IU } + @Override + public void update(UserVO vo) { + UserSession session = SessionContext.getSession(); + if(session.getId() != vo.getId()){ + throw new GlobalException(ResultCode.PROGRAM_ERROR,"不允许修改其他用户的信息!"); + } + User user = this.getById(vo.getId()); + if(null == user){ + throw new GlobalException(ResultCode.PROGRAM_ERROR,"用户不存在"); + } + + user.setNickName(vo.getNickName()); + user.setSex(vo.getSex()); + user.setSignature(vo.getSignature()); + user.setHeadImage(vo.getHeadImage()); + user.setHeadImageThumb(vo.getHeadImageThumb()); + this.updateById(user); + } + @Override public List findUserByNickName(String nickname) { QueryWrapper queryWrapper = new QueryWrapper<>(); @@ -69,7 +90,6 @@ public class UserServiceImpl extends ServiceImpl implements IU vo.setOnline(isOnline(u.getId())); return vo; }).collect(Collectors.toList()); - return vos; } diff --git a/im-platform/src/main/java/com/lx/implatform/service/thirdparty/FileService.java b/im-platform/src/main/java/com/lx/implatform/service/thirdparty/FileService.java index a727324..a34a0d3 100644 --- a/im-platform/src/main/java/com/lx/implatform/service/thirdparty/FileService.java +++ b/im-platform/src/main/java/com/lx/implatform/service/thirdparty/FileService.java @@ -2,11 +2,14 @@ package com.lx.implatform.service.thirdparty; import com.lx.common.enums.FileTypeEnum; import com.lx.common.enums.ResultCode; +import com.lx.implatform.util.FileUtil; import com.lx.implatform.exception.GlobalException; +import com.lx.implatform.util.FileUtil; import com.lx.implatform.util.ImageUtil; import com.lx.implatform.util.MinioUtil; import com.lx.implatform.vo.UploadImageVO; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -47,14 +50,24 @@ public class FileService { public UploadImageVO uploadImage(MultipartFile file){ try { + // 图片格式校验 + if(!FileUtil.isImage(file.getOriginalFilename())){ + throw new GlobalException(ResultCode.PROGRAM_ERROR,"图片格式不合法"); + } + // 上传原图 UploadImageVO vo = new UploadImageVO(); - String fileName = minioUtil.upload(bucketName,imagePath,file); + if(StringUtils.isEmpty(fileName)){ + throw new GlobalException(ResultCode.PROGRAM_ERROR,"图片上传失败"); + } vo.setOriginUrl(generUrl(FileTypeEnum.IMAGE,fileName)); // 上传缩略图 byte[] imageByte = ImageUtil.compressForScale(file.getBytes(),100); fileName = minioUtil.upload(bucketName,imagePath,file.getOriginalFilename(),imageByte,file.getContentType()); - vo.setCompressUrl(generUrl(FileTypeEnum.IMAGE,fileName)); + if(StringUtils.isEmpty(fileName)){ + throw new GlobalException(ResultCode.PROGRAM_ERROR,"图片上传失败"); + } + vo.setThumbUrl(generUrl(FileTypeEnum.IMAGE,fileName)); return vo; } catch (IOException e) { log.error("上传图片失败,{}",e.getMessage(),e); diff --git a/im-platform/src/main/java/com/lx/implatform/util/FileUtil.java b/im-platform/src/main/java/com/lx/implatform/util/FileUtil.java new file mode 100644 index 0000000..d9e7184 --- /dev/null +++ b/im-platform/src/main/java/com/lx/implatform/util/FileUtil.java @@ -0,0 +1,33 @@ +package com.lx.implatform.util; + +public class FileUtil { + + /** + * 获取文件后缀 + * + * @param fileName 文件名 + * @return boolean + */ + public static String getFileExtension(String fileName) { + String extension = fileName.substring(fileName.lastIndexOf(".") + 1); + return extension; + } + + /** + * 判断文件是否图片类型 + * + * @param fileName 文件名 + * @return boolean + */ + public static boolean isImage(String fileName) { + String extension = getFileExtension(fileName); + String[] imageExtension = new String[]{"jpeg", "jpg", "bmp", "png"}; + for (String e : imageExtension){ + if (extension.toLowerCase().equals(e)) { + return true; + } + } + + return false; + } +} diff --git a/im-platform/src/main/java/com/lx/implatform/util/ImageUtil.java b/im-platform/src/main/java/com/lx/implatform/util/ImageUtil.java index a942c56..140bdad 100644 --- a/im-platform/src/main/java/com/lx/implatform/util/ImageUtil.java +++ b/im-platform/src/main/java/com/lx/implatform/util/ImageUtil.java @@ -52,6 +52,9 @@ public class ImageUtil { return imageBytes; } + + + /** * 自动调节精度(经验数值) * diff --git a/im-platform/src/main/java/com/lx/implatform/util/MinioUtil.java b/im-platform/src/main/java/com/lx/implatform/util/MinioUtil.java index 2de97d9..5ce0d65 100644 --- a/im-platform/src/main/java/com/lx/implatform/util/MinioUtil.java +++ b/im-platform/src/main/java/com/lx/implatform/util/MinioUtil.java @@ -3,6 +3,7 @@ package com.lx.implatform.util; import com.lx.common.util.DateTimeUtils; import io.minio.*; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -12,6 +13,7 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.Date; +@Slf4j @Component public class MinioUtil { @@ -28,7 +30,7 @@ public class MinioUtil { try { found = minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build()); } catch (Exception e) { - e.printStackTrace(); + log.error("查询bucket失败",e); return false; } return found; @@ -44,7 +46,7 @@ public class MinioUtil { .bucket(bucketName) .build()); } catch (Exception e) { - e.printStackTrace(); + log.error("创建bucket失败,",e); return false; } return true; @@ -60,7 +62,7 @@ public class MinioUtil { .bucket(bucketName) .build()); } catch (Exception e) { - e.printStackTrace(); + log.error("删除bucket失败,",e); return false; } return true; @@ -87,7 +89,7 @@ public class MinioUtil { //文件名称相同会覆盖 minioClient.putObject(objectArgs); } catch (Exception e) { - e.printStackTrace(); + log.error("上传图片失败,",e); return null; } return objectName; @@ -113,7 +115,7 @@ public class MinioUtil { //文件名称相同会覆盖 minioClient.putObject(objectArgs); } catch (Exception e) { - e.printStackTrace(); + log.error("上传图片失败,",e); return null; } return objectName; @@ -132,6 +134,7 @@ public class MinioUtil { try { minioClient.removeObject( RemoveObjectArgs.builder().bucket(bucketName).object(path+fileName).build()); }catch (Exception e){ + log.error("删除图片失败,",e); return false; } return true; diff --git a/im-platform/src/main/java/com/lx/implatform/vo/FriendsVO.java b/im-platform/src/main/java/com/lx/implatform/vo/FriendsVO.java index 193bb82..b9049f4 100644 --- a/im-platform/src/main/java/com/lx/implatform/vo/FriendsVO.java +++ b/im-platform/src/main/java/com/lx/implatform/vo/FriendsVO.java @@ -5,18 +5,21 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import javax.validation.constraints.NotNull; + @Data @ApiModel("好友信息VO") public class FriendsVO { + @NotNull(message = "好友id不可为空") @ApiModelProperty(value = "好友id") private Long friendId; - - @ApiModelProperty(value = "用户昵称") + @NotNull(message = "好友昵称不可为空") + @ApiModelProperty(value = "好友昵称") private String friendNickName; - @ApiModelProperty(value = "用户头像") + @ApiModelProperty(value = "好友头像") private String friendHeadImage; } diff --git a/im-platform/src/main/java/com/lx/implatform/vo/RegisterVO.java b/im-platform/src/main/java/com/lx/implatform/vo/RegisterVO.java index 1f43a8b..27faf82 100644 --- a/im-platform/src/main/java/com/lx/implatform/vo/RegisterVO.java +++ b/im-platform/src/main/java/com/lx/implatform/vo/RegisterVO.java @@ -3,6 +3,7 @@ package com.lx.implatform.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.hibernate.validator.constraints.Length; import javax.validation.constraints.NotEmpty; @@ -10,14 +11,17 @@ import javax.validation.constraints.NotEmpty; @ApiModel("用户注册VO") public class RegisterVO { + @Length(max = 64,message = "用户名不能大于64字符") @NotEmpty(message="用户名不可为空") @ApiModelProperty(value = "用户名") private String userName; + @Length(min=5,max = 20,message = "密码长度必须在5-20个字符之间") @NotEmpty(message="用户密码不可为空") @ApiModelProperty(value = "用户密码") private String password; + @Length(max = 64,message = "昵称不能大于64字符") @NotEmpty(message="用户昵称不可为空") @ApiModelProperty(value = "用户昵称") private String nickName; diff --git a/im-platform/src/main/java/com/lx/implatform/vo/SingleMessageVO.java b/im-platform/src/main/java/com/lx/implatform/vo/SingleMessageVO.java index a0d9f56..554d2d5 100644 --- a/im-platform/src/main/java/com/lx/implatform/vo/SingleMessageVO.java +++ b/im-platform/src/main/java/com/lx/implatform/vo/SingleMessageVO.java @@ -4,6 +4,7 @@ package com.lx.implatform.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.hibernate.validator.constraints.Length; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; @@ -18,6 +19,7 @@ public class SingleMessageVO { private Long recvUserId; + @Length(max=1024,message = "内容长度不得大于1024") @NotEmpty(message="发送内容不可为空") @ApiModelProperty(value = "发送内容") private String content; diff --git a/im-platform/src/main/java/com/lx/implatform/vo/UnfriendsUserVO.java b/im-platform/src/main/java/com/lx/implatform/vo/UnfriendsUserVO.java deleted file mode 100644 index 71f59cd..0000000 --- a/im-platform/src/main/java/com/lx/implatform/vo/UnfriendsUserVO.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.lx.implatform.vo; - - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -@ApiModel("非好友用户信息VO") -public class UnfriendsUserVO { - - @ApiModelProperty(value = "id") - private Long id; - - @ApiModelProperty(value = "用户名") - private String userName; - - @ApiModelProperty(value = "用户昵称") - private String nickName; - - @ApiModelProperty(value = "头像") - private String headImage; - - @ApiModelProperty(value = "是否已是好友") - private Boolean isFriend; - -} diff --git a/im-platform/src/main/java/com/lx/implatform/vo/UploadImageVO.java b/im-platform/src/main/java/com/lx/implatform/vo/UploadImageVO.java index 40fd3ee..1234fbc 100644 --- a/im-platform/src/main/java/com/lx/implatform/vo/UploadImageVO.java +++ b/im-platform/src/main/java/com/lx/implatform/vo/UploadImageVO.java @@ -12,5 +12,5 @@ public class UploadImageVO { private String originUrl; @ApiModelProperty(value = "缩略图") - private String compressUrl; + private String thumbUrl; } diff --git a/im-platform/src/main/java/com/lx/implatform/vo/UserVO.java b/im-platform/src/main/java/com/lx/implatform/vo/UserVO.java index c41e715..d32a9b3 100644 --- a/im-platform/src/main/java/com/lx/implatform/vo/UserVO.java +++ b/im-platform/src/main/java/com/lx/implatform/vo/UserVO.java @@ -4,23 +4,43 @@ package com.lx.implatform.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; @Data @ApiModel("用户信息VO") public class UserVO { + @NotNull(message = "用户id不能为空") @ApiModelProperty(value = "id") private Long id; + @NotEmpty(message = "用户名不能为空") + @Length(max = 64,message = "用户名不能大于64字符") @ApiModelProperty(value = "用户名") private String userName; + @NotEmpty(message = "用户昵称不能为空") + @Length(max = 64,message = "昵称不能大于64字符") @ApiModelProperty(value = "用户昵称") private String nickName; + @ApiModelProperty(value = "性别") + private Integer sex; + + @Length(max = 64,message = "个性签名不能大于1024个字符") + @ApiModelProperty(value = "个性签名") + private String signature; + @ApiModelProperty(value = "头像") private String headImage; + @ApiModelProperty(value = "头像缩略图") + private String headImageThumb; + + @ApiModelProperty(value = "是否在线") private Boolean online; diff --git a/im-platform/src/main/resources/application.yml b/im-platform/src/main/resources/application.yml index 3ab7486..ab7dbd8 100644 --- a/im-platform/src/main/resources/application.yml +++ b/im-platform/src/main/resources/application.yml @@ -5,7 +5,7 @@ server: spring: datasource: driver-class-name: com.mysql.jdbc.Driver - url: jdbc:mysql://localhost:3306/lx-im?useUnicode=true&characterEncoding=utf-8 + url: jdbc:mysql://localhost:3306/simple-im?useUnicode=true&characterEncoding=utf-8 username: root password: root diff --git a/im-platform/src/main/resources/db/db.sql b/im-platform/src/main/resources/db/db.sql index 69045f7..d35ed63 100644 --- a/im-platform/src/main/resources/db/db.sql +++ b/im-platform/src/main/resources/db/db.sql @@ -4,7 +4,10 @@ create table `user`( `user_name` varchar(255) not null comment '用户名', `nick_name` varchar(255) not null comment '用户昵称', `head_image` varchar(255) default '' comment '用户头像', + `head_image_thumb` varchar(255) default '' comment '用户头像缩略图', `password` varchar(255) not null comment '密码(明文)', + `sex` tinyint(1) default 0 comment '性别 0:男 1::女', + `signature` varchar(1024) not null comment '个性签名', `last_login_time` datetime DEFAULT null comment '最后登录时间', `created_time` datetime DEFAULT CURRENT_TIMESTAMP comment '创建时间', unique key `idx_user_name`(user_name), diff --git a/im-ui/src/App.vue b/im-ui/src/App.vue index 55ef82f..cf15607 100644 --- a/im-ui/src/App.vue +++ b/im-ui/src/App.vue @@ -21,7 +21,6 @@ export default { font-family: 'Avenir', Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; - text-align: center; color: #2c3e50; position: absolute; height: 100%; diff --git a/im-ui/src/components/ChatItem.vue b/im-ui/src/components/ChatItem.vue index 0d0b50f..27993b2 100644 --- a/im-ui/src/components/ChatItem.vue +++ b/im-ui/src/components/ChatItem.vue @@ -47,6 +47,7 @@ } }, methods: { + onClickClose(){ this.$emit("del"); } diff --git a/im-ui/src/components/ChatTime.vue b/im-ui/src/components/ChatTime.vue index 60ec149..8519cce 100644 --- a/im-ui/src/components/ChatTime.vue +++ b/im-ui/src/components/ChatTime.vue @@ -21,9 +21,9 @@ let curTime = new Date(); let dayDiff =curTime.getDate() - time.getDate() ; if (time.getDate() === new Date().getDate()) { - strtime = time.getHours() < 9 ? "0" + time.getHours() : time.getHours(); + strtime = time.getHours() <= 9 ? "0" + time.getHours() : time.getHours(); strtime += ":" - strtime += time.getMinutes() < 9 ? "0" + time.getMinutes() : time.getMinutes(); + strtime += time.getMinutes() <= 9 ? "0" + time.getMinutes() : time.getMinutes(); } else if (dayDiff === 1) { strtime = "昨天"; } else if (dayDiff < 7) { diff --git a/im-ui/src/components/FriendsItem.vue b/im-ui/src/components/FriendsItem.vue index 3194296..16ae935 100644 --- a/im-ui/src/components/FriendsItem.vue +++ b/im-ui/src/components/FriendsItem.vue @@ -1,7 +1,7 @@