PageSourceSearch

https://cha.fan/assets/Topic-Cd0o2Kou.js

js cha.fan collected 2026-09-25 21:49:49 UTC 3,911 bytes, 1 lines download raw bytes

1import{d as $,m as z,g as V,a,w as e,e as k,t as T,c as p,f as h,h as E,r as d,j as t,l as i,u as K,p as L,n as N,b as C,q as W,k as X,i as B}from"./vendor-CxandCH_.js";import{c as M,u as j,a as I,d as S,e as Y,f as Z}from"./index-DjJipepy.js";import{_ as ee,a as te}from"./DynamicItemList.vue_vue_type_script_setup_true_lang-BLXN_O_-.js";const ae={class:"text-h5 text-primary"},oe={key:0},se={class:"mt-2"},P=$({__name:"TopicCard",props:{topic:{}},setup(A){const v=M(),c=A,{token:_}=j(),o=d(null),b=d(!1),l=d(!1),m=d(null);z(async()=>{await v.captureApiError(async()=>{const r=await I.getTopicSubscription(_.value,c.topic.uuid);o.value=r.data}),c.topic.parent_topic_uuid&&(m.value=(await S.getTopic(c.topic.parent_topic_uuid)).data)});async function w(){await v.captureApiError(async()=>{if(c.topic){b.value=!0;const r=await I.unsubscribeTopic(_.value,c.topic.uuid);b.value=!1,o.value=r.data}})}async function u(){await v.captureApiError(async()=>{if(c.topic){l.value=!0;const r=await I.subscribeTopic(_.value,c.topic.uuid);l.value=!1,o.value=r.data}})}return(r,f)=>{const g=t("v-card-title"),q=t("v-chip"),n=t("v-btn"),s=t("v-card-text");return i(),V("div",null,[a(g,null,{default:e(()=>[k("div",ae,"话题:"+T(A.topic.name),1)]),_:1}),o.value?(i(),p(s,{key:0},{default:e(()=>[m.value?(i(),V("div",oe,[f[0]||(f[0]=k("span",null,"所属话题:",-1)),a(q,{to:"/topics/"+m.value.uuid},{default:e(()=>[h(T(m.value.name),1)]),_:1},8,["to"])])):E("",!0),k("div",se,[o.value.subscribed_by_me?(i(),p(n,{key:0,disabled:b.value,variant:"tonal",size:"small",onClick:w},{default:e(()=>[h(" 已关注 ("+T(o.value.subscription_count)+") ",1)]),_:1},8,["disabled"])):(i(),p(n,{key:1,disabled:l.value,color:"primary",variant:"flat",size:"small",onClick:u},{default:e(()=>[h(" 关注 ("+T(o.value.subscription_count)+") ",1)]),_:1},8,["disabled"]))])]),_:1})):E("",!0)])}}}),le=$({__name:"Topic",setup(A){const v=M(),c=Y(),_=K(),o=X(),{token:b}=j(),l=d(null),m=d([]),w=d(!0),u=d(0),r=B(()=>o.params.id),f=B(()=>c.narrowUI);async function g(){await v.captureApiError(async()=>{const n=await S.getTopic(r.value);u.value=33,n&&(l.value=n.data,u.value=100,w.value=!1)})}L(()=>o.params.id,(n,s)=>{n!==s&&o.name==="topic"&&(w.value=!0,u.value=0,m.value=[],g())}),z(async()=>{await g()});async function q(n,s){if(n>0)return[];let x=null;return await v.captureApiError(async()=>{l.value!==null&&(x=(await S.getQuestionsOfTopic(b.value,l.value.uuid)).data)}),x}return(n,s)=>{const x=t("v-progress-linear"),D=t("v-tab"),Q=t("v-tabs"),F=t("v-window-item"),O=t("v-window"),U=t("v-col"),R=t("v-sheet"),G=t("v-bottom-sheet"),H=t("v-row"),J=t("v-container");return i(),p(J,{fluid:""},{default:e(()=>[w.value?(i(),p(x,{key:0,modelValue:u.value,"onUpdate:modelValue":s[0]||(s[0]=y=>u.value=y),indeterminate:u.value===0},null,8,["modelValue","indeterminate"])):(i(),p(H,{key:1,class:"mb-12",justify:"center"},{default:e(()=>[a(U,{class:N({"v-col-8":C(_).mdAndUp&&!f.value,"fixed-narrow-col":f.value,"less-left-right-padding":!C(_).mdAndUp})},{default:e(()=>[a(Q,{"model-value":"questions"},{default:e(()=>[a(D,{value:"questions"},{default:e(()=>[...s[1]||(s[1]=[h("问题",-1)])]),_:1})]),_:1}),a(O,{"model-value":"questions"},{default:e(()=>[a(F,{value:"questions"},{default:e(()=>[a(ee,{loadItems:q,emptyItemsText:"暂无",nullItemsText:""},{default:e(({item:y})=>[a(te,{questionPreview:y},null,8,["questionPreview"])]),_:1})]),_:1})]),_:1})]),_:1},8,["class"]),C(_).mdAndUp?(i(),p(U,{key:0,class:N(f.value?"fixed-narrow-sidecol":"v-col-4")},{default:e(()=>[a(P,{topic:l.value},null,8,["topic"])]),_:1},8,["class"])):(i(),p(G,{key:1},{activator:e(({props:y})=>[k("div",W(y,{class:"bottom-btn"}),[a(Z,{name:"Info"}),s[2]||(s[2]=k("span",{class:"ml-1 text-grey"},"话题信息",-1))],16)]),default:e(()=>[a(R,{class:"pa-2"},{default:e(()=>[a(P,{topic:l.value},null,8,["topic"])]),_:1})]),_:1}))]),_:1}))]),_:1})}}});
1export{le as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.