WokerTask/public/admin/assets/index.107d6def.js

2 lines
12 KiB
JavaScript

import{J as ge,k as se,w as ve,B as fe,b as ye,Q as ke}from"./element-plus.10e48c93.js";import{d as xe,C as we,$ as I,r as P,j as Ee,E as Fe,o as r,c as a,a as i,U as g,L as O,u as w,T as q,a7 as V,S as y,Q as k,M as j,V as oe,bf as Se,be as Ce}from"./@vue.51d7f2d8.js";import{I as be}from"./@element-plus.c80b8015.js";import{j as H,C as Le,l as De,m as Ie,R,n as Te,o as Re,P as Ae,f as B,p as Be,a as Me,d as Ue}from"./index.8604d989.js";import{l as Ne}from"./lodash.08438971.js";import{N as A}from"./nprogress.f73355d0.js";import{b as Pe}from"./axios.105476b3.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"./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.7ac6f233.js";import"./color.44a05936.js";import"./clone.0afcbf90.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.86067895.js";import"./ms.a9ae1d6d.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 Oe="/admin/assets/XC.f7ab4c6f.png",qe="/admin/assets/SP.95ba535e.png",Ve={requestInterceptorsHook(o){var x;A.start();const{withToken:F,isParamsToData:S}=o.requestOptions,d=o.params||{},h=o.headers||{};if(F){const v=De();h.token=v}return S&&!Reflect.has(o,"data")&&((x=o.method)==null?void 0:x.toUpperCase())===Ie.POST&&(o.data=d,o.params={}),o.headers=h,o},requestInterceptorsCatchHook(o){return A.done(),o},async responseInterceptorsHook(o){A.done();const{isTransformResponse:F,isReturnDefaultResponse:S}=o.config.requestOptions;if(S)return o;if(!F)return o.data;const{code:d,data:h,show:x,msg:v}=o.data;switch(d){case R.SUCCESS:return x&&v&&B.msgSuccess(v),h;case R.FAIL:return x&&v&&B.msgError(v),Promise.reject(h);case R.LOGIN_FAILURE:return Te(),Re.push(Ae.LOGIN),Promise.reject();case R.OPEN_NEW_PAGE:return window.location.href=h.url,h;default:return h}},responseInterceptorsCatchHook(o){return A.done(),o.code!==Pe.exports.AxiosError.ERR_CANCELED&&o.message&&B.msgError(o.message),Promise.reject(o)}},je={timeout:H.timeout,baseURL:H.baseUrl,headers:{"Content-Type":Le.JSON,version:H.version},axiosHooks:Ve,requestOptions:{isParamsToData:!0,isReturnDefaultResponse:!1,isTransformResponse:!0,urlPrefix:"",ignoreCancelToken:!1,withToken:!0,isOpenRetry:!0,retryCount:2}};function He(o){return new Be(Ne.exports.merge(je,o||{}))}const M=He(),$e=o=>M.post({url:"/common/im/doBindUid",data:o}),We=o=>M.post({url:"/common/im/sendTextMsg",data:o}),$=o=>M.post({url:"/common/im/msgList",data:o}),ne=o=>M.post({url:"/common/im/contactList",data:o}),U=o=>(Se("data-v-981f48df"),o=o(),Ce(),o),Je={class:"box"},Ye={class:"talk-list"},ze={class:"mt-4 serch"},Ge=U(()=>i("div",{style:{height:"5vh"}},null,-1)),Qe=["onClick"],Ke={class:"l"},Xe={style:{position:"relative"}},Ze={key:0,class:"brage"},et={class:"tit-a"},tt={key:0,class:"value"},st={key:1,class:"value"},ot={key:2,class:"value"},nt={class:"r"},rt={class:"talk-detail",id:"content"},at={class:"top"},it=U(()=>i("div",{style:{height:"4vh"}},null,-1)),lt={key:0,class:"my_task"},ct={class:"content"},ut={key:0},dt=["href"],_t={key:1},pt={key:1},mt={key:2},ht=["src"],gt={key:1,class:"to_task"},vt={class:"content"},ft={key:0},yt=["href"],kt={key:1},xt={key:1},wt={key:2},Et=["src"],Ft={class:"my_task"},St={class:"content"},Ct={style:{width:"120px","margin-right":"10px"}},bt=["src"],Lt=["src"],Dt={class:"bottom"},It={style:{display:"flex"}},Tt=U(()=>i("img",{class:"img_cls",src:Oe,style:{width:"50px",height:"50px"}},null,-1)),Rt=U(()=>i("img",{style:{width:"50px",height:"50px"},src:qe},null,-1)),At="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",Bt=xe({__name:"index",setup(o){const F=we("base_url").replace("adminapi",""),S=Me(),d=S.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 N=P(""),ae=()=>{ne({user_id:d,keywords:N.value}).then(e=>{l.splice(0,l.length),e.forEach(t=>{l.push(t)})})},z=e=>{var t=/^(https?:\/\/|www\.|.*\.com).*$/i;return t.test(e)},C=P(""),G=()=>{!C.value||We({from_user_id:d,to_user_id:c.to_user_id,type:"text",content:C.value,scene:1,msg_id:E.value}).then(e=>{c.talkList.push(e),l[c.index].last_msg_content=C.value,l[c.index].last_msg_time=e.create_time,l[c.index].last_msg_type="text",L(),C.value="",T()})},ie=t=>{var t=window.event||t;t.keyCode==13&&G()};let E=P("");const T=()=>{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)});E.value=t};T();const _=I([]);let Q=()=>({status:!1,localType:null,localSrc:null,type:"",percentage:0,msg_id:E.value});const le=e=>{if(console.log(e.type),!e.type.includes("image"))return se.error("\u8BF7\u9009\u62E9\u6B63\u786E\u7684\u56FE\u7247\u683C\u5F0F!!"),!1;_.push(Q());let t="image";var n=_.findIndex(function(m){return m.msg_id===E.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,L(),T()}},ce=e=>{if(!e.type.includes("video"))return se.error("\u8BF7\u9009\u62E9\u6B63\u786E\u7684\u89C6\u9891\u683C\u5F0F!!"),!1;_.push(Q());let t="video";var n=_.findIndex(function(m){return m.msg_id===E.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,L(),T()}},K=e=>{e.show==0?c.talkList.push(e.data):B.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(),L()})};let X=null;Ee(()=>{X=document.getElementById("center")});const L=()=>{setTimeout(()=>{X.scrollTop=9999999},100)},Z=e=>{const t=new Date,n=new Date(e*1e3);if(ee(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"},ee=(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 ee(n,t)},D=new WebSocket("wss://worker-task.lihaink.cn/wss"),_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,L()):(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;$e({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 D.addEventListener("open",_e),D.addEventListener("message",pe),D.addEventListener("close",me),D.addEventListener("error",he),Fe(()=>{D.close()}),(e,t)=>{const n=ve,u=fe,p=ye,f=ge,m=ke;return r(),a("div",Je,[i("div",Ye,[i("div",ze,[g(u,{modelValue:N.value,"onUpdate:modelValue":t[0]||(t[0]=s=>N.value=s),placeholder:"\u641C\u7D22\u8054\u7CFB\u4EBA",class:"input-with-select"},{append:O(()=>[g(n,{icon:w(be),onClick:ae},null,8,["icon"])]),_:1},8,["modelValue"])]),Ge,(r(!0),a(q,null,V(l,(s,b)=>(r(),a("div",{class:"contacts",key:b,onClick:te=>ue(s,b)},[i("div",Ke,[i("div",Xe,[g(p,{style:{width:"40px",height:"40px"},src:s.avatar},null,8,["src"]),s.no_read_num?(r(),a("div",Ze,y(s.no_read_num),1)):k("",!0)]),i("div",et,[i("div",null,y(s.name),1),s.last_msg_type=="text"?(r(),a("div",tt,y(s.last_msg_content),1)):k("",!0),s.last_msg_type=="image"?(r(),a("div",st,"[\u56FE\u7247]")):k("",!0),s.last_msg_type=="video"?(r(),a("div",ot,"[\u89C6\u9891]")):k("",!0)])]),i("div",nt,y(Z(s.last_msg_time)),1)],8,Qe))),128))]),i("div",rt,[i("div",at,y(c.name),1),it,i("div",{class:"center",id:"center",onScroll:re},[(r(!0),a(q,null,V(c.talkList,(s,b)=>(r(),a("div",{class:"talk",key:b},[j(i("div",{style:{"text-align":"center"}},y(Z(s.create_time)),513),[[oe,b%5==0]]),s.from_user_id==w(d)?(r(),a("div",lt,[i("div",ct,[s.type=="text"?(r(),a("div",ut,[z(s.content)?(r(),a("a",{key:0,href:s.content,target:"_blank",style:{color:"#576B95"}},y(s.content),9,dt)):(r(),a("div",_t,y(s.content),1))])):k("",!0),s.type=="image"?(r(),a("div",pt,[g(p,{style:{width:"100px",height:"auto"},src:s.content,"preview-src-list":v,onClick:te=>W(s)},null,8,["src","preview-src-list","onClick"])])):k("",!0),s.type=="video"?(r(),a("div",mt,[i("video",{controls:"",src:s.content},null,8,ht)])):k("",!0)]),g(p,{style:{width:"40px",height:"40px"},src:w(S).userInfo.avatar},null,8,["src"])])):(r(),a("div",gt,[g(p,{style:{width:"40px",height:"40px","margin-right":"5px"},src:s.from_user_avatar},null,8,["src"]),i("div",vt,[s.type=="text"?(r(),a("div",ft,[z(s.content)?(r(),a("a",{key:0,href:s.content,target:"_blank",style:{color:"#576B95"}},y(s.content),9,yt)):(r(),a("div",kt,y(s.content),1))])):k("",!0),s.type=="image"?(r(),a("div",xt,[g(p,{style:{width:"100px",height:"auto"},src:s.content,"preview-src-list":v,onClick:te=>W(s)},null,8,["src","preview-src-list","onClick"])])):k("",!0),s.type=="video"?(r(),a("div",wt,[i("video",{controls:"",src:s.content},null,8,Et)])):k("",!0)])]))]))),128)),(r(!0),a(q,null,V(_,(s,b)=>j((r(),a("div",Ft,[j((r(),a("div",St,[i("div",Ct,[s.type=="video"?(r(),a("video",{key:0,controls:"",src:s.localSrc},null,8,bt)):(r(),a("img",{key:1,controls:"",src:s.localSrc},null,8,Lt))])])),[[m,!0]]),g(p,{style:{width:"40px",height:"40px","margin-right":"10px"},src:At})],512)),[[oe,s.status]])),256))],32),i("div",Dt,[i("div",It,[g(f,{action:w(F)+"/common/im/sendFileMsg",data:{from_user_id:w(d),to_user_id:c.to_user_id,scene:1,type:"image",msg_id:w(E)},multiple:"","show-file-list":!1,"on-success":K,"before-upload":le},{default:O(()=>[Tt]),_:1},8,["action","data"]),g(f,{action:w(F)+"/common/im/sendFileMsg",data:{from_user_id:w(d),to_user_id:c.to_user_id,scene:1,type:"video",msg_id:w(E)},multiple:"","show-file-list":!1,"on-success":K,"before-upload":ce},{default:O(()=>[Rt]),_:1},8,["action","data"])]),g(u,{modelValue:C.value,"onUpdate:modelValue":t[1]||(t[1]=s=>C.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:G},"\u53D1\u9001")])])])}}});const hs=Ue(Bt,[["__scopeId","data-v-981f48df"]]);export{hs as default};