Browse Source

长按菜单组件名称修改

master
xsx 1 year ago
parent
commit
77d3b9622e
  1. 20
      im-uniapp/components/chat-message-item/chat-message-item.vue
  2. 8
      im-uniapp/components/long-press-menu/long-press-menu.vue
  3. 4
      im-uniapp/pages/chat/chat.vue

20
im-uniapp/components/chat-message-item/chat-message-item.vue

@ -16,24 +16,24 @@
</view> </view>
<view class="chat-msg-bottom"> <view class="chat-msg-bottom">
<view v-if="msgInfo.type == $enums.MESSAGE_TYPE.TEXT"> <view v-if="msgInfo.type == $enums.MESSAGE_TYPE.TEXT">
<pop-menu :items="menuItems" @select="onSelectMenu"> <long-press-menu :items="menuItems" @select="onSelectMenu">
<rich-text class="chat-msg-text" :nodes="$emo.transform(msgInfo.content)"></rich-text> <rich-text class="chat-msg-text" :nodes="$emo.transform(msgInfo.content)"></rich-text>
</pop-menu> </long-press-menu>
</view> </view>
<view class="chat-msg-image" v-if="msgInfo.type == $enums.MESSAGE_TYPE.IMAGE"> <view class="chat-msg-image" v-if="msgInfo.type == $enums.MESSAGE_TYPE.IMAGE">
<pop-menu :items="menuItems" @select="onSelectMenu"> <long-press-menu :items="menuItems" @select="onSelectMenu">
<view class="img-load-box"> <view class="img-load-box">
<image class="send-image" mode="widthFix" :src="JSON.parse(msgInfo.content).thumbUrl" <image class="send-image" mode="widthFix" :src="JSON.parse(msgInfo.content).thumbUrl"
lazy-load="true" @click.stop="onShowFullImage()"> lazy-load="true" @click.stop="onShowFullImage()">
</image> </image>
<loading v-if="loading"></loading> <loading v-if="loading"></loading>
</view> </view>
</pop-menu> </long-press-menu>
<text title="发送失败" v-if="loadFail" @click="onSendFail" <text title="发送失败" v-if="loadFail" @click="onSendFail"
class="send-fail iconfont icon-warning-circle-fill"></text> class="send-fail iconfont icon-warning-circle-fill"></text>
</view> </view>
<view class="chat-msg-file" v-if="msgInfo.type == $enums.MESSAGE_TYPE.FILE"> <view class="chat-msg-file" v-if="msgInfo.type == $enums.MESSAGE_TYPE.FILE">
<pop-menu :items="menuItems" @select="onSelectMenu"> <long-press-menu :items="menuItems" @select="onSelectMenu">
<view class="chat-file-box"> <view class="chat-file-box">
<view class="chat-file-info"> <view class="chat-file-info">
<uni-link class="chat-file-name" :text="data.name" showUnderLine="true" <uni-link class="chat-file-name" :text="data.name" showUnderLine="true"
@ -43,19 +43,19 @@
<view class="chat-file-icon iconfont icon-file"></view> <view class="chat-file-icon iconfont icon-file"></view>
<loading v-if="loading"></loading> <loading v-if="loading"></loading>
</view> </view>
</pop-menu> </long-press-menu>
<text title="发送失败" v-if="loadFail" @click="onSendFail" <text title="发送失败" v-if="loadFail" @click="onSendFail"
class="send-fail iconfont icon-warning-circle-fill"></text> class="send-fail iconfont icon-warning-circle-fill"></text>
</view> </view>
<pop-menu v-if="msgInfo.type == $enums.MESSAGE_TYPE.AUDIO" :items="menuItems" @select="onSelectMenu"> <long-press-menu v-if="msgInfo.type == $enums.MESSAGE_TYPE.AUDIO" :items="menuItems" @select="onSelectMenu">
<view class="chat-msg-audio chat-msg-text" @click="onPlayAudio()"> <view class="chat-msg-audio chat-msg-text" @click="onPlayAudio()">
<text class="iconfont icon-voice-play"></text> <text class="iconfont icon-voice-play"></text>
<text class="chat-audio-text">{{ JSON.parse(msgInfo.content).duration + '"' }}</text> <text class="chat-audio-text">{{ JSON.parse(msgInfo.content).duration + '"' }}</text>
<text v-if="audioPlayState == 'PAUSE'" class="iconfont icon-play"></text> <text v-if="audioPlayState == 'PAUSE'" class="iconfont icon-play"></text>
<text v-if="audioPlayState == 'PLAYING'" class="iconfont icon-pause"></text> <text v-if="audioPlayState == 'PLAYING'" class="iconfont icon-pause"></text>
</view> </view>
</pop-menu> </long-press-menu>
<pop-menu v-if="isAction" :items="menuItems" @select="onSelectMenu"> <long-press-menu v-if="isAction" :items="menuItems" @select="onSelectMenu">
<view class="chat-realtime chat-msg-text" @click="$emit('call')"> <view class="chat-realtime chat-msg-text" @click="$emit('call')">
<text v-if="msgInfo.type == $enums.MESSAGE_TYPE.ACT_RT_VOICE" <text v-if="msgInfo.type == $enums.MESSAGE_TYPE.ACT_RT_VOICE"
class="iconfont icon-chat-voice"></text> class="iconfont icon-chat-voice"></text>
@ -63,7 +63,7 @@
class="iconfont icon-chat-video"></text> class="iconfont icon-chat-video"></text>
<text>{{ msgInfo.content }}</text> <text>{{ msgInfo.content }}</text>
</view> </view>
</pop-menu> </long-press-menu>
<view class="chat-msg-status" v-if="!isAction"> <view class="chat-msg-status" v-if="!isAction">
<text class="chat-readed" v-show="msgInfo.selfSend && !msgInfo.groupId <text class="chat-readed" v-show="msgInfo.selfSend && !msgInfo.groupId
&& msgInfo.status == $enums.MESSAGE_STATUS.READED">已读</text> && msgInfo.status == $enums.MESSAGE_STATUS.READED">已读</text>

8
im-uniapp/components/pop-menu/pop-menu.vue → im-uniapp/components/long-press-menu/long-press-menu.vue

@ -3,7 +3,7 @@
<view @longpress.stop="onLongPress($event)" @touchmove="onTouchMove" @touchend="onTouchEnd"> <view @longpress.stop="onLongPress($event)" @touchmove="onTouchMove" @touchend="onTouchEnd">
<slot></slot> <slot></slot>
</view> </view>
<view v-if="isShowMenu" class="pop-menu" @touchstart="onClose()" @contextmenu.prevent=""></view> <view v-if="isShowMenu" class="menu-mask" @touchstart="onClose()" @contextmenu.prevent=""></view>
<view v-if="isShowMenu" class="menu" :style="menuStyle"> <view v-if="isShowMenu" class="menu" :style="menuStyle">
<view class="menu-item" v-for="(item) in items" :key="item.key" @click.prevent="onSelectMenu(item)"> <view class="menu-item" v-for="(item) in items" :key="item.key" @click.prevent="onSelectMenu(item)">
<text :style="itemStyle(item)"> {{ item.name }}</text> <text :style="itemStyle(item)"> {{ item.name }}</text>
@ -14,7 +14,7 @@
<script> <script>
export default { export default {
name: "pop-menu", name: "long-press-menu",
data() { data() {
return { return {
isShowMenu: false, isShowMenu: false,
@ -74,14 +74,14 @@ export default {
if (item.color) { if (item.color) {
return `color:${item.color};` return `color:${item.color};`
} }
// return `color:#4f76e6;`; return `color:#000;`;
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.pop-menu { .menu-mask {
position: fixed; position: fixed;
left: 0; left: 0;
top: 0; top: 0;

4
im-uniapp/pages/chat/chat.vue

@ -16,9 +16,9 @@
</view> </view>
<scroll-view class="scroll-bar" v-else scroll-with-animation="true" scroll-y="true"> <scroll-view class="scroll-bar" v-else scroll-with-animation="true" scroll-y="true">
<view v-for="(chat, index) in chatStore.chats" :key="index"> <view v-for="(chat, index) in chatStore.chats" :key="index">
<pop-menu v-if="isShowChat(chat)" :items="menu.items" @select="onSelectMenu($event, index)"> <long-press-menu v-if="isShowChat(chat)" :items="menu.items" @select="onSelectMenu($event, index)">
<chat-item :chat="chat" :index="index" :active="menu.chatIdx == index"></chat-item> <chat-item :chat="chat" :index="index" :active="menu.chatIdx == index"></chat-item>
</pop-menu> </long-press-menu>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>

Loading…
Cancel
Save