@phonghq/go-chat 1.0.46 → 1.0.47
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.
- package/dist/assets/icons/call/IconPhoneBase.vue.d.ts +2 -0
- package/dist/assets/icons/global/IconBackspace.vue.d.ts +2 -0
- package/dist/chat/App.vue.d.ts +2 -9
- package/dist/chat/page/home/PhoneNumpad.vue.d.ts +11 -0
- package/dist/components/layout/PageError.vue.d.ts +2 -0
- package/dist/go-chat.es.js +11341 -11014
- package/dist/go-chat.umd.js +15 -15
- package/dist/style.css +1 -1
- package/dist/test/assets/icons/call/IconPhoneBase.vue.js +20 -0
- package/dist/test/assets/icons/global/IconBackspace.vue.js +28 -0
- package/dist/test/chat/App.vue.js +143 -79
- package/dist/test/chat/page/home/ChatList.vue.js +37 -24
- package/dist/test/chat/page/home/Home.vue.js +40 -33
- package/dist/test/chat/page/home/PhoneNumpad.vue.js +127 -0
- package/dist/test/components/chat/call/Calling.vue.js +1 -0
- package/dist/test/components/layout/PageError.vue.js +91 -0
- package/dist/test/utils/chat/store/message.js +24 -0
- package/dist/test/views/home/phone-numpad/ConvercationList.vue.js +174 -0
- package/dist/test/views/home/phone-numpad/PhoneNumpad.vue.js +270 -0
- package/dist/utils/chat/store/message.d.ts +6 -0
- package/dist/views/home/phone-numpad/ConvercationList.vue.d.ts +18 -0
- package/dist/views/home/phone-numpad/PhoneNumpad.vue.d.ts +26 -0
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ import { TOPIC_DETAIL_CHAT, TOPIC_PLIVO_SMS } from '../../../constant/mqtt';
|
|
|
10
10
|
import { MessageState } from '../../../constant/message';
|
|
11
11
|
import { publicTopicConversationUpdate } from '../../../utils/chat/store/conversation';
|
|
12
12
|
import { getCache, removeOldestCache, setCache } from '../../../utils/chat/cache';
|
|
13
|
+
import { digibotId } from '../../../composable/useDigibot';
|
|
13
14
|
const props = withDefaults(defineProps(), {});
|
|
14
15
|
const emit = defineEmits();
|
|
15
16
|
const MESSAGE_STORAGE_KEY = 'chat-message-';
|
|
@@ -310,39 +311,45 @@ else {
|
|
|
310
311
|
...{ class: "grow" },
|
|
311
312
|
});
|
|
312
313
|
}
|
|
313
|
-
|
|
314
|
-
// @ts-ignore
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
// @ts-ignore
|
|
344
|
-
[
|
|
345
|
-
|
|
314
|
+
if (__VLS_ctx.receiverId != __VLS_ctx.digibotId) {
|
|
315
|
+
// @ts-ignore
|
|
316
|
+
[receiverId, digibotId,];
|
|
317
|
+
/** @type {[typeof InputChat, ]} */ ;
|
|
318
|
+
// @ts-ignore
|
|
319
|
+
const __VLS_22 = __VLS_asFunctionalComponent(InputChat, new InputChat({
|
|
320
|
+
...{ 'onSendMessage': {} },
|
|
321
|
+
...{ 'onFocus': {} },
|
|
322
|
+
data: (__VLS_ctx.infoUser),
|
|
323
|
+
responsive: (__VLS_ctx.responsive),
|
|
324
|
+
ref: "inputChatRef",
|
|
325
|
+
...{ class: "p-2 sm:p-6" },
|
|
326
|
+
}));
|
|
327
|
+
const __VLS_23 = __VLS_22({
|
|
328
|
+
...{ 'onSendMessage': {} },
|
|
329
|
+
...{ 'onFocus': {} },
|
|
330
|
+
data: (__VLS_ctx.infoUser),
|
|
331
|
+
responsive: (__VLS_ctx.responsive),
|
|
332
|
+
ref: "inputChatRef",
|
|
333
|
+
...{ class: "p-2 sm:p-6" },
|
|
334
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_22));
|
|
335
|
+
let __VLS_25;
|
|
336
|
+
let __VLS_26;
|
|
337
|
+
const __VLS_27 = ({ sendMessage: {} },
|
|
338
|
+
{ onSendMessage: (__VLS_ctx.handleSendMessage) });
|
|
339
|
+
const __VLS_28 = ({ focus: {} },
|
|
340
|
+
{ onFocus: (...[$event]) => {
|
|
341
|
+
if (!(__VLS_ctx.receiverId != __VLS_ctx.digibotId))
|
|
342
|
+
return;
|
|
343
|
+
__VLS_ctx.emit('inputFocus');
|
|
344
|
+
// @ts-ignore
|
|
345
|
+
[infoUser, responsive, emit, handleSendMessage,];
|
|
346
|
+
} });
|
|
347
|
+
/** @type {typeof __VLS_ctx.inputChatRef} */ ;
|
|
348
|
+
var __VLS_29 = {};
|
|
349
|
+
// @ts-ignore
|
|
350
|
+
[inputChatRef,];
|
|
351
|
+
var __VLS_24;
|
|
352
|
+
}
|
|
346
353
|
/** @type {__VLS_StyleScopedClasses['h-full']} */ ;
|
|
347
354
|
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
348
355
|
/** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
|
|
2
|
+
import { ref } from 'vue';
|
|
3
|
+
import DrawerBaseCustom from '../../../components/common/drawer/DrawerBaseCustom.vue';
|
|
4
|
+
import { responsiveObserver } from '../../../composable/useListentEvent';
|
|
5
|
+
import PhoneNumpad from '../../../views/home/phone-numpad/PhoneNumpad.vue';
|
|
6
|
+
const emit = defineEmits();
|
|
7
|
+
const drawerVisibleRef = ref();
|
|
8
|
+
const phoneNumpadRef = ref();
|
|
9
|
+
const openPhoneNumpad = () => {
|
|
10
|
+
phoneNumpadRef.value?.reset();
|
|
11
|
+
drawerVisibleRef.value?.open();
|
|
12
|
+
};
|
|
13
|
+
const handleCall = (data) => {
|
|
14
|
+
emit('call', data);
|
|
15
|
+
};
|
|
16
|
+
const __VLS_exposed = { openPhoneNumpad };
|
|
17
|
+
defineExpose(__VLS_exposed);
|
|
18
|
+
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
19
|
+
const __VLS_ctx = {
|
|
20
|
+
...{},
|
|
21
|
+
...{},
|
|
22
|
+
...{},
|
|
23
|
+
...{},
|
|
24
|
+
...{},
|
|
25
|
+
};
|
|
26
|
+
let __VLS_elements;
|
|
27
|
+
let __VLS_components;
|
|
28
|
+
let __VLS_directives;
|
|
29
|
+
if (__VLS_ctx.responsiveObserver == 'window') {
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
[responsiveObserver,];
|
|
32
|
+
/** @type {[typeof PhoneNumpad, ]} */ ;
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
const __VLS_0 = __VLS_asFunctionalComponent(PhoneNumpad, new PhoneNumpad({
|
|
35
|
+
...{ 'onCall': {} },
|
|
36
|
+
...{ class: "bg-white shrink-0 border-l layout-border" },
|
|
37
|
+
modelValue: "",
|
|
38
|
+
}));
|
|
39
|
+
const __VLS_1 = __VLS_0({
|
|
40
|
+
...{ 'onCall': {} },
|
|
41
|
+
...{ class: "bg-white shrink-0 border-l layout-border" },
|
|
42
|
+
modelValue: "",
|
|
43
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_0));
|
|
44
|
+
let __VLS_3;
|
|
45
|
+
let __VLS_4;
|
|
46
|
+
const __VLS_5 = ({ call: {} },
|
|
47
|
+
{ onCall: (__VLS_ctx.handleCall) });
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
[handleCall,];
|
|
50
|
+
var __VLS_2;
|
|
51
|
+
}
|
|
52
|
+
if (__VLS_ctx.responsiveObserver != 'window') {
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
[responsiveObserver,];
|
|
55
|
+
/** @type {[typeof DrawerBaseCustom, typeof DrawerBaseCustom, ]} */ ;
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
const __VLS_7 = __VLS_asFunctionalComponent(DrawerBaseCustom, new DrawerBaseCustom({
|
|
58
|
+
ref: "drawerVisibleRef",
|
|
59
|
+
width: (500),
|
|
60
|
+
}));
|
|
61
|
+
const __VLS_8 = __VLS_7({
|
|
62
|
+
ref: "drawerVisibleRef",
|
|
63
|
+
width: (500),
|
|
64
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_7));
|
|
65
|
+
/** @type {typeof __VLS_ctx.drawerVisibleRef} */ ;
|
|
66
|
+
var __VLS_10 = {};
|
|
67
|
+
const { default: __VLS_12 } = __VLS_9.slots;
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
[drawerVisibleRef,];
|
|
70
|
+
{
|
|
71
|
+
const { content: __VLS_13 } = __VLS_9.slots;
|
|
72
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
73
|
+
...{ class: "h-full flex flex-col" },
|
|
74
|
+
});
|
|
75
|
+
/** @type {[typeof PhoneNumpad, ]} */ ;
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
const __VLS_14 = __VLS_asFunctionalComponent(PhoneNumpad, new PhoneNumpad({
|
|
78
|
+
...{ 'onCall': {} },
|
|
79
|
+
...{ 'onBack': {} },
|
|
80
|
+
ref: "phoneNumpadRef",
|
|
81
|
+
...{ class: "bg-white grow border-l layout-border w-full" },
|
|
82
|
+
}));
|
|
83
|
+
const __VLS_15 = __VLS_14({
|
|
84
|
+
...{ 'onCall': {} },
|
|
85
|
+
...{ 'onBack': {} },
|
|
86
|
+
ref: "phoneNumpadRef",
|
|
87
|
+
...{ class: "bg-white grow border-l layout-border w-full" },
|
|
88
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_14));
|
|
89
|
+
let __VLS_17;
|
|
90
|
+
let __VLS_18;
|
|
91
|
+
const __VLS_19 = ({ call: {} },
|
|
92
|
+
{ onCall: (__VLS_ctx.handleCall) });
|
|
93
|
+
const __VLS_20 = ({ back: {} },
|
|
94
|
+
{ onBack: (...[$event]) => {
|
|
95
|
+
if (!(__VLS_ctx.responsiveObserver != 'window'))
|
|
96
|
+
return;
|
|
97
|
+
__VLS_ctx.drawerVisibleRef?.close();
|
|
98
|
+
// @ts-ignore
|
|
99
|
+
[handleCall, drawerVisibleRef,];
|
|
100
|
+
} });
|
|
101
|
+
/** @type {typeof __VLS_ctx.phoneNumpadRef} */ ;
|
|
102
|
+
var __VLS_21 = {};
|
|
103
|
+
// @ts-ignore
|
|
104
|
+
[phoneNumpadRef,];
|
|
105
|
+
var __VLS_16;
|
|
106
|
+
}
|
|
107
|
+
var __VLS_9;
|
|
108
|
+
}
|
|
109
|
+
/** @type {__VLS_StyleScopedClasses['bg-white']} */ ;
|
|
110
|
+
/** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
|
|
111
|
+
/** @type {__VLS_StyleScopedClasses['border-l']} */ ;
|
|
112
|
+
/** @type {__VLS_StyleScopedClasses['layout-border']} */ ;
|
|
113
|
+
/** @type {__VLS_StyleScopedClasses['h-full']} */ ;
|
|
114
|
+
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
115
|
+
/** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
|
|
116
|
+
/** @type {__VLS_StyleScopedClasses['bg-white']} */ ;
|
|
117
|
+
/** @type {__VLS_StyleScopedClasses['grow']} */ ;
|
|
118
|
+
/** @type {__VLS_StyleScopedClasses['border-l']} */ ;
|
|
119
|
+
/** @type {__VLS_StyleScopedClasses['layout-border']} */ ;
|
|
120
|
+
/** @type {__VLS_StyleScopedClasses['w-full']} */ ;
|
|
121
|
+
// @ts-ignore
|
|
122
|
+
var __VLS_11 = __VLS_10, __VLS_22 = __VLS_21;
|
|
123
|
+
const __VLS_export = (await import('vue')).defineComponent({
|
|
124
|
+
setup: () => (__VLS_exposed),
|
|
125
|
+
__typeEmits: {},
|
|
126
|
+
});
|
|
127
|
+
export default {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
|
|
2
|
+
import { goChatError, handleMedialPermissionError, mediaPermissionState } from '../../utils/chat/page-error';
|
|
3
|
+
const reload = () => {
|
|
4
|
+
;
|
|
5
|
+
window.location.reload();
|
|
6
|
+
};
|
|
7
|
+
const askMedialPermission = async () => {
|
|
8
|
+
try {
|
|
9
|
+
await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
10
|
+
window.location.reload();
|
|
11
|
+
}
|
|
12
|
+
catch (e) {
|
|
13
|
+
console.log(e);
|
|
14
|
+
}
|
|
15
|
+
handleMedialPermissionError();
|
|
16
|
+
};
|
|
17
|
+
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
18
|
+
const __VLS_ctx = {
|
|
19
|
+
...{},
|
|
20
|
+
...{},
|
|
21
|
+
};
|
|
22
|
+
let __VLS_elements;
|
|
23
|
+
let __VLS_components;
|
|
24
|
+
let __VLS_directives;
|
|
25
|
+
if (__VLS_ctx.goChatError) {
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
[goChatError,];
|
|
28
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
29
|
+
...{ class: "w-full bg-chat-error text-white text-sm px-4 py-2 flex items-center justify-between gap-2" },
|
|
30
|
+
});
|
|
31
|
+
__VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({});
|
|
32
|
+
(__VLS_ctx.goChatError);
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
[goChatError,];
|
|
35
|
+
if (__VLS_ctx.mediaPermissionState == 'prompt') {
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
[mediaPermissionState,];
|
|
38
|
+
__VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
|
|
39
|
+
...{ onClick: (__VLS_ctx.askMedialPermission) },
|
|
40
|
+
...{ class: "bg-white min-h-10 text-chat-haze-600 font-bold w-[250px] rounded-lg" },
|
|
41
|
+
});
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
[askMedialPermission,];
|
|
44
|
+
}
|
|
45
|
+
else if (__VLS_ctx.mediaPermissionState == 'denied') {
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
[mediaPermissionState,];
|
|
48
|
+
__VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({});
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
__VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
|
|
52
|
+
...{ onClick: (...[$event]) => {
|
|
53
|
+
if (!(__VLS_ctx.goChatError))
|
|
54
|
+
return;
|
|
55
|
+
if (!!(__VLS_ctx.mediaPermissionState == 'prompt'))
|
|
56
|
+
return;
|
|
57
|
+
if (!!(__VLS_ctx.mediaPermissionState == 'denied'))
|
|
58
|
+
return;
|
|
59
|
+
__VLS_ctx.reload();
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
[reload,];
|
|
62
|
+
} },
|
|
63
|
+
...{ class: "bg-white min-h-10 text-chat-haze-600 font-bold text-base w-[200px] rounded-lg" },
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** @type {__VLS_StyleScopedClasses['w-full']} */ ;
|
|
68
|
+
/** @type {__VLS_StyleScopedClasses['bg-chat-error']} */ ;
|
|
69
|
+
/** @type {__VLS_StyleScopedClasses['text-white']} */ ;
|
|
70
|
+
/** @type {__VLS_StyleScopedClasses['text-sm']} */ ;
|
|
71
|
+
/** @type {__VLS_StyleScopedClasses['px-4']} */ ;
|
|
72
|
+
/** @type {__VLS_StyleScopedClasses['py-2']} */ ;
|
|
73
|
+
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
74
|
+
/** @type {__VLS_StyleScopedClasses['items-center']} */ ;
|
|
75
|
+
/** @type {__VLS_StyleScopedClasses['justify-between']} */ ;
|
|
76
|
+
/** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
|
|
77
|
+
/** @type {__VLS_StyleScopedClasses['bg-white']} */ ;
|
|
78
|
+
/** @type {__VLS_StyleScopedClasses['min-h-10']} */ ;
|
|
79
|
+
/** @type {__VLS_StyleScopedClasses['text-chat-haze-600']} */ ;
|
|
80
|
+
/** @type {__VLS_StyleScopedClasses['font-bold']} */ ;
|
|
81
|
+
/** @type {__VLS_StyleScopedClasses['w-[250px]']} */ ;
|
|
82
|
+
/** @type {__VLS_StyleScopedClasses['rounded-lg']} */ ;
|
|
83
|
+
/** @type {__VLS_StyleScopedClasses['bg-white']} */ ;
|
|
84
|
+
/** @type {__VLS_StyleScopedClasses['min-h-10']} */ ;
|
|
85
|
+
/** @type {__VLS_StyleScopedClasses['text-chat-haze-600']} */ ;
|
|
86
|
+
/** @type {__VLS_StyleScopedClasses['font-bold']} */ ;
|
|
87
|
+
/** @type {__VLS_StyleScopedClasses['text-base']} */ ;
|
|
88
|
+
/** @type {__VLS_StyleScopedClasses['w-[200px]']} */ ;
|
|
89
|
+
/** @type {__VLS_StyleScopedClasses['rounded-lg']} */ ;
|
|
90
|
+
const __VLS_export = (await import('vue')).defineComponent({});
|
|
91
|
+
export default {};
|
|
@@ -28,6 +28,30 @@ export const sendMessage = async (body) => {
|
|
|
28
28
|
});
|
|
29
29
|
return res;
|
|
30
30
|
};
|
|
31
|
+
export const sendMessageSmsTest = async (body) => {
|
|
32
|
+
const time = Date.now().toString(16); // timestamp hex
|
|
33
|
+
// const random = crypto.randomUUID().replace(/-/g, '').slice(0, 16)
|
|
34
|
+
const uuid = `${'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
35
|
+
const r = (Math.random() * 16) | 0;
|
|
36
|
+
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
37
|
+
return v.toString(16);
|
|
38
|
+
})}-${time}`;
|
|
39
|
+
for (let i = 1; i <= 7; i++) {
|
|
40
|
+
try {
|
|
41
|
+
const res = await axios.post('http://192.168.1.116:8081/api/v1/public/message/site/webhook-sms', { ...body, message_uuid: uuid, message_time: '2025-11-18 10:11:45.404027' }, {
|
|
42
|
+
headers: {
|
|
43
|
+
'Content-Type': 'multipart/form-data',
|
|
44
|
+
token: '7z62dhqbhfPIsw7hom1vZTOhmGiRz',
|
|
45
|
+
Authorization: ''
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return res;
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
console.log(err);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
31
55
|
export const getCountUnread = async (params) => {
|
|
32
56
|
const res = await axios.get('/api/v1/message/message/unread-count', { params });
|
|
33
57
|
return res;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
|
|
2
|
+
import { phoneNumberFormat } from '../../../utils/string-helper';
|
|
3
|
+
import ScrollEvent from '../../../components/chat/ScrollEvent/ScrollEvent.vue';
|
|
4
|
+
import Avatar from '../../../components/chat/customer/Avatar.vue';
|
|
5
|
+
import { ref } from 'vue';
|
|
6
|
+
import { getConversation } from '../../../utils/chat/store/conversation';
|
|
7
|
+
import { useDebounce } from '../../../utils/debounce';
|
|
8
|
+
const emit = defineEmits();
|
|
9
|
+
const userList = ref([]);
|
|
10
|
+
let pageCount = 0;
|
|
11
|
+
const params = ref({
|
|
12
|
+
page: 1,
|
|
13
|
+
search: ''
|
|
14
|
+
});
|
|
15
|
+
const active = defineModel('active');
|
|
16
|
+
const scrollEventRef = ref(null);
|
|
17
|
+
const handleScroll = useDebounce(async () => {
|
|
18
|
+
if (params.value.page >= pageCount) {
|
|
19
|
+
scrollEventRef.value?.hideLoading();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
params.value.page = params.value.page + 1;
|
|
23
|
+
await getUserList();
|
|
24
|
+
}, 200);
|
|
25
|
+
const getUserList = async (phone, option) => {
|
|
26
|
+
try {
|
|
27
|
+
if (phone != undefined)
|
|
28
|
+
params.value.search = phone;
|
|
29
|
+
if ((params.value.search?.length ?? 0) < 4)
|
|
30
|
+
return (userList.value = []);
|
|
31
|
+
if (option?.reset) {
|
|
32
|
+
active.value = null;
|
|
33
|
+
params.value.page = 1;
|
|
34
|
+
}
|
|
35
|
+
const res = await getConversation(params.value);
|
|
36
|
+
if (option?.reset) {
|
|
37
|
+
userList.value = [];
|
|
38
|
+
}
|
|
39
|
+
userList.value.push(...(res?.items ?? []));
|
|
40
|
+
params.value.page = res?._meta?.currentPage || 1;
|
|
41
|
+
pageCount = res?._meta?.pageCount || 1;
|
|
42
|
+
checkActiveUserList();
|
|
43
|
+
if (option?.reset) {
|
|
44
|
+
getAllList();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
console.log(e);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const getAllList = async () => {
|
|
52
|
+
while (params.value.page < pageCount && !scrollEventRef.value?.canScroll()) {
|
|
53
|
+
params.value.page = params.value.page + 1;
|
|
54
|
+
await getUserList();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const handleSelectConversation = (item) => {
|
|
58
|
+
active.value = item;
|
|
59
|
+
emit('selectConversation', item);
|
|
60
|
+
};
|
|
61
|
+
const checkActiveUserList = () => {
|
|
62
|
+
if (params.value.search.length == 10) {
|
|
63
|
+
active.value = userList.value.find(item => item.phone === ('1' + params.value.search)) ?? null;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const __VLS_exposed = { getUserList, checkActiveUserList };
|
|
67
|
+
defineExpose(__VLS_exposed);
|
|
68
|
+
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
69
|
+
const __VLS_modelEmit = defineEmits();
|
|
70
|
+
const __VLS_ctx = {
|
|
71
|
+
...{},
|
|
72
|
+
...{},
|
|
73
|
+
...{},
|
|
74
|
+
...{},
|
|
75
|
+
...{},
|
|
76
|
+
};
|
|
77
|
+
let __VLS_elements;
|
|
78
|
+
let __VLS_components;
|
|
79
|
+
let __VLS_directives;
|
|
80
|
+
/** @type {[typeof ScrollEvent, typeof ScrollEvent, ]} */ ;
|
|
81
|
+
// @ts-ignore
|
|
82
|
+
const __VLS_0 = __VLS_asFunctionalComponent(ScrollEvent, new ScrollEvent({
|
|
83
|
+
...{ 'onGetDataBottom': {} },
|
|
84
|
+
ref: "scrollEventRef",
|
|
85
|
+
...{ class: "h-full overflow-auto flex flex-col gap-y-2" },
|
|
86
|
+
bottom: true,
|
|
87
|
+
}));
|
|
88
|
+
const __VLS_1 = __VLS_0({
|
|
89
|
+
...{ 'onGetDataBottom': {} },
|
|
90
|
+
ref: "scrollEventRef",
|
|
91
|
+
...{ class: "h-full overflow-auto flex flex-col gap-y-2" },
|
|
92
|
+
bottom: true,
|
|
93
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_0));
|
|
94
|
+
let __VLS_3;
|
|
95
|
+
let __VLS_4;
|
|
96
|
+
const __VLS_5 = ({ getDataBottom: {} },
|
|
97
|
+
{ onGetDataBottom: (__VLS_ctx.handleScroll) });
|
|
98
|
+
/** @type {typeof __VLS_ctx.scrollEventRef} */ ;
|
|
99
|
+
var __VLS_6 = {};
|
|
100
|
+
const { default: __VLS_8 } = __VLS_2.slots;
|
|
101
|
+
// @ts-ignore
|
|
102
|
+
[handleScroll, scrollEventRef,];
|
|
103
|
+
for (const [user] of __VLS_getVForSourceType((__VLS_ctx.userList))) {
|
|
104
|
+
// @ts-ignore
|
|
105
|
+
[userList,];
|
|
106
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
107
|
+
...{ onClick: (...[$event]) => {
|
|
108
|
+
__VLS_ctx.handleSelectConversation(user);
|
|
109
|
+
// @ts-ignore
|
|
110
|
+
[handleSelectConversation,];
|
|
111
|
+
} },
|
|
112
|
+
...{ class: "shrink-0 w-full overflow-hidden flex items-center gap-2 hover:bg-[#EDF5FF] cursor-pointer px-6 py-2" },
|
|
113
|
+
...{ class: ({ 'bg-[#EDF5FF]': __VLS_ctx.active && __VLS_ctx.active?.id == user.id }) },
|
|
114
|
+
key: (user.id),
|
|
115
|
+
});
|
|
116
|
+
// @ts-ignore
|
|
117
|
+
[active, active,];
|
|
118
|
+
/** @type {[typeof Avatar, ]} */ ;
|
|
119
|
+
// @ts-ignore
|
|
120
|
+
const __VLS_9 = __VLS_asFunctionalComponent(Avatar, new Avatar({
|
|
121
|
+
id: (user.id),
|
|
122
|
+
...{ class: "shrink-0" },
|
|
123
|
+
src: (''),
|
|
124
|
+
color: (user.color ?? ''),
|
|
125
|
+
name: (user.username ?? ''),
|
|
126
|
+
}));
|
|
127
|
+
const __VLS_10 = __VLS_9({
|
|
128
|
+
id: (user.id),
|
|
129
|
+
...{ class: "shrink-0" },
|
|
130
|
+
src: (''),
|
|
131
|
+
color: (user.color ?? ''),
|
|
132
|
+
name: (user.username ?? ''),
|
|
133
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_9));
|
|
134
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({});
|
|
135
|
+
__VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
|
|
136
|
+
...{ class: "truncate font-semibold" },
|
|
137
|
+
});
|
|
138
|
+
(user.username);
|
|
139
|
+
__VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
|
|
140
|
+
...{ class: "truncate" },
|
|
141
|
+
});
|
|
142
|
+
(__VLS_ctx.phoneNumberFormat(user.phone ?? ''));
|
|
143
|
+
// @ts-ignore
|
|
144
|
+
[phoneNumberFormat,];
|
|
145
|
+
}
|
|
146
|
+
var __VLS_2;
|
|
147
|
+
/** @type {__VLS_StyleScopedClasses['h-full']} */ ;
|
|
148
|
+
/** @type {__VLS_StyleScopedClasses['overflow-auto']} */ ;
|
|
149
|
+
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
150
|
+
/** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
|
|
151
|
+
/** @type {__VLS_StyleScopedClasses['gap-y-2']} */ ;
|
|
152
|
+
/** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
|
|
153
|
+
/** @type {__VLS_StyleScopedClasses['w-full']} */ ;
|
|
154
|
+
/** @type {__VLS_StyleScopedClasses['overflow-hidden']} */ ;
|
|
155
|
+
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
|
|
156
|
+
/** @type {__VLS_StyleScopedClasses['items-center']} */ ;
|
|
157
|
+
/** @type {__VLS_StyleScopedClasses['gap-2']} */ ;
|
|
158
|
+
/** @type {__VLS_StyleScopedClasses['hover:bg-[#EDF5FF]']} */ ;
|
|
159
|
+
/** @type {__VLS_StyleScopedClasses['cursor-pointer']} */ ;
|
|
160
|
+
/** @type {__VLS_StyleScopedClasses['px-6']} */ ;
|
|
161
|
+
/** @type {__VLS_StyleScopedClasses['py-2']} */ ;
|
|
162
|
+
/** @type {__VLS_StyleScopedClasses['bg-[#EDF5FF]']} */ ;
|
|
163
|
+
/** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
|
|
164
|
+
/** @type {__VLS_StyleScopedClasses['truncate']} */ ;
|
|
165
|
+
/** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
|
|
166
|
+
/** @type {__VLS_StyleScopedClasses['truncate']} */ ;
|
|
167
|
+
// @ts-ignore
|
|
168
|
+
var __VLS_7 = __VLS_6;
|
|
169
|
+
const __VLS_export = (await import('vue')).defineComponent({
|
|
170
|
+
setup: () => (__VLS_exposed),
|
|
171
|
+
__typeEmits: {},
|
|
172
|
+
__typeProps: {},
|
|
173
|
+
});
|
|
174
|
+
export default {};
|