Files
machartaa_admin_dist/dist/assets/index-60713758.js
T

2 lines
13 KiB
JavaScript
Raw Normal View History

2026-08-22 13:27:44 +03:30
import{_ as V}from"./button.vue_vue_type_style_index_0_lang-86273660.js";import{_ as Q}from"./BasicInput.vue_vue_type_style_index_0_lang-ebcbbe1b.js";import{N as j,f as ee,g as O,d as B,u as M,A as E,r as R,o as m,c as I,a as c,b as p,w as f,i as S,j as a,x as ne,p as N,V as z,W as te,D as F,X as U,s as W,Y as q,Z as H,E as T,v as se,$ as oe,a0 as ae,k as x,l as le,F as ue,n as ie,e as re}from"./index-d718011e.js";import{n as de}from"./phone-6ff17ec0.js";import{u as ce,I as pe}from"./Icon-cc126d0d.js";import{F as A,_ as D}from"./index-7a1bd658.js";import{S as P}from"./index-5ade1644.js";import{_ as L,T as me}from"./index-68cba126.js";import"./index-12b8b726.js";import"./_plugin-vue_export-helper-0ed48b96.js";import"./usePrice-bc935b83.js";import"./index-ba4d9879.js";import"./SearchOutlined-31f9ef0b.js";import"./omit-86fc1094.js";import"./vnode-0b482026.js";import"./FormItemContext-6bb05345.js";import"./isPlainObject-63126d02.js";import"./index-7eae579c.js";import"./isSymbol-e219d64b.js";import"./_flatRest-e8ea393e.js";import"./Col-7aad654b.js";import"./styleChecker-351d08aa.js";import"./toArray-02b8a08a.js";import"./index-5b828516.js";import"./shallowequal-c9e151d3.js";import"./useState-d226846a.js";import"./useRefs-373e2aeb.js";import"./isMobile-e2e89480.js";const fe="/assets/logo-dd2a3541.png",ve=async e=>{const o=de(e.username),l=o.includes("@")?o:`${o}@example.com`;return await j.post("/auth/login-admin",{username:l,password:e.password})},ye=async e=>await j.post("/auth/login",e),he=async e=>await j.post("/auth/verify",e),G=ee("login",()=>{const e=O(""),o=O(null);return{mobile:e,id:o,setMobile:s=>{e.value=s},setId:s=>{o.value=s}}}),ge={class:"grid grid-cols-1 md:grid-cols-12 h-full bg-gradient"},_e={class:"md:col-span-3 flex justify-center items-center"},Oe={class:"min-h-[300px]"},we={key:1},be={key:1},Ie=c("div",{class:"md:col-span-9 md:flex md:justify-center md:items-center hidden"},[c("img",{src:fe,alt:"machartaa logo",class:"w-40vw"})],-1),ke=B({__name:"Panel",emits:["verify"],setup(e,{emit:o}){const l=O(0),t=O(!1),s=M(),v=E(),{prefixCls:g}=ce("login"),w=G(),u=R({username:"",password:""}),b=async i=>{var n,d,_,y;try{if(t.value=!0,i.username&&i.password){const h={...i,provider:"user"};console.log("Login payload:",h);const $=await ve(h);if(console.log("Login response:",$),(n=$==null?void 0:$.session)!=null&&n.access_token){await z($.session.access_token);try{await v.getMyInfo()}catch{te(),F.error("شما دسترسی ادمین ندارید");return}U(v.routePermissionKeys,s,v.isSuperAdmin);const r=W();await q(s,H(r.routes))}else F.error("توکن دریافتی نامعتبر است")}else F.error("وارد کردن تمامی فیلدها الزامی است")}catch(h){console.log("Login error:",h),console.log("Error response:",(d=h==null?void 0:h.response)==null?void 0:d.data),F.error(((y=(_=h==null?void 0:h.response)==null?void 0:_.data)==null?void 0:y.message)||"خطا در ورود به پنل کاربری")}finally{t.value=!1}},k=async i=>{try{if(t.value=!0,i.username!==""){w.setMobile(i.username);let n=await ye({...i,provider:"user"});w.setId(n.id),o("verify",!0)}else F.error("وارد کردن تمامی فیلدها الزامی است")}catch(n){console.log(n),F.error("خطا در ورود به پنل کاربری")}finally{t.value=!1}};return(i,n)=>{const d=Q,_=V;return m(),I("div",{class:N(["h-screen bg-image overflow-hidden",[`${a(g)}`]])},[c("div",ge,[c("div",_e,[c("div",Oe,[p(a(me),{activeKey:a(l),"onUpdate:activeKey":n[3]||(n[3]=y=>ne(l)?l.value=y:null)},{default:f(()=>[(m(),S(a(L),{tab:"ورود با شماره تلفن",key:0,"force-render":""},{default:f(()=>[p(a(A),{model:a(u),onFinish:b},{default:f(()=>[p(a(D),{label:"شماره تلفن",name:"username"},{default:f(()=>[p(d,{"place-holder":"مثال: 09123456789",value:a(u).username,"onUpdate:value":n[0]||(n[0]=y=>a(u).username=y)},null,8,["value"])]),_:1}),p(a(D),{label:"کلمه عبور",name:"password"},{default:f(()=>[p(d,{"is-password":"","place-holder":"کلمه عبور",value:a(u).password,"onUpdate:value":n[1]||(n[1]=y=>a(u).passwo