searchEngine.1705924948177.js 5.4 KB

1
  1. import{_ as e,u as l,r as a,b as t,c as o,d,e as u,k as s,h as n,X as i,a1 as r,g as c,m as p,j as m,V as h,a2 as v,L as g,D as f,E as w}from"./index.1705924948177.js";const b={class:"SearchEngine"},_={class:"p-4 bg-white rounded-lg overflow-hidden flex flex-wrap gap-4"},V={class:"mt-4 p-4 bg-white rounded-lg overflow-hidden w-full"},x=["src"],y=(e=>(f("data-v-73d46173"),e=e(),w(),e))((()=>u("span",{class:"text-red-500 text-xs mt-2 leading-5"},[r("注意事项:搜索跳转会将{1}替换为用户搜索内容,例如: https://www.bing.com/search?q={1} "),u("br"),r(" 用户搜索 “新闻” 会被替换为 https://www.bing.com/search?q=新闻 ")],-1))),k={style:{display:"flex","align-items":"center",width:"100%"}},U=["src"];var C=e({__name:"searchEngine",setup(e){const f=l(),w=a({name:""}),C=a(!1),E=a({}),L=()=>{E.value={},C.value=!0},j=e=>{1===e.code&&(E.value.icon=e.data.url)};a(!1);const z=()=>{i({url:"/searchEngine/add",method:"post",data:{form:E.value}}).then((e=>{g.success(e.msg),C.value=!1,q()}))},O=a([]),q=()=>{i({url:"/searchEngine/list",method:"post",data:{search:w.value}}).then((e=>{O.value=e.data}))};return q(),(e,l)=>{const a=t("el-input"),D=t("el-button"),G=t("el-table-column"),I=t("el-tag"),S=t("el-table"),X=t("el-form-item"),A=t("el-upload"),B=t("el-option"),F=t("el-select"),H=t("el-input-number"),J=t("el-form"),K=t("el-dialog");return o(),d("div",b,[u("div",_,[s(a,{modelValue:w.value.name,"onUpdate:modelValue":l[0]||(l[0]=e=>w.value.name=e),style:{width:"200px"},placeholder:"名称搜索",clearable:""},null,8,["modelValue"]),s(D,{onClick:q,type:"primary"},{default:n((()=>[r("搜索")])),_:1}),s(D,{type:"danger",onClick:L},{default:n((()=>[r("添加新搜索引擎")])),_:1})]),u("div",V,[s(S,{ref:"table",height:"calc(100vh - 143px)",stripe:"",data:O.value},{default:n((()=>[s(G,{prop:"name",label:"引擎名称",align:"center",width:"150"}),s(G,{prop:"图标",label:"LOGO",align:"center",width:"80"},{default:n((e=>[u("img",{src:e.row.icon,class:"searchEngineLogo",alt:"Logo",style:{"max-width":"100%","max-height":"100%"}},null,8,x)])),_:1}),s(G,{prop:"url","show-overflow-tooltip":"",label:"搜索链接",align:"center","min-width":"260"}),s(G,{prop:"tips",label:"简介","min-width":"200px",align:"center"}),s(G,{prop:"status",label:"状态",align:"center",width:"80"},{default:n((e=>[1===e.row.status?(o(),c(I,{key:0},{default:n((()=>[r("展示")])),_:1})):p("",!0),0===e.row.status?(o(),c(I,{key:1,type:"info"},{default:n((()=>[r("隐藏")])),_:1})):p("",!0)])),_:1}),s(G,{prop:"sort",label:"展示顺序(降序)",align:"center",width:"150"}),s(G,{prop:"create_time",label:"创建时间",align:"center",width:"200"}),s(G,{fixed:"right",label:"操作",align:"center",width:"160"},{default:n((e=>[s(D,{type:"primary",size:"small",onClick:l=>{return a=e.row,E.value=Object.assign({},a),void(C.value=!0);var a}},{default:n((()=>[r("操作")])),_:2},1032,["onClick"]),s(D,{type:"danger",size:"small",onClick:l=>{return a=e.row.id,void v.confirm("是否批量删除","删除提示").then((e=>{i({url:"/searchEngine/del",method:"post",data:{ids:[a]}}).then((e=>{g.success(e.msg),q()}))})).catch();var a}},{default:n((()=>[r("删除")])),_:2},1032,["onClick"])])),_:1})])),_:1},8,["data"])]),s(K,{modelValue:C.value,"onUpdate:modelValue":l[8]||(l[8]=e=>C.value=e),title:"编辑搜索引擎表单",size:"400px","close-on-click-modal":!1},{default:n((()=>[s(J,{modelValue:E.value,"onUpdate:modelValue":l[7]||(l[7]=e=>E.value=e),"label-position":"top"},{default:n((()=>[s(X,{label:"名称"},{default:n((()=>[s(a,{modelValue:E.value.name,"onUpdate:modelValue":l[1]||(l[1]=e=>E.value.name=e),"show-word-limit":"",maxlength:"50",placeholder:"请输入搜索引擎名称"},null,8,["modelValue"])])),_:1}),s(X,{label:"网址"},{default:n((()=>[s(a,{modelValue:E.value.url,"onUpdate:modelValue":l[2]||(l[2]=e=>E.value.url=e),"show-word-limit":"",maxlength:"251",placeholder:"请输入搜索引擎网址,请携带https协议,"},null,8,["modelValue"]),y])),_:1}),s(X,{label:"logo"},{default:n((()=>[u("div",k,[E.value.icon?(o(),d("img",{key:0,src:E.value.icon,style:{width:"30px",height:"30px","margin-right":"10px","border-radius":"3px"},alt:""},null,8,U)):p("",!0),s(a,{modelValue:E.value.icon,"onUpdate:modelValue":l[3]||(l[3]=e=>E.value.icon=e),placeholder:"标签图标地址(120x120)px尺寸最佳"},{append:n((()=>[s(A,{class:"upload-demo","show-file-list":!1,"on-success":j,action:m(h)+m(f).state.site.upload},{default:n((()=>[s(D,{type:"primary"},{default:n((()=>[r("上传")])),_:1})])),_:1},8,["action"])])),_:1},8,["modelValue"])])])),_:1}),s(X,{label:"状态"},{default:n((()=>[s(F,{modelValue:E.value.status,"onUpdate:modelValue":l[4]||(l[4]=e=>E.value.status=e),placeholder:"用户端显示状态",class:"w-full"},{default:n((()=>[s(B,{label:"显示",value:1}),s(B,{label:"隐藏",value:0})])),_:1},8,["modelValue"])])),_:1}),s(X,{label:"简介"},{default:n((()=>[s(a,{modelValue:E.value.tips,"onUpdate:modelValue":l[5]||(l[5]=e=>E.value.tips=e),placeholder:"请简单介绍一下建议30字符以内","show-word-limit":"",maxlength:"50"},null,8,["modelValue"])])),_:1}),s(X,{label:"排行"},{default:n((()=>[s(H,{modelValue:E.value.sort,"onUpdate:modelValue":l[6]||(l[6]=e=>E.value.sort=e),class:"w-full",placeholder:"数字越大,排名越靠前,默认0"},null,8,["modelValue"])])),_:1})])),_:1},8,["modelValue"]),s(D,{type:"primary",class:"w-full",onClick:z},{default:n((()=>[r("保存")])),_:1})])),_:1},8,["modelValue"])])}}},[["__scopeId","data-v-73d46173"]]);export{C as default};