WokerTask/public/admin/assets/index.55681c0e.js

2 lines
12 KiB
JavaScript

import{J as ge,k as A,w as ve,B as fe,b as ye,Q as ke}from"./element-plus.b0ecf6ae.js";import{d as xe,$ as I,r as q,j as Ee,E as Fe,o as r,c as a,a as i,U as g,L as V,u as E,T as j,a7 as z,S as y,Q as k,M as H,V as oe,bf as we,be as Ce}from"./@vue.51d7f2d8.js";import{I as Se}from"./@element-plus.c80b8015.js";import{j as M,C as De,l as be,m as Le,R as T,n as Ie,o as Be,P as Ae,f as U,p as Te,a as Re,d as Me}from"./index.9e5a9063.js";import{l as Ue}from"./lodash.ffb5376d.js";import{N as R}from"./nprogress.f73355d0.js";import{b as Ne}from"./axios.f9df025a.js";import"./@vueuse.ec90c285.js";import"./lodash-es.29c53eac.js";import"./dayjs.e873ead7.js";import"./@amap.8a62addd.js";import"./async-validator.fb49d0f5.js";import"./@ctrl.82a509e0.js";import"./@popperjs.36402333.js";import"./escape-html.e5dfadb9.js";import"./normalize-wheel-es.8aeb3683.js";import"./vue-router.9f65afb1.js";import"./pinia.56356cb7.js";import"./vue-demi.b3a9cad9.js";import"./css-color-function.4b0c77cb.js";import"./color.992612d2.js";import"./clone.d8d3ae9a.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./vue-clipboard3.dca5bca3.js";import"./clipboard.16e4491b.js";import"./echarts.ac57a99a.js";import"./zrender.d54ce080.js";import"./tslib.60310f1a.js";import"./highlight.js.dba6fa1b.js";import"./@highlightjs.40d5feba.js";const Pe="/admin/assets/XC.f7ab4c6f.png",Oe="/admin/assets/SP.95ba535e.png",qe={requestInterceptorsHook(o){var x;R.start();const{withToken:w,isParamsToData:C}=o.requestOptions,d=o.params||{},h=o.headers||{};if(w){const v=be();h.token=v}return C&&!Reflect.has(o,"data")&&((x=o.method)==null?void 0:x.toUpperCase())===Le.POST&&(o.data=d,o.params={}),o.headers=h,o},requestInterceptorsCatchHook(o){return R.done(),o},async responseInterceptorsHook(o){R.done();const{isTransformResponse:w,isReturnDefaultResponse:C}=o.config.requestOptions;if(C)return o;if(!w)return o.data;const{code:d,data:h,show:x,msg:v}=o.data;switch(d){case T.SUCCESS:return x&&v&&U.msgSuccess(v),h;case T.FAIL:return x&&v&&U.msgError(v),Promise.reject(h);case T.LOGIN_FAILURE:return Ie(),Be.push(Ae.LOGIN),Promise.reject();case T.OPEN_NEW_PAGE:return window.location.href=h.url,h;default:return h}},responseInterceptorsCatchHook(o){return R.done(),o.code!==Ne.exports.AxiosError.ERR_CANCELED&&o.message&&U.msgError(o.message),Promise.reject(o)}},Ve={timeout:M.timeout,baseURL:M.baseUrl,headers:{"Content-Type":De.JSON,version:M.version},axiosHooks:qe,requestOptions:{isParamsToData:!0,isReturnDefaultResponse:!1,isTransformResponse:!0,urlPrefix:"",ignoreCancelToken:!1,withToken:!0,isOpenRetry:!0,retryCount:2}};function je(o){return new Te(Ue.exports.merge(Ve,o||{}))}const N=je(),ze=o=>N.post({url:"/common/im/doBindUid",data:o}),He=o=>N.post({url:"/common/im/sendTextMsg",data:o}),$=o=>N.post({url:"/common/im/msgList",data:o}),ne=o=>N.post({url:"/common/im/contactList",data:o}),P=o=>(we("data-v-7d155991"),o=o(),Ce(),o),$e={class:"box"},We={class:"talk-list"},Je={class:"mt-4 serch"},Ye=P(()=>i("div",{style:{height:"5vh"}},null,-1)),Ge=["onClick"],Qe={class:"l"},Ke={style:{position:"relative"}},Xe={key:0,class:"brage"},Ze={class:"tit-a"},et={key:0,class:"value"},tt={key:1,class:"value"},st={key:2,class:"value"},ot={class:"r"},nt={class:"talk-detail",id:"content"},rt={class:"top"},at=P(()=>i("div",{style:{height:"4vh"}},null,-1)),it={key:0,class:"my_task"},lt={class:"content"},ct={key:0},ut=["href"],dt={key:1},_t={key:1},pt={key:2},mt=["src"],ht={key:1,class:"to_task"},gt={class:"content"},vt={key:0},ft=["href"],yt={key:1},kt={key:1},xt={key:2},Et=["src"],Ft={class:"my_task"},wt={class:"content"},Ct={style:{width:"120px","margin-right":"10px"}},St=["src"],Dt=["src"],bt={class:"bottom"},Lt={style:{display:"flex"}},It=P(()=>i("img",{class:"img_cls",src:Pe,style:{width:"50px",height:"50px"}},null,-1)),Bt=P(()=>i("img",{style:{width:"50px",height:"50px"},src:Oe},null,-1)),At="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",Tt=xe({__name:"index",setup(o){const w=M.baseUrl,C=Re(),d=C.userInfo.id;let h=1,x=null;const v=I([]),W=e=>{v[0]=e.content},re=e=>{e.target.scrollTop<=0&&(h++,$({from_user_id:d,to_user_id:x,scene:1,page_no:h,page_size:10}).then(n=>{n.length<=0||(c.talkList=n.reverse().concat(c.talkList),e.target.scrollTop=100)}))};let J=!1;const l=I([]);let Y=I([]);const c=I({name:"",to_user_id:"",talkList:[],index:0});ne({user_id:d}).then(e=>{e.forEach(t=>{l.push(t),Y.push(t)}),console.log(Y,6666),c.name=l[0].name,c.to_user_id=l[0].id,x=l[0].id,$({from_user_id:d,to_user_id:l[0].id,scene:1,page_no:1,page_size:10}).then(t=>{c.talkList=t.reverse()})});const O=q(""),ae=()=>{ne({user_id:d,keywords:O.value}).then(e=>{l.splice(0,l.length),e.forEach(t=>{l.push(t)})})},G=e=>{var t=/^(https?:\/\/|www\.|.*\.com).*$/i;return t.test(e)},S=q(""),Q=()=>{!S.value||He({from_user_id:d,to_user_id:c.to_user_id,type:"text",content:S.value,scene:1,msg_id:F.value}).then(e=>{c.talkList.push(e),l[c.index].last_msg_content=S.value,l[c.index].last_msg_time=e.create_time,l[c.index].last_msg_type="text",b(),S.value="",B()})},ie=t=>{var t=window.event||t;t.keyCode==13&&Q()};let F=q("");const B=()=>{var e=new Date().getTime(),t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var u=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(n=="x"?u:u&3|8).toString(16)});F.value=t};B();const _=I([]);let K=()=>({status:!1,localType:null,localSrc:null,type:"",percentage:0,msg_id:F.value});const le=e=>{if(e.size>=50703395)return A.error("\u89C6\u9891\u6587\u4EF6\u8FC7\u5927\u8BF7\u91CD\u65B0\u4E0A\u4F20!!"),!1;if(!e.type.includes("image"))return A.error("\u8BF7\u9009\u62E9\u6B63\u786E\u7684\u56FE\u7247\u683C\u5F0F!!"),!1;_.push(K());let t="image";var n=_.findIndex(function(m){return m.msg_id===F.value});let u=e;_[n].type=t;const p=u;var f=new FileReader;f.readAsDataURL(p),f.onloadend=function(m){var s;_[n].status=!0,_[n].localSrc=(s=m.target)==null?void 0:s.result,b(),B()}},ce=e=>{if(!e.type.includes("video"))return A.error("\u8BF7\u9009\u62E9\u6B63\u786E\u7684\u89C6\u9891\u683C\u5F0F!!"),!1;if(e.size>=50703395)return A.error("\u89C6\u9891\u6587\u4EF6\u8FC7\u5927\u8BF7\u91CD\u65B0\u4E0A\u4F20!!"),!1;console.log(e.size),_.push(K());let t="video";var n=_.findIndex(function(m){return m.msg_id===F.value});let u=e;_[n].type=t;const p=u;var f=new FileReader;f.readAsDataURL(p),f.onloadend=function(m){var s;_[n].status=!0,_[n].localSrc=(s=m.target)==null?void 0:s.result,b(),B()}},X=e=>{e.show==0?c.talkList.push(e.data):U.msgError(e.msg);var t=_.findIndex(function(n){return n.msg_id===e.data.msg_id});_[t].status=!1,l[c.index].last_msg_type=e.data.type,console.log(e.data)},ue=(e,t)=>{l[t].no_read_num=0,c.name=e.name,c.to_user_id=e.id,c.index=t,x=e.id,$({from_user_id:d,to_user_id:e.id,scene:1,page_no:1,page_size:10}).then(n=>{c.talkList=n.reverse(),b()})};let Z=null;Ee(()=>{Z=document.getElementById("center")});const b=()=>{setTimeout(()=>{Z.scrollTop=9999999},100)},ee=e=>{const t=new Date,n=new Date(e*1e3);if(te(t,n)){const f=n.getHours(),m=n.getMinutes();return f+":"+(m<10?"0"+m:m)}else if(de(t,n))return"\u6628\u5929";const u=n.getMonth()+1,p=n.getDate();return u+"\u6708"+p+"\u65E5"},te=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),de=(e,t)=>{const n=new Date(e.getFullYear(),e.getMonth(),e.getDate()-1);return te(n,t)},L=new WebSocket("wss://ceshi-worker-task.lihaink.cn/im"),_e=e=>{console.log("WebSocket\u8FDE\u63A5\u5DF2\u6253\u5F00")},pe=e=>{let t=JSON.parse(e.data);if(J){if(t.id){var n=l.findIndex(function(u){return u.id==t.from_user_id});t.from_user_id==c.to_user_id?(console.log(t,"\u6536\u5230scoket\u6D88\u606F"),c.talkList.push(t),l[n].last_msg_content=t.content,l[n].last_msg_time=t.create_time,l[n].last_msg_type=t.type,b()):(l[n].no_read_num++,l[n].last_msg_content=t.content,l[n].last_msg_time=t.create_time,l[n].last_msg_type=t.type)}}else{let u=JSON.parse(e.data).client_id;ze({client_id:u,user_id:d,scene:1}).then(p=>{J=!0,console.log("\u7ED1\u5B9A\u6210\u529F")})}console.log(t)},me=e=>{console.log("WebSocket\u8FDE\u63A5\u5DF2\u5173\u95ED")},he=e=>{console.error("WebSocket\u8FDE\u63A5\u53D1\u751F\u9519\u8BEF")};return L.addEventListener("open",_e),L.addEventListener("message",pe),L.addEventListener("close",me),L.addEventListener("error",he),Fe(()=>{L.close()}),(e,t)=>{const n=ve,u=fe,p=ye,f=ge,m=ke;return r(),a("div",$e,[i("div",We,[i("div",Je,[g(u,{modelValue:O.value,"onUpdate:modelValue":t[0]||(t[0]=s=>O.value=s),placeholder:"\u641C\u7D22\u8054\u7CFB\u4EBA",class:"input-with-select"},{append:V(()=>[g(n,{icon:E(Se),onClick:ae},null,8,["icon"])]),_:1},8,["modelValue"])]),Ye,(r(!0),a(j,null,z(l,(s,D)=>(r(),a("div",{class:"contacts",key:D,onClick:se=>ue(s,D)},[i("div",Qe,[i("div",Ke,[g(p,{style:{width:"40px",height:"40px"},src:s.avatar},null,8,["src"]),s.no_read_num?(r(),a("div",Xe,y(s.no_read_num),1)):k("",!0)]),i("div",Ze,[i("div",null,y(s.name),1),s.last_msg_type=="text"?(r(),a("div",et,y(s.last_msg_content),1)):k("",!0),s.last_msg_type=="image"?(r(),a("div",tt,"[\u56FE\u7247]")):k("",!0),s.last_msg_type=="video"?(r(),a("div",st,"[\u89C6\u9891]")):k("",!0)])]),i("div",ot,y(ee(s.last_msg_time)),1)],8,Ge))),128))]),i("div",nt,[i("div",rt,y(c.name),1),at,i("div",{class:"center",id:"center",onScroll:re},[(r(!0),a(j,null,z(c.talkList,(s,D)=>(r(),a("div",{class:"talk",key:D},[H(i("div",{style:{"text-align":"center"}},y(ee(s.create_time)),513),[[oe,D%5==0]]),s.from_user_id==E(d)?(r(),a("div",it,[i("div",lt,[s.type=="text"?(r(),a("div",ct,[G(s.content)?(r(),a("a",{key:0,href:s.content,target:"_blank",style:{color:"#576B95"}},y(s.content),9,ut)):(r(),a("div",dt,y(s.content),1))])):k("",!0),s.type=="image"?(r(),a("div",_t,[g(p,{style:{width:"100px",height:"auto"},src:s.content,"preview-src-list":v,onClick:se=>W(s)},null,8,["src","preview-src-list","onClick"])])):k("",!0),s.type=="video"?(r(),a("div",pt,[i("video",{controls:"",src:s.content},null,8,mt)])):k("",!0)]),g(p,{style:{width:"40px",height:"40px"},src:E(C).userInfo.avatar},null,8,["src"])])):(r(),a("div",ht,[g(p,{style:{width:"40px",height:"40px","margin-right":"5px"},src:s.from_user_avatar},null,8,["src"]),i("div",gt,[s.type=="text"?(r(),a("div",vt,[G(s.content)?(r(),a("a",{key:0,href:s.content,target:"_blank",style:{color:"#576B95"}},y(s.content),9,ft)):(r(),a("div",yt,y(s.content),1))])):k("",!0),s.type=="image"?(r(),a("div",kt,[g(p,{style:{width:"100px",height:"auto"},src:s.content,"preview-src-list":v,onClick:se=>W(s)},null,8,["src","preview-src-list","onClick"])])):k("",!0),s.type=="video"?(r(),a("div",xt,[i("video",{controls:"",src:s.content},null,8,Et)])):k("",!0)])]))]))),128)),(r(!0),a(j,null,z(_,(s,D)=>H((r(),a("div",Ft,[H((r(),a("div",wt,[i("div",Ct,[s.type=="video"?(r(),a("video",{key:0,controls:"",src:s.localSrc},null,8,St)):(r(),a("img",{key:1,controls:"",src:s.localSrc},null,8,Dt))])])),[[m,!0]]),g(p,{style:{width:"40px",height:"40px","margin-right":"10px"},src:At})],512)),[[oe,s.status]])),256))],32),i("div",bt,[i("div",Lt,[g(f,{action:E(w)+"/common/im/sendFileMsg",data:{from_user_id:E(d),to_user_id:c.to_user_id,scene:1,type:"image",msg_id:E(F)},multiple:"","show-file-list":!1,"on-success":X,"before-upload":le},{default:V(()=>[It]),_:1},8,["action","data"]),g(f,{action:E(w)+"/common/im/sendFileMsg",data:{from_user_id:E(d),to_user_id:c.to_user_id,scene:1,type:"video",msg_id:E(F)},multiple:"","show-file-list":!1,"on-success":X,"before-upload":ce},{default:V(()=>[Bt]),_:1},8,["action","data"])]),g(u,{modelValue:S.value,"onUpdate:modelValue":t[1]||(t[1]=s=>S.value=s),style:{border:"none",outline:"none"},placeholder:"\u8BF7\u8F93\u5165...",onKeydown:t[2]||(t[2]=s=>ie(e.event))},null,8,["modelValue"]),i("div",{class:"send-btn",onClick:Q},"\u53D1\u9001")])])])}}});const _s=Me(Tt,[["__scopeId","data-v-7d155991"]]);export{_s as default};