21 lines
5.9 KiB
JavaScript
21 lines
5.9 KiB
JavaScript
"use strict";(self["webpackChunkwordhelper"]=self["webpackChunkwordhelper"]||[]).push([[405],{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"}]])},77405:function(e,t,a){a.r(t),a.d(t,{default:function(){return V}});a(44114),a(18111),a(22489);var r=a(56768),l=a(90144),o=a(24232),i=a(45130),s=a(98728),n=a(97387),c=a(36909),d=a(54880),u=a(42517),v=a(35161),y=a(91733),p=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 g=(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 h=a(35720);const x={class:"favorite-view max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8"},f={class:"flex items-center gap-2 mb-8",initial:{opacity:0,x:-20},enter:{opacity:1,x:0,transition:{duration:500}}},w={key:0,class:"flex flex-col items-center justify-center py-20"},m={class:"w-24 h-24 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center mb-4"},b={key:1,class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"},C=["enter"],_={class:"flex justify-between items-start"},A={class:"text-2xl font-bold text-gray-900 dark:text-white group-hover:text-primary transition-colors"},L={class:"flex items-center gap-1 mt-2 text-sm text-gray-500 dark:text-gray-400"},R={class:"flex items-center gap-2"},F={class:"p-2 bg-yellow-50 dark:bg-yellow-900/20 rounded-lg"},j=["onClick"],E={key:2,class:"flex justify-center mt-8"},X={key:3,class:"text-center mt-8 text-gray-400 text-sm"};var M={__name:"FavoriteView",setup(e){const t=(0,s.rd)(),a=(0,n.J)(),k=(0,c.s)(),{isDark:M}=(0,r.WQ)("themeContext"),D=(0,l.KR)(!1),K=(0,l.KR)([]),V=(0,l.KR)(1),W=(0,l.KR)(0),z=(0,r.EW)(()=>K.value.length<W.value),q=e=>e?new Date(e).toLocaleDateString():"",Q=async(e=1)=>{D.value=!0;try{const t=await h.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;K.value=1===e?a.list:[...K.value,...a.list],W.value=a.total,V.value=e}}catch(t){a.error("获取生词本失败")}finally{D.value=!1}},$=()=>{!D.value&&z.value&&Q(V.value+1)},H=async e=>{k.warning({title:"确认移除",content:`确定要将单词 "${e.word}" 移出生词本吗?`,positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{try{const t=await h.A.post("https://newfront.xn--xhq44jb2fzpc.com/word_helper/detail/favorite",{word_id:e.id});t.data&&!1===t.data.is_favorite&&(a.success("已将单词移出生词本"),K.value=K.value.filter(t=>t.id!==e.id),W.value=Math.max(0,W.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)(()=>{Q(),document.title="我的生词本 - Word Helper"}),(e,t)=>{const a=(0,r.gN)("motion");return(0,r.uX)(),(0,r.CE)("div",x,[(0,r.bo)(((0,r.uX)(),(0,r.CE)("div",f,[(0,r.bF)((0,l.R1)(v.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]]),D.value||0!==K.value.length?((0,r.uX)(),(0,r.CE)("div",b,[((0,r.uX)(!0),(0,r.CE)(r.FK,null,(0,r.pI)(K.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)(u.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",_,[(0,r.Lk)("div",null,[(0,r.Lk)("h3",A,(0,o.v_)(e.word),1),(0,r.Lk)("div",L,[(0,r.bF)((0,l.R1)(p.A),{class:"w-4 h-4"}),(0,r.Lk)("span",null,"收藏于 "+(0,o.v_)(q(e.created_at)),1)])]),(0,r.Lk)("div",R,[(0,r.Lk)("div",F,[(0,r.bF)((0,l.R1)(v.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)(g),{class:"w-5 h-5 text-gray-400 group-hover/btn:text-red-500 transition-colors"})],8,j)])])]),_:2},1032,["onClick"])],8,C)),[[a]])),128))])):((0,r.uX)(),(0,r.CE)("div",w,[(0,r.Lk)("div",m,[(0,r.bF)((0,l.R1)(y.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)(d.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",E,[(0,r.bF)((0,l.R1)(d.Ay),{loading:D.value,size:"large",secondary:"",round:"",onClick:$},{default:(0,r.k6)(()=>[...t[4]||(t[4]=[(0,r.eW)(" 加载更多 ",-1)])]),_:1},8,["loading"])])):(0,r.Q3)("",!0),!z.value&&K.value.length>0?((0,r.uX)(),(0,r.CE)("div",X," 没有更多了 ")):(0,r.Q3)("",!0)])}}},D=a(71241);const K=(0,D.A)(M,[["__scopeId","data-v-7e7e4605"]]);var V=K},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"}]])}}]);
|
|
//# sourceMappingURL=405.f97998f1.js.map
|