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.
paopao-ce/web/dist/assets/Topic-Dyi1bGbQ.js

2 lines
4.3 KiB

import{E as I,F as A,G as M,H as O,I as z,_ as D}from"./index-Lx4Mi1rj.js";import{D as G}from"./@vicons-UfsZxvNZ.js";import{d as q,H as u,c as T,b as B,r as H,e as c,f as r,k as n,w as s,t as h,A as C,Z as m,v as $,bf as w,E as j,am as P,F as Z,x}from"./@vue-73x4sYJ2.js";import{o as J,M as V,j as K,e as Q,P as R,O as W,G as X,f as Y,g as ee,a as oe,k as te}from"./naive-ui-qF3urcFV.js";import{_ as ne}from"./main-nav.vue_vue_type_style_index_0_lang--76-h8Yy.js";import{u as se}from"./vuex-6eozxOS7.js";import"./vue-router-22lN-LLO.js";import"./axios-QLjAsgXu.js";import"./moment-TH1CLKMj.js";/* empty css */import"./seemly-tZbmuCcS.js";import"./vueuc-oXvKre1p.js";import"./evtd-9ZCiDXyn.js";import"./@css-render-RY9kiobo.js";import"./vooks-574GUng3.js";import"./vdirs-gz97tqc5.js";import"./@juggle--NVrOerG.js";import"./css-render-Jaty3dru.js";import"./@emotion-vV6BesBt.js";import"./lodash-es-KEIJqYRD.js";import"./treemate-hmrDCADh.js";import"./async-validator-BHjhHa7C.js";import"./date-fns-E8ESfRGG.js";const ae={key:0,class:"tag-item"},ce={key:0,class:"tag-quote"},le={key:1,class:"tag-quote tag-follow"},ie={key:0,class:"options"},_e=q({__name:"tag-item",props:{tag:{},showAction:{type:Boolean},checkFollowing:{type:Boolean}},setup(F){const i=u(!1),t=F,g=T(()=>t.tag.user?t.tag.user.avatar:I),_=T(()=>{let e=[];return t.tag.is_following===0?e.push({label:"关注",key:"follow"}):(t.tag.is_top===0?e.push({label:"置顶",key:"stick"}):e.push({label:"取消置顶",key:"unstick"}),e.push({label:"取消关注",key:"unfollow"})),e}),l=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"stick":A({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":A({topic_id:t.tag.id}).then(o=>{t.tag.is_top=o.top_status,window.$message.success("取消置顶")}).catch(o=>{console.log(o)});break}};return B(()=>{i.value=!1}),(e,o)=>{const d=H("router-link"),k=J,a=V,f=K,v=Q,p=R,b=W;return!e.checkFollowing||e.checkFollowing&&e.tag.is_following===1?(c(),r("div",ae,[n(b,null,{header:s(()=>[(c(),$(a,{type:"success",size:"large",round:"",key:e.tag.id},{avatar:s(()=>[n(k,{src:g.value},null,8,["src"])]),default:s(()=>[n(d,{class:"hash-link",to:{name:"home",query:{q:e.tag.tag,t:"tag"}}},{default:s(()=>[C(" #"+h(e.tag.tag),1)]),_:1},8,["to"]),e.showAction?m("",!0):(c(),r("span",ce,"("+h(e.tag.quote_num)+")",1)),e.showAction?(c(),r("span",le,"("+h(e.tag.quote_num)+")",1)):m("",!0)]),_:1}))]),"header-extra":s(()=>[e.showAction?(c(),r("div",ie,[n(p,{placement:"bottom-end",trigger:"click",size:"small",options:_.value,onSelect:l},{default:s(()=>[n(v,{type:"success",quaternary:"",circle:"",block:""},{icon:s(()=>[n(f,null,{default:s(()=>[n(w(G))]),_:1})]),_:1})]),_:1},8,["options"])])):m("",!0)]),_:1})])):m("",!0)}}}),ue=q({__name:"Topic",setup(F){const i=se(),t=u([]),g=u("hot"),_=u(!1),l=u(!1),e=u(!1);j(l,()=>{l.value||(window.$message.success("保存成功"),i.commit("refreshTopicFollow"))});const o=T({get:()=>{let a="编辑";return l.value&&(a="保存"),a},set:a=>{}}),d=()=>{_.value=!0,z({type:g.value,num:50}).then(a=>{t.value=a.topics,_.value=!1}).catch(a=>{console.log(a),_.value=!1})},k=a=>{g.value=a,a=="follow"?e.value=!0:e.value=!1,d()};return B(()=>{d()}),(a,f)=>{const v=ne,p=Y,b=V,E=ee,L=_e,N=oe,S=te,U=X;return c(),r("div",null,[n(v,{title:"话题"}),n(U,{class:"main-content-wrap tags-wrap",bordered:""},{default:s(()=>[n(E,{type:"line",animated:"","onUpdate:value":k},P({default:s(()=>[n(p,{name:"hot",tab:"热门"}),n(p,{name:"new",tab:"最新"}),w(i).state.userLogined?(c(),$(p,{key:0,name:"follow",tab:"关注"})):m("",!0)]),_:2},[w(i).state.userLogined?{name:"suffix",fn:s(()=>[n(b,{checked:l.value,"onUpdate:checked":f[0]||(f[0]=y=>l.value=y),checkable:""},{default:s(()=>[C(h(o.value),1)]),_:1},8,["checked"])]),key:"0"