15 lines
4.9 KiB
JavaScript
15 lines
4.9 KiB
JavaScript
"use strict";(self["webpackChunkwordhelper"]=self["webpackChunkwordhelper"]||[]).push([[67],{18495:function(e,a,t){t.d(a,{A:function(){return r}});var l=t(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 r=(0,l.A)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])},46067:function(e,a,t){t.r(a),t.d(a,{default:function(){return Q}});var l=t(56768),r=t(90144),s=t(45130),n=t(24232),c=t(98728),i=t(97387),o=t(93913),u=t(54880),d=t(42517),y=t(18169),v=t(18495),x=t(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 k=(0,x.A)("search-x",[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);var p=t(35720);const h={class:"search-view max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8"},g={class:"max-w-3xl mx-auto"},m={class:"text-center mb-10",initial:{opacity:0,y:-20},enter:{opacity:1,y:0,transition:{duration:500}}},w={class:"flex gap-2"},f={class:"text-left mt-2 h-5"},b={key:0,class:"text-red-500 text-sm"},C={key:0},R={class:"flex items-center justify-between mb-4"},_={class:"text-lg font-medium text-gray-700 dark:text-gray-300"},A={key:0,class:"space-y-4"},L={class:"flex items-center justify-between"},E={class:"text-lg font-bold text-gray-900 dark:text-white"},X={key:0,class:"text-center mt-8"},K={key:1,class:"text-center py-12 bg-gray-50 dark:bg-gray-800/50 rounded-xl"},F={class:"text-gray-400 mb-2"},j={key:1,class:"text-center py-20 opacity-50"};var W={__name:"SearchView",setup(e){const a=(0,c.rd)(),t=(0,i.J)(),{isDark:x}=(0,l.WQ)("themeContext"),W=(0,r.KR)(""),q=(0,r.KR)(!1),z=(0,r.KR)([]),Q=(0,r.KR)(1),I=(0,r.KR)(0),S=(0,r.KR)(!1),V=(0,r.KR)(""),D=(0,l.EW)(()=>z.value.length<I.value),H=async()=>{const e=W.value.trim();e?e.length>20?V.value="搜索内容不能超过20个字符":(V.value="",Q.value=1,S.value=!0,await M(!0)):V.value="请输入搜索内容"},J=async()=>{Q.value++,await M(!1)},M=async e=>{q.value=!0;try{const a=await p.A.post("https://newfront.xn--xhq44jb2fzpc.com/word_helper/search",{keyword:W.value,page:Q.value,limit:10}),t=a.data;z.value=e?t.list:[...z.value,...t.list],I.value=t.total}catch(a){console.error("Search failed:",a),t.error("搜索失败,请稍后重试")}finally{q.value=!1}},N=e=>{const t=a.resolve({name:"word-detail",query:{word_id:e}});window.open(t.href,"_blank")};return(0,l.sV)(()=>{document.title="单词搜索 - Word Helper"}),(e,a)=>{const t=(0,l.gN)("motion");return(0,l.uX)(),(0,l.CE)("div",h,[(0,l.Lk)("div",g,[(0,l.bo)(((0,l.uX)(),(0,l.CE)("div",m,[a[2]||(a[2]=(0,l.Lk)("h1",{class:"text-3xl font-bold text-gray-900 dark:text-white mb-4"},"单词搜索",-1)),(0,l.Lk)("div",w,[(0,l.bF)((0,r.R1)(o.A),{value:W.value,"onUpdate:value":a[0]||(a[0]=e=>W.value=e),size:"large",placeholder:"输入单词进行搜索(支持部分匹配)",maxlength:20,onKeydown:(0,s.jR)(H,["enter"]),class:"flex-1 text-left"},{prefix:(0,l.k6)(()=>[(0,l.bF)((0,r.R1)(y.A),{class:"w-5 h-5 text-gray-400"})]),_:1},8,["value"]),(0,l.bF)((0,r.R1)(u.Ay),{type:"primary",size:"large",loading:q.value&&1===Q.value,onClick:H,class:"px-8"},{default:(0,l.k6)(()=>[...a[1]||(a[1]=[(0,l.eW)(" 搜索 ",-1)])]),_:1},8,["loading"])]),(0,l.Lk)("div",f,[V.value?((0,l.uX)(),(0,l.CE)("span",b,(0,n.v_)(V.value),1)):(0,l.Q3)("",!0)])])),[[t]]),S.value?((0,l.uX)(),(0,l.CE)("div",C,[(0,l.Lk)("div",R,[(0,l.Lk)("h2",_,"搜索结果 ("+(0,n.v_)(I.value)+")",1)]),z.value.length>0?((0,l.uX)(),(0,l.CE)("div",A,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(z.value,(e,a)=>(0,l.bo)(((0,l.uX)(),(0,l.Wv)((0,r.R1)(d.Ay),{key:e.id,class:"hover:shadow-md transition-shadow cursor-pointer dark:bg-gray-800",size:"small",onClick:a=>N(e.id),initial:{opacity:0,y:20},enter:{opacity:1,y:0,transition:{delay:50*a}}},{default:(0,l.k6)(()=>[(0,l.Lk)("div",L,[(0,l.Lk)("span",E,(0,n.v_)(e.word),1),(0,l.bF)((0,r.R1)(v.A),{class:"w-4 h-4 text-gray-400"})])]),_:2},1032,["onClick","enter"])),[[t]])),128)),D.value?((0,l.uX)(),(0,l.CE)("div",X,[(0,l.bF)((0,r.R1)(u.Ay),{loading:q.value,secondary:"",round:"",onClick:J},{default:(0,l.k6)(()=>[...a[3]||(a[3]=[(0,l.eW)(" 加载更多 ",-1)])]),_:1},8,["loading"])])):(0,l.Q3)("",!0)])):((0,l.uX)(),(0,l.CE)("div",K,[(0,l.Lk)("div",F,[(0,l.bF)((0,r.R1)(k),{class:"w-12 h-12 mx-auto opacity-50"})]),a[4]||(a[4]=(0,l.Lk)("p",{class:"text-gray-500 dark:text-gray-400"},"未找到相关单词",-1))]))])):((0,l.uX)(),(0,l.CE)("div",j,[(0,l.bF)((0,r.R1)(y.A),{class:"w-16 h-16 mx-auto text-gray-300 dark:text-gray-600 mb-4"}),a[5]||(a[5]=(0,l.Lk)("p",{class:"text-gray-400 dark:text-gray-500"},"输入关键词开始探索...",-1))]))])])}}},q=t(71241);const z=(0,q.A)(W,[["__scopeId","data-v-75475b89"]]);var Q=z}}]);
|
|
//# sourceMappingURL=67.c5181ab8.js.map
|