index.d338d72a.js 1.8 KB

1
  1. import{d as p,ah as c,ag as d,r as f,$ as m,c as s,aj as h,ak as S,al as g,m as C,g as o}from"./index.5f7ffb46.js";import{O as y}from"./index.ec2a7822.js";import{O as k}from"./index.7790de2a.js";import{s as r}from"./index.module.2e3d103e.js";import{L as w}from"./index.9ef28852.js";import{C as O}from"./index.abd668f7.js";import"./index.6438a25f.js";import"./use-tab-status.69b57a37.js";function b(i){return typeof i=="function"||Object.prototype.toString.call(i)==="[object Object]"&&!g(i)}var N=p({name:"help-center",setup(){const i=c(),n=d(),t=f({isClick:!1,list:[],listState:{dataShow:!0,loading:!1,finished:!1},params:{keyword:null,status:!0,page:1,rows:20}}),l=async()=>{try{if(t.isClick)return;t.isClick=!0;const a=await C.post(o.platformApi+"/helpCenterContent/page",{data:{...t.params,catalogType:o.platformType}});t.listState.loading=!1;const e=a.data||{};if(t.list.length>0&&e.current===1)return;t.list=t.list.concat(e.rows||[]),t.listState.finished=e.current>=e.pages,t.params.page=e.current+1,t.listState.dataShow=t.list.length>0,t.isClick=!1}catch{t.listState.dataShow=!1,t.listState.finished=!0,t.isClick=!1}},u=a=>{t.params.keyword=a,t.params.page=1,t.list=[],t.listState.dataShow=!0,t.listState.loading=!1,t.listState.finished=!1,l()};return m(()=>{l()}),()=>{let a;return s("div",{class:[r.helpCenter,!t.listState.dataShow&&"emptyRootContainer"]},[s(k,{position:"top"},{default:()=>[s(h,{border:!1},null),s(y,{onSearch:u},null)]}),t.listState.dataShow?s(w,{finished:t.listState.finished,finishedText:" ",class:r.container,onLoad:l,immediateCheck:!1},b(a=t.list.map(e=>s(O,{titleClass:[r.title,"van-ellipsis"],title:e.title,isLink:!0,onClick:()=>{n.push({path:"help-detail",query:{id:e.id,source:i.query.source}})}},null)))?a:{default:()=>[a]}):s(S,{btnStatus:!1,tips:"\u6682\u65E0\u6570\u636E"},null)])}}});export{N as default};