vue-chat-kit 0.3.7 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,197 @@
1
+ <template>
2
+ <div v-if="visible" class="emoji-picker" @click.stop>
3
+ <div class="emoji-header">
4
+ <div
5
+ v-for="(category, index) in emojiCategories"
6
+ :key="category.id"
7
+ :class="['emoji-category-tab', { active: currentCategory === index }]"
8
+ @click="currentCategory = index"
9
+ >
10
+ {{ category.icon }}
11
+ </div>
12
+ </div>
13
+ <div class="emoji-body">
14
+ <div
15
+ v-for="emoji in emojiCategories[currentCategory].emojis"
16
+ :key="emoji"
17
+ class="emoji-item"
18
+ @click="selectEmoji(emoji)"
19
+ >
20
+ {{ emoji }}
21
+ </div>
22
+ </div>
23
+ </div>
24
+ </template>
25
+
26
+ <script setup>
27
+ import { ref } from 'vue'
28
+
29
+ const props = defineProps({
30
+ visible: {
31
+ type: Boolean,
32
+ default: false
33
+ }
34
+ })
35
+
36
+ const emit = defineEmits(['select', 'close'])
37
+
38
+ const currentCategory = ref(0)
39
+
40
+ // 常用表情分类
41
+ const emojiCategories = [
42
+ {
43
+ id: 'emoticons',
44
+ icon: '😀',
45
+ name: '表情',
46
+ emojis: [
47
+ '😀', '😃', '😄', '😁', '😆', '😅', '🤣', '😂', '🙂', '🙃',
48
+ '😉', '😊', '😇', '🥰', '😍', '🤩', '😘', '😗', '😚', '😋',
49
+ '😛', '😜', '🤪', '😝', '🤑', '🤗', '🤭', '🤫', '🤔', '🤐',
50
+ '🤨', '😐', '😑', '😶', '😏', '😒', '🙄', '😬', '🤥', '😌',
51
+ '😔', '😪', '🤤', '😴', '😷', '🤒', '🤕', '🤢', '🤮', '🤧',
52
+ '🥵', '🥶', '🥴', '😵', '🤯', '🤠', '🥳', '😎', '🤓', '🧐',
53
+ '😕', '😟', '🙁', '☹️', '😮', '😯', '😲', '😳', '🥺', '😦',
54
+ '😧', '😨', '😰', '😥', '😢', '😭', '😱', '😖', '😣', '😞'
55
+ ]
56
+ },
57
+ {
58
+ id: 'gestures',
59
+ icon: '👋',
60
+ name: '手势',
61
+ emojis: [
62
+ '👋', '🤚', '🖐️', '✋', '🖖', '👌', '🤌', '🤏', '✌️', '🤞',
63
+ '🤟', '🤘', '🤙', '👈', '👉', '👆', '🖕', '👇', '☝️', '👍',
64
+ '👎', '✊', '👊', '🤛', '🤜', '👏', '🙌', '👐', '🤲', '🤝',
65
+ '🙏', '🤚🏻', '🖐🏻', '✋🏻', '🖖🏻', '👌🏻', '🤌🏻', '🤏🏻', '✌🏻', '🤞🏻',
66
+ '🤟🏻', '🤘🏻', '🤙🏻', '👈🏻', '👉🏻', '👆🏻', '🖕🏻', '👇🏻', '☝🏻', '👍🏻'
67
+ ]
68
+ },
69
+ {
70
+ id: 'animals',
71
+ icon: '🐶',
72
+ name: '动物',
73
+ emojis: [
74
+ '🐶', '🐱', '🐭', '🐹', '🐰', '🦊', '🐻', '🐼', '🐨', '🐯',
75
+ '🦁', '🐮', '🐷', '🐸', '🐵', '🙈', '🙉', '🙊', '🐒', '🐔',
76
+ '🐧', '🐦', '🐤', '🐣', '🐥', '🦆', '🦅', '🦉', '🦇', '🐺',
77
+ '🐗', '🐴', '🦄', '🐝', '🐛', '🦋', '🐌', '🐞', '🐜', '🦟',
78
+ '🦗', '🕷️', '🦂', '🐢', '🐍', '🦎', '🦖', '🦕', '🐙', '🦑'
79
+ ]
80
+ },
81
+ {
82
+ id: 'food',
83
+ icon: '🍎',
84
+ name: '食物',
85
+ emojis: [
86
+ '🍎', '🍊', '🍋', '🍌', '🍉', '🍇', '🍓', '🍈', '🍒', '🍑',
87
+ '🥭', '🍍', '🥥', '🥝', '🍅', '🍆', '🥑', '🥦', '🥬', '🥒',
88
+ '🌶️', '🌽', '🥕', '🧄', '🧅', '🥔', '🍠', '🥐', '🥯', '🍞',
89
+ '🥖', '🥨', '🧀', '🥚', '🍳', '🧈', '🥞', '🧇', '🥓', '🥩',
90
+ '🍗', '🍖', '🌭', '🍔', '🍟', '🍕', '🥪', '🥙', '🧆', '🌮'
91
+ ]
92
+ },
93
+ {
94
+ id: 'objects',
95
+ icon: '⌚',
96
+ name: '物品',
97
+ emojis: [
98
+ '⌚', '📱', '📲', '💻', '⌨️', '🖥️', '🖨️', '🖱️', '🖲️', '🕹️',
99
+ '🗜️', '💽', '💾', '💿', '📀', '🧮', '🎥', '🎞️', '📽️', '🎬',
100
+ '📺', '📷', '📸', '📹', '📼', '🔍', '🔎', '🕯️', '💡', '🔦',
101
+ '🏮', '📔', '📕', '📖', '📗', '📘', '📙', '📚', '📓', '📒',
102
+ '📃', '📜', '📄', '📰', '🗞️', '📑', '🔖', '🏷️', '💰', '🪙'
103
+ ]
104
+ },
105
+ {
106
+ id: 'nature',
107
+ icon: '☀️',
108
+ name: '自然',
109
+ emojis: [
110
+ '☀️', '🌤️', '⛅', '🌥️', '☁️', '🌦️', '🌧️', '⛈️', '🌩️', '🌨️',
111
+ '❄️', '☃️', '⛄', '🌬️', '💨', '🌪️', '🌫️', '🌊', '💧', '💦',
112
+ '☔', '☂️', '🌱', '🌲', '🌳', '🌴', '🌵', '🌷', '🌹', '🥀',
113
+ '🌺', '🌸', '🌼', '🌻', '🌞', '⭐', '🌟', '✨', '💫', '🌙',
114
+ '🌚', '🌛', '🌜', '🌝', '🪐', '🌍', '🌎', '🌏', '⛱️', '🏖️'
115
+ ]
116
+ }
117
+ ]
118
+
119
+ const selectEmoji = (emoji) => {
120
+ emit('select', emoji)
121
+ }
122
+ </script>
123
+
124
+ <style scoped>
125
+ .emoji-picker {
126
+ position: absolute;
127
+ bottom: 100%;
128
+ left: 0;
129
+ width: 320px;
130
+ background: rgba(255, 255, 255, 0.9);
131
+ backdrop-filter: blur(20px);
132
+ -webkit-backdrop-filter: blur(20px);
133
+ border-radius: 16px;
134
+ box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
135
+ border: 1px solid rgba(255, 255, 255, 0.3);
136
+ overflow: hidden;
137
+ z-index: 1000;
138
+ margin-bottom: 8px;
139
+ }
140
+
141
+ .emoji-header {
142
+ display: flex;
143
+ padding: 8px 12px;
144
+ border-bottom: 1px solid rgba(0, 0, 0, 0.08);
145
+ gap: 4px;
146
+ }
147
+
148
+ .emoji-category-tab {
149
+ padding: 8px 12px;
150
+ cursor: pointer;
151
+ border-radius: 8px;
152
+ transition: all 0.2s;
153
+ font-size: 18px;
154
+ line-height: 1;
155
+ }
156
+
157
+ .emoji-category-tab:hover {
158
+ background: rgba(0, 0, 0, 0.05);
159
+ }
160
+
161
+ .emoji-category-tab.active {
162
+ background: rgba(7, 193, 96, 0.1);
163
+ }
164
+
165
+ .emoji-body {
166
+ display: grid;
167
+ grid-template-columns: repeat(8, 1fr);
168
+ gap: 4px;
169
+ padding: 12px;
170
+ max-height: 240px;
171
+ overflow-y: auto;
172
+ }
173
+
174
+ .emoji-body::-webkit-scrollbar {
175
+ width: 6px;
176
+ }
177
+
178
+ .emoji-body::-webkit-scrollbar-thumb {
179
+ background: rgba(0, 0, 0, 0.2);
180
+ border-radius: 3px;
181
+ }
182
+
183
+ .emoji-item {
184
+ font-size: 24px;
185
+ padding: 8px;
186
+ text-align: center;
187
+ cursor: pointer;
188
+ border-radius: 8px;
189
+ transition: all 0.15s;
190
+ line-height: 1;
191
+ }
192
+
193
+ .emoji-item:hover {
194
+ background: rgba(0, 0, 0, 0.08);
195
+ transform: scale(1.2);
196
+ }
197
+ </style>
@@ -510,22 +510,6 @@ export function useChat(config, emit) {
510
510
  myAvatar.value = avatarUrl
511
511
  }
512
512
 
513
- const getUserInfo = async () => {
514
- loadingUserInfo.value = true
515
- try {
516
- const res = await api.getUserInfo(myUsername)
517
- if (res.code === 200 && res.data) {
518
- userInfo.value = {
519
- ...userInfo.value,
520
- ...res.data
521
- }
522
- }
523
- } catch (error) {
524
- console.error('[VueChatKit] 获取用户信息失败', error)
525
- } finally {
526
- loadingUserInfo.value = false
527
- }
528
- }
529
513
 
530
514
  const updateUserInfo = async (data) => {
531
515
  try {
@@ -605,7 +589,6 @@ export function useChat(config, emit) {
605
589
  loadFriendApplyList,
606
590
  agreeFriend,
607
591
  updateMyAvatar,
608
- getUserInfo,
609
592
  updateUserInfo
610
593
  }
611
594
  }
@@ -17,8 +17,6 @@ const defaultConfig = {
17
17
  setChatStatus: '/chart/friend/chat/status',
18
18
  getAvailableUsers: '/chart/user/canAddFriend',
19
19
  searchUser: '/chart/user/search',
20
- getUserInfo: '/user/info',
21
- updateUserInfo: '/user/info',
22
20
  getUserAvatar: '/user/getAvatar',
23
21
  uploadAvatar: '/user/uploadAvatar'
24
22
  },
@@ -145,26 +145,6 @@ export const customAdapter = {
145
145
  return { code: 200 }
146
146
  },
147
147
 
148
- /**
149
- * 获取用户信息
150
- * @param {string} username - 用户名
151
- * @returns {Promise<{code: number, data: Object}>}
152
- */
153
- async getUserInfo(username) {
154
- console.log('getUserInfo 被调用, username:', username)
155
- return { code: 200, data: { username, nickname: '', avatar: '', email: '', phone: '', bio: '' } }
156
- },
157
-
158
- /**
159
- * 更新用户信息
160
- * @param {string} username - 用户名
161
- * @param {Object} data - 更新的数据
162
- * @returns {Promise<{code: number}>}
163
- */
164
- async updateUserInfo(username, data) {
165
- console.log('updateUserInfo 被调用', { username, data })
166
- return { code: 200 }
167
- },
168
148
 
169
149
  /**
170
150
  * 获取用户头像
package/src/core/api.js CHANGED
@@ -149,19 +149,6 @@ export class ChatApi {
149
149
  return this.http.post(this.endpoints.uploadFile, formData)
150
150
  }
151
151
 
152
- // ========== 用户相关 ==========
153
-
154
- /**
155
- * 获取用户信息
156
- */
157
- async getUserInfo(username) {
158
- return this._call('getUserInfo', username)
159
- }
160
-
161
- async _getUserInfo(username) {
162
- return this.http.get(this.endpoints.getUserInfo, { username })
163
- }
164
-
165
152
  /**
166
153
  * 更新用户信息
167
154
  */