Files
tehran_taj/apps/user-app-v2/dist/assets/LoginRegisterView-D5rR2ltY.js
T
s.esmaeili 53a304b5d5 SearchView: Removed the dynamic collection-tile grid (e.g. "پرفروش‌های این هفته") and the "نتایج / N محصول" section header from the UI. Underlying data/filtering logic untouched.
DashboardView ("میز کار"): Rebuilt from scratch with a new structure, distinct from the old card+grid layout but visually aligned with HomeView (same blurred bar, @ink/@wine palette, staged reveal animation on mount):

Single hero card (ink→wine gradient) showing balance, gold/fiat debt, and identity — no quick-action icons inside it anymore.

Live gold rate folded into a slim inline row at the bottom instead of a titled section.
Iterated shadow/spacing on the hero card per feedback (softer, less clipped).
DialogVant / DialogVantOneButton (shared modal components, used in 7+ call sites: Dashboard, Cart, SingleProduct, Register, App): Replaced Vant's default dialog chrome with the app's own rounded-card language — circular icon badge for the illustration, pill-shaped primary/secondary buttons. No call-site markup changed.

LoginView: Rebuilt from scratch — full-bleed dark hero (brand + step copy) overlapped by a floating white form sheet, animated crossfade transition between the mobile-number and OTP steps, same staged entrance animation as Home/Dashboard. All auth logic (API check, OTP stub, session login) unchanged.
2026-09-18 12:54:45 +03:30

2 lines
11 KiB
JavaScript

import{d as B,g as F,E as j,B as Z,f as y,c as w,w as M,G as Q,b as c,i as S,e as T,F as L,r as ee,j as U,v as q,H as te,D as se,s as N,l as a,q as f,I as K,t as A,u as s,J as ne,C as H,A as D,p as ae,h as oe,_ as W}from"./index-CmYEpHK9.js";import{P as z}from"./PageBar-D80e377v.js";import{_ as le}from"./NotifyVant.vue_vue_type_script_setup_true_lang-jgMMdODO.js";import{a as ue}from"./client-WIBW0tF5.js";import{a as G,F as I,I as $,T as ie}from"./index-BNDtSOlu.js";import{a as re}from"./Spinner.vue_vue_type_style_index_0_lang-CvgYqzhC.js";import{_ as ce}from"./DialogVant.vue_vue_type_style_index_0_lang-D7yryjTd.js";import"./FormItemContext-LH987h9F.js";import"./classCallCheck-Ddn4Ym7v.js";import"./_commonjsHelpers-Cpj98o6Y.js";const de={class:"otp-single-input"},pe=["type","placeholder","disabled"],me={key:0},fe=["innerHTML"],ve=B({__name:"SingleOtpInput",props:{inputType:{default:"tel"},value:{},separator:{},focus:{type:Boolean},inputClasses:{},shouldAutoFocus:{type:Boolean},isLastChild:{type:Boolean},placeholder:{},disabled:{type:Boolean}},emits:["on-change","on-keydown","on-paste","on-focus","on-blur"],setup(o,{emit:g}){const r=o,v=g,n=F(r.value||""),l=F(null),u=()=>(n.value=n.value.toString(),n.value.length>1&&(n.value=n.value.slice(0,1)),v("on-change",n.value)),_=d=>d>=48&&d<=57||d>=96&&d<=105,p=d=>{r.disabled&&d.preventDefault();const m=d||window.event,k=m.which?m.which:m.keyCode;_(k)||[8,9,13,37,39,46,86].includes(k)?v("on-keydown",d):m.preventDefault()},e=d=>v("on-paste",d),h=()=>(l.value.select(),v("on-focus")),i=()=>v("on-blur");return j(()=>r.value,(d,m)=>{d!==m&&(n.value=d??"")}),j(()=>r.focus,(d,m)=>{m!==d&&l.value&&r.focus&&(l.value.focus(),l.value.select())}),Z(()=>{l.value&&r.focus&&r.shouldAutoFocus&&(l.value.focus(),l.value.select())}),(d,m)=>(y(),w("div",de,[M(c("input",{type:o.inputType,placeholder:o.placeholder,disabled:o.disabled,ref_key:"input",ref:l,min:"0",max:"9",maxlength:"1",pattern:"[0-9]","onUpdate:modelValue":m[0]||(m[0]=k=>n.value=k),class:S(o.inputClasses),onInput:u,onKeydown:p,onPaste:e,onFocus:h,onBlur:i},null,42,pe),[[Q,n.value]]),!o.isLastChild&&o.separator?(y(),w("span",me,[c("span",{innerHTML:o.separator},null,8,fe)])):T("",!0)]))}}),he={class:"flex ltr justify-around w-full"},_e=8,ye=37,ge=39,be=46,we=B({__name:"OtpInput",props:{defaultFocus:{type:Boolean},numInputs:{default:4},separator:{},inputClasses:{},inputType:{},shouldAutoFocus:{type:Boolean,default:!1},placeholder:{},disabled:{type:Boolean,default:!1}},emits:["on-change","on-complete"],setup(o,{emit:g}){const r=o,v=g,n=F(0),l=F([]),u=F([]),_=t=>{r.defaultFocus&&t<r.numInputs&&!l.value[t]?n.value=l.value.length:n.value=t},p=()=>{n.value=-1},e=()=>l.value.join("").length===r.numInputs?v("on-complete",l.value.join("")):"Wait until the user enters the required number of characters",h=t=>{n.value=Math.max(Math.min(r.numInputs-1,t),0)},i=()=>h(n.value+1),d=()=>h(n.value-1),m=t=>{u.value=Object.assign([],l.value),typeof t=="string"&&t===""?l.value.splice(n.value,1):l.value[n.value]=t,u.value.join("")!==l.value.join("")&&(v("on-change",l.value.join("")),e())},k=t=>{var P;t.preventDefault();const C=(((P=t.clipboardData)==null?void 0:P.getData("text/plain"))??"").slice(0,r.numInputs-n.value).split("");if(r.inputType==="number"&&!C.join("").match(/^\d+$/))return"Invalid pasted data";const V=l.value.slice(0,n.value).concat(C);return V.slice(0,r.numInputs).forEach((X,Y)=>{l.value[Y]=X}),h(V.slice(0,r.numInputs).length),e()},R=t=>{m(t),i()},b=t=>{switch(t.keyCode){case _e:t.preventDefault(),m(""),d();break;case be:t.preventDefault(),m("");break;case ye:t.preventDefault(),d();break;case ge:t.preventDefault(),i();break}};return(t,E)=>(y(),w("div",null,[c("div",he,[(y(!0),w(L,null,ee(o.numInputs,(C,x)=>(y(),U(ve,{key:x,focus:n.value===x,value:l.value[x],separator:o.separator,"input-type":o.inputType,"input-classes":o.inputClasses,"is-last-child":x===o.numInputs-1,"should-auto-focus":o.shouldAutoFocus,placeholder:o.placeholder,disabled:o.disabled,onOnChange:R,onOnKeydown:b,onOnPaste:k,onOnFocus:V=>_(x),onOnBlur:p},null,8,["focus","value","separator","input-type","input-classes","is-last-child","should-auto-focus","placeholder","disabled","onOnFocus"]))),128))])]))}}),ke=o=>` مقدار ${o} نا معتبر است `,J=o=>({pattern:/^(\+98|0098|98|0)?9\d{9}$/g,message:ke(o)}),O=o=>({required:!0,message:` لطفا ${o} را وارد کنید `}),Ce={class:"auth"},Ie={class:"auth__intro"},Oe={class:"auth__mark","aria-hidden":"true"},Fe={class:"auth__sub"},$e={class:"auth__card"},xe={key:0,class:"auth__timer"},De={key:1,class:"auth__timer"},Be=["disabled"],Te={class:"auth__switch"},Re=B({__name:"LoginView",emits:["register"],setup(o,{emit:g}){const r=g,v=q(),n=te(),l=se(),u=D({username:void 0}),_=D({show:!1,text:"اطلاعات کاربری در سیستم وجود ندارد."}),p=D({step:1,loading:!1,defaultFocus:!1});let e=null;const h=F(0),i=()=>{h.value>0&&setTimeout(()=>{h.value>0&&(h.value-=1,i())},1e3)},d=async()=>{try{if(p.loading=!0,e=(await ue.listCustomers()).find(t=>t.mobile===u.username)??null,!e){_.text="اطلاعات کاربری در سیستم وجود ندارد.",_.show=!0;return}p.step=2,h.value=120,i(),await ae(()=>{p.defaultFocus=!0})}catch(b){console.log(b)}finally{p.loading=!1}},m=async b=>{try{if(p.loading=!0,!e)return;l.login(e.id,e.mobile);const t=typeof n.query.redirect=="string"?n.query.redirect:void 0;await v.push(t??{name:"home"}),_.text="با موفقیت وارد شدید",_.show=!0}finally{p.loading=!1}},k=b=>b<10?"0"+b:b,R=oe(()=>p.step===1?"دریافت رمز عبور":"دریافت مجدد رمز عبور");return(b,t)=>{const E=N("container");return y(),w("div",Ce,[a(le,{timeOut:2e3,modelValue:_.show,"onUpdate:modelValue":t[0]||(t[0]=C=>_.show=C),text:_.text,color:"background-color: #DC2626"},null,8,["modelValue","text"]),a(z,{title:"ورود","back-to":"home"}),a(E,{class:"auth__body"},{default:f(()=>[c("section",Ie,[c("div",Oe,[a(K,{icon:"vuesax-linear:security-user",size:"28"})]),t[3]||(t[3]=c("h2",{class:"auth__title"},"ورود به منتزر",-1)),c("p",Fe,A(p.step===1?"شماره موبایل خود را وارد کنید":"رمز یکبارمصرف را وارد کنید"),1)]),c("section",$e,[p.step===2?(y(),w(L,{key:0},[a(we,{class:"auth__otp","input-classes":"otp-input",inputType:"tel","num-inputs":4,"should-auto-focus":!0,defaultFocus:p.defaultFocus,onOnComplete:m},null,8,["defaultFocus"]),h.value>0?(y(),w("p",xe," امکان دریافت مجدد رمز در "+A(k(h.value))+" ثانیه دیگر ",1)):(y(),w("p",De,"برای دریافت رمز عبور مجدد تلاش کنید"))],64)):T("",!0),a(s(G),{model:u,layout:"vertical",onFinish:d,class:"auth__form"},{default:f(()=>[M(a(s(I),{name:"username",label:"تلفن همراه",rules:[s(O)("تلفن همراه"),s(J)("تلفن همراه")]},{default:f(()=>[a(s($),{type:"number",value:u.username,"onUpdate:value":t[1]||(t[1]=C=>u.username=C)},null,8,["value"])]),_:1},8,["rules"]),[[ne,p.step===1]]),c("button",{type:"submit",class:S(["auth__cta",{"is-loading":p.loading}]),disabled:p.loading||h.value>0&&p.step===2},A(R.value),11,Be)]),_:1},8,["model"])]),c("p",Te,[t[4]||(t[4]=H(" اگر ثبت نام نکرده‌اید ",-1)),c("button",{type:"button",onClick:t[2]||(t[2]=C=>r("register",!0))},"ثبت نام کنید")])]),_:1})])}}}),Ee=W(Re,[["__scopeId","data-v-08d7f1af"]]),Ve="/assets/registerDelay-BdXluE_Y.svg",Ae={class:"auth"},Ue={class:"auth__intro"},Le={class:"auth__mark","aria-hidden":"true"},Pe={class:"auth__card"},je={class:"auth__switch"},Me=["src"],Se=B({__name:"RegisterView",emits:["register"],setup(o,{emit:g}){const r=g,v=q(),n=D({loading:!1}),l=F(!1),u=D({fname:void 0,lname:void 0,mobile:void 0,store_name:void 0,phone:void 0,address:void 0,city:void 0}),_=async()=>{try{n.loading=!0,l.value=!0}finally{n.loading=!1}};return(p,e)=>{const h=N("container");return y(),w("div",Ae,[a(z,{title:"ثبت نام","back-to":"home"}),a(re,{spinning:n.loading,tip:"در حال ثبت اطلاعات"},{default:f(()=>[a(h,{class:"auth__body"},{default:f(()=>[c("section",Ue,[c("div",Le,[a(K,{icon:"vuesax-linear:user-add",size:"28"})]),e[10]||(e[10]=c("h2",{class:"auth__title"},"ساخت حساب کاربری",-1)),e[11]||(e[11]=c("p",{class:"auth__sub"},"اطلاعات فروشگاه خود را وارد کنید",-1))]),c("section",Pe,[a(s(G),{model:u,layout:"vertical",onFinish:_,class:"auth__form"},{default:f(()=>[a(s(I),{name:"fname",label:"نام",rules:s(O)("نام")},{default:f(()=>[a(s($),{value:u.fname,"onUpdate:value":e[0]||(e[0]=i=>u.fname=i)},null,8,["value"])]),_:1},8,["rules"]),a(s(I),{name:"lname",label:"نام خانوادگی",rules:s(O)("نام خانوادگی")},{default:f(()=>[a(s($),{value:u.lname,"onUpdate:value":e[1]||(e[1]=i=>u.lname=i)},null,8,["value"])]),_:1},8,["rules"]),a(s(I),{name:"mobile",label:"شماره موبایل",rules:[s(J)("شماره موبایل"),s(O)("شماره موبایل")]},{default:f(()=>[a(s($),{value:u.mobile,"onUpdate:value":e[2]||(e[2]=i=>u.mobile=i),type:"number"},null,8,["value"])]),_:1},8,["rules"]),a(s(I),{name:"store_name",label:"نام فروشگاه",rules:s(O)("نام فروشگاه")},{default:f(()=>[a(s($),{value:u.store_name,"onUpdate:value":e[3]||(e[3]=i=>u.store_name=i)},null,8,["value"])]),_:1},8,["rules"]),a(s(I),{name:"phone",label:"تلفن فروشگاه",rules:[s(O)("تلفن فروشگاه")]},{default:f(()=>[a(s($),{value:u.phone,"onUpdate:value":e[4]||(e[4]=i=>u.phone=i),type:"number"},null,8,["value"])]),_:1},8,["rules"]),a(s(I),{name:"address",label:"آدرس پستی",rules:s(O)("آدرس")},{default:f(()=>[a(s(ie),{value:u.address,"onUpdate:value":e[5]||(e[5]=i=>u.address=i),rows:3},null,8,["value"])]),_:1},8,["rules"]),a(s(I),{name:"city",label:"شهر",rules:s(O)("شهر")},{default:f(()=>[a(s($),{value:u.city,"onUpdate:value":e[6]||(e[6]=i=>u.city=i)},null,8,["value"])]),_:1},8,["rules"]),e[12]||(e[12]=c("button",{type:"submit",class:"auth__cta"},"ثبت اطلاعات",-1))]),_:1},8,["model"])]),c("p",je,[e[13]||(e[13]=H(" اگر حساب کاربری دارید ",-1)),c("button",{type:"button",onClick:e[7]||(e[7]=i=>r("register",!1))},"وارد شوید")])]),_:1})]),_:1},8,["spinning"]),a(ce,{timeOut:-1,show:l.value,"onUpdate:show":e[9]||(e[9]=i=>l.value=i),closeOnClickOverlay:!1},{img:f(()=>[c("img",{src:s(Ve),alt:"",class:"opacity-80"},null,8,Me)]),title:f(()=>[...e[14]||(e[14]=[c("div",{class:"p-5"}," ثبت نام شما با موفقیت انجام شد. منتظر تایید اطلاعات ثبت نامی شما توسط کارشناسان بمانید. ",-1)])]),button:f(()=>[c("div",{class:"text-center",onClick:e[8]||(e[8]=i=>s(v).push({name:"home"}))},"متوجه شدم")]),_:1},8,["show"])])}}}),qe=W(Se,[["__scopeId","data-v-23baea3e"]]),Qe=B({__name:"LoginRegisterView",setup(o){const g=F(!1),r=v=>g.value=v;return(v,n)=>(y(),w(L,null,[g.value?T("",!0):(y(),U(Ee,{key:0,onRegister:r})),g.value?(y(),U(qe,{key:1,onRegister:r})):T("",!0)],64))}});export{Qe as default};