mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-11-08 01:48:56 +08:00
fix(theme): 优化主题色设置功能并修复令牌刷新逻辑
- 移除楼层列表中的主题色设置按钮及路由 - 重构主题色设置页面,新增系统预设色系和自定义模式 - 添加移动端真实页面预览功能,支持商品详情和订单页面预览 - 优化商品详情页优惠券展示样式和布局 - 修复买家端API刷新令牌请求的拦截器递归死锁问题 - 添加无refreshToken时的刷新请求保护机制
This commit is contained in:
@@ -63,6 +63,9 @@ export function handleRefreshToken(token) {
|
|||||||
url: `/buyer/passport/member/refresh/${token}`,
|
url: `/buyer/passport/member/refresh/${token}`,
|
||||||
method: Method.GET,
|
method: Method.GET,
|
||||||
needToken: false,
|
needToken: false,
|
||||||
|
// 刷新令牌请求自身不再进入 401/403 刷新分支,避免拦截器递归死锁;失败也不弹全局错误提示
|
||||||
|
skipAuthHandler: true,
|
||||||
|
skipMessage: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,42 +102,40 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- 优惠券展示 -->
|
<!-- 优惠券展示 -->
|
||||||
<div class="item-price-coupon-row" v-if="promotionMap['COUPON'].length">
|
<div class="item-price-coupon-row" v-if="promotionMap['COUPON'].length">
|
||||||
<div class="Ellipsis">
|
<span class="item-price-title">优惠券</span>
|
||||||
<span class="item-price-title">优惠券</span>
|
<div class="coupon-tags">
|
||||||
<span>
|
<span
|
||||||
<span
|
class="item-coupon"
|
||||||
class="item-coupon"
|
v-for="(item, index) in promotionMap['COUPON'].slice(0, 6)"
|
||||||
v-for="(item, index) in promotionMap['COUPON'].slice(0, 6)"
|
:key="index"
|
||||||
:key="index"
|
@click="receiveCoupon(item.id)"
|
||||||
@click="receiveCoupon(item.id)"
|
>
|
||||||
>
|
<span v-if="item.couponType == 'PRICE'"
|
||||||
<span v-if="item.couponType == 'PRICE'"
|
>满{{ item.consumeThreshold }}减{{ item.price }}</span>
|
||||||
>满{{ item.consumeThreshold }}减{{ item.price }}</span>
|
<span v-if="item.couponType == 'DISCOUNT'"
|
||||||
<span v-if="item.couponType == 'DISCOUNT'"
|
>满{{ item.consumeThreshold }}打{{
|
||||||
>满{{ item.consumeThreshold }}打{{
|
item.couponDiscount
|
||||||
item.couponDiscount
|
}}折</span>
|
||||||
}}折</span>
|
|
||||||
</span>
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div class="dropdown" v-if="promotionMap['COUPON'].length > 6">
|
<div class="dropdown" v-if="promotionMap['COUPON'].length > 6">
|
||||||
<span>展开更多</span>
|
<span class="dropdown-more">展开更多 ▾</span>
|
||||||
<div class="dropdown-content">
|
<div class="dropdown-content">
|
||||||
<span
|
<span
|
||||||
class="item-coupon"
|
class="item-coupon"
|
||||||
v-for="(item, index) in promotionMap['COUPON'].slice(6, promotionMap['COUPON'].length)"
|
v-for="(item, index) in promotionMap['COUPON'].slice(6, promotionMap['COUPON'].length)"
|
||||||
:key="index"
|
:key="index"
|
||||||
@click="receiveCoupon(item.id)"
|
@click="receiveCoupon(item.id)"
|
||||||
>
|
>
|
||||||
<span v-if="item.couponType == 'PRICE'"
|
<span v-if="item.couponType == 'PRICE'"
|
||||||
>满{{ item.consumeThreshold }}减{{ item.price }}</span>
|
>满{{ item.consumeThreshold }}减{{ item.price }}</span>
|
||||||
<span v-if="item.couponType == 'DISCOUNT'"
|
<span v-if="item.couponType == 'DISCOUNT'"
|
||||||
>满{{ item.consumeThreshold }}打{{
|
>满{{ item.consumeThreshold }}打{{
|
||||||
item.couponDiscount
|
item.couponDiscount
|
||||||
}}折</span>
|
}}折</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 限时折扣 -->
|
<!-- 限时折扣 -->
|
||||||
@@ -898,62 +896,75 @@ export default {
|
|||||||
|
|
||||||
.item-price-coupon-row {
|
.item-price-coupon-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: flex-start;
|
||||||
margin: 5px 0px;
|
margin: 8px 0px;
|
||||||
|
|
||||||
|
.item-price-title {
|
||||||
|
flex-shrink: 0;
|
||||||
|
line-height: 22px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.Ellipsis {
|
.coupon-tags {
|
||||||
overflow: hidden;
|
display: flex;
|
||||||
display: -webkit-box;
|
flex-wrap: wrap;
|
||||||
-webkit-line-clamp: 2; //控制显示几行
|
align-items: center;
|
||||||
-webkit-box-orient: vertical; //webbox方向
|
gap: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown {
|
.dropdown {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: inline-block;
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown .item-coupon {
|
.dropdown-more {
|
||||||
display: flex;
|
font-size: 12px;
|
||||||
align-content: center;
|
color: #999;
|
||||||
align-items: center;
|
line-height: 22px;
|
||||||
color: $theme_color;
|
white-space: nowrap;
|
||||||
margin: 5px 0;
|
|
||||||
font-size: 14px;
|
|
||||||
background-color: var(--theme-tint-12, #ffdedf);
|
|
||||||
border: 1px dotted $theme_color;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
span {
|
&:hover {
|
||||||
padding: 3px;
|
color: $theme_color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-content {
|
.dropdown-content {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: #f9f9f9;
|
top: 24px;
|
||||||
min-width: 160px;
|
left: 0;
|
||||||
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
|
background-color: #fff;
|
||||||
padding: 12px 16px;
|
min-width: 220px;
|
||||||
|
max-width: 320px;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
||||||
|
padding: 12px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 6px;
|
||||||
}
|
}
|
||||||
.dropdown:hover .dropdown-content {
|
.dropdown:hover .dropdown-content {
|
||||||
display: block;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-coupon {
|
.item-coupon {
|
||||||
margin-right: 5px;
|
position: relative;
|
||||||
padding: 0 5px;
|
padding: 2px 10px;
|
||||||
color: $theme_color;
|
color: $theme_color;
|
||||||
font-size: 14px;
|
font-size: 12px;
|
||||||
background-color: var(--theme-tint-12, #ffdedf);
|
line-height: 18px;
|
||||||
border: 1px dotted $theme_color;
|
background-color: #fff;
|
||||||
|
border: 1px solid $theme_color;
|
||||||
|
border-radius: 3px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
transition: background-color 0.2s, color 0.2s;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
span {
|
&:hover {
|
||||||
padding: 3px;
|
background-color: $theme_color;
|
||||||
|
color: #fff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.item-promotion {
|
.item-promotion {
|
||||||
|
|||||||
@@ -161,9 +161,10 @@ service.interceptors.response.use(
|
|||||||
const errorData = errorResponse.data || {};
|
const errorData = errorResponse.data || {};
|
||||||
|
|
||||||
if (
|
if (
|
||||||
errorResponse.status === 401 ||
|
!error.config?.skipAuthHandler &&
|
||||||
errorResponse.status === 403 ||
|
(errorResponse.status === 401 ||
|
||||||
error.response?.data?.code === 20004
|
errorResponse.status === 403 ||
|
||||||
|
error.response?.data?.code === 20004)
|
||||||
) {
|
) {
|
||||||
isRefreshToken++;
|
isRefreshToken++;
|
||||||
if (isRefreshToken === 1) {
|
if (isRefreshToken === 1) {
|
||||||
@@ -212,8 +213,12 @@ function getTokenDebounce() {
|
|||||||
let success = false;
|
let success = false;
|
||||||
return function () {
|
return function () {
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
lock = true;
|
|
||||||
const oldRefreshToken = Storage.getItem("refreshToken");
|
const oldRefreshToken = Storage.getItem("refreshToken");
|
||||||
|
// 无 refreshToken(未登录)时不发起刷新请求,直接判失败,避免请求 /refresh/undefined 造成拦截器死锁
|
||||||
|
if (!oldRefreshToken) {
|
||||||
|
return Promise.resolve("fail");
|
||||||
|
}
|
||||||
|
lock = true;
|
||||||
handleRefreshToken(oldRefreshToken)
|
handleRefreshToken(oldRefreshToken)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
|
|||||||
@@ -361,12 +361,6 @@ export const otherRouter = {
|
|||||||
name: "main",
|
name: "main",
|
||||||
component: () => import("@/views/page-decoration/wap/main.vue")
|
component: () => import("@/views/page-decoration/wap/main.vue")
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: "/floorList/theme-setting",
|
|
||||||
title: "主题色设置",
|
|
||||||
name: "theme-setting",
|
|
||||||
component: () => import("@/views/page-decoration/theme-setting.vue")
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "add-sms-sign",
|
path: "add-sms-sign",
|
||||||
title: "短信签名",
|
title: "短信签名",
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
</el-tabs>
|
</el-tabs>
|
||||||
<div class="operation mb_10">
|
<div class="operation mb_10">
|
||||||
<el-button type="primary" @click="createTemp">添加页面</el-button>
|
<el-button type="primary" @click="createTemp">添加页面</el-button>
|
||||||
<el-button @click="goThemeSetting">主题色设置</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
<el-table v-loading="loading" :data="list" style="width: 100%">
|
<el-table v-loading="loading" :data="list" style="width: 100%">
|
||||||
<el-table-column prop="name" label="页面名称" min-width="200" show-overflow-tooltip>
|
<el-table-column prop="name" label="页面名称" min-width="200" show-overflow-tooltip>
|
||||||
@@ -169,10 +168,6 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
goThemeSetting() {
|
|
||||||
this.$router.push({ name: "theme-setting" });
|
|
||||||
},
|
|
||||||
|
|
||||||
changePageNum(val) {
|
changePageNum(val) {
|
||||||
this.searchForm.pageNumber = val;
|
this.searchForm.pageNumber = val;
|
||||||
this.getTemplateList();
|
this.getTemplateList();
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,6 @@
|
|||||||
</el-tabs>
|
</el-tabs>
|
||||||
<div class="operation mb_10">
|
<div class="operation mb_10">
|
||||||
<el-button type="primary" @click="handleAdd()">添加页面</el-button>
|
<el-button type="primary" @click="handleAdd()">添加页面</el-button>
|
||||||
<el-button @click="goThemeSetting">主题色设置</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
<el-table v-loading="loading" :data="list" style="width: 100%">
|
<el-table v-loading="loading" :data="list" style="width: 100%">
|
||||||
<el-table-column prop="name" label="页面名称" min-width="200" show-overflow-tooltip>
|
<el-table-column prop="name" label="页面名称" min-width="200" show-overflow-tooltip>
|
||||||
@@ -163,9 +162,6 @@ export default {
|
|||||||
query: { pagetype: this.params.pageType },
|
query: { pagetype: this.params.pageType },
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
goThemeSetting() {
|
|
||||||
this.$router.push({ name: "theme-setting" });
|
|
||||||
},
|
|
||||||
changePageSize(v) {
|
changePageSize(v) {
|
||||||
this.params.pageNumber = 1;
|
this.params.pageNumber = 1;
|
||||||
this.params.pageSize = v;
|
this.params.pageSize = v;
|
||||||
|
|||||||
Reference in New Issue
Block a user