TaskSystem/public/admin/assets/index.6497010e.js
2023-10-20 22:57:58 +08:00

2 lines
11 KiB
JavaScript

import{J as ge,k as te,w as ve,B as fe,b as ye,Q as xe}from"./element-plus.b0ecf6ae.js";import{d as ke,$ as I,r as P,j as we,E as Ee,o as r,c as a,a as i,U as g,L as q,u as w,T as V,a7 as j,S as y,Q as x,M as H,V as se,bf as Fe,be as Se}from"./@vue.51d7f2d8.js";import{I as Ce}from"./@element-plus.c80b8015.js";import{j as M,C as be,l as Le,m as De,R,n as Ie,o as Te,P as Be,f as T,p as Re,a as Ae,d as Me}from"./index.de9860bb.js";import{l as Ue}from"./lodash.7667638b.js";import{N as A}from"./nprogress.f73355d0.js";import{b as Ne}from"./axios.a9c6ff29.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.b3d568d6.js";import"./color.c724765d.js";import"./clone.b8f0173c.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 Oe="/admin/assets/XC.f7ab4c6f.png",Pe="/admin/assets/SP.95ba535e.png",qe={requestInterceptorsHook(o){var k;A.start();const{withToken:E,isParamsToData:S}=o.requestOptions,d=o.params||{},h=o.headers||{};if(E){const v=Le();h.token=v}return S&&!Reflect.has(o,"data")&&((k=o.method)==null?void 0:k.toUpperCase())===De.POST&&(o.data=d,o.params={}),o.headers=h,o},requestInterceptorsCatchHook(o){return A.done(),o},async responseInterceptorsHook(o){A.done();const{isTransformResponse:E,isReturnDefaultResponse:S}=o.config.requestOptions;if(S)return o;if(!E)return o.data;const{code:d,data:h,show:k,msg:v}=o.data;switch(d){case R.SUCCESS:return k&&v&&T.msgSuccess(v),h;case R.FAIL:return k&&v&&T.msgError(v),Promise.reject(h);case R.LOGIN_FAILURE:return Ie(),Te.push(Be.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!==Ne.exports.AxiosError.ERR_CANCELED&&(o.message.indexOf("timeout")!==-1?T.msgError("\u8BF7\u6C42\u8D85\u65F6!!!"):o.message&&T.msgError(o.message)),Promise.reject(o)}},Ve={timeout:M.timeout,baseURL:M.baseUrl,headers:{"Content-Type":be.JSON,version:M.version},axiosHooks:qe,requestOptions:{isParamsToData:!0,isReturnDefaultResponse:!1,isTransformResponse:!0,urlPrefix:"common",ignoreCancelToken:!1,withToken:!0,isOpenRetry:!0,retryCount:2}};function je(o){return new Re(Ue.exports.merge(Ve,o||{}))}const U=je(),He=o=>U.post({url:"/im/doBindUid",data:o}),$e=o=>U.post({url:"/im/sendTextMsg",data:o}),$=o=>U.post({url:"/im/msgList",data:o}),oe=o=>U.post({url:"/im/contactList",data:o}),N=o=>(Fe("data-v-92036668"),o=o(),Se(),o),We={class:"box"},Je={class:"talk-list"},Ye={class:"mt-4 serch"},ze=N(()=>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=N(()=>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},xt={key:1},kt={key:2},wt=["src"],Et={class:"my_task"},Ft={class:"content"},St={style:{width:"120px","margin-right":"10px"}},Ct=["src"],bt=["src"],Lt={class:"bottom"},Dt={style:{display:"flex"}},It=N(()=>i("img",{class:"img_cls",src:Oe,style:{width:"50px",height:"50px"}},null,-1)),Tt=N(()=>i("img",{style:{width:"50px",height:"50px"},src:Pe},null,-1)),Bt="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",Rt=ke({__name:"index",setup(o){const E=M.baseUrl;console.log(E,"\u6211\u662Fbaseurl");const S=Ae(),d=S.userInfo.id;let h=1,k=null;const v=I([]),W=e=>{v[0]=e.content},ne=e=>{e.target.scrollTop<=0&&(h++,$({from_user_id:d,to_user_id:k,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 re=I([]);const c=I({name:"",to_user_id:"",talkList:[],index:0});oe({user_id:d}).then(e=>{e.forEach(t=>{l.push(t),re.push(t)}),c.name=l[0].name,c.to_user_id=l[0].id,k=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=P(""),ae=()=>{oe({user_id:d,keywords:O.value}).then(e=>{l.splice(0,l.length),e.forEach(t=>{l.push(t)})})},Y=e=>{var t=/^(https?:\/\/|www\.|.*\.com).*$/i;return t.test(e)},C=P(""),z=()=>{!C.value||$e({from_user_id:d,to_user_id:c.to_user_id,type:"text",content:C.value,scene:1,msg_id:F.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="",B()})},ie=t=>{var t=window.event||t;t.keyCode==13&&z()};let F=P("");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 G=()=>({status:!1,localType:null,localSrc:null,type:"",percentage:0,msg_id:F.value});const le=e=>{if(!e.type.includes("image"))return te.error("\u8BF7\u9009\u62E9\u6B63\u786E\u7684\u56FE\u7247\u683C\u5F0F!!"),!1;_.push(G());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,L(),B()}},ce=e=>{if(!e.type.includes("video"))return te.error("\u8BF7\u9009\u62E9\u6B63\u786E\u7684\u89C6\u9891\u683C\u5F0F!!"),!1;_.push(G());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,L(),B()}},Q=e=>{e.show==0?c.talkList.push(e.data):T.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},ue=(e,t)=>{l[t].no_read_num=0,c.name=e.name,c.to_user_id=e.id,c.index=t,k=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 K=null;we(()=>{K=document.getElementById("center")});const L=()=>{setTimeout(()=>{K.scrollTop=9999999},100)},X=e=>{const t=new Date,n=new Date(e*1e3);if(Z(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"},Z=(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 Z(n,t)},D=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?(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;He({client_id:u,user_id:d,scene:1}).then(p=>{J=!0,console.log("\u7ED1\u5B9A\u6210\u529F")})}},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),Ee(()=>{D.close()}),(e,t)=>{const n=ve,u=fe,p=ye,f=ge,m=xe;return r(),a("div",We,[i("div",Je,[i("div",Ye,[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:q(()=>[g(n,{icon:w(Ce),onClick:ae},null,8,["icon"])]),_:1},8,["modelValue"])]),ze,(r(!0),a(V,null,j(l,(s,b)=>(r(),a("div",{class:"contacts",key:b,onClick:ee=>ue(s,b)},[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)):x("",!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)):x("",!0),s.last_msg_type=="image"?(r(),a("div",tt,"[\u56FE\u7247]")):x("",!0),s.last_msg_type=="video"?(r(),a("div",st,"[\u89C6\u9891]")):x("",!0)])]),i("div",ot,y(X(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:ne},[(r(!0),a(V,null,j(c.talkList,(s,b)=>(r(),a("div",{class:"talk",key:b},[H(i("div",{style:{"text-align":"center"}},y(X(s.create_time)),513),[[se,b%5==0]]),s.from_user_id==w(d)?(r(),a("div",it,[i("div",lt,[s.type=="text"?(r(),a("div",ct,[Y(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))])):x("",!0),s.type=="image"?(r(),a("div",_t,[g(p,{style:{width:"100px",height:"auto"},src:s.content,"preview-src-list":v,onClick:ee=>W(s)},null,8,["src","preview-src-list","onClick"])])):x("",!0),s.type=="video"?(r(),a("div",pt,[i("video",{controls:"",src:s.content},null,8,mt)])):x("",!0)]),g(p,{style:{width:"40px",height:"40px"},src:w(S).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,[Y(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))])):x("",!0),s.type=="image"?(r(),a("div",xt,[g(p,{style:{width:"100px",height:"auto"},src:s.content,"preview-src-list":v,onClick:ee=>W(s)},null,8,["src","preview-src-list","onClick"])])):x("",!0),s.type=="video"?(r(),a("div",kt,[i("video",{controls:"",src:s.content},null,8,wt)])):x("",!0)])]))]))),128)),(r(!0),a(V,null,j(_,(s,b)=>H((r(),a("div",Et,[H((r(),a("div",Ft,[i("div",St,[s.type=="video"?(r(),a("video",{key:0,controls:"",src:s.localSrc},null,8,Ct)):(r(),a("img",{key:1,controls:"",src:s.localSrc},null,8,bt))])])),[[m,!0]]),g(p,{style:{width:"40px",height:"40px","margin-right":"10px"},src:Bt})],512)),[[se,s.status]])),256))],32),i("div",Lt,[i("div",Dt,[g(f,{action:w(E)+"common/im/sendFileMsg",data:{from_user_id:w(d),to_user_id:c.to_user_id,scene:1,type:"image",msg_id:w(F)},multiple:"","show-file-list":!1,"on-success":Q,"before-upload":le},{default:q(()=>[It]),_:1},8,["action","data"]),g(f,{action:w(E)+"common/im/sendFileMsg",data:{from_user_id:w(d),to_user_id:c.to_user_id,scene:1,type:"video",msg_id:w(F)},multiple:"","show-file-list":!1,"on-success":Q,"before-upload":ce},{default:q(()=>[Tt]),_: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:z},"\u53D1\u9001")])])])}}});const _s=Me(Rt,[["__scopeId","data-v-92036668"]]);export{_s as default};