mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-11-06 17:09:08 +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}`,
|
||||
method: Method.GET,
|
||||
needToken: false,
|
||||
// 刷新令牌请求自身不再进入 401/403 刷新分支,避免拦截器递归死锁;失败也不弹全局错误提示
|
||||
skipAuthHandler: true,
|
||||
skipMessage: true,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -102,42 +102,40 @@
|
||||
</div>
|
||||
<!-- 优惠券展示 -->
|
||||
<div class="item-price-coupon-row" v-if="promotionMap['COUPON'].length">
|
||||
<div class="Ellipsis">
|
||||
<span class="item-price-title">优惠券</span>
|
||||
<span>
|
||||
<span
|
||||
class="item-coupon"
|
||||
v-for="(item, index) in promotionMap['COUPON'].slice(0, 6)"
|
||||
:key="index"
|
||||
@click="receiveCoupon(item.id)"
|
||||
>
|
||||
<span v-if="item.couponType == 'PRICE'"
|
||||
>满{{ item.consumeThreshold }}减{{ item.price }}</span>
|
||||
<span v-if="item.couponType == 'DISCOUNT'"
|
||||
>满{{ item.consumeThreshold }}打{{
|
||||
item.couponDiscount
|
||||
}}折</span>
|
||||
</span>
|
||||
<span class="item-price-title">优惠券</span>
|
||||
<div class="coupon-tags">
|
||||
<span
|
||||
class="item-coupon"
|
||||
v-for="(item, index) in promotionMap['COUPON'].slice(0, 6)"
|
||||
:key="index"
|
||||
@click="receiveCoupon(item.id)"
|
||||
>
|
||||
<span v-if="item.couponType == 'PRICE'"
|
||||
>满{{ item.consumeThreshold }}减{{ item.price }}</span>
|
||||
<span v-if="item.couponType == 'DISCOUNT'"
|
||||
>满{{ item.consumeThreshold }}打{{
|
||||
item.couponDiscount
|
||||
}}折</span>
|
||||
</span>
|
||||
|
||||
<div class="dropdown" v-if="promotionMap['COUPON'].length > 6">
|
||||
<span>展开更多</span>
|
||||
<div class="dropdown-content">
|
||||
<span
|
||||
class="item-coupon"
|
||||
v-for="(item, index) in promotionMap['COUPON'].slice(6, promotionMap['COUPON'].length)"
|
||||
:key="index"
|
||||
@click="receiveCoupon(item.id)"
|
||||
>
|
||||
<span v-if="item.couponType == 'PRICE'"
|
||||
>满{{ item.consumeThreshold }}减{{ item.price }}</span>
|
||||
<span v-if="item.couponType == 'DISCOUNT'"
|
||||
>满{{ item.consumeThreshold }}打{{
|
||||
item.couponDiscount
|
||||
}}折</span>
|
||||
</span>
|
||||
</div>
|
||||
<span class="dropdown-more">展开更多 ▾</span>
|
||||
<div class="dropdown-content">
|
||||
<span
|
||||
class="item-coupon"
|
||||
v-for="(item, index) in promotionMap['COUPON'].slice(6, promotionMap['COUPON'].length)"
|
||||
:key="index"
|
||||
@click="receiveCoupon(item.id)"
|
||||
>
|
||||
<span v-if="item.couponType == 'PRICE'"
|
||||
>满{{ item.consumeThreshold }}减{{ item.price }}</span>
|
||||
<span v-if="item.couponType == 'DISCOUNT'"
|
||||
>满{{ item.consumeThreshold }}打{{
|
||||
item.couponDiscount
|
||||
}}折</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 限时折扣 -->
|
||||
@@ -898,62 +896,75 @@ export default {
|
||||
|
||||
.item-price-coupon-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 5px 0px;
|
||||
align-items: flex-start;
|
||||
margin: 8px 0px;
|
||||
|
||||
.item-price-title {
|
||||
flex-shrink: 0;
|
||||
line-height: 22px;
|
||||
}
|
||||
}
|
||||
|
||||
.Ellipsis {
|
||||
overflow: hidden;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2; //控制显示几行
|
||||
-webkit-box-orient: vertical; //webbox方向
|
||||
.coupon-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.dropdown {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.dropdown .item-coupon {
|
||||
display: flex;
|
||||
align-content: center;
|
||||
align-items: center;
|
||||
color: $theme_color;
|
||||
margin: 5px 0;
|
||||
font-size: 14px;
|
||||
background-color: var(--theme-tint-12, #ffdedf);
|
||||
border: 1px dotted $theme_color;
|
||||
cursor: pointer;
|
||||
.dropdown-more {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
line-height: 22px;
|
||||
white-space: nowrap;
|
||||
|
||||
span {
|
||||
padding: 3px;
|
||||
&:hover {
|
||||
color: $theme_color;
|
||||
}
|
||||
}
|
||||
|
||||
.dropdown-content {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: #f9f9f9;
|
||||
min-width: 160px;
|
||||
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
|
||||
padding: 12px 16px;
|
||||
top: 24px;
|
||||
left: 0;
|
||||
background-color: #fff;
|
||||
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 {
|
||||
display: block;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.item-coupon {
|
||||
margin-right: 5px;
|
||||
padding: 0 5px;
|
||||
position: relative;
|
||||
padding: 2px 10px;
|
||||
color: $theme_color;
|
||||
font-size: 14px;
|
||||
background-color: var(--theme-tint-12, #ffdedf);
|
||||
border: 1px dotted $theme_color;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
background-color: #fff;
|
||||
border: 1px solid $theme_color;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s, color 0.2s;
|
||||
white-space: nowrap;
|
||||
|
||||
span {
|
||||
padding: 3px;
|
||||
&:hover {
|
||||
background-color: $theme_color;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.item-promotion {
|
||||
|
||||
@@ -161,9 +161,10 @@ service.interceptors.response.use(
|
||||
const errorData = errorResponse.data || {};
|
||||
|
||||
if (
|
||||
errorResponse.status === 401 ||
|
||||
errorResponse.status === 403 ||
|
||||
error.response?.data?.code === 20004
|
||||
!error.config?.skipAuthHandler &&
|
||||
(errorResponse.status === 401 ||
|
||||
errorResponse.status === 403 ||
|
||||
error.response?.data?.code === 20004)
|
||||
) {
|
||||
isRefreshToken++;
|
||||
if (isRefreshToken === 1) {
|
||||
@@ -212,8 +213,12 @@ function getTokenDebounce() {
|
||||
let success = false;
|
||||
return function () {
|
||||
if (!lock) {
|
||||
lock = true;
|
||||
const oldRefreshToken = Storage.getItem("refreshToken");
|
||||
// 无 refreshToken(未登录)时不发起刷新请求,直接判失败,避免请求 /refresh/undefined 造成拦截器死锁
|
||||
if (!oldRefreshToken) {
|
||||
return Promise.resolve("fail");
|
||||
}
|
||||
lock = true;
|
||||
handleRefreshToken(oldRefreshToken)
|
||||
.then((res) => {
|
||||
if (res.success) {
|
||||
|
||||
@@ -361,12 +361,6 @@ export const otherRouter = {
|
||||
name: "main",
|
||||
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",
|
||||
title: "短信签名",
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
</el-tabs>
|
||||
<div class="operation mb_10">
|
||||
<el-button type="primary" @click="createTemp">添加页面</el-button>
|
||||
<el-button @click="goThemeSetting">主题色设置</el-button>
|
||||
</div>
|
||||
<el-table v-loading="loading" :data="list" style="width: 100%">
|
||||
<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) {
|
||||
this.searchForm.pageNumber = val;
|
||||
this.getTemplateList();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,6 @@
|
||||
</el-tabs>
|
||||
<div class="operation mb_10">
|
||||
<el-button type="primary" @click="handleAdd()">添加页面</el-button>
|
||||
<el-button @click="goThemeSetting">主题色设置</el-button>
|
||||
</div>
|
||||
<el-table v-loading="loading" :data="list" style="width: 100%">
|
||||
<el-table-column prop="name" label="页面名称" min-width="200" show-overflow-tooltip>
|
||||
@@ -163,9 +162,6 @@ export default {
|
||||
query: { pagetype: this.params.pageType },
|
||||
});
|
||||
},
|
||||
goThemeSetting() {
|
||||
this.$router.push({ name: "theme-setting" });
|
||||
},
|
||||
changePageSize(v) {
|
||||
this.params.pageNumber = 1;
|
||||
this.params.pageSize = v;
|
||||
|
||||
Reference in New Issue
Block a user