Browse Source

细节优化

master
xsx 11 months ago
parent
commit
10e1081341
  1. 4
      im-platform/src/main/java/com/bx/implatform/dto/RegisterDTO.java
  2. 12
      im-uniapp/components/chat-at-box/chat-at-box.vue
  3. 3
      im-uniapp/components/friend-item/friend-item.vue
  4. 29
      im-uniapp/im.scss
  5. 13
      im-uniapp/pages/chat/chat-box.vue
  6. 37
      im-uniapp/pages/group/group-invite.vue
  7. 6
      im-uniapp/pages/mine/mine-password.vue
  8. 8
      im-uniapp/pages/register/register.vue
  9. 8
      im-web/src/components/chat/ChatBox.vue
  10. 2
      im-web/src/components/chat/ChatMessageItem.vue
  11. 2
      im-web/src/components/setting/Setting.vue
  12. 2
      im-web/src/view/Group.vue
  13. 8
      im-web/src/view/Register.vue

4
im-platform/src/main/java/com/bx/implatform/dto/RegisterDTO.java

@ -9,7 +9,7 @@ import org.hibernate.validator.constraints.Length;
@Schema(description = "用户注册DTO") @Schema(description = "用户注册DTO")
public class RegisterDTO { public class RegisterDTO {
@Length(max = 64, message = "用户名不能大于64字符") @Length(max = 20, message = "用户名不能大于20字符")
@NotEmpty(message = "用户名不可为空") @NotEmpty(message = "用户名不可为空")
@Schema(description = "用户名") @Schema(description = "用户名")
private String userName; private String userName;
@ -19,7 +19,7 @@ public class RegisterDTO {
@Schema(description = "用户密码") @Schema(description = "用户密码")
private String password; private String password;
@Length(max = 64, message = "昵称不能大于64字符") @Length(max = 20, message = "昵称不能大于20字符")
@NotEmpty(message = "用户昵称不可为空") @NotEmpty(message = "用户昵称不可为空")
@Schema(description = "用户昵称") @Schema(description = "用户昵称")
private String nickName; private String nickName;

12
im-uniapp/components/chat-at-box/chat-at-box.vue

@ -20,10 +20,12 @@
<view class="member-items"> <view class="member-items">
<virtual-scroller :items="memberItems"> <virtual-scroller :items="memberItems">
<template v-slot="{ item }"> <template v-slot="{ item }">
<view class="member-item" :class="{ checked: item.checked }" @click="onSwitchChecked(item)"> <view class="member-item" @click="onSwitchChecked(item)">
<head-image :name="item.showNickName" :online="item.online" :url="item.headImage" <head-image :name="item.showNickName" :online="item.online" :url="item.headImage"
size="small"></head-image> size="small"></head-image>
<view class="member-name">{{ item.showNickName }}</view> <view class="member-name">{{ item.showNickName }}</view>
<radio :checked="item.checked" :disabled="item.locked"
@click.stop="onSwitchChecked(item)" />
</view> </view>
</template> </template>
</virtual-scroller> </virtual-scroller>
@ -152,11 +154,11 @@ export default {
background-color: white; background-color: white;
white-space: nowrap; white-space: nowrap;
margin-bottom: 1px; margin-bottom: 1px;
&.checked { &:hover {
background-color: $im-color-primary-light-9; background-color: $im-bg-active;
} }
.member-name { .member-name {
flex: 1; flex: 1;
padding-left: 20rpx; padding-left: 20rpx;

3
im-uniapp/components/friend-item/friend-item.vue

@ -7,6 +7,7 @@
<image v-show="friend.onlineWeb" class="online" src="/static/image/online_web.png" title="电脑设备在线" /> <image v-show="friend.onlineWeb" class="online" src="/static/image/online_web.png" title="电脑设备在线" />
<image v-show="friend.onlineApp" class="online" src="/static/image/online_app.png" title="移动设备在线" /> <image v-show="friend.onlineApp" class="online" src="/static/image/online_app.png" title="移动设备在线" />
</view> </view>
<slot></slot>
</view> </view>
</view> </view>
</template> </template>
@ -51,11 +52,11 @@ export default {
.friend-info { .friend-info {
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column;
padding-left: 20rpx; padding-left: 20rpx;
text-align: left; text-align: left;
.friend-name { .friend-name {
flex: 1;
font-size: $im-font-size; font-size: $im-font-size;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;

29
im-uniapp/im.scss

@ -102,9 +102,34 @@ button[size='mini'] {
} }
} }
.uni-radio-input svg{
border-color: white !important;
background-color: $im-color-primary !important;
}
.uni-radio-input svg {
background-color: $im-color-primary !important;
border-color: $im-color-primary !important;
background-clip: content-box !important;
box-sizing: border-box;
border-radius: 50%;
transform: translate(-50%, -50%) scale(0.7)!important;
}
.uni-radio-input svg path{
fill: $im-color-primary !important;
}
.uni-radio-input { .uni-radio-input {
//border-color: $im-color-primary !important; background-color: white !important;
//background-color: $im-color-primary !important; border-color: $im-color-primary !important;
}
.uni-radio-input-disabled {
background-color: rgb(225, 225, 225) !important;
border-color: rgb(209, 209, 209) !important;
opacity: 0.5;
} }
.uni-section__content-title { .uni-section__content-title {

13
im-uniapp/pages/chat/chat-box.vue

@ -1,5 +1,5 @@
<template> <template>
<view class="page chat-box"> <view class="page chat-box" id="chatBox">
<nav-bar back more @more="onShowMore">{{ title }}</nav-bar> <nav-bar back more @more="onShowMore">{{ title }}</nav-bar>
<view class="chat-main-box" :style="{height: chatMainHeight+'px'}"> <view class="chat-main-box" :style="{height: chatMainHeight+'px'}">
<view class="chat-msg" @click="switchChatTabBox('none')"> <view class="chat-msg" @click="switchChatTabBox('none')">
@ -17,7 +17,7 @@
</scroll-view> </scroll-view>
</view> </view>
<view v-if="atUserIds.length > 0" class="chat-at-bar" @click="openAtBox()"> <view v-if="atUserIds.length > 0" class="chat-at-bar" @click="openAtBox()">
<view class="iconfont icon-at">:&nbsp;</view> <view class="iconfont icon-at">&nbsp;</view>
<scroll-view v-if="atUserIds.length > 0" class="chat-at-scroll-box" scroll-x="true" scroll-left="120"> <scroll-view v-if="atUserIds.length > 0" class="chat-at-scroll-box" scroll-x="true" scroll-left="120">
<view class="chat-at-items"> <view class="chat-at-items">
<view v-for="m in atUserItems" class="chat-at-item" :key="m.userId"> <view v-for="m in atUserItems" class="chat-at-item" :key="m.userId">
@ -809,7 +809,7 @@ export default {
if (window.visualViewport && uni.getSystemInfoSync().platform == 'ios') { if (window.visualViewport && uni.getSystemInfoSync().platform == 'ios') {
keyboardHeight = this.initHeight - window.visualViewport.height; keyboardHeight = this.initHeight - window.visualViewport.height;
} }
console.log("resizeListener:",window.visualViewport.height) console.log("resizeListener:", window.visualViewport.height)
this.isShowKeyBoard = keyboardHeight > 150; this.isShowKeyBoard = keyboardHeight > 150;
if (this.isShowKeyBoard) { if (this.isShowKeyBoard) {
this.keyboardHeight = keyboardHeight; this.keyboardHeight = keyboardHeight;
@ -950,11 +950,12 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.windowHeight = uni.getSystemInfoSync().windowHeight; this.windowHeight = uni.getSystemInfoSync().windowHeight;
this.reCalChatMainHeight() this.reCalChatMainHeight()
// ios h5:
// #ifdef H5 // #ifdef H5
this.initHeight = window.innerHeight; this.initHeight = window.innerHeight;
document.body.addEventListener('touchmove', function(e) { // iosh5:
e.preventDefault(); const chatBox = document.getElementById('chatBox')
chatBox.addEventListener('touchmove', e => {
e.preventDefault()
}, { passive: false }); }, { passive: false });
// #endif // #endif
}); });

37
im-uniapp/pages/group/group-invite.vue

@ -1,5 +1,6 @@
<template> <template>
<view class="page group-invite"> <view class="page group-invite">
<nav-bar back>邀请</nav-bar>
<view class="nav-bar"> <view class="nav-bar">
<view class="nav-search"> <view class="nav-search">
<uni-search-bar v-model="searchText" radius="100" cancelButton="none" <uni-search-bar v-model="searchText" radius="100" cancelButton="none"
@ -7,20 +8,18 @@
</view> </view>
</view> </view>
<view class="friend-items"> <view class="friend-items">
<scroll-view class="scroll-bar" scroll-with-animation="true" scroll-y="true"> <virtual-scroller height="100%" :items="showFriends">
<view v-for="friend in friendItems" :key="friend.id"> <template v-slot="{ item }">
<view v-show="!searchText || friend.nickName.includes(searchText)" class="friend-item" <friend-item :friend="item" :detail="false" @tap="onSwitchChecked(item)">
@click="onSwitchChecked(friend)" <radio @click.stop="onSwitchChecked(item)" :disabled="item.disabled" :checked="item.checked" />
:class="{ checked: friend.checked, disabled: friend.disabled }"> </friend-item>
<head-image :name="friend.nickName" :online="friend.online" </template>
:url="friend.headImage"></head-image> </virtual-scroller>
<view class="friend-name">{{ friend.nickName }}</view> </view>
</view> <view class="btn-bar">
</view> <button class="btn" type="primary" :disabled="inviteSize == 0"
</scroll-view> @click="onInviteFriends()">邀请({{ inviteSize }}) </button>
</view> </view>
<button class="bottom-btn" type="primary" :disabled="inviteSize == 0"
@click="onInviteFriends()">邀请({{ inviteSize }}) </button>
</view> </view>
</template> </template>
@ -108,6 +107,9 @@ export default {
computed: { computed: {
inviteSize() { inviteSize() {
return this.friendItems.filter(f => !f.disabled && f.checked).length; return this.friendItems.filter(f => !f.disabled && f.checked).length;
},
showFriends() {
return this.friendItems.filter(f => f.nickName.includes(this.searchText))
} }
}, },
onLoad(options) { onLoad(options) {
@ -161,5 +163,14 @@ export default {
height: 100%; height: 100%;
} }
} }
.btn-bar {
position: fixed;
bottom: 0;
background: $im-bg;
padding: 30rpx;
box-sizing: border-box;
width: 100%;
}
} }
</style> </style>

6
im-uniapp/pages/mine/mine-password.vue

@ -4,13 +4,13 @@
<uni-card :is-shadow="false" is-full :border="false"> <uni-card :is-shadow="false" is-full :border="false">
<uni-forms ref="form" :modelValue="formData" label-position="top" label-width="100%"> <uni-forms ref="form" :modelValue="formData" label-position="top" label-width="100%">
<uni-forms-item label="原密码" name="oldPassword"> <uni-forms-item label="原密码" name="oldPassword">
<uni-easyinput type="password" v-model="formData.oldPassword" /> <uni-easyinput type="password" v-model="formData.oldPassword" maxlength="20"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="新密码" name="newPassword"> <uni-forms-item label="新密码" name="newPassword">
<uni-easyinput type="password" v-model="formData.newPassword" /> <uni-easyinput type="password" v-model="formData.newPassword" maxlength="20"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="确认密码" name="confirmPassword"> <uni-forms-item label="确认密码" name="confirmPassword">
<uni-easyinput type="password" v-model="formData.confirmPassword" /> <uni-easyinput type="password" v-model="formData.confirmPassword" maxlength="20"/>
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
</uni-card> </uni-card>

8
im-uniapp/pages/register/register.vue

@ -4,16 +4,16 @@
<view class="form"> <view class="form">
<uni-forms ref="form" :modelValue="dataForm" :rules="rules" validate-trigger="bind" label-width="80px"> <uni-forms ref="form" :modelValue="dataForm" :rules="rules" validate-trigger="bind" label-width="80px">
<uni-forms-item name="userName" label="用户名"> <uni-forms-item name="userName" label="用户名">
<uni-easyinput type="text" v-model="dataForm.userName" placeholder="用户名" /> <uni-easyinput type="text" v-model="dataForm.userName" placeholder="用户名" maxlength="20"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item name="nickName" label="昵称"> <uni-forms-item name="nickName" label="昵称">
<uni-easyinput type="text" v-model="dataForm.nickName" placeholder="昵称" /> <uni-easyinput type="text" v-model="dataForm.nickName" placeholder="昵称" maxlength="20"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item name="password" label="密码"> <uni-forms-item name="password" label="密码">
<uni-easyinput type="password" v-model="dataForm.password" placeholder="密码" /> <uni-easyinput type="password" v-model="dataForm.password" placeholder="密码" maxlength="20"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item name="corfirmPassword" label="确认密码"> <uni-forms-item name="corfirmPassword" label="确认密码">
<uni-easyinput type="password" v-model="dataForm.corfirmPassword" placeholder="确认密码" /> <uni-easyinput type="password" v-model="dataForm.corfirmPassword" placeholder="确认密码" maxlength="20"/>
</uni-forms-item> </uni-forms-item>
<button class="btn-submit" @click="submit" type="primary">注册并登录</button> <button class="btn-submit" @click="submit" type="primary">注册并登录</button>
</uni-forms> </uni-forms>

8
im-web/src/components/chat/ChatBox.vue

@ -3,8 +3,7 @@
<el-container> <el-container>
<el-header height="50px"> <el-header height="50px">
<span>{{ title }}</span> <span>{{ title }}</span>
<span title="群聊信息" v-show="isGroup" class="btn-side el-icon-more" <span title="群聊信息" v-show="isGroup" class="btn-side el-icon-more" @click="showSide = !showSide"></span>
@click="showSide = !showSide"></span>
</el-header> </el-header>
<el-main style="padding: 0;"> <el-main style="padding: 0;">
<el-container> <el-container>
@ -321,7 +320,7 @@ export default {
// //
let ids = [this.mine.id]; let ids = [this.mine.id];
let maxChannel = this.$store.state.configStore.webrtc.maxChannel; let maxChannel = this.$store.state.configStore.webrtc.maxChannel;
this.$refs.rtcSel.open(maxChannel, ids, ids,[]); this.$refs.rtcSel.open(maxChannel, ids, ids, []);
}, },
onInviteOk(members) { onInviteOk(members) {
if (members.length < 2) { if (members.length < 2) {
@ -699,6 +698,9 @@ export default {
handler(newChat, oldChat) { handler(newChat, oldChat) {
if (newChat.targetId > 0 && (!oldChat || newChat.type != oldChat.type || if (newChat.targetId > 0 && (!oldChat || newChat.type != oldChat.type ||
newChat.targetId != oldChat.targetId)) { newChat.targetId != oldChat.targetId)) {
this.userInfo = {}
this.group = {};
this.groupMembers = [];
if (this.chat.type == "GROUP") { if (this.chat.type == "GROUP") {
this.loadGroup(this.chat.targetId); this.loadGroup(this.chat.targetId);
} else { } else {

2
im-web/src/components/chat/ChatMessageItem.vue

@ -253,7 +253,7 @@ export default {
padding-left: 5px; padding-left: 5px;
.chat-msg-text { .chat-msg-text {
display: block; display: inline-block;
position: relative; position: relative;
line-height: 26px; line-height: 26px;
//margin-top: 3px; //margin-top: 3px;

2
im-web/src/components/setting/Setting.vue

@ -13,7 +13,7 @@
<el-input disabled v-model="userInfo.userName" autocomplete="off" size="small"></el-input> <el-input disabled v-model="userInfo.userName" autocomplete="off" size="small"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="nickName" label="昵称"> <el-form-item prop="nickName" label="昵称">
<el-input v-model="userInfo.nickName" autocomplete="off" size="small"></el-input> <el-input v-model="userInfo.nickName" autocomplete="off" size="small" maxlength="20"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="性别"> <el-form-item label="性别">
<el-radio-group v-model="userInfo.sex"> <el-radio-group v-model="userInfo.sex">

2
im-web/src/view/Group.vue

@ -21,7 +21,7 @@
</el-aside> </el-aside>
<el-container class="group-box"> <el-container class="group-box">
<div class="group-header" v-show="activeGroup.id"> <div class="group-header" v-show="activeGroup.id">
{{ activeGroup.showGroupName }}({{ groupMembers.length }}) {{ activeGroup.showGroupName }}({{ showMembers.length }})
</div> </div>
<div class="group-container"> <div class="group-container">
<div v-show="activeGroup.id"> <div v-show="activeGroup.id">

8
im-web/src/view/Register.vue

@ -9,19 +9,19 @@
</div> </div>
<el-form-item label="用户名" prop="userName"> <el-form-item label="用户名" prop="userName">
<el-input type="userName" v-model="registerForm.userName" autocomplete="off" <el-input type="userName" v-model="registerForm.userName" autocomplete="off"
placeholder="用户名(登录使用)"></el-input> placeholder="用户名(登录使用)" maxlength="20"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="昵称" prop="nickName"> <el-form-item label="昵称" prop="nickName">
<el-input type="nickName" v-model="registerForm.nickName" autocomplete="off" <el-input type="nickName" v-model="registerForm.nickName" autocomplete="off"
placeholder="昵称"></el-input> placeholder="昵称" maxlength="20"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="密码" prop="password"> <el-form-item label="密码" prop="password">
<el-input type="password" v-model="registerForm.password" autocomplete="off" <el-input type="password" v-model="registerForm.password" autocomplete="off"
placeholder="密码"></el-input> placeholder="密码" maxlength="20"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="确认密码" prop="confirmPassword"> <el-form-item label="确认密码" prop="confirmPassword">
<el-input type="password" v-model="registerForm.confirmPassword" autocomplete="off" <el-input type="password" v-model="registerForm.confirmPassword" autocomplete="off"
placeholder="确认密码"></el-input> placeholder="确认密码" maxlength="20"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="submitForm('registerForm')">注册</el-button> <el-button type="primary" @click="submitForm('registerForm')">注册</el-button>

Loading…
Cancel
Save