import{bK as e,bj as t,x as a,aV as o,D as n,bs as r,bJ as s}from"./index-DXvjTqMr.js";const u={};function c(e){return u.post("user/phone_login",e)}function i(e){return u.get("forum/user_label",e)}function f(){return u.post("forum/category")}function l(e){return u.post("forum/save_label",e)}function d(e){return u.post("forum/label",e)}function p(e){return u.post("forum/list",e)}function m(e){return u.get(`forum/detail/${e}`)}function h(e){return u.get(`forum/collect/${e.id}/${e.status}`,e)}function g(e){return u.get(`forum/support/${e.id}/${e.status}`,e)}["options","get","post","put","head","delete","trace","connect"].forEach((c=>{u[c]=(u,i,f)=>function(u,c,i,{noAuth:f=!1,noVerify:l=!1}){let d={"content-type":"application/json; charset=utf-8",Authorization:""},p="";return e.state.app.forumToken?d[s]="Bearer "+e.state.app.forumToken:d[s]="Bearer ",t({success:e=>{p=e.networkType}}),new Promise(((t,s)=>{if("none"===p)return a.error("似乎已断开网络连接"),!1;o({url:"https://manage.tuoluojiang.com/api/know/"+u,method:c,header:d,data:i||{},success:a=>{(a.header.Token||a.header.token)&&e.commit("forumLogin",a.header.Token?a.header.Token:a.header.token),l||200==a.data.status?t(a.data):-1!==[41e4,410001,410002,410003].indexOf(a.data.status)?(n(),a.data.message="登录已过期，请重新登录",s(a.data)):s(a.data)},fail:()=>{s({message:"请求失败"})}}),r("request",{invoke(e){const{data:t,method:a}=e;if("get"===a&&Object.keys(t).length>0){const a=Object.keys(t),o=Object.values(t);let n="";for(let e=0;e<o.length;e++)if("object"==typeof o[e])for(let t=0;t<o[e].length;t++)n+=`&${a[e]}[]=${o[e][t]}`;else n+=`&${a[e]}=${o[e]}`;n=n.slice(1),e.data={},e.url=`${e.url}?${n}`}},success(){},fail(){},complete(){}})}))}(u,c,i,f||{})}));export{p as a,m as b,h as c,g as d,f as e,c as f,d as g,i as h,l as i};
