UNPKG

@tencentcloud/ai-desk-customer-wechat

Version:

AI Desk customer UIKit for wechat mini program

3 lines (2 loc) 4.18 kB
"use strict";const e=require("../../../../../../common/vendor.js"),E=require("../../../../../adapter-vue.js"),r=require("../../../../../@aidesk/uikit-engine/index.js"),m=require("../../../../../../common/assets.js"),G=require("../../../emoji-config/index.js"),T=require("../../../../../utils/env.js"),D=require("../../../emoji-config/custom-emoji.js"),O=require("../../../emoji-config/default-emoji.js");Math||(b+x+j)();const b=()=>"../../../../common/Icon.js",j=()=>"./message-container.js",x=()=>"../message-record/index.js",L=e.defineComponent({__name:"index",props:{messageID:{default:""},isMounted:{type:Boolean,default:!1}},emits:["closeOverlay"],setup(M,{emit:v}){const{computed:g,ref:l,watch:y}=E.vue,I=v,c=M,a=r.Vt.TYPES,f=l(!1),t=l([]),d=l({title:"",messageList:[]});l(),y(()=>t.value.length,async o=>{if(f.value=!1,o<1)return;const n=t.value[t.value.length-1];if(n.downloadKey&&n.messageList.length===0)try{const s=await r.Yt.downloadMergedMessages({payload:n,type:r.Vt.TYPES.MSG_MERGER});t.value[t.value.length-1]=s.payload}catch{f.value=!0}d.value=t.value[t.value.length-1]}),y(()=>c.isMounted,o=>{if(o){if(!c.messageID)throw new Error("messageID is required when first render of simple-message-list.");const n=r.Kt.getMessageModel(c.messageID).getMessage().payload;t.value=[n]}else t.value=[]},{immediate:!0});const i=g(()=>t.value.length>1),_=g(()=>{var o;return(o=d.value)!=null&&o.messageList?d.value.messageList.length>0:!1});function C(o,n){t.value.push(n.messageBody[0].payload),o.stopPropagation()}function B(){t.value.pop(),t.value.length<1&&I("closeOverlay")}function S(o){const n=encodeURIComponent(o);e.index.navigateTo({url:`/TUIKit/components/TUIChat/video-play?videoUrl=${n}`})}function U(o){let n="";return o.indexOf("@custom")>-1?n=D.CUSTOM_BIG_EMOJI_URL+o:(n=O.DEFAULT_BIG_EMOJI_URL+o,n.indexOf("@2x")===-1?n+="@2x.png":n+=".png"),n}return(o,n)=>e.e$1({a:e.p({file:e.unref(m.addIcon),size:"18px"}),b:e.unref(i)},e.unref(i)?{c:e.t(e.unref(r.jt).t("TUIChat.返回"))}:{d:e.t(e.unref(r.jt).t("TUIChat.关闭"))},{e:e.o(B),f:e.t(e.unref(d).title),g:e.unref(f)},e.unref(f)?{}:e.unref(_)?{i:e.f(e.unref(d).messageList,(s,A,p)=>e.e$1({a:s.messageBody[0].type===e.unref(a).MSG_TEXT},s.messageBody[0].type===e.unref(a).MSG_TEXT?{b:e.f(e.unref(G.parseTextToRenderArray)(s.messageBody[0].payload.text),(u,h,R)=>e.e$1({a:u.type==="text"},u.type==="text"?{b:e.t(u.content)}:{c:u.content},{d:h}))}:s.messageBody[0].type===e.unref(a).MSG_IMAGE?{d:s.messageBody[0].payload.imageInfoArray[2].url}:s.messageBody[0].type===e.unref(a).MSG_VIDEO?{f:s.messageBody[0].payload.thumbUrl,g:"0b4bd2fd-2-"+p+","+("0b4bd2fd-1-"+p),h:e.p({file:e.unref(m.playIcon)}),i:e.o(u=>S(s.messageBody[0].payload.remoteVideoUrl),s.ID)}:s.messageBody[0].type===e.unref(a).MSG_AUDIO?{k:e.t(e.unref(r.jt).t("TUIChat.语音")),l:e.t(s.messageBody[0].payload.second)}:s.messageBody[0].type===e.unref(a).MSG_FACE?{n:U(s.messageBody[0].payload.data)}:s.messageBody[0].type===e.unref(a).MSG_FILE?{p:e.t(e.unref(r.jt).t("TUIChat.[文件]"))}:s.messageBody[0].type===e.unref(a).MSG_LOCATION?{r:e.t(e.unref(r.jt).t("TUIChat.[地理位置]"))}:s.messageBody[0].type===e.unref(a).MSG_MERGER?{t:"0b4bd2fd-3-"+p+","+("0b4bd2fd-1-"+p),v:e.p({disabled:!0,renderData:s.messageBody[0].payload}),w:e.o(u=>C(u,s),s.ID)}:s.messageBody[0].type===e.unref(a).MSG_CUSTOM?{y:e.t(e.unref(r.jt).t("TUIChat.[自定义消息]"))}:{},{c:s.messageBody[0].type===e.unref(a).MSG_IMAGE,e:s.messageBody[0].type===e.unref(a).MSG_VIDEO,j:s.messageBody[0].type===e.unref(a).MSG_AUDIO,m:s.messageBody[0].type===e.unref(a).MSG_FACE,o:s.messageBody[0].type===e.unref(a).MSG_FILE,q:s.messageBody[0].type===e.unref(a).MSG_LOCATION,s:s.messageBody[0].type===e.unref(a).MSG_MERGER,x:s.messageBody[0].type===e.unref(a).MSG_CUSTOM,z:"0b4bd2fd-1-"+p,A:e.p({sender:s.nick,avatar:s.avatar,type:s.messageBody[0].type,time:s.time}),B:s.ID}))}:{},{h:e.unref(_),j:e.unref(T.isMobile)?1:""})}}),k=e._export_sfc(L,[["__scopeId","data-v-0b4bd2fd"]]);wx.createComponent(k); //# sourceMappingURL=../../../../../../../.sourcemap/mp-weixin/ai-desk-customer-uniapp/components/CustomerServiceChat/message-list/message-elements/simple-message-list/index.js.map