mirror of https://github.com/rocboss/paopao-ce
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
5.1 KiB
2 lines
5.1 KiB
import{E as I,F as q,G as A,H as M,I as O,J as j,_ as D}from"./index-DxHQoSDp.js";import{M as J,Q as H,B as Q,i as Y,m as K,O as B,G as R,f as W,g as X,j as Z,a as x,J as ee}from"./naive-ui-BJojRuLw.js";import{D as oe}from"./@vicons-PCg97L0F.js";import{d as C,r as _,c as $,b as P,l as te,f as p,Y as u,j as c,q as n,w as a,bq as m,t as w,G as L,z as k,C as ne,ar as se,F as ae,x as ce}from"./@vue-9sINKCPW.js";import{_ as ie}from"./main-nav.vue_vue_type_style_index_0_lang-D7-FAbTY.js";import{u as le}from"./vuex--ttreJMD.js";import"./vue-router-yrkFRUM9.js";import"./axios-t--hEgTQ.js";import"./moment-P60zs0je.js";/* empty css */import"./seemly-D-teBmey.js";import"./vueuc-DrMWnH2h.js";import"./evtd-CI_DDEu_.js";import"./@css-render-DN2R7sM6.js";import"./vooks-CfQnrjIt.js";import"./vdirs-DRH9Xvnd.js";import"./@juggle-C8OzoCMD.js";import"./css-render-BDrvWz3H.js";import"./@emotion-WldOFDRm.js";import"./lodash-es-TJvrUncL.js";import"./treemate-HRdUPn5m.js";import"./async-validator-9PlIezaS.js";import"./date-fns-Db9XENWt.js";const _e={key:0,class:"tag-item"},pe={key:0,class:"tag-quote"},ue={key:1,class:"tag-quote tag-follow"},re={key:0,class:"options"},ge=C({__name:"tag-item",props:{tag:{},showAction:{type:Boolean},checkFollowing:{type:Boolean},checkPin:{type:Boolean}},setup(F){const l=_(!1),t=F,d=$(()=>t.tag.user?t.tag.user.avatar:I),r=$(()=>{let e=[];return t.tag.is_following===0?e.push({label:"关注",key:"follow"}):(t.tag.is_pin===0?e.push({label:"钉住",key:"pin"}):e.push({label:"取消钉住",key:"unpin"}),t.tag.is_top===0?e.push({label:"置顶",key:"stick"}):e.push({label:"取消置顶",key:"unstick"}),e.push({label:"取消关注",key:"unfollow"})),e}),i=e=>{switch(e){case"follow":O({topic_id:t.tag.id}).then(o=>{t.tag.is_following=1,window.$message.success("关注成功")}).catch(o=>{console.log(o)});break;case"unfollow":M({topic_id:t.tag.id}).then(o=>{t.tag.is_following=0,window.$message.success("取消关注")}).catch(o=>{console.log(o)});break;case"pin":A({topic_id:t.tag.id}).then(o=>{t.tag.is_pin=1,window.$message.success("钉住成功")}).catch(o=>{console.log(o)});break;case"unpin":A({topic_id:t.tag.id}).then(o=>{t.tag.is_pin=0,window.$message.success("取消钉住")}).catch(o=>{console.log(o)});break;case"stick":q({topic_id:t.tag.id}).then(o=>{t.tag.is_top=o.top_status,window.$message.success("置顶成功")}).catch(o=>{console.log(o)});break;case"unstick":q({topic_id:t.tag.id}).then(o=>{t.tag.is_top=o.top_status,window.$message.success("取消置顶")}).catch(o=>{console.log(o)});break}};return P(()=>{l.value=!1}),(e,o)=>{const v=te("router-link"),h=K,y=B,s=Y,f=Q,b=H,g=J;return!e.checkFollowing&&!e.checkPin||e.checkFollowing&&e.tag.is_following===1||e.checkPin&&e.tag.is_following===1&&e.tag.is_pin===1?(c(),p("div",_e,[n(g,null,{header:a(()=>[(c(),w(y,{type:"success",size:"large",round:"",key:e.tag.id},{avatar:a(()=>[n(h,{src:d.value},null,8,["src"])]),default:a(()=>[n(v,{class:"hash-link",to:{name:"home",query:{q:e.tag.tag,t:"tag"}}},{default:a(()=>[L(" #"+k(e.tag.tag),1)]),_:1},8,["to"]),e.showAction?u("",!0):(c(),p("span",pe,"("+k(e.tag.quote_num)+")",1)),e.showAction?(c(),p("span",ue,"("+k(e.tag.quote_num)+")",1)):u("",!0)]),_:1}))]),"header-extra":a(()=>[e.showAction?(c(),p("div",re,[n(b,{placement:"bottom-end",trigger:"click",size:"small",options:r.value,onSelect:i},{default:a(()=>[n(f,{type:"success",quaternary:"",circle:"",block:""},{icon:a(()=>[n(s,null,{default:a(()=>[n(m(oe))]),_:1})]),_:1})]),_:1},8,["options"])])):u("",!0)]),_:1})])):u("",!0)}}}),me={key:0,class:"empty-wrap"},de=C({__name:"Topic",setup(F){const l=le(),t=_([]),d=_("hot"),r=_(!1),i=_(!1),e=_(!1),o=_(!1);ne(i,()=>{i.value||(window.$message.success("保存成功"),l.commit("refreshTopicFollow"))});const v=$({get:()=>{let s="编辑";return i.value&&(s="保存"),s},set:s=>{}}),h=()=>{r.value=!0,j({type:d.value,num:50}).then(s=>{t.value=s.topics,r.value=!1}).catch(s=>{t.value=[],console.log(s),r.value=!1})},y=s=>{d.value=s,e.value=s==="follow",o.value=s==="pin",h()};return P(()=>{h()}),(s,f)=>{const b=ie,g=X,V=B,z=W,N=ge,S=x,U=ee,E=Z,G=R;return c(),p("div",null,[n(b,{title:"话题"}),n(G,{class:"main-content-wrap tags-wrap",bordered:""},{default:a(()=>[n(z,{type:"line",animated:"","onUpdate:value":y},se({default:a(()=>[n(g,{name:"hot",tab:"热门"}),n(g,{name:"new",tab:"最新"}),m(l).state.userLogined?(c(),w(g,{key:0,name:"follow",tab:"关注"})):u("",!0),m(l).state.userLogined?(c(),w(g,{key:1,name:"pin",tab:"钉住"})):u("",!0)]),_:2},[m(l).state.userLogined?{name:"suffix",fn:a(()=>[n(V,{checked:i.value,"onUpdate:checked":f[0]||(f[0]=T=>i.value=T),checkable:""},{default:a(()=>[L(k(v.value),1)]),_:1},8,["checked"])]),key:"0"}:void 0]),1024),n(E,{show:r.value},{default:a(()=>[n(S,null,{default:a(()=>[(c(!0),p(ae,null,ce(t.value,T=>(c(),w(N,{tag:T,showAction:m(l).state.userLogined&&i.value,checkFollowing:e.value,checkPin:o.value},null,8,["tag","showAction","checkFollowing","checkPin"]))),256))]),_:1}),t.value.length===0?(c(),p("div",me,[n(U,{size:"large",description:"暂无数据"})])):u("",!0)]),_:1},8,["show"])]),_:1})])}}}),Ie=D(de,[["__scopeId","data-v-f89944c3"]]);export{Ie as default};
|