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.
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { defineStore } from 'pinia';
|
|
|
|
/**
|
|
* Holds the logged-in customer's identity. Now backed by a real (if stubbed —
|
|
* see LoginView.vue) login flow: `login()` sets the same `appToken`
|
|
* localStorage key legacy's `isUserLoggedIn()` reads, so downstream login
|
|
* gates keep working unchanged.
|
|
*/
|
|
export const useSessionStore = defineStore('session', {
|
|
state: () => ({
|
|
customerId: localStorage.getItem('gold-bank:customerId') as string | null,
|
|
mobile: localStorage.getItem('gold-bank:mobile') as string | null,
|
|
}),
|
|
actions: {
|
|
setCustomerId(id: string) {
|
|
this.customerId = id;
|
|
localStorage.setItem('gold-bank:customerId', id);
|
|
},
|
|
login(customerId: string, mobile: string) {
|
|
this.customerId = customerId;
|
|
this.mobile = mobile;
|
|
localStorage.setItem('gold-bank:customerId', customerId);
|
|
localStorage.setItem('gold-bank:mobile', mobile);
|
|
// matches legacy's isUserLoggedIn() check (Mixins/checkAccess.ts)
|
|
localStorage.setItem('appToken', customerId);
|
|
},
|
|
logout() {
|
|
this.customerId = null;
|
|
this.mobile = null;
|
|
localStorage.removeItem('gold-bank:customerId');
|
|
localStorage.removeItem('gold-bank:mobile');
|
|
localStorage.removeItem('appToken');
|
|
},
|
|
},
|
|
});
|