Files
machartaa_admin_dist/dist/assets/index-32ef5b9a.js
T

2 lines
13 KiB
JavaScript
Raw Normal View History

2026-08-25 15:58:39 +03:30
import{_ as V}from"./button.vue_vue_type_style_index_0_lang-56e9b09f.js";import{_ as Q}from"./BasicInput.vue_vue_type_style_index_0_lang-0a0d6ad5.js";import{O as j,g as ee,i as O,d as B,u as M,D as R,h as E,o as m,c as I,b as c,e as p,w as f,k as S,l as a,z as ne,s as z,X as N,Y as te,G as F,Z as U,a as q,$ as W,r as H,y as T,x as se,a0 as oe,a1 as ae,n as x,p as le,F as ue,q as ie,f as re}from"./index-864e73c5.js";import{n as de}from"./phone-6ff17ec0.js";import{u as ce,I as pe}from"./Icon-7c626614.js";import{F as A,_ as D}from"./index-391eda35.js";import{S as P}from"./index-bd9719ff.js";import{_ as L,T as me}from"./index-846ea911.js";import"./index-69195e76.js";import"./_plugin-vue_export-helper-a65526b0.js";import"./usePrice-bc935b83.js";import"./index-7c172d43.js";import"./SearchOutlined-8ea30c34.js";import"./omit-ab9263d6.js";import"./vnode-81e10d7c.js";import"./FormItemContext-37273d98.js";import"./isPlainObject-13142948.js";import"./index-e764b6ae.js";import"./isSymbol-cbbd997a.js";import"./_flatRest-2445814a.js";import"./Col-55712802.js";import"./styleChecker-4198f097.js";import"./toArray-21522b5d.js";import"./index-e8adaad2.js";import"./shallowequal-c06f2dba.js";import"./useState-85b22590.js";import"./useRefs-d7f22ed1.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=R(),{prefixCls:g}=ce("login"),w=G(),u=E({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 N($.session.access_token);try{await v.getMyInfo()}catch{te(),F.error("شما دسترسی ادمین ندارید");return}U(v.routePermissionKeys,s,v.isSuperAdmin);const r=q();await W(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:z(["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).passw