Files
im/pages/conversation/chating/components/ChatingFooter/ChatingActionBar.vue
T

193 lines
4.6 KiB
Vue
Raw Normal View History

2025-11-07 09:56:20 +08:00
<template>
2025-11-25 05:36:02 +08:00
<view class="chat_action_bar">
2025-12-02 03:05:52 +08:00
<view class="fun-box u-border-top show-fun-box" v-if="isEmoji">
2025-12-09 09:27:29 +08:00
<scroll-view scroll-y="true">
<view class="emoji-list">
<view @tap.stop="emojiClick(emojiList[i])" v-for="(emojiItem,i) in emojiList" :key="i">
{{emojiItem}}
2025-12-02 03:05:52 +08:00
</view>
</view>
2025-12-09 09:27:29 +08:00
</scroll-view>
<view class="delete-btn">
<view @click="delSendStr()" @longpress="clearSendStr()">
<u-icon name="backspace" size="32" color="#ffffff"></u-icon>
</view>
2025-12-02 03:05:52 +08:00
</view>
</view>
<u-row class="action_row" v-else>
2025-12-11 22:33:31 +08:00
<u-col v-for="(item,idx) in actionList" :key="idx" @click="actionClick(item)" span="3">
2025-11-25 05:36:02 +08:00
<view class="action_item">
2025-12-08 18:10:51 +08:00
<image class="img" :src="item.icon" alt="" srcset="" />
2025-11-25 05:36:02 +08:00
<text class="action_item_title">{{ item.title }}</text>
</view>
</u-col>
</u-row>
</view>
2025-11-07 09:56:20 +08:00
</template>
<script>
2025-11-25 05:36:02 +08:00
import {ChatingFooterActionTypes,} from "@/constant";
2025-12-02 03:05:52 +08:00
import emojis from "@/common/emojis.js"
2025-12-11 22:33:31 +08:00
import chating_action_image_img from "@/static/images/chat/action_bar/image.png";
import chating_action_camera_img from "@/static/images/chat/action_bar/camera.png";
import chating_action_call_img from "@/static/images/chat/action_bar/call.png";
import chating_action_location_img from "@/static/images/chat/action_bar/location.png";
import chating_action_file_img from "@/static/images/chat/action_bar/file.png";
2025-11-07 09:56:20 +08:00
2025-11-25 05:36:02 +08:00
export default {
2025-12-02 03:05:52 +08:00
props:{
isEmoji:{
type:Boolean,
default:false
}
},
watch:{
isEmoji(v){
this.emojiMode = v;
}
},
2025-11-25 05:36:02 +08:00
data() {
return {
2025-12-02 03:05:52 +08:00
emojiList:emojis,
2025-11-25 05:36:02 +08:00
actionList: [
{
type: ChatingFooterActionTypes.Album,
title: "照片",
2025-12-11 22:33:31 +08:00
icon: chating_action_image_img,
2025-11-25 05:36:02 +08:00
},
{
type: ChatingFooterActionTypes.Camera,
title: "拍摄",
2025-12-11 22:33:31 +08:00
icon: chating_action_camera_img,
2025-11-25 05:36:02 +08:00
},
{
2025-12-11 22:33:31 +08:00
type: ChatingFooterActionTypes.Call,
2025-11-25 05:36:02 +08:00
title: "视频通话",
2025-12-11 22:33:31 +08:00
icon: chating_action_call_img,
2025-11-25 05:36:02 +08:00
},
{
type: ChatingFooterActionTypes.Location,
title: "位置",
2025-12-11 22:33:31 +08:00
icon: chating_action_location_img,
2025-11-25 05:36:02 +08:00
},
// {
2025-12-11 22:33:31 +08:00
// type: "File",
// title: "文件",
// icon: chating_action_file_img,
// },
// {
2025-11-25 05:36:02 +08:00
// type: ChatingFooterActionTypes.Album,
// title: "红包",
2025-12-08 18:10:51 +08:00
// icon: chating_action_image,
2025-11-25 05:36:02 +08:00
// },
// {
// type: ChatingFooterActionTypes.Album,
// title: "转账",
2025-12-08 18:10:51 +08:00
// icon: chating_action_image,
2025-11-25 05:36:02 +08:00
// }
],
};
},
methods: {
2025-12-09 09:27:29 +08:00
//删除表情和文字
delSendStr: function() {
this.$emit("onUserEvent",{type:"delSendStr"});
},
//清除文本
clearSendStr: function() {
this.$emit("onUserEvent",{type:"clearSendStr"});
},
2025-12-02 03:05:52 +08:00
async emojiClick(emoji){
2025-12-11 22:33:31 +08:00
this.$emit("onUserEvent", {type:'insertEmoji', emoji:emoji});
2025-12-02 03:05:52 +08:00
},
2025-11-25 05:36:02 +08:00
async actionClick(action) {
switch (action.type) {
case ChatingFooterActionTypes.Album:
2025-12-11 22:33:31 +08:00
this.$emit("onUserEvent",{type:"prepend_image_message",source:"album"});
2025-11-25 05:36:02 +08:00
break;
case ChatingFooterActionTypes.Camera:
2025-12-11 22:33:31 +08:00
this.$emit("onUserEvent",{type:"prepend_image_message",source:"camera"});
break;
case ChatingFooterActionTypes.Call:
this.$emit("onUserEvent",{type:"prepend_call_message"});
break;
case "File":
this.$emit("onUserEvent",{type:"prepend_file_message"});
2025-11-25 05:36:02 +08:00
break;
case ChatingFooterActionTypes.Location:
2025-12-11 22:33:31 +08:00
this.$emit("onUserEvent",{type:"prepend_location_message"});
2025-11-25 05:36:02 +08:00
break;
default:
break;
}
},
},
};
2025-11-07 09:56:20 +08:00
</script>
<style lang="scss" scoped>
2025-11-25 05:36:02 +08:00
.chat_action_bar {
position: relative;
2025-12-02 03:05:52 +08:00
background: #ececec;
2025-11-25 05:36:02 +08:00
padding: 24rpx 36rpx;
2025-12-08 18:10:51 +08:00
2025-11-25 05:36:02 +08:00
.action_row {
flex-wrap: wrap;
margin-bottom: 24rpx;
}
2025-11-07 09:56:20 +08:00
2025-11-25 05:36:02 +08:00
.action_item {
@include centerBox();
flex-direction: column;
margin-top: 24rpx;
2025-11-07 09:56:20 +08:00
2025-12-08 18:10:51 +08:00
.img {
2025-11-25 05:36:02 +08:00
width: 96rpx;
height: 96rpx;
}
2025-11-07 09:56:20 +08:00
2025-11-25 05:36:02 +08:00
&_title {
font-size: 24rpx;
color: #999;
margin-top: 6rpx;
}
}
2025-12-09 09:27:29 +08:00
.emoji-list {
2025-12-02 03:05:52 +08:00
height: 400rpx;
2025-12-09 09:27:29 +08:00
display: flex;
align-content: flex-start;
flex-wrap: wrap;
2025-12-02 03:05:52 +08:00
2025-12-09 09:27:29 +08:00
view {
width: 90rpx;
height: 90rpx;
font-size: 48rpx;
2025-12-02 03:05:52 +08:00
display: flex;
2025-12-09 09:27:29 +08:00
justify-content: center;
align-items: center;
}
}
.delete-btn{
position: absolute;
bottom: 90rpx;
right: 10rpx;
z-index: 1000;
display: flex;
justify-content: flex-end;
align-items: flex-end;
>view{
border: 1px solid #f1f1f1;
border-radius: 10rpx;
background-color: rgba(0, 0, 0, 0.6);
text-align: center;
padding:20rpx 50rpx;
margin-right: 8rpx;
.u-icon{justify-content: center;}
::v-deep .uicon-backspace{
font-size: 64rpx !important;
2025-12-02 03:05:52 +08:00
}
}
}
2025-11-25 05:36:02 +08:00
}
</style>