"use strict";(self["webpackChunkwordhelper"]=self["webpackChunkwordhelper"]||[]).push([[431],{55727:function(e,t,a){a.d(t,{A:function(){return l}});var r=a(45525);
/**
* @license lucide-vue-next v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const l=(0,r.A)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])},91733:function(e,t,a){a.d(t,{A:function(){return l}});var r=a(45525);
/**
* @license lucide-vue-next v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const l=(0,r.A)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]])},96431:function(e,t,a){a.r(t),a.d(t,{default:function(){return z}});a(44114),a(18111),a(22489);var r=a(56768),l=a(90144),o=a(24232),i=a(45130),n=a(98728),s=a(97387),d=a(35268),c=a(63494);function u(){const e=(0,r.WQ)(c.hL,null);return null===e&&(0,d.$8)("use-dialog","No outer founded."),e}var v=a(54880),y=a(42517),p=a(35161),g=a(91733),h=a(55727),k=a(45525);
/**
* @license lucide-vue-next v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const x=(0,k.A)("trash",[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);var f=a(35720);const w={class:"favorite-view max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8"},m={class:"flex items-center gap-2 mb-8",initial:{opacity:0,x:-20},enter:{opacity:1,x:0,transition:{duration:500}}},b={key:0,class:"flex flex-col items-center justify-center py-20"},C={class:"w-24 h-24 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center mb-4"},_={key:1,class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"},A=["enter"],L={class:"flex justify-between items-start"},R={class:"text-2xl font-bold text-gray-900 dark:text-white group-hover:text-primary transition-colors"},F={class:"flex items-center gap-1 mt-2 text-sm text-gray-500 dark:text-gray-400"},j={class:"flex items-center gap-2"},E={class:"p-2 bg-yellow-50 dark:bg-yellow-900/20 rounded-lg"},X=["onClick"],M={key:2,class:"flex justify-center mt-8"},W={key:3,class:"text-center mt-8 text-gray-400 text-sm"};var D={__name:"FavoriteView",setup(e){const t=(0,n.rd)(),a=(0,s.J)(),d=u(),{isDark:c}=(0,r.WQ)("themeContext"),k=(0,l.KR)(!1),D=(0,l.KR)([]),K=(0,l.KR)(1),V=(0,l.KR)(0),z=(0,r.EW)(()=>D.value.lengthe?new Date(e).toLocaleDateString():"",$=async(e=1)=>{k.value=!0;try{const t=await f.A.get("https://newfront.xn--xhq44jb2fzpc.com/word_helper/favorite/list",{params:{page:e}});if(t.data&&0===t.data.code&&t.data.data){const a=t.data.data;D.value=1===e?a.list:[...D.value,...a.list],V.value=a.total,K.value=e}}catch(t){a.error("获取生词本失败")}finally{k.value=!1}},q=()=>{!k.value&&z.value&&$(K.value+1)},H=async e=>{d.warning({title:"确认移除",content:`确定要将单词 "${e.word}" 移出生词本吗?`,positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{try{const t=await f.A.post("https://newfront.xn--xhq44jb2fzpc.com/word_helper/detail/favorite",{word_id:e.id});t.data&&!1===t.data.is_favorite&&(a.success("已将单词移出生词本"),D.value=D.value.filter(t=>t.id!==e.id),V.value=Math.max(0,V.value-1))}catch(t){console.error("Delete favorite failed:",t),a.error("删除失败")}}})},I=e=>{const a=t.resolve({name:"word-detail",query:{word_id:e}});window.open(a.href,"_blank")};return(0,r.sV)(()=>{$(),document.title="我的生词本 - Word Helper"}),(e,t)=>{const a=(0,r.gN)("motion");return(0,r.uX)(),(0,r.CE)("div",w,[(0,r.bo)(((0,r.uX)(),(0,r.CE)("div",m,[(0,r.bF)((0,l.R1)(p.A),{class:"w-8 h-8 text-yellow-500 fill-current"}),t[1]||(t[1]=(0,r.Lk)("h1",{class:"text-3xl font-bold text-gray-900 dark:text-white"},"我的生词本",-1))])),[[a]]),k.value||0!==D.value.length?((0,r.uX)(),(0,r.CE)("div",_,[((0,r.uX)(!0),(0,r.CE)(r.FK,null,(0,r.pI)(D.value,(e,t)=>(0,r.bo)(((0,r.uX)(),(0,r.CE)("div",{key:e.favorite_id,initial:{opacity:0,y:20},enter:{opacity:1,y:0,transition:{delay:50*t}}},[(0,r.bF)((0,l.R1)(y.Ay),{class:"h-full rounded-xl shadow-sm hover:shadow-md transition-all cursor-pointer dark:bg-gray-800 group",bordered:!1,onClick:t=>I(e.id)},{default:(0,r.k6)(()=>[(0,r.Lk)("div",L,[(0,r.Lk)("div",null,[(0,r.Lk)("h3",R,(0,o.v_)(e.word),1),(0,r.Lk)("div",F,[(0,r.bF)((0,l.R1)(h.A),{class:"w-4 h-4"}),(0,r.Lk)("span",null,"收藏于 "+(0,o.v_)(Q(e.created_at)),1)])]),(0,r.Lk)("div",j,[(0,r.Lk)("div",E,[(0,r.bF)((0,l.R1)(p.A),{class:"w-5 h-5 text-yellow-500 fill-current"})]),(0,r.Lk)("div",{class:"p-2 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors cursor-pointer group/btn",onClick:(0,i.D$)(t=>H(e),["stop"]),title:"移除生词"},[(0,r.bF)((0,l.R1)(x),{class:"w-5 h-5 text-gray-400 group-hover/btn:text-red-500 transition-colors"})],8,X)])])]),_:2},1032,["onClick"])],8,A)),[[a]])),128))])):((0,r.uX)(),(0,r.CE)("div",b,[(0,r.Lk)("div",C,[(0,r.bF)((0,l.R1)(g.A),{class:"w-12 h-12 text-gray-400"})]),t[3]||(t[3]=(0,r.Lk)("p",{class:"text-gray-500 mb-3 dark:text-gray-400 text-lg"},"还没有添加任何单词哦",-1)),(0,r.bF)((0,l.R1)(v.Ay),{class:"mt-8",type:"primary",onClick:t[0]||(t[0]=t=>e.$router.push("/dict"))},{default:(0,r.k6)(()=>[...t[2]||(t[2]=[(0,r.eW)(" 去背单词 ",-1)])]),_:1})])),z.value?((0,r.uX)(),(0,r.CE)("div",M,[(0,r.bF)((0,l.R1)(v.Ay),{loading:k.value,size:"large",secondary:"",round:"",onClick:q},{default:(0,r.k6)(()=>[...t[4]||(t[4]=[(0,r.eW)(" 加载更多 ",-1)])]),_:1},8,["loading"])])):(0,r.Q3)("",!0),!z.value&&D.value.length>0?((0,r.uX)(),(0,r.CE)("div",W," 没有更多了 ")):(0,r.Q3)("",!0)])}}},K=a(71241);const V=(0,K.A)(D,[["__scopeId","data-v-7e7e4605"]]);var z=V}}]);
//# sourceMappingURL=431.ce56f232.js.map