Browse Source

修复菜单移动异常的bug

master
xsx 1 year ago
parent
commit
1e6df97d94
  1. 4
      im-uniapp/.env.js
  2. 17
      im-uniapp/components/chat-item/chat-item.vue
  3. 18
      im-uniapp/components/pop-menu/pop-menu.vue

4
im-uniapp/.env.js

@ -2,8 +2,8 @@
const ENV = "DEV";
const UNI_APP = {}
if(ENV=="DEV"){
UNI_APP.BASE_URL = "http://192.168.43.199:8888";
UNI_APP.WS_URL = "ws://192.168.43.199:8878/im";
UNI_APP.BASE_URL = "http://127.0.0.1:8888";
UNI_APP.WS_URL = "ws://127.0.0.1:8878/im";
// H5 走本地代理解决跨域问题
// #ifdef H5
UNI_APP.BASE_URL = "/api";

17
im-uniapp/components/chat-item/chat-item.vue

@ -7,10 +7,10 @@
</view>
<view class="chat-right">
<view class="chat-name">
<view class="chat-name-text">
<view>{{chat.showName}}</view>
<uni-tag v-if="chat.type=='GROUP'" circle text="群" size="small"></uni-tag>
</view>
<view class="chat-name-text">
<view>{{chat.showName}}</view>
<uni-tag v-if="chat.type=='GROUP'" circle text="群" size="small"></uni-tag>
</view>
<view class="chat-time">{{$date.toTimeText(chat.lastSendTime,true)}}</view>
</view>
<view class="chat-content">
@ -42,7 +42,7 @@
}
},
methods: {
showChatBox() {
uni.navigateTo({
url: "/pages/chat/chat-box?chatIdx=" + this.index
@ -133,14 +133,17 @@
overflow: hidden;
display: flex;
align-items: center;
.uni-tag {
text-align: center;
margin-left: 5rpx;
background-color: #5a60d2;
border: 0;
height: 30rpx;
line-height: 30rpx;
font-size: 20rpx;
padding: 1px 5px;
background-color: #de1c1c;
opacity: 0.8;
}
}

18
im-uniapp/components/pop-menu/pop-menu.vue

@ -1,10 +1,9 @@
<template>
<view>
<view @longpress.stop="onLongPress($event)" @touchmove="onTouchMove" @touchend="onTouchEnd">
<view @longpress.stop="onLongPress($event)" @touchmove="onTouchMove">
<slot></slot>
</view>
<view v-if="isShowMenu" class="pop-menu" @tap="onClose()" @contextmenu.prevent=""></view>
<view v-if="isShowMenu" class="pop-menu" @touchstart="onClose()" @contextmenu.prevent=""></view>
<view v-if="isShowMenu" class="menu" :style="menuStyle">
<view class="menu-item" v-for="(item) in items" :key="item.key" @click.prevent="onSelectMenu(item)">
<uni-icons class="menu-icon" :type="item.icon" :style="itemStyle(item)" size="22"></uni-icons>
@ -30,9 +29,6 @@
},
methods: {
onLongPress(e){
if(this.isTouchMove){
return;
}
uni.getSystemInfo({
success: (res) => {
let touches = e.touches[0];
@ -57,10 +53,7 @@
})
},
onTouchMove(){
this.isTouchMove = true;
},
onTouchEnd(){
this.isTouchMove = false;
this.onClose()
},
onSelectMenu(item) {
this.$emit("select", item);
@ -89,9 +82,8 @@
width: 100%;
height: 100%;
background-color: #333;
z-index: 99;
z-index: 999;
opacity: 0.5;
}
.menu {
@ -100,7 +92,7 @@
border-radius: 7px;
overflow: hidden;
background-color: #f5f6ff;
z-index: 100;
z-index: 1000;
.menu-item {
height: 25px;
min-width: 150rpx;

Loading…
Cancel
Save