mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-11-11 03:18:56 +08:00
fix(seller): 裁剪userInfoSeller存储字段,避免Cookie超限导致登录卡死
This commit is contained in:
@@ -30,6 +30,27 @@ const STATIC_ROUTE_NAMES = new Set([
|
|||||||
|
|
||||||
util.dynamicRouteNames = [];
|
util.dynamicRouteNames = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提取商家端会话必需的基础展示字段,避免超长经营范围或入驻详情导致 Cookie 超限
|
||||||
|
*
|
||||||
|
* @param {Object} raw 商家信息对象
|
||||||
|
* @returns {Object} 核心会话档案对象
|
||||||
|
*/
|
||||||
|
util.pickSellerProfile = function (raw) {
|
||||||
|
if (!raw) return {};
|
||||||
|
return {
|
||||||
|
id: raw.id,
|
||||||
|
storeId: raw.storeId || raw.id,
|
||||||
|
storeName: raw.storeName,
|
||||||
|
storeLogo: raw.storeLogo,
|
||||||
|
nickName: raw.nickName,
|
||||||
|
storeDisable: raw.storeDisable,
|
||||||
|
serviceScore: raw.serviceScore,
|
||||||
|
deliveryScore: raw.deliveryScore,
|
||||||
|
descriptionScore: raw.descriptionScore,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
util.clearDynamicRoutes = function () {
|
util.clearDynamicRoutes = function () {
|
||||||
util.dynamicRouteNames.forEach((name) => {
|
util.dynamicRouteNames.forEach((name) => {
|
||||||
if (STATIC_ROUTE_NAMES.has(name)) {
|
if (STATIC_ROUTE_NAMES.has(name)) {
|
||||||
|
|||||||
@@ -212,12 +212,13 @@ function afterLogin(res) {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
setStore("saveLogin", saveLogin.value);
|
setStore("saveLogin", saveLogin.value);
|
||||||
|
const profile = util.pickSellerProfile(res.result);
|
||||||
if (saveLogin.value) {
|
if (saveLogin.value) {
|
||||||
Cookies.set("userInfoSeller", JSON.stringify(res.result), {
|
Cookies.set("userInfoSeller", JSON.stringify(profile), {
|
||||||
expires: 7,
|
expires: 7,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Cookies.set("userInfoSeller", JSON.stringify(res.result));
|
Cookies.set("userInfoSeller", JSON.stringify(profile));
|
||||||
}
|
}
|
||||||
|
|
||||||
util.initRouter();
|
util.initRouter();
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import { validateMobile } from "@/libs/validate";
|
|||||||
import uploadPicThumb from "@/views/my-components/lili/upload-pic-thumb";
|
import uploadPicThumb from "@/views/my-components/lili/upload-pic-thumb";
|
||||||
import multipleMap from "@/views/my-components/map/multiple-map";
|
import multipleMap from "@/views/my-components/map/multiple-map";
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
|
import util from "@/libs/util.js";
|
||||||
import { Message } from "@/utils/message";
|
import { Message } from "@/utils/message";
|
||||||
|
|
||||||
defineOptions({ name: "shopSetting" });
|
defineOptions({ name: "shopSetting" });
|
||||||
@@ -158,7 +159,7 @@ function getShopInfo() {
|
|||||||
form.value = res.result;
|
form.value = res.result;
|
||||||
storeName.value = res.result.storeName;
|
storeName.value = res.result.storeName;
|
||||||
form.value.storeCenter = res.result.storeCenter;
|
form.value.storeCenter = res.result.storeCenter;
|
||||||
Cookies.set("userInfoSeller", JSON.stringify(res.result));
|
Cookies.set("userInfoSeller", JSON.stringify(util.pickSellerProfile(res.result)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user