Files
lucky_shop/pages_tool/ai-chat/components/ai-chat-emoji-panel.vue
ZF sun 94be20d499 refactor: 优化项目配置与代码冗余清理
1. 新增components-diy占位组件与注入脚本,按需注入分包占位配置
2. 开启postcss编译优化
3. 移除多处重复的图标字体全局样式导入
2026-07-09 15:13:06 +08:00

160 lines
5.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="emoji-popup" v-if="visible">
<view class="emoji-mask" @click="hideEmojiPanel"></view>
<view class="emoji-panel">
<view class="emoji-header">
<text>{{ $lang('ai-chat.index.emojiTitle') }}</text>
<button class="close-btn" @click="hideEmojiPanel">
<text>×</text>
</button>
</view>
<view class="emoji-grid">
<view
v-for="(emoji, index) in emojiList"
:key="index"
class="emoji-item"
@click="insertEmoji(emoji)">
<text class="emoji-text">{{ emoji }}</text>
</view>
</view>
</view>
</view>
</template>
<script>
/**
* ai-chat-emoji-panel - Emoji 面板组件
*
* Props:
* visible: Boolean - 控制显示/隐藏
*
* Events:
* update:visible - 同步关闭状态
* emoji-selected - 选择表情,参数:emoji 字符串
*/
export default {
name: 'AiChatEmojiPanel',
props: {
visible: {
type: Boolean,
default: false
}
},
data() {
return {
emojiList: [
'😀','😃','😄','😁','😆','😅','🤣','😂','🙂','🙃','😉','😊','😇','🥰','😍','🤩','😘','😗','😚','😋','😛','😜','🤪','😝','🤑','🤗','🤭','🤫','🤔','🤐','🤨','😐','😑','😶','😏','😒','🙄','😬','🤥','😌','😔','😪','🤤','😴','😷','🤒','🤕','🤢','🤮','🤧','🥵','🥶','🥴','😵','🤯','🤠','🥳','😎','🤓','🧐','😕','😟','🙁','😮','😯','😲','😳','🥺','😦','😧','😨','😰','😥','😢','😭','😱','😖','😣','😞','😓','😩','😫','🥱','😤','😡','😠','🤬','😈','👿','💀','💩','👻','👽','🤖','🎃','😺','😸','😹','😻','😼','😽','🙀','😿','😾','👋','🤚','🖐','✋','🖖','👌','🤏','✌','🤞','🤟','🤘','🤙','👈','👉','👆','🖕','👇','☝','👍','👎','✊','👊','🤛','🤜','👏','🙌','👐','🤲','🤝','🙏','✍','💅','🤳','💪','💗','💓','💕','💖','💝','💞','💘','💌','💟','💛','💙','💜','🖤','💔','💢','💣','💥','💫','💦','💨','👁','👀','👅','👄','👂','👃','👶','👦','👧','👨','👩','👴','👵','👱','👲','👳','👴','👵','👶','👼','👸','🎅','🤶','🦸','🦹','🧙','🧚','🧛','🧜','🧝','🧞','🧟','🦄','🐶','🐱','🐭','🐹','🐰','🦊','🐻','🐼','🐨','🐯','🦁','🐮','🐷','🐸','🐵','🙈','🙉','🙊','🐒','🐔','🐧','🐦','🐤','🐣','🐥','🦆','🦅','🦉','🦇','🐺','🐗','🐴','🦄','🐝','🐛','🦋','🐌','🐞','🐜','🦟','🦗','🕷','🦂','🐢','🐍','🦎','🦖','🦕','🐙','🦑','🦐','🦞','🦀','🐡','🐠','🐟','🐬','🐳','🐋','🦈','🐊','🐅','🐆','🦓','🦍','🦧','🐘','🦛','🦏','🐪','🐫','🦒','🦘','🐃','🐂','🐄','🐎','🐖','🐏','🐑','🐐','🐓','🦃','🦚','🦜','🦢','🦩','🕊','🐕','🐩','🐈','🐓','🐇','🐁','🐀','🐿','🦔','🐾','🐉','🐲'
]
}
},
methods: {
hideEmojiPanel() {
this.$emit('update:visible', false)
},
insertEmoji(emoji) {
this.$emit('emoji-selected', emoji)
this.hideEmojiPanel()
}
}
}
</script>
<style lang="scss" scoped>
/* 引入图标字体: 由 main.wxss 全局提供, 不再重复 import */
/* 引入全局变量 */
@import '../styles/ai-chat-global.scss';
.emoji-popup {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 999;
.emoji-mask {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.4);
}
.emoji-panel {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background-color: #fff;
border-radius: 24rpx 24rpx 0 0;
padding: 0;
box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
max-height: 55vh;
.emoji-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16rpx 20rpx;
border-bottom: 1rpx solid #e5e5e5;
background-color: #f7f7f7;
text {
font-size: 30rpx;
font-weight: 500;
color: #333;
}
.close-btn {
width: 48rpx;
height: 48rpx;
border-radius: 50%;
background-color: transparent;
display: flex;
align-items: center;
justify-content: center;
border: none;
text {
font-size: 36rpx;
color: #999;
}
}
}
.emoji-grid {
display: grid;
grid-template-columns: repeat(8, 1fr);
gap: 8rpx;
padding: 20rpx 16rpx;
overflow-y: auto;
max-height: 45vh;
.emoji-item {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 80rpx;
border-radius: 8rpx;
background-color: transparent;
&:active {
background-color: #e5e5e5;
}
.emoji-text {
font-size: 48rpx;
line-height: 1;
}
}
}
}
}
</style>