Browse Source

ui优化

master
xsx 2 years ago
parent
commit
ce86855fbd
  1. 33
      im-uniapp/components/chat-record/chat-record.vue
  2. 2
      im-uniapp/pages.json
  3. 27
      im-uniapp/pages/chat/chat-box.vue
  4. 8
      im-uniapp/pages/friend/friend.vue
  5. BIN
      im-uniapp/static/tarbar/chat.png
  6. BIN
      im-uniapp/static/tarbar/chat_active.png
  7. BIN
      im-uniapp/static/tarbar/friend.png
  8. BIN
      im-uniapp/static/tarbar/friend_active.png
  9. BIN
      im-uniapp/static/tarbar/group.png
  10. BIN
      im-uniapp/static/tarbar/group_active.png
  11. BIN
      im-uniapp/static/tarbar/mine.png
  12. BIN
      im-uniapp/static/tarbar/mine_active.png
  13. 3
      im-uniapp/uni.scss

33
im-uniapp/components/chat-record/chat-record.vue

@ -1,10 +1,8 @@
<template> <template>
<view class="chat-record"> <view class="chat-record">
<view class="chat-record-bar" id="chat-record-bar" :style="recordBarStyle" <view class="chat-record-bar" id="chat-record-bar" :style="recordBarStyle" @click.stop=""
@click.stop="" @touchstart.prevent="onStartRecord" @touchmove.prevent="onTouchMove" @touchend.prevent="onEndRecord">
@touchstart.prevent="onStartRecord" {{recording?'正在录音':'长按 说话'}}</view>
@touchmove.prevent="onTouchMove"
@touchend.prevent="onEndRecord">{{recording?'正在录音':'长按 说话'}}</view>
<view v-if="recording" class="chat-record-window" :style="recordWindowStyle"> <view v-if="recording" class="chat-record-window" :style="recordWindowStyle">
<view class="rc-wave"> <view class="rc-wave">
<text class="note" style="--d: 0"></text> <text class="note" style="--d: 0"></text>
@ -17,8 +15,7 @@
</view> </view>
<view class="rc-tip">{{recordTip}}</view> <view class="rc-tip">{{recordTip}}</view>
<view class="cancel-btn" @click="onCancel"> <view class="cancel-btn" @click="onCancel">
<uni-icons :class="moveToCancel?'red':'black'" type="clear" <uni-icons :class="moveToCancel?'red':'black'" type="clear" :size="moveToCancel?45:40"></uni-icons>
:size="moveToCancel?45:40"></uni-icons>
</view> </view>
<view class="opt-tip" :class="moveToCancel?'red':'black'">{{moveToCancel? '松手取消':'松手发送,上划取消'}}</view> <view class="opt-tip" :class="moveToCancel?'red':'black'">{{moveToCancel? '松手取消':'松手发送,上划取消'}}</view>
</view> </view>
@ -41,10 +38,10 @@
methods: { methods: {
onTouchMove(e) { onTouchMove(e) {
const moveY = e.touches[0].clientY; const moveY = e.touches[0].clientY;
this.moveToCancel = moveY < this.recordBarTop-40; this.moveToCancel = moveY < this.recordBarTop - 40;
}, },
onCancel(){ onCancel() {
if(this.recording){ if (this.recording) {
this.moveToCancel = true; this.moveToCancel = true;
this.onEndRecord(); this.onEndRecord();
} }
@ -52,7 +49,7 @@
onStartRecord() { onStartRecord() {
/* 使@touchend /* 使@touchend
一直处于录音状态这里允许用户再次点击发送语音并结束录音 */ 一直处于录音状态这里允许用户再次点击发送语音并结束录音 */
if(this.recording){ if (this.recording) {
this.onEndRecord(); this.onEndRecord();
return; return;
} }
@ -65,7 +62,7 @@
// //
this.startTimer(); this.startTimer();
}).catch((e) => { }).catch((e) => {
console.log("录音失败"+JSON.stringify(e)) console.log("录音失败" + JSON.stringify(e))
uni.showToast({ uni.showToast({
title: "录音失败", title: "录音失败",
icon: "none" icon: "none"
@ -111,7 +108,7 @@
this.rcTimer = setInterval(() => { this.rcTimer = setInterval(() => {
this.druation++; this.druation++;
// 60s, // 60s,
if(this.druation >= 60 ){ if (this.druation >= 60) {
this.onEndRecord(); this.onEndRecord();
} }
}, 1000) }, 1000)
@ -136,10 +133,12 @@
}, },
recordBarStyle() { recordBarStyle() {
const bgColor = this.recording ? "royalblue" : "#f8f8f8"; const bgColor = this.recording ? "royalblue" : "#f8f8f8";
return `background-color:${bgColor};` const textColor = this.recording ? "white" : "black";
return `background-color:${bgColor};
color:${textColor};`
}, },
recordTip(){ recordTip() {
if(this.druation > 50){ if (this.druation > 50) {
return `${60-this.druation}s后将停止录音`; return `${60-this.druation}s后将停止录音`;
} }
return `录音时长:${this.druation}s`; return `录音时长:${this.druation}s`;
@ -201,7 +200,7 @@
left: 0; left: 0;
height: 360rpx; height: 360rpx;
width: 100%; width: 100%;
background-color: rgba(255, 255, 255, 0.95); background-color: rgba(255, 255, 255, 0.95);
padding: 30rpx; padding: 30rpx;
.icon-microphone { .icon-microphone {

2
im-uniapp/pages.json

@ -51,7 +51,7 @@
}, },
"tabBar": { "tabBar": {
"color": "#000000", "color": "#000000",
"selectedColor": "#09C160", "selectedColor": "#587ff0",
"borderStyle": "black", "borderStyle": "black",
"backgroundColor": "#ffffff", "backgroundColor": "#ffffff",
"list": [{ "list": [{

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

@ -50,14 +50,14 @@
<view class="chat-tools-item"> <view class="chat-tools-item">
<image-upload :maxCount="9" sourceType="album" :onBefore="onUploadImageBefore" <image-upload :maxCount="9" sourceType="album" :onBefore="onUploadImageBefore"
:onSuccess="onUploadImageSuccess" :onError="onUploadImageFail"> :onSuccess="onUploadImageSuccess" :onError="onUploadImageFail">
<view class="tool-icon iconfont icon-picture" style="background-color:#497eed;"></view> <view class="tool-icon iconfont icon-picture" ></view>
</image-upload> </image-upload>
<view class="tool-name">相册</view> <view class="tool-name">相册</view>
</view> </view>
<view class="chat-tools-item"> <view class="chat-tools-item">
<image-upload sourceType="camera" :onBefore="onUploadImageBefore" :onSuccess="onUploadImageSuccess" <image-upload sourceType="camera" :onBefore="onUploadImageBefore" :onSuccess="onUploadImageSuccess"
:onError="onUploadImageFail"> :onError="onUploadImageFail">
<view class="tool-icon iconfont icon-camera" style="background-color: #7454b0;"></view> <view class="tool-icon iconfont icon-camera" ></view>
</image-upload> </image-upload>
<view class="tool-name">拍摄</view> <view class="tool-name">拍摄</view>
</view> </view>
@ -65,32 +65,32 @@
<view class="chat-tools-item"> <view class="chat-tools-item">
<file-upload :onBefore="onUploadFileBefore" :onSuccess="onUploadFileSuccess" <file-upload :onBefore="onUploadFileBefore" :onSuccess="onUploadFileSuccess"
:onError="onUploadFileFail"> :onError="onUploadFileFail">
<view class="tool-icon iconfont icon-folder" style="background-color: #c99122;"></view> <view class="tool-icon iconfont icon-folder" ></view>
</file-upload> </file-upload>
<view class="tool-name">文件</view> <view class="tool-name">文件</view>
</view> </view>
<view class="chat-tools-item" @click="onRecorderInput()"> <view class="chat-tools-item" @click="onRecorderInput()">
<view class="tool-icon iconfont icon-microphone" style="background-color: #a8a53f;"></view> <view class="tool-icon iconfont icon-microphone" ></view>
<view class="tool-name">语音消息</view> <view class="tool-name">语音消息</view>
</view> </view>
<view v-if="chat.type == 'GROUP'" class="chat-tools-item" @click="switchReceipt()"> <view v-if="chat.type == 'GROUP'" class="chat-tools-item" @click="switchReceipt()">
<view class="tool-icon iconfont icon-receipt" style="background-color: #663399;" <view class="tool-icon iconfont icon-receipt"
:class="isReceipt?'active':''"></view> :class="isReceipt?'active':''"></view>
<view class="tool-name">回执消息</view> <view class="tool-name">回执消息</view>
</view> </view>
<!-- #ifndef MP-WEIXIN --> <!-- #ifndef MP-WEIXIN -->
<!-- 音视频不支持小程序 --> <!-- 音视频不支持小程序 -->
<view v-if="chat.type == 'PRIVATE'" class="chat-tools-item" @click="onPriviteVideo()"> <view v-if="chat.type == 'PRIVATE'" class="chat-tools-item" @click="onPriviteVideo()">
<view class="tool-icon iconfont icon-video" style="background-color: #8380E7;"></view> <view class="tool-icon iconfont icon-video" ></view>
<view class="tool-name">视频通话</view> <view class="tool-name">视频通话</view>
</view> </view>
<view v-if="chat.type == 'PRIVATE'" class="chat-tools-item" @click="onPriviteVoice()"> <view v-if="chat.type == 'PRIVATE'" class="chat-tools-item" @click="onPriviteVoice()">
<view class="tool-icon iconfont icon-call" style="background-color: #8380E7;"></view> <view class="tool-icon iconfont icon-call" ></view>
<view class="tool-name">语音通话</view> <view class="tool-name">语音通话</view>
</view> </view>
<view v-if="chat.type == 'GROUP'" class="chat-tools-item" @click="onGroupVideo()"> <view v-if="chat.type == 'GROUP'" class="chat-tools-item" @click="onGroupVideo()">
<view class="tool-icon iconfont icon-call" style="background-color: #8380E7;"></view> <view class="tool-icon iconfont icon-call" ></view>
<view class="tool-name">语音通话</view> <view class="tool-name">语音通话</view>
</view> </view>
<!-- #endif --> <!-- #endif -->
@ -829,7 +829,6 @@
.iconfont { .iconfont {
font-size: 68rpx; font-size: 68rpx;
margin: 6rpx; margin: 6rpx;
color: $uni-text-color-icon;
} }
.chat-record { .chat-record {
@ -839,7 +838,6 @@
.send-text { .send-text {
flex: 1; flex: 1;
background-color: white !important;
overflow: auto; overflow: auto;
padding: 20rpx; padding: 20rpx;
background-color: #fff; background-color: #fff;
@ -853,7 +851,6 @@
.btn-send { .btn-send {
margin: 5rpx; margin: 5rpx;
background-color: $uni-text-color-icon;
} }
} }
@ -861,7 +858,7 @@
.chat-tab-bar { .chat-tab-bar {
height: 500rpx; height: 500rpx;
padding: 20rpx; padding: 20rpx;
background-color: #f8ffff; background-color: #f8f8f8;
.chat-tools { .chat-tools {
display: flex; display: flex;
@ -877,9 +874,9 @@
.tool-icon { .tool-icon {
padding: 28rpx; padding: 28rpx;
font-size: 60rpx; font-size: 60rpx;
background-color: rebeccapurple; border-radius: 20%;
border-radius: 50%; background-color: white;
color: white; color: black;
&.active { &.active {
background-color: #ddd; background-color: #ddd;
} }

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

@ -61,7 +61,7 @@
isEnglish(character) { isEnglish(character) {
return /^[A-Za-z]+$/.test(character); return /^[A-Za-z]+$/.test(character);
}, },
init() { refreshFriendGroup() {
// //
let groupMap = new Map(); let groupMap = new Map();
this.friends.forEach((f) => { this.friends.forEach((f) => {
@ -103,7 +103,7 @@
}, },
}, },
onShow() { onShow() {
this.init(); this.refreshFriendGroup();
} }
} }
@ -141,10 +141,6 @@
.nav-add { .nav-add {
line-height: 56px; line-height: 56px;
cursor: pointer; cursor: pointer;
.uni-icons {
color: $uni-text-color-icon !important;
}
} }
} }

BIN
im-uniapp/static/tarbar/chat.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

BIN
im-uniapp/static/tarbar/chat_active.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
im-uniapp/static/tarbar/friend.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
im-uniapp/static/tarbar/friend_active.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
im-uniapp/static/tarbar/group.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
im-uniapp/static/tarbar/group_active.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

BIN
im-uniapp/static/tarbar/mine.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

BIN
im-uniapp/static/tarbar/mine_active.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

3
im-uniapp/uni.scss

@ -11,8 +11,7 @@ $uni-text-color:#333;//基本色
$uni-text-color-inverse:#fff;//反色 $uni-text-color-inverse:#fff;//反色
$uni-text-color-grey:#999;//辅助灰色如加载更多的提示信息 $uni-text-color-grey:#999;//辅助灰色如加载更多的提示信息
$uni-text-color-placeholder: #808080; $uni-text-color-placeholder: #808080;
$uni-text-color-disable:#c0c0c0; $uni-text-color-disable: #c0c0c0;
$uni-text-color-icon: #663399;
/* 背景颜色 */ /* 背景颜色 */
$uni-bg-color:#ffffff; $uni-bg-color:#ffffff;
$uni-bg-color-grey:#f8f8f8; $uni-bg-color-grey:#f8f8f8;

Loading…
Cancel
Save