cnhis-design-vue 3.2.4-beta.24 → 3.2.4-beta.26
Sign up to get free protection for your applications and to get access to all the features.
- package/es/components/big-table/src/components/edit-form/edit-select.d.ts +1 -1
- package/es/components/big-table/src/hooks/useEdit.d.ts +1 -1
- package/es/components/biunique-chat/index.d.ts +4 -1
- package/es/components/biunique-chat/src/Index.vue.d.ts +4 -1
- package/es/components/biunique-chat/src/components/ChatFile.vue.d.ts +4 -0
- package/es/components/biunique-chat/src/components/ChatFile.vue2.js +1 -1
- package/es/components/biunique-chat/src/components/ChatFooter.vue2.js +1 -1
- package/es/components/biunique-chat/src/components/ChatHeader.vue.d.ts +3 -0
- package/es/components/biunique-chat/src/components/ChatMain.vue.d.ts +2 -2
- package/es/components/biunique-chat/src/components/ChatMain.vue2.js +1 -1
- package/es/components/biunique-chat/src/utils/index.d.ts +2 -0
- package/es/components/biunique-chat/src/utils/index.js +1 -1
- package/es/components/biunique-chat/style/index.css +1 -1
- package/es/components/button-print/index.d.ts +3829 -1370
- package/es/components/button-print/src/ButtonPrint.vue.d.ts +3831 -1370
- package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
- package/es/components/button-print/src/components/NewPrintComponent.vue.d.ts +2065 -0
- package/es/components/button-print/src/components/NewPrintComponent.vue.js +1 -0
- package/es/components/button-print/src/components/NewPrintComponent.vue2.js +1 -0
- package/es/components/button-print/src/components/OldPrintComponent.vue.d.ts +1996 -0
- package/es/components/button-print/src/components/OldPrintComponent.vue.js +1 -0
- package/es/components/button-print/src/components/OldPrintComponent.vue2.js +1 -0
- package/es/components/button-print/src/constants/index.d.ts +2 -0
- package/es/components/button-print/src/constants/index.js +1 -0
- package/es/components/button-print/style/index.css +1 -1
- package/es/components/classification/src/components/table-modal/index.vue.d.ts +0 -3
- package/es/components/classification/src/index.vue.d.ts +0 -3
- package/es/components/field-set/src/FieldColor.vue.d.ts +6 -6
- package/es/components/field-set/src/FieldFilter.vue.d.ts +1 -1
- package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
- package/es/components/field-set/src/components/Row.vue.d.ts +1 -1
- package/es/components/field-set/src/components/edit-dialog.vue.d.ts +5 -5
- package/es/components/field-set/src/components/edit-filter.vue.d.ts +2 -2
- package/es/components/iho-table/src/plugins/defaultConfigPlugin.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/levelSearchCascadePlugin/levelSearchCascade.vue.d.ts +1 -1
- package/es/components/index.css +1 -1
- package/es/components/search-cascader/index.d.ts +1 -1
- package/es/components/search-cascader/src/SearchCascader.vue.d.ts +1 -1
- package/es/env.d.ts +25 -25
- package/es/shared/package.json.js +1 -1
- package/package.json +2 -2
@@ -11,7 +11,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
11
11
|
type: (NumberConstructor | ObjectConstructor)[];
|
12
12
|
default: number;
|
13
13
|
};
|
14
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("formChange" | "setOptions")[], "
|
14
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("formChange" | "setOptions")[], "setOptions" | "formChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
15
15
|
col: {
|
16
16
|
type: ObjectConstructor;
|
17
17
|
default: () => {};
|
@@ -96,7 +96,7 @@ export declare const comps: {
|
|
96
96
|
type: (NumberConstructor | ObjectConstructor)[];
|
97
97
|
default: number;
|
98
98
|
};
|
99
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("formChange" | "setOptions")[], "
|
99
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("formChange" | "setOptions")[], "setOptions" | "formChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
100
100
|
col: {
|
101
101
|
type: ObjectConstructor;
|
102
102
|
default: () => {};
|
@@ -840,6 +840,7 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
|
|
840
840
|
type: BooleanConstructor;
|
841
841
|
};
|
842
842
|
}, {
|
843
|
+
cssVars: import("vue").ComputedRef<import("vue").CSSProperties>;
|
843
844
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
844
845
|
type: {
|
845
846
|
type: StringConstructor;
|
@@ -869,6 +870,7 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
|
|
869
870
|
resetAndSearch: () => void;
|
870
871
|
title: import("vue").ComputedRef<"聊天图片" | "聊天文件">;
|
871
872
|
getDetail: (item: import("../../shared/types").AnyObject) => string;
|
873
|
+
getFileType: (item: import("../../shared/types").AnyObject) => any;
|
872
874
|
NModal: any;
|
873
875
|
NImageGroup: import("vue").DefineComponent<{
|
874
876
|
showToolbar: {
|
@@ -1075,6 +1077,7 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
|
|
1075
1077
|
SearchOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
1076
1078
|
OpenOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
1077
1079
|
DownloadOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
1080
|
+
downloadFile: typeof import("./src/utils").downloadFile;
|
1078
1081
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
1079
1082
|
type: {
|
1080
1083
|
type: StringConstructor;
|
@@ -1245,7 +1248,6 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
|
|
1245
1248
|
needShowTime: (item: import("../../shared/types").AnyObject, index: number) => boolean;
|
1246
1249
|
setScrollToButtom: () => Promise<void>;
|
1247
1250
|
resetInfo: () => void;
|
1248
|
-
handleDownload: (url: string, filename: string) => void;
|
1249
1251
|
NAvatar: any;
|
1250
1252
|
NImageGroup: import("vue").DefineComponent<{
|
1251
1253
|
showToolbar: {
|
@@ -1591,6 +1593,7 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
|
|
1591
1593
|
}>>, {}>;
|
1592
1594
|
images: import("vue").Ref<any[]>;
|
1593
1595
|
formatTime: typeof import("./src/utils").formatTime;
|
1596
|
+
downloadFile: typeof import("./src/utils").downloadFile;
|
1594
1597
|
MESSAGE_TYPE: typeof import("./src/constants").MESSAGE_TYPE;
|
1595
1598
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
1596
1599
|
ChatFooter: import("vue").DefineComponent<{}, {
|
@@ -843,6 +843,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
843
843
|
type: BooleanConstructor;
|
844
844
|
};
|
845
845
|
}, {
|
846
|
+
cssVars: import("vue").ComputedRef<import("vue").CSSProperties>;
|
846
847
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
847
848
|
type: {
|
848
849
|
type: StringConstructor;
|
@@ -872,6 +873,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
872
873
|
resetAndSearch: () => void;
|
873
874
|
title: import("vue").ComputedRef<"聊天图片" | "聊天文件">;
|
874
875
|
getDetail: (item: AnyObject) => string;
|
876
|
+
getFileType: (item: AnyObject) => any;
|
875
877
|
NModal: any;
|
876
878
|
NImageGroup: import("vue").DefineComponent<{
|
877
879
|
showToolbar: {
|
@@ -1078,6 +1080,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
1078
1080
|
SearchOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
1079
1081
|
OpenOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
1080
1082
|
DownloadOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
1083
|
+
downloadFile: typeof import("./utils").downloadFile;
|
1081
1084
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
1082
1085
|
type: {
|
1083
1086
|
type: StringConstructor;
|
@@ -1248,7 +1251,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
1248
1251
|
needShowTime: (item: AnyObject, index: number) => boolean;
|
1249
1252
|
setScrollToButtom: () => Promise<void>;
|
1250
1253
|
resetInfo: () => void;
|
1251
|
-
handleDownload: (url: string, filename: string) => void;
|
1252
1254
|
NAvatar: any;
|
1253
1255
|
NImageGroup: import("vue").DefineComponent<{
|
1254
1256
|
showToolbar: {
|
@@ -1594,6 +1596,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
1594
1596
|
}>>, {}>;
|
1595
1597
|
images: import("vue").Ref<any[]>;
|
1596
1598
|
formatTime: typeof import("./utils").formatTime;
|
1599
|
+
downloadFile: typeof import("./utils").downloadFile;
|
1597
1600
|
MESSAGE_TYPE: typeof import("./constants").MESSAGE_TYPE;
|
1598
1601
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
1599
1602
|
ChatFooter: import("vue").DefineComponent<{}, {
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { PropType } from 'vue';
|
2
2
|
import { AnyObject } from '../../../../shared/types';
|
3
|
+
import { downloadFile } from '../utils';
|
3
4
|
declare const _default: import("vue").DefineComponent<{
|
4
5
|
type: {
|
5
6
|
type: StringConstructor;
|
@@ -9,6 +10,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
9
10
|
type: BooleanConstructor;
|
10
11
|
};
|
11
12
|
}, {
|
13
|
+
cssVars: import("vue").ComputedRef<import("vue").CSSProperties>;
|
12
14
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
13
15
|
type: {
|
14
16
|
type: StringConstructor;
|
@@ -38,6 +40,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
38
40
|
resetAndSearch: () => void;
|
39
41
|
title: import("vue").ComputedRef<"聊天图片" | "聊天文件">;
|
40
42
|
getDetail: (item: AnyObject) => string;
|
43
|
+
getFileType: (item: AnyObject) => any;
|
41
44
|
NModal: any;
|
42
45
|
NImageGroup: import("vue").DefineComponent<{
|
43
46
|
showToolbar: {
|
@@ -244,6 +247,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
244
247
|
SearchOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
245
248
|
OpenOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
246
249
|
DownloadOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
250
|
+
downloadFile: typeof downloadFile;
|
247
251
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
248
252
|
type: {
|
249
253
|
type: StringConstructor;
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as t,computed as
|
1
|
+
import{defineComponent as e,ref as t,computed as s,watch as a,openBlock as o,createBlock as n,unref as i,withCtx as l,withDirectives as r,createElementVNode as c,createVNode as m,createElementBlock as p,Fragment as d,renderList as u,toDisplayString as y,vShow as f,normalizeStyle as g}from"vue";import{NModal as v,NImageGroup as h,NImage as w,NInput as b,NIcon as M}from"naive-ui";import{SearchOutline as k,OpenOutline as T,DownloadOutline as I}from"@vicons/ionicons5";import{searchChatRecordApi as S}from"../api/index.js";import{useScrollLoading as _}from"../hooks/useScrollLoading.js";import{format as x,isSameWeek as j,isSameMonth as A}from"date-fns";import{useState as H}from"../hooks/useState.js";import{getFileSize as D,downloadFile as C}from"../utils/index.js";import{last as z}from"lodash-es";import{useDebounceFn as L}from"@vueuse/core";import{useTheme as U}from"../../../../shared/hooks/useTheme.js";import"@vue/shared";import"../../../../shared/utils/index.js";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";const E={class:"label"},O={class:"image-box"},$={class:"file-type"},F={class:"text"},K={class:"name"},P={class:"detail"},R={class:"opt-box"};var B=e({__name:"ChatFile",props:{type:{type:String,default:"image"},visible:{type:Boolean}},setup(e){const B=e,G=U(),{state:N}=H(),q=t([]),J=t([]),Q=t(),V=t(),W=t(),X=L(ee,500),Y={page:0,hasMore:!0,lastSendTime:x(new Date,"yyyy-MM-dd HH:mm:ss")};async function Z(){var e;try{if(!Y.hasMore)return;Y.page++;const t=await S({orgId:N.orgId,keyword:W.value,endTime:"",startTime:"",lastSendTime:Y.lastSendTime,memberIdSet:[],page:Y.page,recordType:"image"===B.type?"IMAGE":"FILE",sessionKey:N.currentSessionItem.sessionKey,userId:N.userInfo.id});Array.isArray(t)&&0!==t.length&&Array.isArray(t[0].recordList)||(Y.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了"));let s=t||[];if(Array.isArray(t)&&t.length>0&&(s=t[0].recordList),Y.lastSendTime=null==(e=z(s))?void 0:e.sendTime,"image"===B.type){const e=function(e){const t={};e.forEach((e=>{const s=new Date(e.sendTime);let a=x(s,"yyyy年MM月");j(s,new Date)?a="本周":A(s,new Date)&&(a="本月"),t[a]||(t[a]=[]),t[a].push(e.content.msg)}));return Object.entries(t).map((([e,t])=>({label:e,list:t})))}(s);q.value=Y.page>1?q.value.concat(e):e}else{const e=s.map((e=>new Promise((async t=>{const s=await D(e.content.fileUrl);t({...e,size:s})})))),t=await Promise.all(e);J.value=Y.page>1?J.value.concat(t):t}}catch(e){console.log(e)}}function ee(){Object.assign(Y,{page:0,hasMore:!0,lastSendTime:x(new Date,"yyyy-MM-dd HH:mm:ss")}),Z()}_(Q,(()=>{Z()})),_(V,(()=>{Z()}));const te=s((()=>"image"===B.type?"聊天图片":"聊天文件"));function se(e){const{size:t,sendTime:s,senderName:a}=e;return`${t} · ${x(new Date(s),"yyyy/MM/dd HH:mm")} ${a}`}function ae(e){var t;const s=(null==(t=e.content)?void 0:t.msg)||"",a=s.lastIndexOf(".");if(-1!==a){return s.charAt(a+1).toUpperCase()}return"?"}return a((()=>B.visible),(e=>{e?ee():W.value=""})),(t,s)=>(o(),n(i(v),{preset:"dialog",title:i(te),"show-icon":!1,"auto-focus":!1,class:"c-chat-dialog"},{default:l((()=>[r(c("div",{class:"c-chat-dialog__content c-chat-image-wrapper",ref_key:"imageRef",ref:Q},[m(i(h),{"show-toolbar-tooltip":""},{default:l((()=>[(o(!0),p(d,null,u(q.value,(e=>(o(),p("div",{class:"image-item",key:e.label},[c("span",E,y(e.label),1),c("div",O,[(o(!0),p(d,null,u(e.list,(e=>(o(),n(i(w),{key:e,width:"80",height:"80",src:e},null,8,["src"])))),128))])])))),128))])),_:1})],512),[[f,"image"===e.type]]),r(c("div",{class:"c-chat-dialog__content c-chat-file-wrapper",style:g(i(G))},[m(i(b),{clearable:"",placeholder:"搜索文件",value:W.value,"onUpdate:value":s[0]||(s[0]=e=>W.value=e),valueModifiers:{trim:!0},onInput:i(X)},{prefix:l((()=>[m(i(M),{component:i(k)},null,8,["component"])])),_:1},8,["value","onInput"]),c("div",{class:"file-list-box",ref_key:"fileRef",ref:V},[(o(!0),p(d,null,u(J.value,((e,t)=>(o(),p("div",{class:"file-item",key:t},[c("span",$,y(ae(e)),1),c("div",F,[c("span",K,y(e.content.msg),1),c("span",P,y(se(e)),1)]),c("div",R,[m(i(M),{size:16,component:i(T)},null,8,["component"]),m(i(M),{size:16,component:i(I),onClick:()=>i(C)(e.content.fileUr,e.content.msg)},null,8,["component","onClick"])])])))),128))],512)],4),[[f,"image"!==e.type]])])),_:1},8,["title"]))}});export{B as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as t,ref as e,withDirectives as n,openBlock as s,createElementBlock as i,normalizeStyle as a,unref as o,createElementVNode as l,createVNode as
|
1
|
+
import{defineComponent as t,ref as e,withDirectives as n,openBlock as s,createElementBlock as i,normalizeStyle as a,unref as o,createElementVNode as l,createVNode as c,withCtx as r,createCommentVNode as u,Fragment as d,renderList as f,createBlock as p,createTextVNode as m,toDisplayString as g,vShow as h}from"vue";import{NPopover as v,NTooltip as y,NUpload as M,NUploadTrigger as k,NButton as x}from"naive-ui";import{format as C}from"date-fns";import{useState as T}from"../hooks/useState.js";import{useSession as b}from"../hooks/useSession.js";import{images as w,alt as E}from"../utils/emoji.js";import{MESSAGE_TYPE as I}from"../constants/index.js";import{uploadFileApi as _}from"../api/index.js";const S={class:"tool-box"},j=l("span",null,[l("i",{class:"chat--iconfont chat--icon-face"})],-1),L={class:"emoji-box"},F=l("span",null,"默认表情",-1),K={class:"list-box"},D=["onClick"],H=["src"],J=[l("i",{class:"chat--iconfont chat--icon-good"},null,-1)],N=["onClick"],O=[l("i",{class:"chat--iconfont chat--icon-image"},null,-1)],A=["onClick"],G=[l("i",{class:"chat--iconfont chat--icon-folder"},null,-1)],U={class:"btn-box"},X=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var z=t({__name:"ChatFooter",setup(t){const z=e(),B=e(""),{state:R,stompClient:q}=T(),{setCurrentSessionItem:P}=b(R),Q=e(!1);function V(t){["Enter"].includes(t.key)&&(function(t){return t.altKey||t.ctrlKey||t.metaKey||t.shiftKey}(t)||(t.preventDefault(),Z()))}function W(){var t,e;B.value=(null==(e=null==(t=z.value)?void 0:t.innerText)?void 0:e.trim())||""}async function Y(t,e){const{file:n,name:s}=t.file,i=new FormData;i.append("sender",R.userInfo.id),i.append("file",n);const a=await _(i);if(!a)return console.log("上传失败");$({chatMessageType:e,msg:e===I.FILE?s:a,url:a})}function Z(){if(!(B.value.length>2e3))return B.value?void $({msg:B.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function $(t){const{chatMessageType:e=I.TEXT,msg:n,url:s}=t,i={msg:n,chatMessageType:e};e===I.FILE&&(i.fileUrl=s),[I.TEXT,I.BLEND].includes(e)&&(z.value.innerHTML="",B.value="");const a=C(new Date,"yyyy-MM-dd HH:mm:ss");R.currentMsg={content:i,sender:R.userInfo.id,id:"",sendTime:a,sending:!0,fail:!1},R.isAppendMsg=!0,P({lastMessageSendTime:a,lastMessage:i,sortTime:a});try{q.value.send("/app/chat/send",{},JSON.stringify({chatType:"SINGLE",content:i,receiver:R.currentSessionItem.receiver})),R.currentMsg={...R.currentMsg,fail:!1}}catch(t){R.currentMsg={...R.currentMsg,fail:!0}}finally{R.currentMsg={...R.currentMsg,sending:!1}}}return(t,e)=>n((s(),i("section",{class:"chat-footer",style:a({cursor:o(R).id?"default":"not-allowed"})},[l("div",S,[c(o(v),{show:Q.value,"onUpdate:show":e[0]||(e[0]=t=>Q.value=t),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:r((()=>[j])),default:r((()=>[l("div",L,[u(' <span>最近使用</span>\n\t\t\t\t\t<div class="list-box">\n\t\t\t\t\t\t<template v-for="(img, index) in images" :key="index">\n\t\t\t\t\t\t\t<i>\n\t\t\t\t\t\t\t\t<img :src="img" />\n\t\t\t\t\t\t\t</i>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</div> '),F,l("div",K,[(s(!0),i(d,null,f(o(w),((t,e)=>(s(),i(d,{key:e},[e>0?(s(),p(o(y),{key:0,"show-arrow":!1,trigger:"hover"},{trigger:r((()=>[l("i",{onClick:()=>function(t){Q.value=!1,$({chatMessageType:I.EMOJI,msg:t})}(e)},[l("img",{src:t},null,8,H)],8,D)])),default:r((()=>[m(" "+g(o(E)[e-1]||"微笑"),1)])),_:2},1024)):u("v-if",!0)],64)))),128))])])])),_:1},8,["show"]),l("span",{onClick:e[1]||(e[1]=()=>$({chatMessageType:o(I).EMOJI,msg:0}))},J),c(o(M),{abstract:"",multiple:"",accept:"image/*",onChange:e[2]||(e[2]=t=>Y(t,o(I).IMAGE))},{default:r((()=>[c(o(k),{abstract:""},{default:r((({handleClick:t})=>[l("span",{onClick:t},O,8,N)])),_:1})])),_:1}),c(o(M),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:e[3]||(e[3]=t=>Y(t,o(I).FILE))},{default:r((()=>[c(o(k),{abstract:""},{default:r((({handleClick:t})=>[l("span",{onClick:t},G,8,A)])),_:1})])),_:1})]),n(l("div",{ref_key:"inputRef",ref:z,class:"input-box",contenteditable:"",onKeydown:V,onInput:W},null,544),[[h,o(R).id]]),l("div",U,[X,c(o(x),{type:"primary",round:"",disabled:!B.value,onClick:Z},{default:r((()=>[m("发送")])),_:1},8,["disabled"])])],4)),[[h,o(R).id]])}});export{z as default};
|
@@ -336,6 +336,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
336
336
|
type: BooleanConstructor;
|
337
337
|
};
|
338
338
|
}, {
|
339
|
+
cssVars: import("vue").ComputedRef<import("vue").CSSProperties>;
|
339
340
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
340
341
|
type: {
|
341
342
|
type: StringConstructor;
|
@@ -365,6 +366,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
365
366
|
resetAndSearch: () => void;
|
366
367
|
title: import("vue").ComputedRef<"聊天图片" | "聊天文件">;
|
367
368
|
getDetail: (item: AnyObject) => string;
|
369
|
+
getFileType: (item: AnyObject) => any;
|
368
370
|
NModal: any;
|
369
371
|
NImageGroup: import("vue").DefineComponent<{
|
370
372
|
showToolbar: {
|
@@ -571,6 +573,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
571
573
|
SearchOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
572
574
|
OpenOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
573
575
|
DownloadOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
576
|
+
downloadFile: typeof import("../utils").downloadFile;
|
574
577
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
575
578
|
type: {
|
576
579
|
type: StringConstructor;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { AnyObject } from '../../../../shared/types';
|
2
|
-
import { formatTime } from '../utils';
|
2
|
+
import { formatTime, downloadFile } from '../utils';
|
3
3
|
import { MESSAGE_TYPE } from '../constants';
|
4
4
|
declare const _default: import("vue").DefineComponent<{}, {
|
5
5
|
chatMainRef: import("vue").Ref<HTMLElement | undefined>;
|
@@ -18,7 +18,6 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
18
18
|
needShowTime: (item: AnyObject, index: number) => boolean;
|
19
19
|
setScrollToButtom: () => Promise<void>;
|
20
20
|
resetInfo: () => void;
|
21
|
-
handleDownload: (url: string, filename: string) => void;
|
22
21
|
NAvatar: any;
|
23
22
|
NImageGroup: import("vue").DefineComponent<{
|
24
23
|
showToolbar: {
|
@@ -364,6 +363,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
364
363
|
}>>, {}>;
|
365
364
|
images: import("vue").Ref<any[]>;
|
366
365
|
formatTime: typeof formatTime;
|
366
|
+
downloadFile: typeof downloadFile;
|
367
367
|
MESSAGE_TYPE: typeof MESSAGE_TYPE;
|
368
368
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
369
369
|
export default _default;
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as t,watch as s,openBlock as n,createElementBlock as
|
1
|
+
import{defineComponent as e,ref as t,watch as s,openBlock as n,createElementBlock as i,normalizeClass as o,unref as a,createVNode as r,withCtx as m,Fragment as l,renderList as c,toDisplayString as d,createCommentVNode as u,createBlock as p,withModifiers as g}from"vue";import{NImageGroup as f,NAvatar as y,NImage as T}from"naive-ui";import{format as v}from"date-fns";import{getHistoryRecordApi as M,readMessageApi as h}from"../api/index.js";import{useState as k}from"../hooks/useState.js";import{useSession as _}from"../hooks/useSession.js";import{first as E,last as L,isNumber as S}from"lodash-es";import j from"./PersonProfile.vue.js";import I from"./MessageTemplate.vue.js";import{images as A}from"../utils/emoji.js";import{formatTime as H,downloadFile as w}from"../utils/index.js";import{MESSAGE_TYPE as P}from"../constants/index.js";import{useScrollLoading as b}from"../hooks/useScrollLoading.js";const x={key:0,class:"time"},C={key:2,class:"message-box"},D=["data-time"],N=["innerHTML"],O=["src"],G=["href","onClick"];var J=e({__name:"ChatMain",setup(e){const J=t(),{state:K,setMsgList:U}=k(),{setCurrentSessionItem:z}=_(K),F={page:0,hasMore:!0,lastSendTime:v(new Date,"yyyy-MM-dd HH:mm:ss")};async function R(){try{if(!F.hasMore)return;F.page++;const e=await M({sessionKey:K.currentSessionItem.sessionKey,page:F.page,lastSendTime:F.lastSendTime});if(!Array.isArray(e)||0===e.length)return F.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=E(e).id;F.lastSendTime=L(e).sendTime,U(F.page>1?[...e,...K.msgList]:e),1===F.page&&K.currentSessionItem.unreadNum&&(await h({chatType:"SINGLE",messageIdSet:[t],receiver:K.userInfo.id,sender:K.currentSessionItem.receiver}),z({unreadNum:0}))}catch(e){console.log(e)}}function X(e){const{chatMessageType:t,messageTemplate:s}=e.content;return t!==P.TEMPLATE||!!s}function q(e,t){var s,n;const{chatMessageType:i,messageTemplate:o}=e.content;if(i===P.TEMPLATE)return"system"===t?2==(null==(s=null==o?void 0:o.setting)?void 0:s.style.id):2!=(null==(n=null==o?void 0:o.setting)?void 0:n.style.id)}function B(e){var t,s;const{chatMessageType:n,messageTemplate:i}=e;return n===P.TEMPLATE&&3==(null==(s=null==(t=null==i?void 0:i.setting)?void 0:t.style)?void 0:s.id)}function Q(e,t){var s;const n=S(e.sendTime)?e.sendTime:Date.parse(e.sendTime),i=null==(s=K.msgList[t-1])?void 0:s.sendTime;return n-(0===t?0:S(i)?i:Date.parse(i))>3e5}return b(J,(()=>{R()}),"top"),s((()=>K.id),(e=>{e&&(Object.assign(F,{page:0,hasMore:!0,lastSendTime:v(new Date,"yyyy-MM-dd HH:mm:ss")}),R())}),{immediate:!0}),s((()=>K.isAppendMsg),(e=>{e&&(U([...K.msgList,K.currentMsg]),K.isAppendMsg=!1,async function(){var e,t,s;const n=null!=(t=null==(e=J.value)?void 0:e.scrollHeight)?t:0;null==(s=J.value)||s.scrollTo({top:n,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(n(),i("div",{class:o(["chat-main",{"home-bg":!a(K).id}]),ref_key:"chatMainRef",ref:J},[r(a(f),{"show-toolbar-tooltip":""},{default:m((()=>[(n(!0),i(l,null,c(a(K).msgList,((e,t)=>(n(),i(l,{key:t},[X(e)?(n(),i("div",{key:0,class:o(["message-item",{"message-item--mine":e.sender==a(K).userInfo.id}])},[Q(e,t)?(n(),i("p",x,d(a(H)(e.sendTime).recordTime),1)):u("v-if",!0),q(e,"system")?(n(),p(I,{key:1,data:e},null,8,["data"])):(n(),i("div",C,[r(j,{"user-id":e.sender},{trigger:m((()=>[r(a(y),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id"]),e.content?(n(),i("div",{key:0,class:o(["content",{emoji:e.content.chatMessageType===a(P).EMOJI,template:e.content.chatMessageType===a(P).TEMPLATE,"template--3":B(e.content)}]),"data-time":e.__time},[e.content.chatMessageType===a(P).TEXT?(n(),i("pre",{key:0,innerHTML:e.__content},null,8,N)):u("v-if",!0),e.content.chatMessageType===a(P).EMOJI?(n(),i("img",{key:1,src:a(A)[e.__content]},null,8,O)):u("v-if",!0),q(e,"template")?(n(),p(I,{key:2,data:e},null,8,["data"])):u("v-if",!0),e.content.chatMessageType===a(P).IMAGE?(n(),p(a(T),{key:3,width:"240",src:e.__content},null,8,["src"])):u("v-if",!0),e.content.chatMessageType===a(P).FILE?(n(),i("a",{key:4,href:e.content.fileUrl,onClick:g((()=>a(w)(e.content.fileUrl,e.__content)),["prevent"])},d(e.__content),9,G)):u("v-if",!0)],10,D)):u("v-if",!0)]))],2)):u("v-if",!0)],64)))),128))])),_:1})],2))}});export{J as default};
|
@@ -7,3 +7,5 @@ export declare function formatTime(dateStr: string): {
|
|
7
7
|
export declare function listSort(list: AnyObject[]): AnyObject[];
|
8
8
|
export declare function transformMessage(content: string): string;
|
9
9
|
export declare function transformLastMessage(lastMessage: AnyObject): any;
|
10
|
+
export declare function downloadFile(url: string, filename: string): void;
|
11
|
+
export declare function getFileSize(url: string): Promise<unknown>;
|
@@ -1 +1 @@
|
|
1
|
-
import{isToday as e,format as t,isYesterday as
|
1
|
+
import{isToday as e,format as t,isYesterday as n}from"date-fns";import{cloneDeep as r}from"lodash-es";import{MESSAGE_TYPE as o}from"../constants/index.js";import{images as a}from"./emoji.js";function s(r){const o=new Date(r);let a,s;if(e(o))a=s=t(o,"HH:mm");else{a=n(o)?"昨天":t(o,"MM-dd");const e=o.getFullYear(),r=(new Date).getFullYear();s=t(o,e<r?"yyyy年M月d日 HH:mm":"M月d日 HH:mm")}return{siderMsgTime:a,msgTime:s,recordTime:function(r){const o=new Date(r),a=Date.now()-o.getTime();if(a<6e4)return"刚刚";if(a<36e5)return Math.ceil(a/1e3/60)+"分钟前";if(e(o))return"今天 "+t(o,"HH:mm");if(n(o))return"昨天 "+t(o,"HH:mm");{const e=o.getFullYear(),n=(new Date).getFullYear();return t(o,e<n?"yyyy年M月d日 HH:mm":"M月d日 HH:mm")}}(r)}}function i(e){return r(e).sort(((e,t)=>e.topping&&!t.topping?-1:!e.topping&&t.topping?1:new Date(t.sortTime).getTime()-new Date(e.sortTime).getTime()))}function c(e){if(!e)return"";const t=e=>new RegExp("\\n*\\["+(e||"")+"(code|pre|div|span|p|table|thead|th|tbody|tr|td|ul|li|ol|li|dl|dt|dd|h2|h3|h4|h5)([\\s\\S]*?)]\\n*","g");return e=e.toString().replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""").replace(/@(\S+)(\s+?|$)/g,'@<a href="javascript:;">$1</a>$2').replace(t(),"<$1 $2>").replace(t("/"),"</$1>").replace(/\n/g,"<br>")}function l(e){var t;const{chatMessageType:n,msg:r,messageTemplate:s}=e;switch(n){case o.TEXT:return c(r);case o.IMAGE:return"[图片]";case o.FILE:return"[文件]";case o.EMOJI:return`<img alt=${r} src=${a.value[r]}>`;case o.TEMPLATE:return null==(t=null==s?void 0:s.setting)?void 0:t.title;default:return"其他消息"}}function u(e,t){const n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="blob",n.onload=function(r){if(200===n.status){const r=window.URL.createObjectURL(n.response),o=document.createElement("a");o.href=r,o.download=t,o.dispatchEvent(new MouseEvent("click")),window.URL.revokeObjectURL(e)}},n.send()}function m(e){return new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open("HEAD",e,!0),r.onreadystatechange=()=>{var e;if(4===r.readyState&&200===r.status){let n=null!=(e=r.getResponseHeader("Content-Length"))?e:0;const o=+n;o>1048576?n=(o/1048576).toFixed(2)+"M":o>1024?n=(o/1024).toFixed(2)+"K":n+="B",t(n)}},r.send()}))}export{u as downloadFile,s as formatTime,m as getFileSize,i as listSort,l as transformLastMessage,c as transformMessage};
|