增加登录,页面刷新获取店铺详情

This commit is contained in:
YeMingfei666 2025-02-24 09:51:45 +08:00
parent 45212ea243
commit 0e644c507f
3 changed files with 220 additions and 3 deletions

View File

@ -24,9 +24,23 @@ const ShopApi = {
data,
});
},
get(params: getRequest) {
return request<any, ShopInfo>({
url: `${baseURL}/detail`,
method: "get",
params
});
}
};
export default ShopApi;
export interface getRequest {
/**
* id
*/
id?: string | number;
[property: string]: any;
}
/**
* ShopInfoEditDTO
@ -58,3 +72,202 @@ export interface PageQuery {
status?: number;
[property: string]: any;
}
/**
* ShopInfo
*/
export interface ShopInfo {
/**
*
*/
address?: null | string;
/**
*
*/
article?: null | string;
/**
*
*/
backImg?: null | string;
/**
*
*/
bindAccount?: null | string;
/**
*
*/
bookingSms?: null | string;
/**
* ()
*/
businessEndDay?: null | string;
/**
* ()
*/
businessStartDay?: null | string;
/**
*
*/
businessTime?: null | string;
/**
*
*/
chainName?: null | string;
/**
*
*/
cities?: null | string;
/**
* all- vip-
*/
consumeColony?: null | string;
/**
*
*/
contactName?: null | string;
/**
*
*/
coverImg?: null | string;
createTime?: null | string;
/**
*
*/
detail?: null | string;
/**
* /
*/
districts?: null | string;
/**
* dine-in take-out
*/
eatModel?: null | string;
/**
*
*/
expireTime?: null | string;
/**
*
*/
frontImg?: null | string;
/**
* 使 sys_user id
*/
id?: number | null;
/**
*
*/
isAccountPay?: number | null;
/**
* 1 0
*/
isCustomAmount?: number | null;
/**
* 1 0
*/
isMemberInPwd?: number | null;
/**
* 01
*/
isMemberPrice?: number | null;
/**
* 退 1 0
*/
isMemberReturnPwd?: number | null;
/**
* 退 1 0
*/
isReturnPwd?: number | null;
/**
* 01
*/
isTableFee?: number | null;
/**
*
*/
lat?: null | string;
/**
*
*/
lng?: null | string;
/**
* logo
*/
logo?: null | string;
/**
* id
*/
mainId?: number | null;
/**
* 0 1 2
*/
onSale?: number | null;
/**
*
*/
operationPwd?: null | string;
/**
*
*/
paymentQrcode?: null | string;
/**
*
*/
phone?: null | string;
/**
* trial试用版release正式
*/
profiles?: null | string;
/**
*
*/
provinces?: null | string;
registerType?: null | string;
/**
*
*/
sdType?: null | string;
/**
*
*/
shopName?: null | string;
/**
*
*/
shopQrcode?: null | string;
/**
* --only --chain--join type
*/
shopType?: null | string;
/**
* ()
*/
smallQrcode?: null | string;
/**
* -1 0-1
*/
status?: number | null;
/**
*
*/
subTitle?: null | string;
/**
*
*/
tableFee?: number | null;
/**
*
*/
tag?: null | string;
/**
*
*/
taxAmount?: null | string;
/**
* 0 1, 1 0
*/
tubeType?: number | null;
updateTime?: null | string;
[property: string]: any;
}

View File

@ -3,6 +3,7 @@ import { usePermissionStoreHook } from "@/store/modules/permission";
import { useDictStoreHook } from "@/store/modules/dict";
import AuthAPI, { type loginRequest } from "@/api/account/login";
import ShopApi from "@/api/account/shop";
import UserAPI, { type UserInfo } from "@/api/system/user";
import { setToken, setRefreshToken, getRefreshToken, clearToken } from "@/utils/auth";
@ -12,7 +13,9 @@ export const useUserStore = defineStore("user", () => {
const promissionList = useStorage<string[]>("promissionList", [] as string[]);
localStorage.setItem("shopId", "" + userInfo.value.shopId);
if (userInfo.value.shopId) {
getUserInfo()
}
/**
*
*
@ -43,13 +46,14 @@ export const useUserStore = defineStore("user", () => {
*/
function getUserInfo() {
return new Promise<UserInfo>((resolve, reject) => {
UserAPI.getInfo(userInfo.value.shopId)
ShopApi.get({ id: userInfo.value.shopId })
.then((data) => {
if (!data) {
reject("Verification failed, please Login again.");
return;
}
localStorage.setItem("shopId", "" + userInfo.value.shopId);
console.log("获取用户信息", data);
Object.assign(userInfo.value, { ...data });
resolve(data);
})

View File

@ -181,7 +181,7 @@ function handleLogin() {
userStore
.login(user)
.then(async (res) => {
// await userStore.getUserInfo();
await userStore.getUserInfo();
const { path, queryParams } = parseRedirect();
console.log(res, "Denglv返回");
router.push({ path: path, query: queryParams });