mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-11-07 09:28:53 +08:00
refactor(axios): 优化HTTP请求拦截器和错误处理机制
- 移除调试用的console.log语句 - 调整表格列对齐方式,将操作列从居中改为右对齐 - 添加搜索表单功能,包括账单号、店铺名称、生成时间等筛选条件 - 重构axios拦截器逻辑,简化错误处理流程 - 实现统一的token刷新机制,使用单例模式避免重复请求 - 优化防抖函数实现,提高性能表现 - 添加401和403状态码的特殊处理逻辑 - 统一错误提示信息的显示方式 - 优化表格列宽度设置,调整金额相关列的显示效果 - 删除未使用的组件文件和样式代码 - 移除调试相关的代码和注释 - 优化图标组件的导入方式,使用markRaw包装 - 优化热词统计图表的数据显示逻辑,添加空数据提示
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
>
|
||||
<el-table-column prop="articleCategoryName" label="分类名称" min-width="200" />
|
||||
<el-table-column prop="sort" label="排序" width="120" />
|
||||
<el-table-column label="操作" width="320" align="center">
|
||||
<el-table-column label="操作" width="320" align="right">
|
||||
<template #default="{ row }">
|
||||
<template v-if="row">
|
||||
<a class="link-text" @click="edit(row)">编辑</a>
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
title="这里展示历史某一天的热词数据统计,可根据需求配置每日持久化多少条数据。"
|
||||
/>
|
||||
|
||||
<div id="container"></div>
|
||||
<div v-show="hasData" id="container"></div>
|
||||
<el-empty v-if="!hasData" description="该日期暂无热词数据" :image-size="100" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Chart } from "@antv/g2";
|
||||
import { getHotWordsHistory } from "@/api/index";
|
||||
import { Message } from "@/utils/message";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -34,6 +34,7 @@ export default {
|
||||
},
|
||||
hotWordsChart: null,
|
||||
hotWordsData: [],
|
||||
hasData: true,
|
||||
endMonth: null,
|
||||
};
|
||||
},
|
||||
@@ -60,13 +61,11 @@ export default {
|
||||
const res = await getHotWordsHistory(this.params);
|
||||
if (res.success) {
|
||||
this.hotWordsData = res.result || [];
|
||||
if (this.hotWordsChart) {
|
||||
this.hasData = this.hotWordsData.length > 0;
|
||||
if (this.hasData && this.hotWordsChart) {
|
||||
this.hotWordsChart.changeData(this.hotWordsData);
|
||||
this.hotWordsChart.render();
|
||||
}
|
||||
if (!this.hotWordsData.length) {
|
||||
Message.error("暂无数据");
|
||||
}
|
||||
}
|
||||
},
|
||||
init() {
|
||||
|
||||
@@ -13,11 +13,12 @@
|
||||
</div>
|
||||
</el-affix>
|
||||
|
||||
<div id="container"></div>
|
||||
<el-table border :data="hotWordsData" style="width: 100%">
|
||||
<div v-show="hasData" id="container"></div>
|
||||
<el-table v-if="hasData" border :data="hotWordsData" style="width: 100%">
|
||||
<el-table-column prop="keywords" label="热词名称" min-width="160" />
|
||||
<el-table-column prop="score" label="搜索次数" min-width="120" />
|
||||
</el-table>
|
||||
<el-empty v-else description="暂无热词统计数据" :image-size="100" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -40,6 +41,7 @@ export default {
|
||||
},
|
||||
hotWordsChart: "",
|
||||
hotWordsData: [],
|
||||
hasData: true,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
@@ -61,7 +63,11 @@ export default {
|
||||
async search() {
|
||||
const res = await getHotWordsStatistics(this.params);
|
||||
if (res.success) {
|
||||
this.hotWordsData = res.result;
|
||||
this.hotWordsData = res.result || [];
|
||||
this.hasData = this.hotWordsData.length > 0;
|
||||
if (!this.hasData) {
|
||||
return;
|
||||
}
|
||||
if (!this.hotWordsChart) {
|
||||
this.hotWordsChart = new Chart({
|
||||
container: "container",
|
||||
|
||||
@@ -10,13 +10,19 @@
|
||||
title="这里展示今日系统中搜索前一百的搜索热词,分数为热词在排序系统中的分数,分数越高,可以在用户获取热词时进行优先展示(首页商品搜索栏下方推荐位)(分数可以填写负数,会降低推荐度)"
|
||||
/>
|
||||
|
||||
<div class="card-list">
|
||||
<el-card v-for="words in data" :key="words" class="card-item" shadow="hover">
|
||||
<div class="card-item-inner">
|
||||
<a href="#" class="word-link" @click.prevent="add(words)">{{ words }}</a>
|
||||
<el-icon class="close-icon" @click="deleteWords(words)"><Close /></el-icon>
|
||||
</div>
|
||||
</el-card>
|
||||
<div class="word-list">
|
||||
<el-tag
|
||||
v-for="words in data"
|
||||
:key="words"
|
||||
size="large"
|
||||
closable
|
||||
class="word-tag"
|
||||
@close="deleteWords(words)"
|
||||
@click="add(words)"
|
||||
>
|
||||
{{ words }}
|
||||
</el-tag>
|
||||
<el-empty v-if="!data.length" description="暂无热词,点击上方按钮设置" :image-size="80" />
|
||||
</div>
|
||||
|
||||
<el-dialog
|
||||
@@ -44,13 +50,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Close } from "@element-plus/icons-vue";
|
||||
import { getHotWords, setHotWords, deleteHotWords } from "@/api/index";
|
||||
import { regular } from "@/utils";
|
||||
|
||||
export default {
|
||||
name: "todayHotWords",
|
||||
components: { Close },
|
||||
data() {
|
||||
return {
|
||||
submitLoading: false,
|
||||
@@ -127,36 +131,23 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card-list {
|
||||
.word-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.card-item {
|
||||
min-width: 100px;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.card-item-inner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.word-link {
|
||||
color: var(--el-color-primary);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.close-icon {
|
||||
.word-tag {
|
||||
cursor: pointer;
|
||||
color: var(--el-text-color-secondary);
|
||||
padding: 0 14px;
|
||||
height: 32px;
|
||||
font-size: 14px;
|
||||
|
||||
&:hover {
|
||||
color: var(--el-color-danger);
|
||||
color: var(--el-color-primary);
|
||||
border-color: var(--el-color-primary);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user