Files
machartaa_admin_dist/dist/assets/index-8984619b.js
T

2 lines
13 KiB
JavaScript
Raw Normal View History

2026-08-15 17:53:12 +03:30
import{_ as L}from"./button.vue_vue_type_style_index_0_lang-99dfcd06.js";import{_ as Q}from"./BasicInput.vue_vue_type_style_index_0_lang-0a352870.js";import{G as Y,L as V,f as Z,g as w,d as B,u as M,A as E,r as R,o as p,c as I,a as d,b as c,w as f,i as $,j as o,x as ee,p as N,S as U,T as ne,D as F,U as z,V as W,E as T,v as te,W as se,X as ae,k as q,l as oe,F as le,n as ie,e as ue}from"./index-bc4edd51.js";import{n as re}from"./phone-6ff17ec0.js";import{u as de,I as ce}from"./Icon-c9ad16b9.js";import{F as A,_ as D}from"./index-6d8a75c0.js";import{S as P}from"./index-d4870df7.js";import{_ as K,T as pe}from"./index-627337a8.js";import"./index-9df7eaa1.js";import"./_plugin-vue_export-helper-c8347567.js";import"./usePrice-bc935b83.js";import"./index-49e2e544.js";import"./SearchOutlined-4504ec77.js";import"./omit-6f60253b.js";import"./vnode-f2307909.js";import"./FormItemContext-4e017a44.js";import"./isPlainObject-ed8996b4.js";import"./index-1d49b36b.js";import"./isSymbol-f9834f4f.js";import"./_flatRest-9adb1e9a.js";import"./Col-96f7f23f.js";import"./styleChecker-bc667521.js";import"./toArray-b01cb1f9.js";import"./index-47b6ba8f.js";import"./shallowequal-cad00b6e.js";import"./useState-47ff4833.js";import"./useRefs-225197bd.js";import"./isMobile-e2e89480.js";const me="/assets/logo-dd2a3541.png",fe=async e=>{const a=re(e.username),{data:l,error:n}=await Y.auth.signInWithPassword({email:`${a}@example.com`,password:e.password});if(n)throw n;return l},ve=async e=>await V.post("/auth/login",e),ye=async e=>await V.post("/auth/verify",e),H=Z("login",()=>{const e=w(""),a=w(null);return{mobile:e,id:a,setMobile:s=>{e.value=s},setId:s=>{a.value=s}}}),he={class:"grid grid-cols-1 md:grid-cols-12 h-full bg-gradient"},ge={class:"md:col-span-3 flex justify-center items-center"},_e={class:"min-h-[300px]"},we={key:1},Oe={key:1},be=d("div",{class:"md:col-span-9 md:flex md:justify-center md:items-center hidden"},[d("img",{src:me,alt:"machartaa logo",class:"w-40vw"})],-1),Ie=B({__name:"Panel",emits:["verify"],setup(e,{emit:a}){const l=w(0),n=w(!1),s=M(),y=E(),{prefixCls:g}=de("login"),O=H(),i=R({username:"",password:""}),b=async u=>{var t,m,_,v;try{if(n.value=!0,u.username&&u.password){const h={...u,provider:"user"};console.log("Login payload:",h);const S=await fe(h);if(console.log("Login response:",S),(t=S==null?void 0:S.session)!=null&&t.access_token){await U(S.session.access_token);try{await y.getMyInfo()}catch{ne(),F.error("شما دسترسی ادمین ندارید");return}z(y.routePermissionKeys,s,y.isSuperAdmin),await W(s)}else F.error("توکن دریافتی نامعتبر است")}else F.error("وارد کردن تمامی فیلدها الزامی است")}catch(h){console.log("Login error:",h),console.log("Error response:",(m=h==null?void 0:h.response)==null?void 0:m.data),F.error(((v=(_=h==null?void 0:h.response)==null?void 0:_.data)==null?void 0:v.message)||"خطا در ورود به پنل کاربری")}finally{n.value=!1}},k=async u=>{try{if(n.value=!0,u.username!==""){O.setMobile(u.username);let t=await ve({...u,provider:"user"});O.setId(t.id),a("verify",!0)}else F.error("وارد کردن تمامی فیلدها الزامی است")}catch(t){console.log(t),F.error("خطا در ورود به پنل کاربری")}finally{n.value=!1}};return(u,t)=>{const m=Q,_=L;return p(),I("div",{class:N(["h-screen bg-image overflow-hidden",[`${o(g)}`]])},[d("div",he,[d("div",ge,[d("div",_e,[c(o(pe),{activeKey:o(l),"onUpdate:activeKey":t[3]||(t[3]=v=>ee(l)?l.value=v:null)},{default:f(()=>[(p(),$(o(K),{tab:"ورود با شماره تلفن",key:0,"force-render":""},{default:f(()=>[c(o(A),{model:o(i),onFinish:b},{default:f(()=>[c(o(D),{label:"شماره تلفن",name:"username"},{default:f(()=>[c(m,{"place-holder":"مثال: 09123456789",value:o(i).username,"onUpdate:value":t[0]||(t[0]=v=>o(i).username=v)},null,8,["value"])]),_:1}),c(o(D),{label:"کلمه عبور",name:"password"},{default:f(()=>[c(m,{"is-password":"","place-holder":"کلمه عبور",value:o(i).password,"onUpdate:value":t[1]||(t[1]=v=>o(i).password=v)},null,8,["value"])]),_