| File was renamed from mingdaojingjiang_guide_app/dist/build/h5/assets/auth.B0B2nLVy.js |
| | |
| | | import{j as e,N as t,v as n,O as a,x as r,z as o}from"./index-cIZo5tkX.js";function u(){const e=r(a)||null;return e&&e.expiresAt&&Number(e.expiresAt)<=Date.now()?(o(a),null):e}function i(){const e=u();return Boolean(e&&e.token)}function s({phone:r,code:o}){return r&&o?e({url:"/guide/auth/login",method:"POST",authenticated:!1,data:{phone:r,code:o}}).then(e=>{const o=e.user||{},u={token:e.token,expiresIn:e.expiresIn,expiresAt:Date.now()+1e3*Number(e.expiresIn||0),guide:{...t,id:o.id,name:o.realName||o.username||t.name,phone:o.mobile||r,avatar:o.avatar||t.avatar,rating:Number(o.rating||0),orderCount:o.acceptedOrderCount||0,auditStatus:(i=o.status,1===i?"approved":2===i?"pending":0===i?"disabled":"pending"),onlineStatus:"offline",groupName:o.teamName||("个人"===o.teamType?"个人导游":t.groupName)}};var i;return n(a,u),Promise.resolve(!1),u}):Promise.reject(new Error("请输入手机号和验证码"))}function d(t){return e({url:"/guide/auth/sms-code",method:"POST",authenticated:!1,data:{phone:t,scene:"login"}})}function c(){const t=u();return t&&t.token?e({url:"/guide/push-device",method:"DELETE"}).catch(()=>{}).then(()=>e({url:"/guide/auth/logout",method:"POST"})).finally(()=>o(a)):(o(a),Promise.resolve())}function m(){return e({url:"/guide/push-device",method:"DELETE"}).catch(()=>{}).then(()=>e({url:"/guide/auth/account",method:"DELETE"})).then(e=>(o(a),e))}export{c as a,m as c,u as g,i,s as l,d as s}; |
| | | import{j as e,N as t,v as n,O as a,x as r,z as o}from"./index-DbKL47i0.js";function u(){const e=r(a)||null;return e&&e.expiresAt&&Number(e.expiresAt)<=Date.now()?(o(a),null):e}function i(){const e=u();return Boolean(e&&e.token)}function s({phone:r,code:o}){return r&&o?e({url:"/guide/auth/login",method:"POST",authenticated:!1,data:{phone:r,code:o}}).then(e=>{const o=e.user||{},u={token:e.token,expiresIn:e.expiresIn,expiresAt:Date.now()+1e3*Number(e.expiresIn||0),guide:{...t,id:o.id,name:o.realName||o.username||t.name,phone:o.mobile||r,avatar:o.avatar||t.avatar,rating:Number(o.rating||0),orderCount:o.acceptedOrderCount||0,auditStatus:(i=o.status,1===i?"approved":2===i?"pending":0===i?"disabled":"pending"),onlineStatus:"offline",groupName:o.teamName||("个人"===o.teamType?"个人导游":t.groupName)}};var i;return n(a,u),Promise.resolve(!1),u}):Promise.reject(new Error("请输入手机号和验证码"))}function d(t){return e({url:"/guide/auth/sms-code",method:"POST",authenticated:!1,data:{phone:t,scene:"login"}})}function c(){const t=u();return t&&t.token?e({url:"/guide/push-device",method:"DELETE"}).catch(()=>{}).then(()=>e({url:"/guide/auth/logout",method:"POST"})).finally(()=>o(a)):(o(a),Promise.resolve())}function m(){return e({url:"/guide/push-device",method:"DELETE"}).catch(()=>{}).then(()=>e({url:"/guide/auth/account",method:"DELETE"})).then(e=>(o(a),e))}export{c as a,m as c,u as g,i,s as l,d as s}; |