PageSourceSearch

https://www.bilinote.com.cn/assets/Collections-DYaI7w47.js

js bilinote.com.cn collected 2026-10-10 02:42:30 UTC 12,428 bytes, 1 lines download raw bytes

1import{d as Ue,i as xe,c as i,a as t,b as a,m as v,R as ze,J as n,t as c,r as u,x as B,U as p,Q as r,e as _,F as j,p as R,g as z,s as Te,H as G,Z as Ie,u as Ae,N as Se,o as l,_ as Me}from"./index-BTrELifV.js";import{c as y}from"./collection-DzNhVM4I.js";import{c as T}from"./createLucideIcon-CWquSz1K.js";import{P as $}from"./plus-MLPwAgsc.js";import{F as Le}from"./folder-open-WlXMJ90t.js";import{S as Ne}from"./share-2-DRmj4_5d.js";import{T as De}from"./trash-2-BYas67_q.js";const Oe=T("clock-3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]]);const Be=T("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);const je=T("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const Ee=T("inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);const Fe=T("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);const Ve=T("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),Pe={class:"collections-page"},Re={class:"collections-content"},$e={class:"page-header"},He={class:"title-block"},qe={class:"title-icon"},Je={class:"page-actions"},Ke={class:"overview-strip"},Qe={class:"overview-item"},Ze={class:"overview-value"},Ge={class:"overview-item"},We={class:"overview-value"},Xe={class:"overview-item"},Ye={class:"overview-value"},et={class:"overview-item"},tt={class:"overview-value"},at={key:0,class:"collection-grid"},ot={class:"card-body"},st={key:1,class:"empty-state"},nt={class:"empty-icon"},lt={key:2,class:"collection-grid"},it=["onClick"],rt={class:"card-cover"},ct=["src","alt"],ut={key:1,class:"cover-fallback"},dt={key:2,class:"card-source"},vt=["onClick"],pt={class:"icon-action"},_t={class:"card-body"},mt={class:"card-name"},ft={key:0,class:"card-desc"},yt={class:"card-meta"},gt={class:"card-footer"},kt={key:0,class:"card-tags"},ht={key:1,class:"source-muted"},wt={class:"create-card-icon"},bt={key:3,class:"pagination-wrap"},Ct={class:"share-modal"},Ut={key:0,class:"share-link-row"},xt={class:"share-meta"},zt={class:"share-actions"},Tt=Ue({__name:"Collections",setup(It){const W=Ae(),g=u(!1),E=u(!1),m=u([]),M=u(0),L=u(1),N=u(20),k=u(""),I=u(!1),A=u("create"),D=u(null),F=u(!1),V=u(!1),h=u(!1),S=u(null),f=u(null),d=Ie({name:"",description:"",coverUrl:"",tags:[]}),X=B(()=>m.value.filter(o=>o.sourceType==="MANUAL").length),Y=B(()=>m.value.filter(o=>o.sourceType!=="MANUAL").length),ee=B(()=>{const o=[...m.value].sort((e,C)=>+new Date(C.updatedAt)-+new Date(e.updatedAt))[0];return o?J(o.updatedAt):"--"}),w=B(()=>f.value?.shortCode?`${window.location.origin}/s/${f.value.shortCode}`:"");let H;async function b(){g.value=!0;try{const o=await y.list({page:L.value,size:N.value,keyword:k.value||void 0});m.value=o.records,M.value=o.total}catch{p.error("加载合集失败")}finally{g.value=!1}}function P(){A.value="create",D.value=null,Object.assign(d,{name:"",description:"",coverUrl:"",tags:[]}),I.value=!0}function te(o){A.value="edit",D.value=o.collectionId,Object.assign(d,{name:o.name,description:o.description||"",coverUrl:o.coverUrl||"",tags:o.tags||[]}),I.value=!0}function ae(o){W.push(`/workspace/collection/${o}`)}function oe(){window.clearTimeout(H),H=window.setTimeout(()=>{L.value=1,b()},260)}function se(o,e){if(o==="share"){le(e);return}o==="delete"&&de(e)}function ne(o,e){se(String(o.key),e)}async function le(o){S.value=o,F.value=!0,V.value=!0;try{f.value=await y.shareStatus(o.collectionId)}catch(e){p.error(e?.response?.data?.msg||"加载分享状态失败")}finally{V.value=!1}}async function ie(){if(S.value){h.value=!0;try{f.value=await y.enableShare(S.value.collectionId),p.success("分享已开启")}catch(o){p.error(o?.response?.data?.msg||"开启失败")}finally{h.value=!1}}}async function re(){if(S.value){h.value=!0;try{await y.disableShare(S.value.collectionId),f.value={...f.value,active:!1},p.success("分享已关闭")}catch(o){p.error(o?.response?.data?.msg||"关闭失败")}finally{h.value=!1}}}
1async function ce(){if(w.value)try{await navigator.clipboard.writeText(w.value),p.success("链接已复制")}catch{p.warning("复制失败,请手动复制")}}function ue(){w.value&&window.open(w.value,"_blank")}function de(o){Se.confirm({title:"删除合集",content:`确定删除「${o.name}」吗?合集内笔记会保留。`,okText:"删除",okType:"danger",cancelText:"取消",async onOk(){await y.delete(o.collectionId),p.success("合集已删除"),await b()}})}async function ve(){if(!d.name?.trim()){p.warning("合集名不能为空");return}E.value=!0;try{A.value==="create"?(await y.create({...d}),p.success("合集已创建")):D.value&&(await y.update(D.value,{...d}),p.success("已保存")),I.value=!1,await b()}catch{p.error("保存失败")}finally{E.value=!1}}function q(o){return{MANUAL:"手动创建",BILIBILI_COLLECTION:"B站合集",FAVORITES:"B站收藏夹",UP_USER:"UP 主"}[o]||o}function J(o){if(!o)return"--";const e=new Date(o);return Number.isNaN(e.getTime())?"--":new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit"}).format(e)}return xe(b),(o,e)=>{const C=r("a-input"),U=r("a-button"),pe=r("a-skeleton-image"),_e=r("a-skeleton"),me=r("a-tooltip"),K=r("a-menu-item"),fe=r("a-menu"),ye=r("a-dropdown"),ge=r("a-tag"),ke=r("a-pagination"),Q=r("a-spin"),O=r("a-form-item"),he=r("a-textarea"),we=r("a-select"),be=r("a-form"),Z=r("a-modal"),Ce=r("a-popconfirm");return l(),i("div",Pe,[t("div",Re,[t("div",$e,[t("div",He,[t("div",qe,[a(v(ze))]),e[10]||(e[10]=t("div",null,[t("h2",{class:"page-title"},"笔记合集"),t("p",{class:"page-sub"},"把同一主题的笔记集中管理,后续可继续融合、分享和导出。")],-1))]),t("div",Je,[a(C,{value:k.value,"onUpdate:value":e[0]||(e[0]=s=>k.value=s),placeholder:"搜索合集名 / 描述","allow-clear":"",class:"search",onPressEnter:b,onChange:oe},{prefix:n(()=>[a(v(Ve),{size:16,class:"search-prefix"})]),_:1},8,["value"]),a(U,{type:"primary",class:"create-btn",onClick:P},{icon:n(()=>[a(v($),{size:16})]),default:n(()=>[e[11]||(e[11]=_(" 新建合集 ",-1))]),_:1})])]),t("div",Ke,[t("div",Qe,[e[12]||(e[12]=t("span",{class:"overview-label"},"全部",-1)),t("span",Ze,c(M.value),1)]),t("div",Ge,[e[13]||(e[13]=t("span",{class:"overview-label"},"来源合集",-1)),t("span",We,c(Y.value),1)]),t("div",Xe,[e[14]||(e[14]=t("span",{class:"overview-label"},"手动创建",-1)),t("span",Ye,c(X.value),1)]),t("div",et,[e[15]||(e[15]=t("span",{class:"overview-label"},"最近更新",-1)),t("span",tt,c(ee.value),1)])]),a(Q,{spinning:g.value&&m.value.length>0},{default:n(()=>[g.value&&m.value.length===0?(l(),i("div",at,[(l(),i(j,null,R(6,s=>t("div",{key:s,class:"collection-card collection-card--skeleton"},[a(pe,{active:"",class:"skeleton-cover"}),t("div",ot,[a(_e,{active:"",paragraph:{rows:2}})])])),64))])):z("",!0),m.value.length===0&&!g.value?(l(),i("div",st,[t("div",nt,[a(v(Ee),{size:34})]),t("h3",null,c(k.value?"没有匹配的合集":"还没有合集"),1),t("p",null,c(k.value?"换个关键词试试,或新建一个合集继续整理笔记。":"新建一个合集,把同一主题、课程或 UP 主的笔记归到一起。"),1),a(U,{type:"primary",class:"create-btn",onClick:P},{icon:n(()=>[a(v($),{size:16})]),default:n(()=>[_(" "+c(k.value?"新建合集":"新建第一个合集"),1)]),_:1})])):!g.value||m.value.length>0?(l(),i("div",lt,[(l(!0),i(j,null,R(m.value,s=>(l(),i("div",{key:s.collectionId,class:"collection-card",onClick:x=>ae(s.collectionId)},[t("div",rt,[s.coverUrl?(l(),i("img",{key:0,src:s.coverUrl,alt:s.name},null,8,ct)):(l(),i("div",ut,[a(v(Le),{size:42})])),s.sourceType!=="MANUAL"?(l(),i("span",dt,c(q(s.sourceType)),1)):z("",!0),t("div",{class:"card-actions",onClick:e[1]||(e[1]=Te(()=>{},["stop"]))},[a(me,{title:"编辑合集"},{default:n(()=>[t("button",{class:"icon-action",onClick:x=>te(s)},[a(v(Fe),{size:15})],8,vt)]),_:2},1024),a(ye,{trigger:"click"},{overlay:n(()=>[a(fe,{onClick:x=>ne(x,s)},{default:n(()=>[a(K,{key:"share"},{default:n(()=>[a(v(Ne),{size:14}),e[16]||(e[16]=_(" 分享合集 ",-1))]),_:1}),a(K,{key:"delete",danger:""},{default:n(()=>[a(v(De),{size:14}),e[17]||(e[17]=_(" 删除合集 ",-1))]),_:1})]),_:1},8,["onClick"])]),default:n(()=>[t("button",pt,[a(v(Be),{size:16})])]),_:2},1024)])]),t("div",_t,[t("div",mt,c(s.name),1),s.description?(l(),i("div",ft,c(s.description),1)):z("",!0),t("div",yt,[t("span",null,[a(v(je),{size:14}),_(c(s.noteCount)+" 篇笔记",1)]),t("span",null,[a(v(Oe),{size:14}
1),_(c(J(s.updatedAt)),1)])]),t("div",gt,[s.tags&&s.tags.length?(l(),i("span",kt,[(l(!0),i(j,null,R(s.tags.slice(0,3),x=>(l(),G(ge,{key:x,size:"small",color:"blue"},{default:n(()=>[_(c(x),1)]),_:2},1024))),128))])):(l(),i("span",ht,c(q(s.sourceType)),1))])])],8,it))),128)),t("button",{class:"collection-card collection-card--create",onClick:P},[t("span",wt,[a(v($),{size:24})]),e[18]||(e[18]=t("span",{class:"create-card-title"},"新建合集",-1)),e[19]||(e[19]=t("span",{class:"create-card-sub"},"整理课程、主题或批量生成的笔记",-1))])])):z("",!0),M.value>N.value?(l(),i("div",bt,[a(ke,{current:L.value,"onUpdate:current":e[2]||(e[2]=s=>L.value=s),"page-size":N.value,"onUpdate:pageSize":e[3]||(e[3]=s=>N.value=s),total:M.value,"show-quick-jumper":"",onChange:b},null,8,["current","page-size","total"])])):z("",!0)]),_:1},8,["spinning"])]),a(Z,{open:I.value,"onUpdate:open":e[8]||(e[8]=s=>I.value=s),title:A.value==="create"?"新建合集":"编辑合集","confirm-loading":E.value,"ok-text":A.value==="create"?"创建":"保存",onOk:ve},{default:n(()=>[a(be,{layout:"vertical"},{default:n(()=>[a(O,{label:"合集名",required:""},{default:n(()=>[a(C,{value:d.name,"onUpdate:value":e[4]||(e[4]=s=>d.name=s),"max-length":200,placeholder:"如:李宏毅 2024 机器学习课"},null,8,["value"])]),_:1}),a(O,{label:"描述"},{default:n(()=>[a(he,{value:d.description,"onUpdate:value":e[5]||(e[5]=s=>d.description=s),"max-length":500,"auto-size":{minRows:2,maxRows:4},placeholder:"选填"},null,8,["value"])]),_:1}),a(O,{label:"封面图 URL"},{default:n(()=>[a(C,{value:d.coverUrl,"onUpdate:value":e[6]||(e[6]=s=>d.coverUrl=s),placeholder:"选填,默认取第一个子笔记封面"},null,8,["value"])]),_:1}),a(O,{label:"标签"},{default:n(()=>[a(we,{value:d.tags,"onUpdate:value":e[7]||(e[7]=s=>d.tags=s),mode:"tags","token-separators":[",",","],placeholder:"回车添加标签,如:学习、AI、B站"},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["open","title","confirm-loading","ok-text"]),a(Z,{open:F.value,"onUpdate:open":e[9]||(e[9]=s=>F.value=s),title:"分享合集",footer:null,"destroy-on-close":!0},{default:n(()=>[a(Q,{spinning:V.value},{default:n(()=>[t("div",Ct,[e[24]||(e[24]=t("p",{class:"share-hint"}," 开启分享后,任何人通过链接都可以查看合集内笔记,无需登录。 关闭分享后链接立即失效,再次开启会复用同一链接。 ",-1)),f.value?.active&&w.value?(l(),i("div",Ut,[a(C,{value:w.value,readonly:""},{addonAfter:n(()=>[a(U,{type:"link",size:"small",onClick:ce},{default:n(()=>[...e[20]||(e[20]=[_("复制",-1)])]),_:1})]),_:1},8,["value"]),t("div",xt,c(f.value.viewCount??0)+" 次浏览",1)])):z("",!0),t("div",zt,[f.value?.active?(l(),i(j,{key:1},[a(U,{type:"primary",ghost:"",onClick:ue},{default:n(()=>[...e[22]||(e[22]=[_("打开链接",-1)])]),_:1}),a(Ce,{title:"关闭后公开链接将无法访问,确定关闭?","ok-text":"关闭","cancel-text":"取消",onConfirm:re},{default:n(()=>[a(U,{danger:"",loading:h.value},{default:n(()=>[...e[23]||(e[23]=[_("关闭分享",-1)])]),_:1},8,["loading"])]),_:1})],64)):(l(),G(U,{key:0,type:"primary",loading:h.value,onClick:ie},{default:n(()=>[...e[21]||(e[21]=[_(" 开启分享 ",-1)])]),_:1},8,["loading"]))])])]),_:1},8,["spinning"])]),_:1},8,["open"])])}}}),Bt=Me(Tt,[["__scopeId","data-v-27dceff9"]]);export{Bt 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.