2 lines
27 KiB
JavaScript
2 lines
27 KiB
JavaScript
import{_ as ke}from"./index-x1lD9bO6.js";import{d as Z,l as _e,Z as J,i as T,c as x,f as o,n as O,h as P,a2 as pe,G as X,q as I,O as U,o as p,B as q,K as ae,L as xe,M as ve,C as V,F as oe,r as le,A as M,a8 as ye,D as G,H as Ce,$ as Xe,b as ne,N as de,a as N,Q as $,aS as De,m as $e,a4 as Ae,E as Ye,bd as Le,aj as we,a6 as Me,a7 as Be,S as ze}from"./index-C4UKuwCQ.js";import{l as Pe,m as Re,n as He,d as Ee}from"./index-DMocdcUs.js";import"./index-BAOCFoRq.js";/* empty css *//* empty css */import{T as Fe}from"./index-B0URU-57.js";import{T as We}from"./index-CxeVpmmJ.js";import{n as Ve}from"./router-dp33hNB3.js";import{W as Ne,_ as Oe}from"./index-GMqurEao.js";import{R as Ze}from"./index-BDV2IQRF.js";import{E as Qe,g as Ue}from"./emoji-BdD0w41K.js";import{M as Ge}from"./index-QwxSwrho.js";import{c as Je}from"./company-tDza3qMe.js";import"./index-C8Ze-KO3.js";import"./use-merge-state-BIwn2CEf.js";import"./index-B3Ic4ZHL.js";import"./index-nprHl-Vj.js";import"./resize-observer-DsiuURlg.js";import"./index-BM0JB0P6.js";/* empty css */import"./index.es-BW_FzNZC.js";import"./index-Dv5Lj9Gr.js";import"./index-Y5pyQQ_e.js";import"./keyboard-b0R5wflF.js";const qe={class:"actions"},je={class:"action"},Ke={class:"info"},et={class:"count"},tt={class:"info"},ot={class:"count"},st={class:"icon"},nt={class:"info"},at={class:"count"},it={class:"action"},lt=Z({__name:"actions",props:{postDetail:{}},setup(d){const w=d,h=_e({likeCount:w.postDetail.likeCount||0,favoriteCount:w.postDetail.favoriteCount||0,commentCount:w.postDetail.commentCount||0});J(()=>w.postDetail.commentCount,r=>{h.commentCount=r||0},{immediate:!1});const n=T(!1),v=T(!1),u=T(w.postDetail.isLike||!1),c=T(w.postDetail.isFavorite||!1),b=()=>{n.value||(n.value=!0,Pe(w.postDetail.forumPostId).finally(()=>{u.value=!u.value,h.likeCount=u.value?h.likeCount+1:h.likeCount-1,n.value=!1}))},t=()=>{v.value||(v.value=!0,Re(w.postDetail.forumPostId).finally(()=>{c.value=!c.value,h.favoriteCount=c.value?h.favoriteCount+1:h.favoriteCount-1,v.value=!1}))},f=()=>{const r=document.getElementById("main-comment-input");r&&(r.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(()=>{const i=r.querySelector(".custom-input");i&&i.focus()},300))},a=()=>{const r=window.location.href;console.log(r);const i=`来自【Link56】的精彩分享:《${w.postDetail.title}》点击查看详情:${r}`;_(i)},_=async r=>{try{await navigator.clipboard.writeText(r),U.success("复制链接成功,快去分享吧😀")}catch(i){console.error("复制失败:",i)}};return(r,i)=>{const m=pe;return p(),x("div",qe,[o("div",je,[o("div",{class:O(["icon",{active:u.value,disabled:n.value}]),onClick:b},[u.value?(p(),P(m,{key:0,icon:"mynaui:like-solid"})):(p(),P(m,{key:1,icon:"mynaui:like"}))],2),o("div",Ke,[o("span",et,X(h.likeCount),1),i[0]||(i[0]=o("span",{class:"name"},"点赞",-1))])]),o("div",{class:"action",onClick:t},[o("div",{class:O(["icon",{active:c.value,disabled:v.value}])},[c.value?(p(),P(m,{key:0,icon:"weui:star-filled"})):(p(),P(m,{key:1,icon:"weui:star-outlined"}))],2),o("div",tt,[o("span",ot,X(h.favoriteCount),1),i[1]||(i[1]=o("span",{class:"name"},"收藏",-1))])]),o("div",{class:"action",onClick:f},[o("div",st,[I(m,{icon:"mingcute:comment-2-line"})]),o("div",nt,[o("span",at,X(h.commentCount),1),i[2]||(i[2]=o("span",{class:"name"},"评论",-1))])]),o("div",it,[o("div",{class:"icon",onClick:a},[I(m,{icon:"mdi:share-variant-outline"})]),i[3]||(i[3]=o("div",{class:"info"},[o("span",{class:"name"},"分享")],-1))])])}}}),ct=q(lt,[["__scopeId","data-v-751e26b2"]]),ut={class:"author-card"},rt={class:"author-main"},dt={class:"author-meta"},mt={class:"author-name"},pt={key:0,class:"author-tags"},vt={class:"actions"},ft=Z({__name:"author-card",props:{postCompanyDetail:{}},setup(d){const w=d,h=ae(),n=xe();function v(){if(w.postCompanyDetail.companyId===h.userInfo.id){U.warning("自己不能与自己聊天");return}n.setActiveChatCompany({companyId:w.postCompanyDetail.companyId,companyName:w.postCompanyDetail.name}),Ve("/messages/im")}return(u,c)=>{const b=ve,t=We,f=Fe,a=pe,_=ye;return p(),x("div",ut,[o("div",rt,[I(b,{class:"author-avatar"}),o("div",dt,[o("div",mt,X(u.postCompanyDetail.name||""),1),u.postCompanyDetail.industry.length>0?(p(),x("div",pt,[(p(!0),x(oe,null,le(u.postCompanyDetail.industry,(r,i)=>(p(),P(t,{key:i,color:"#168cff",size:"small"},{default:M(()=>[G(X(r),1)]),_:2},1024))),128))])):V("",!0)])]),I(f,{ellipsis:{rows:2,expandable:!0}},{default:M(()=>[G(X(u.postCompanyDetail.profile),1)]),_:1}),o("div",vt,[I(_,{size:"small",long:"",type:"primary",onClick:v},{icon:M(()=>[I(a,{icon:"mingcute:message-3-line"})]),default:M(()=>[c[0]||(c[0]=G(" 发起聊天 "))]),_:1})])])}}}),ht=q(ft,[["__scopeId","data-v-b3078854"]]),gt={class:"sidebar-container"},_t=Z({__name:"index",props:{postCompanyDetail:{}},setup(d){return(w,h)=>(p(),x("div",gt,[I(ht,{"post-company-detail":w.postCompanyDetail},null,8,["post-company-detail"]),I(Ne,{content:w.postCompanyDetail.description,class:"directory",top:60},null,8,["content"])]))}}),yt=q(_t,[["__scopeId","data-v-afd85198"]]),Ct="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAELklEQVRYR+2YW2wUZRTH//9vtlCoF9IoIklT3PqgPGi326hoetuaGEhIr9SgCYkkgt2WGOQVCca+GavWdr0GjD4YhG3RB3hply1LQA1tEQIxEXapGI2pEkys9LIzx2ylYWfY6e5sF0oi+7hzzvl+3/9855xvhrjNf7zN+XAHcL4Z+n8o6JWTeYt++W25S596AIZy6TB+n3yo+Nchlk8vmIIVowdXU9c3Q1gDSilBlQwjgBAYFGDvdF58/4milqvZwDpOcXWsb5Uh8hmBqkwXFMhlCN8aX5LXNbRy/T+Z+iXsHAFWRXs3QGQPyLucLDJrK5DgUXdTsxPfjAEro8E3Ce50EtxsKxPTwCPH3U2jTmJkBJgWTnAMxDeGMEoa0xQ+LJQnCD4HYFkCyAC3RdwN3U7gMkpxRTTYrMD91sCJIgCxV5R6O1Jcfy7VwonqLoj9/CqB2kF341qncGkBvRe+ureAWpRgoalCBecMFzcdK24YymZRJz5zprgq1tsJwXYL3CVZGvdGHmwZc7JQtra2gE+f712ep2QUYP714DJhaJrXLqXZQszlZwtYdSHoB9ljVk/ePVrSZFL0ZkAlxzQBVseCT8WhZhRThtFB8plk9Zi/qCi8cv0fNxvKFrDy4oF11NXXIFy2EII4iBcG3Y03VLZT8OqRd5aFPduvOEpxRayvXolxAKB2g6NgEhobBlc1HHYKY7WvHf5wtVAPgegIlbbZ9seUZ7AyFnwewi9pGoUyDmhrB931kfnC1ZwOeKlLP8GZJi6QLSFP2yep4toXSbT3ZQAfX3O6omt8Nhd9r/aHQAUMOQywYBZo5uZD2ThQ2rbPCjlnH6yI9rUryE5DU75ctJaake46Be4DuDjF8dFBNA94/AdtiySVxIlpMlTS8td801o70vMigM9huTda2lhcKHVHPO2HZv/P6LIwX7hk/+qzPSvUJGMkrg8AQYTkroRdXMlE+HH/twsG6BsOdJHYZlaO/lBZ6weOiiSXqs3Gqj0TeAxx+T75DIpgwjC0onD51pQD4JaluPrkR/cpFT9DcoVp84LOgTL/DjtBbglgou+puHwB8lEznPxJw1XSX77VtgizBvQNBw4RMqB7xt4Lc3c8lQKJaQHoO4R8ydz0/7MWoCXk8c85MrMC9J3qaafw/WtQlwXST+F3BnAeYB4obgJ1BJIuG+YtiKAjVOZ/Pd1ZdwzoG+4uBtSPpjaRbhXLcwF3hzytb2TilgVgT5BkYybBrTYC+Rvg5nRpdTRJrIs8+VPXPQXj2i4ItxC4O2NQQUQnN4U9rRcz9nH64p4ceM2lziX5Y4s3KHCdUHwE77ecMkMEp6BwhIa2Z6DslZRvfulgHafYLuCas58WLp2aLCFUga70qxOFU6dPFL2W1feYeaU43Y5z/TxnCuYabMEuC043ckdBp4pZ7f8FE5psOI1g6fwAAAAASUVORK5CYII=",wt=["width","height"],It=["width","height"],St=["width","height"],Tt=o("div",{class:"loading-gif_"},[o("span"),o("span"),o("span"),o("span"),o("span")],-1),bt=[Tt],kt={class:"auth-control_"},xt={class:"range-text"},Xt=o("div",null,null,-1),Dt=o("div",null,null,-1),$t=o("div",null,null,-1),At=[Xt,Dt,$t],Yt=Z({__name:"App",props:{type:{type:String,default:"modal"},canvasWidth:{type:Number,default:310},canvasHeight:{type:Number,default:160},show:{type:Boolean,default:!1},puzzleScale:{type:Number,default:1},sliderSize:{type:Number,default:50},range:{type:Number,default:10},zIndex:{type:Number,default:999},imgs:{type:Array,default:null},successText:{type:String,default:"验证通过!"},failText:{type:String,default:"验证失败,请重试"},sliderText:{type:String,default:"拖动滑块完成拼图"},className:{type:String,default:""}},emits:["success","fail","close","reset"],setup(d,{expose:w,emit:h}){const n=d;Ce(()=>{document.addEventListener("mousemove",z,!1),document.addEventListener("mouseup",C,!1),document.addEventListener("touchmove",z,{passive:!1}),document.addEventListener("touchend",C,!1),t.isInside=n.type==="inside",n.show&&(!t.isInside&&document.body.classList.add("vue-puzzle-overflow"),L())}),Xe(()=>{t.timer1&&clearTimeout(t.timer1),document.removeEventListener("mousemove",z,!1),document.removeEventListener("mouseup",C,!1),document.removeEventListener("touchmove",z,!1),document.removeEventListener("touchend",C,!1)});const v=T(),u=T(),c=T(),b=T(),t=_e({isInside:!1,mouseDown:!1,startWidth:50,startX:0,newX:0,pinX:0,pinY:0,loading:!1,isCanSlide:!1,error:!1,infoBoxShow:!1,infoText:"",infoBoxFail:!1,timer1:void 0,closeDown:!1,isSuccess:!1,imgIndex:-1,isSubmting:!1});J(()=>n.show,s=>{s?(!t.isInside&&document.body.classList.add("vue-puzzle-overflow"),L()):(t.isSubmting=!1,t.isSuccess=!1,t.infoBoxShow=!1,document.body.classList.remove("vue-puzzle-overflow"))}),J(()=>n.type,s=>{s==="inside"?(t.isInside=!0,document.body.classList.remove("vue-puzzle-overflow")):t.isInside=!1});const f=ne(()=>{const s=t.startWidth+t.newX-t.startX;return s<_.value?_.value:s>n.canvasWidth?n.canvasWidth:s}),a=ne(()=>Math.round(Math.max(Math.min(n.puzzleScale,2),.2)*52.5+6)),_=ne(()=>Math.max(Math.min(Math.round(n.sliderSize),Math.round(n.canvasWidth*.5)),10)),r=ne(()=>n.zIndex!==999?`z-index:${n.zIndex}`:""),i=()=>{!t.mouseDown&&!t.isSubmting&&(t.timer1&&clearTimeout(t.timer1),h("close"))},m=()=>{t.isInside||(t.closeDown=!0)},R=()=>{t.closeDown&&i(),t.closeDown=!1},A=s=>{var l;t.isCanSlide&&(t.mouseDown=!0,t.startWidth=((l=v.value)==null?void 0:l.clientWidth)||0,t.newX=s.clientX!==void 0?s.clientX:s.changedTouches[0].clientX,t.startX=s.clientX!==void 0?s.clientX:s.changedTouches[0].clientX)},z=s=>{t.mouseDown&&(s.preventDefault(),t.newX=s.clientX!==void 0?s.clientX:s.changedTouches[0].clientX)},C=()=>{t.mouseDown&&(t.mouseDown=!1,k())},S=(s=!1)=>{var l;if(t.loading&&!s)return;t.loading=!0,t.isCanSlide=!1;const Y=u.value,B=c.value,H=b.value,e=Y==null?void 0:Y.getContext("2d",{willReadFrequently:!0}),F=B==null?void 0:B.getContext("2d"),ie=H==null?void 0:H.getContext("2d");if(!e||!F||!ie){console.error("not found ctx / ctx2 / ctx3");return}const Se=navigator.userAgent.indexOf("Firefox")>=0&&navigator.userAgent.indexOf("Windows")>=0,W=document.createElement("img");if(e.fillStyle="rgba(255,255,255,1)",ie.fillStyle="rgba(255,255,255,1)",e.clearRect(0,0,n.canvasWidth,n.canvasHeight),F.clearRect(0,0,n.canvasWidth,n.canvasHeight),t.pinX=y(a.value+20,n.canvasWidth-a.value-10),t.pinY=y(20,n.canvasHeight-a.value-10),W.crossOrigin="anonymous",W.onload=()=>{const[E,ce,ue,re]=j(W),fe=Math.random(),he=Math.random(),ge=Math.random(),Te=Math.random(),se=fe<.33?-1:fe<.66?0:1,ee=he<.33?-1:he<.66?0:1,te=ge<.33?-1:ge<.66?0:1;let Q=Te<.6?1:0;se===ee&&ee===te&&te===Q&&Q===0&&(Q=1),e.save(),K(e,se,ee,te,Q),e.closePath(),Se?(e.clip(),e.save(),e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowColor="#000",e.shadowBlur=3,e.fill(),e.restore()):(e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowColor="#000",e.shadowBlur=3,e.fill(),e.clip()),e.drawImage(W,E,ce,ue,re),ie.fillRect(0,0,n.canvasWidth,n.canvasHeight),ie.drawImage(W,E,ce,ue,re),e.globalCompositeOperation="source-atop",K(e,se,ee,te,Q),e.arc(t.pinX+Math.ceil(a.value/2),t.pinY+Math.ceil(a.value/2),a.value*1.2,0,Math.PI*2,!0),e.closePath(),e.shadowColor="rgba(255, 255, 255, .8)",e.shadowOffsetX=-1,e.shadowOffsetY=-1,e.shadowBlur=Math.min(Math.ceil(8*n.puzzleScale),12),e.fillStyle="#ffffaa",e.fill();const be=e.getImageData(t.pinX-3,t.pinY-20,t.pinX+a.value+5,t.pinY+a.value+5);F.putImageData(be,0,t.pinY-20),e.restore(),e.clearRect(0,0,n.canvasWidth,n.canvasHeight),e.save(),K(e,se,ee,te,Q),e.globalAlpha=.8,e.fillStyle="#ffffff",e.fill(),e.restore(),e.save(),e.globalCompositeOperation="source-atop",K(e,se,ee,te,Q),e.arc(t.pinX+Math.ceil(a.value/2),t.pinY+Math.ceil(a.value/2),a.value*1.2,0,Math.PI*2,!0),e.shadowColor="#000",e.shadowOffsetX=2,e.shadowOffsetY=2,e.shadowBlur=16,e.fill(),e.restore(),e.save(),e.globalCompositeOperation="destination-over",e.drawImage(W,E,ce,ue,re),e.restore(),t.loading=!1,t.isCanSlide=!0},W.onerror=()=>{S(!0)},!s&&(l=n.imgs)!=null&&l.length){let E=y(0,n.imgs.length-1);E===t.imgIndex&&(E===n.imgs.length-1?E=0:E++),t.imgIndex=E,W.src=n.imgs[E]}else W.src=g()},y=(s,l)=>Math.ceil(Math.random()*(l-s)+s),j=s=>{const l=s.width/s.height,Y=n.canvasWidth/n.canvasHeight;let B=0,H=0,e=0,F=0;return l>Y?(F=n.canvasHeight,e=l*F,H=0,B=(n.canvasWidth-e)/2):(e=n.canvasWidth,F=e/l,B=0,H=(n.canvasHeight-F)/2),[B,H,e,F]},K=(s,l,Y,B,H)=>{const e=Math.ceil(15*n.puzzleScale);s.beginPath(),s.moveTo(t.pinX,t.pinY),s.lineTo(t.pinX+e,t.pinY),s.arcTo(t.pinX+e,t.pinY+l*e/2,t.pinX+e+e/2,t.pinY+l*e/2,e/2),s.arcTo(t.pinX+e+e,t.pinY+l*e/2,t.pinX+e+e,t.pinY,e/2),s.lineTo(t.pinX+e+e+e,t.pinY),s.lineTo(t.pinX+e+e+e,t.pinY+e),s.arcTo(t.pinX+e+e+e+Y*e/2,t.pinY+e,t.pinX+e+e+e+Y*e/2,t.pinY+e+e/2,e/2),s.arcTo(t.pinX+e+e+e+Y*e/2,t.pinY+e+e,t.pinX+e+e+e,t.pinY+e+e,e/2),s.lineTo(t.pinX+e+e+e,t.pinY+e+e+e),s.lineTo(t.pinX+e+e,t.pinY+e+e+e),s.arcTo(t.pinX+e+e,t.pinY+e+e+e+B*e/2,t.pinX+e+e/2,t.pinY+e+e+e+B*e/2,e/2),s.arcTo(t.pinX+e,t.pinY+e+e+e+B*e/2,t.pinX+e,t.pinY+e+e+e,e/2),s.lineTo(t.pinX,t.pinY+e+e+e),s.lineTo(t.pinX,t.pinY+e+e),s.arcTo(t.pinX+H*e/2,t.pinY+e+e,t.pinX+H*e/2,t.pinY+e+e/2,e/2),s.arcTo(t.pinX+H*e/2,t.pinY+e,t.pinX,t.pinY+e,e/2),s.lineTo(t.pinX,t.pinY)},g=()=>{const s=document.createElement("canvas"),l=s.getContext("2d");if(!l)return console.error("not found ctx"),"";s.width=n.canvasWidth,s.height=n.canvasHeight,l.fillStyle=`rgb(${y(100,255)},${y(100,255)},${y(100,255)})`,l.fillRect(0,0,n.canvasWidth,n.canvasHeight);for(let Y=0;Y<12;Y++)if(l.fillStyle=`rgb(${y(100,255)},${y(100,255)},${y(100,255)})`,l.strokeStyle=`rgb(${y(100,255)},${y(100,255)},${y(100,255)})`,y(0,2)>1)l.save(),l.rotate(y(-90,90)*Math.PI/180),l.fillRect(y(-20,s.width-20),y(-20,s.height-20),y(10,s.width/2+10),y(10,s.height/2+10)),l.restore();else{l.beginPath();const B=y(-Math.PI,Math.PI);l.arc(y(0,s.width),y(0,s.height),y(10,s.height/2+10),B,B+Math.PI*1.5),l.closePath(),l.fill()}return s.toDataURL("image/png")},k=()=>{t.isSubmting=!0;const s=f.value-_.value-(a.value-_.value)*((f.value-_.value)/(n.canvasWidth-_.value)),l=t.pinX-3-s;Math.abs(l)<n.range?(t.infoText=n.successText,t.infoBoxFail=!1,t.infoBoxShow=!0,t.isCanSlide=!1,t.isSuccess=!0,t.timer1&&clearTimeout(t.timer1),t.timer1=setTimeout(()=>{t.isSubmting=!1,h("success",l,{deviation:l,offsetX:s,pinX:t.pinX-3})},800)):(t.infoText=n.failText,t.infoBoxFail=!0,t.infoBoxShow=!0,t.isCanSlide=!1,h("fail",l,{deviation:l,offsetX:s,pinX:t.pinX-3}),t.timer1&&clearTimeout(t.timer1),t.timer1=setTimeout(()=>{t.isSubmting=!1,L()},800))},D=()=>{t.infoBoxFail=!1,t.infoBoxShow=!1,t.isCanSlide=!1,t.isSuccess=!1,t.startWidth=_.value,t.startX=0,t.newX=0},L=s=>{t.isSubmting||(D(),S(),s&&h("reset"))};return w({reset:L}),(s,l)=>(p(),P(De,{to:"body",disabled:t.isInside},[o("div",{class:O(["vue-puzzle-vcode",{inside_:t.isInside,show_:d.show},d.className]),style:N($(r)),onMousedown:m,onMouseup:R,onTouchstartPassive:m,onTouchend:R},[o("div",{class:"vue-auth-box_",onMousedown:l[3]||(l[3]=de(()=>{},["stop"])),onTouchstart:l[4]||(l[4]=de(()=>{},["stop"]))},[o("div",{class:"auth-body_",style:N(`width:${d.canvasWidth}px;height: ${d.canvasHeight}px`)},[o("canvas",{ref_key:"canvas1",ref:u,class:"auth-canvas1_",width:d.canvasWidth,height:d.canvasHeight},null,8,wt),o("canvas",{ref_key:"canvas3",ref:b,class:O(["auth-canvas3_",{show:t.isSuccess}]),width:d.canvasWidth,height:d.canvasHeight},null,10,It),o("canvas",{ref_key:"canvas2",ref:c,class:"auth-canvas2_",width:$(a),height:d.canvasHeight,style:N(`width:${$(a)}px;height:${d.canvasHeight}px;transform:translateX(${$(f)-$(_)-($(a)-$(_))*(($(f)-$(_))/(d.canvasWidth-$(_)))}px)`)},null,12,St),o("div",{class:O(["loading-box_",{hide_:!t.loading}])},bt,2),o("div",{class:O(["info-box_",{show:t.infoBoxShow},{fail:t.infoBoxFail}])},X(t.infoText),3),o("div",{class:O(["flash_",{show:t.isSuccess}]),style:N(`transform: translateX(${t.isSuccess?`${d.canvasWidth+d.canvasHeight*.578}px`:`-${d.canvasHeight*.578}px`}) skew(-30deg, 0);`)},null,6),o("img",{class:"reset_",onClick:l[0]||(l[0]=Y=>L(!0)),src:Ct})],4),o("div",kt,[o("div",{class:"range-box",style:N(`height:${$(_)}px;width:${d.canvasWidth}px`)},[o("div",xt,X(d.sliderText),1),o("div",{class:"range-slider",ref_key:"rangeSlider",ref:v,style:N(`width:${$(f)}px`)},[o("div",{class:O(["range-btn",{isDown:t.mouseDown}]),style:N(`width:${$(_)}px`),onMousedown:l[1]||(l[1]=Y=>A(Y)),onTouchstart:l[2]||(l[2]=Y=>A(Y))},At,38)],4)],4)])],32)],38)],8,["disabled"]))}}),Lt=["data-placeholder"],Mt={class:"custom-input-footer"},Bt={key:1,class:"nologin-container"},zt=Z({__name:"custom-comment-input",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:"请输入内容..."},loading:{type:Boolean,default:!1}},emits:["update:modelValue","submit"],setup(d,{emit:w}){const h=T(!1),n=ae(),v=Ye(),u=T(null),c=T(""),b=T(!1),t=ne(()=>{var g;return c.value.trim()===""?!0:((g=u.value)==null?void 0:g.innerText.trim())===""}),f=d,a=w;J(()=>f.modelValue,g=>{c.value=g,u.value&&u.value.innerHTML!==g&&(u.value.innerHTML=g)});function _(){b.value=!0}function r(){b.value=!1}function i(g){let k=g.target.innerHTML||"";(k.trim()==="<br>"||k.trim()==="<div><br></div>")&&(k="",g.target.innerHTML=""),c.value=k,a("update:modelValue",c.value)}function m(g){g.preventDefault();const k=g.clipboardData.getData("text/plain"),D=window.getSelection();if(D!==null&&D.rangeCount>0){const L=D.getRangeAt(0),s=document.createTextNode(k);L.deleteContents(),L.insertNode(s),L.setStartAfter(s),L.setEndAfter(s),D.removeAllRanges(),D.addRange(L),u.value!==null&&(c.value=u.value.innerHTML,a("update:modelValue",c.value))}}function R(g){g.key}let A=null;const z=g=>{if(!u.value)return;const k=window.getSelection();if(!k||!A)return;const D=document.createRange();D.setStart(A.node,A.offset),D.collapse(!0);const L=document.createTextNode(g);D.insertNode(L),D.setStartAfter(L),D.collapse(!0),k.removeAllRanges(),k.addRange(D),u.value.dispatchEvent(new Event("input",{bubbles:!0}))},C=()=>{const g=window.getSelection();if(!(g!=null&&g.rangeCount))return;const k=g.getRangeAt(0);A={node:k.startContainer,offset:k.startOffset}};function S(g){z(g||"")}function y(){var g;if(((g=u.value)==null?void 0:g.innerText.trim())===""){U.warning("发送内容不能为空!");return}h.value=!0}function j(){h.value=!1,a("submit",c.value),Ae(()=>{c.value="",u.value&&(u.value.innerText="")})}function K(){v.push("/login")}return(g,k)=>{const D=ye;return p(),x(oe,null,[$(n).isLogined?(p(),x("div",$e({key:0,class:["custom-input-container",{"is-focused":b.value}]},g.$attrs),[o("div",{ref_key:"inputRef",ref:u,contenteditable:"true",class:"custom-input","data-placeholder":d.placeholder,onFocus:_,onBlur:r,onInput:i,onPaste:m,onKeydown:R,onClick:C,onKeyup:C},null,40,Lt),o("div",Mt,[I(Qe,{onSelect:S}),o("div",null,[I(D,{type:"primary",size:"mini",class:"send-button",onClick:de(y,["stop"]),disabled:t.value,loading:d.loading},{default:M(()=>k[0]||(k[0]=[G("发送")])),_:1},8,["disabled","loading"])])])],16)):(p(),x("div",Bt,[k[2]||(k[2]=o("div",{class:"nologin-title"},"尚未登陆,请先登录后发表评论!",-1)),I(D,{type:"primary",size:"mini",onClick:K},{default:M(()=>k[1]||(k[1]=[G("登录/注册")])),_:1})])),I($(Yt),{show:h.value,onSuccess:j},null,8,["show"])],64)}}}),me=q(zt,[["__scopeId","data-v-5221e2eb"]]),Ie=d=>we("/forum/post/comment/add",d),Pt=d=>Le(`/forum/post/comment/list?forumPostId=${d}`),Rt=d=>we(`/forum/post/comment/delete/${d}`),Ht={class:"custom-comment-left"},Et={class:"custom-comment-right"},Ft={class:"custom-comment-meta"},Wt={class:"custom-comment-title"},Vt={class:"custom-comment-author"},Nt={key:0,class:"custom-comment-author-tag"},Ot={class:"custom-comment-time"},Zt=["innerHTML"],Qt={class:"custom-comment-actions"},Ut=["onClick"],Gt={key:1,class:"custom-comment-children"},Jt={class:"custom-comment-left"},qt={class:"custom-comment-right"},jt={class:"custom-comment-meta"},Kt={class:"custom-comment-title"},eo={class:"custom-comment-author"},to={key:0,class:"custom-comment-author-tag"},oo={class:"custom-comment-author"},so={class:"custom-comment-time"},no={class:"custom-comment-content"},ao={class:"custom-comment-actions"},io=["onClick"],lo=Z({__name:"comment-list",props:{modelValue:{},postDetail:{}},emits:["update:modelValue"],setup(d,{emit:w}){const h=d,n=w,v=T([]);J(()=>h.modelValue,r=>{v.value=r},{deep:!0,immediate:!0});const u=ae(),c=T(""),b=T(!1);function t(r){c.value===r?c.value="":c.value=r}function f(r){if(r===""){U.error("评论内容不能为空!");return}b.value=!0,Ie({fatherId:c.value,postId:h.postDetail.forumPostId,companyId:u.userInfo.id,content:r}).then(i=>{U.success(i.message);const m=a(v.value,c.value);m?(m.children||(m.children=[]),m.children.push(i.data)):v.value.push(i.data),n("update:modelValue",v.value)}).finally(()=>{c.value="",b.value=!1})}function a(r,i){for(const m of r)if(m.commentId===i||m.children&&m.children.find(A=>A.commentId===i))return m}const _=r=>{const i=Ge.confirm({title:"删除提示",content:"确认删除该评论么?",okText:"确认",hideCancel:!1,cancelText:"取消",okLoading:!1,onBeforeOk(m){i.update({okLoading:!0}),Rt(r.commentId).then(R=>{v.value.forEach((A,z)=>{var C;if(A.commentId===r.commentId){v.value.splice(z,1);return}(C=A.children)==null||C.forEach((S,y)=>{var j;if(S.commentId===r.commentId){(j=A.children)==null||j.splice(y,1);return}})}),U.success(R.message),m(!0)}).catch(()=>{m(!1)}).finally(()=>{i.update({okLoading:!1})})},onCancel:()=>{console.log("用户取消了删除")}})};return(r,i)=>{const m=ve,R=pe,A=Me,z=Be;return p(!0),x(oe,null,le(v.value,C=>(p(),x("div",{class:"custom-comment",key:C.commentId},[o("div",Ht,[I(m,{class:"custom-comment-avatar",url:C.publishCompany.avatar},null,8,["url"])]),o("div",Et,[o("div",Ft,[o("div",Wt,[o("div",Vt,X(C.publishCompany.name),1),C.publishCompany.companyId===r.postDetail.companyId?(p(),x("div",Nt,"作者")):V("",!0)]),o("div",Ot,X(C.createTime),1)]),o("div",{class:"custom-comment-content",innerHTML:C.content},null,8,Zt),o("div",Qt,[o("div",{class:"custom-comment-action",style:N({color:c.value===C.commentId?"#165dff":"#1d2129"}),onClick:S=>t(C.commentId)},[i[0]||(i[0]=o("div",{class:"i-mingcute:message-3-line"},null,-1)),o("div",null,X(c.value===C.commentId?"取消回复":"回复"),1)],12,Ut),I(z,null,{content:M(()=>[$(u).userInfo.id===C.publishCompany.companyId?(p(),P(A,{key:0,onClick:S=>_(C)},{icon:M(()=>[I(R,{icon:"material-symbols:delete-forever-outline"})]),default:M(()=>i[1]||(i[1]=[G("删除")])),_:2},1032,["onClick"])):V("",!0)]),default:M(()=>[i[2]||(i[2]=o("div",{class:"custom-comment-action flex ml-auto"},[o("div",{class:"i-akar-icons:more-horizontal-fill"})],-1))]),_:2},1024)]),c.value===C.commentId?(p(),P(me,{key:0,onSubmit:f,loading:b.value},null,8,["loading"])):V("",!0),C.children&&C.children.length>0?(p(),x("div",Gt,[(p(!0),x(oe,null,le(C.children,S=>(p(),x("div",{key:S.commentId,class:"custom-comment"},[o("div",Jt,[I(m,{class:"custom-comment-avatar",url:S.publishCompany.avatar},null,8,["url"])]),o("div",qt,[o("div",jt,[o("div",Kt,[o("div",eo,X(S.publishCompany.name),1),S.publishCompany.companyId===r.postDetail.companyId?(p(),x("div",to,"作者")):V("",!0),S.replyCompany&&S.fatherId!==C.commentId?(p(),x(oe,{key:1},[i[3]||(i[3]=o("div",null,"回复",-1)),o("div",oo,X(S.replyCompany.name),1)],64)):V("",!0)]),o("div",so,X(S.createTime),1)]),o("div",no,X(S.content),1),o("div",ao,[o("div",{class:"custom-comment-action",style:N({color:c.value===S.commentId?"#165dff":"#1d2129"}),onClick:y=>t(S.commentId)},[i[4]||(i[4]=o("div",{class:"i-mingcute:message-3-line"},null,-1)),o("div",null,X(c.value===S.commentId?"取消回复":"回复"),1)],12,io),I(z,null,{content:M(()=>[I(A,{onClick:y=>_(S)},{icon:M(()=>[I(R,{icon:"material-symbols:delete-forever-outline"})]),default:M(()=>i[5]||(i[5]=[G("删除")])),_:2},1032,["onClick"])]),default:M(()=>[i[6]||(i[6]=o("div",{class:"custom-comment-action flex ml-auto"},[o("div",{class:"i-akar-icons:more-horizontal-fill"})],-1))]),_:2},1024)]),c.value===S.commentId?(p(),P(me,{key:0,onSubmit:f,loading:b.value},null,8,["loading"])):V("",!0)])]))),128))])):V("",!0)])]))),128)}}}),co=q(lo,[["__scopeId","data-v-c202da5a"]]),uo={class:"main-container"},ro={class:"post-detail"},mo={class:"post-title"},po={key:0,class:"post-tags"},vo={class:"post-meta"},fo={class:"post-meta-item"},ho={class:"post-author"},go={class:"post-meta-item"},_o={class:"editor"},yo={class:"post-comment"},Co={class:"primary-comment"},wo={class:"reply-comment"},Io={key:0,class:"reply-comment-list"},So=Z({__name:"index",props:{postDetail:{},commentList:{}},emits:["comment-size-change"],setup(d,{emit:w}){const h=d,n=w,v=T([]);J(()=>h.commentList,f=>{v.value=f},{deep:!0,immediate:!0}),J(()=>v.value,f=>{let a=0;f.forEach(_=>{a=a+1,_.children&&_.children.length>0&&(a=a+_.children.length)}),n("comment-size-change",a)},{deep:!0});const u=ae(),c=T(""),b=T(!1),t=f=>{b.value=!0,Ie({fatherId:"",postId:h.postDetail.forumPostId,companyId:u.userInfo.id,content:f}).then(a=>{c.value="",U.success(a.message),v.value.push(a.data),n("comment-size-change")}).finally(()=>{b.value=!1})};return(f,a)=>{const _=Oe,r=ve,i=Ze;return p(),x("div",uo,[o("div",ro,[o("div",mo,X(f.postDetail.title),1),f.postDetail.tags.length>0?(p(),x("div",po,[(p(!0),x(oe,null,le(f.postDetail.tags,m=>(p(),x("div",{class:"post-tag",key:m},X(m),1))),128))])):V("",!0),o("div",vo,[o("div",fo,[a[3]||(a[3]=o("div",{class:"i-lucide:square-user"},null,-1)),o("div",ho,X(f.postDetail.companyName),1)]),o("div",go,[a[4]||(a[4]=o("div",{class:"i-lucide:clock-4"},null,-1)),o("div",null,X($(Ue)(f.postDetail.publishTime)),1)])]),a[5]||(a[5]=o("div",{class:"divider"},null,-1)),o("div",_o,[I(_,{modelValue:f.postDetail.content,"onUpdate:modelValue":a[0]||(a[0]=m=>f.postDetail.content=m),displayMode:"view"},null,8,["modelValue"])])]),o("div",yo,[a[6]||(a[6]=o("div",{class:"divider"},null,-1)),a[7]||(a[7]=o("div",{class:"post-comment-title"},"评论",-1)),o("div",Co,[I(r,{class:"post-comment-avatar"}),I(me,{id:"main-comment-input",class:"post-comment-input",modelValue:c.value,"onUpdate:modelValue":a[1]||(a[1]=m=>c.value=m),onSubmit:t,loading:b.value},null,8,["modelValue","loading"])]),o("div",wo,[v.value.length>0?(p(),x("div",Io,[I(co,{modelValue:v.value,"onUpdate:modelValue":a[2]||(a[2]=m=>v.value=m),"post-detail":f.postDetail},null,8,["modelValue","post-detail"])])):(p(),P(i,{key:1,title:"暂时没有评论 🤔",subtitle:"成为第一个评论的人吧!💬"}))])])])}}}),To=q(So,[["__scopeId","data-v-c02ff656"]]),bo={key:1,class:"post-detail"},ko=Z({__name:"index",setup(d){const w=ze(),h=ae(),n=T(!0),v=T(""),u=T({forumPostId:"",title:"",content:"",summary:"",cover:"",tags:[],publishTime:"",companyId:"",companyName:"",viewCount:0,likeCount:0,favoriteCount:0,commentCount:0}),c=T([]),b=T({companyId:"",avatar:"",name:"",email:"",profile:"",description:"",phone:"",establishedDate:"",address:[],industry:[],shortName:""});Ce(()=>{v.value=w.query.postId,t(),v.value&&He(v.value)});async function t(){if(n.value=!0,await Ee({forumPostId:v.value,companyId:h.userInfo.id}).then(a=>{u.value=a.data}),u.value===null){n.value=!1;return}await Pt(v.value).then(a=>{c.value=a.data}),await Je({companyId:u.value.companyId}).then(a=>{b.value=a.data}),n.value=!1}const f=a=>{u.value.commentCount=a};return(a,_)=>{const r=ke;return n.value?(p(),P(r,{key:0})):(p(),x("div",bo,[I(ct,{class:"actions","post-detail":u.value},null,8,["post-detail"]),I(To,{class:"main","post-detail":u.value,"comment-list":c.value,onCommentSizeChange:f},null,8,["post-detail","comment-list"]),I(yt,{class:"sidebar","post-company-detail":b.value},null,8,["post-company-detail"])]))}}}),jo=q(ko,[["__scopeId","data-v-28acf681"]]);export{jo as default};
|