mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-11-07 17:38:55 +08:00
fix(buyer): 修复商品详情页未登录时调用评价接口导致的登录弹窗与未捕获报错
- goodsComment/goodsCommentNum 改为 needToken,未登录时不再发起请求 - 评价/收藏状态等后台查询增加 skipAuthHandler+skipMessage,token 失效时静默失败 - ShowGoodsDetail 评价接口调用补充 catch 并增加登录守卫
This commit is contained in:
@@ -100,7 +100,7 @@
|
||||
v-model:current-page="commentParams.pageNumber"
|
||||
v-model:page-size="commentParams.pageSize"
|
||||
:total="commentTotal"
|
||||
small
|
||||
size="small"
|
||||
@current-change="changePageNum"
|
||||
@size-change="changePageSize"
|
||||
layout="prev, pager, next"
|
||||
@@ -136,6 +136,7 @@
|
||||
import { computed, onMounted, onBeforeUnmount, reactive, ref } from 'vue';
|
||||
import { Refresh } from '@element-plus/icons-vue';
|
||||
import { goodsComment, goodsCommentNum } from '@/api/member.js';
|
||||
import storage from '@/plugins/storage.js';
|
||||
import StoreSide from './StoreSide.vue';
|
||||
|
||||
defineOptions({ name: 'ShowGoodsDetail' });
|
||||
@@ -246,17 +247,23 @@ function changePageSize (val) {
|
||||
getList();
|
||||
}
|
||||
function getList () {
|
||||
// 评价接口需要登录,未登录时不发起请求
|
||||
if (!storage.getItem('accessToken') || !storage.getItem('userInfo')) return;
|
||||
commentParams.goodsId = skuDetail.value.goodsId;
|
||||
goodsComment(commentParams).then(res => {
|
||||
if (res.success) {
|
||||
commentList.value = res.result.records;
|
||||
commentTotal.value = res.result.total;
|
||||
}
|
||||
}).catch(() => {
|
||||
// 评价为可选数据,加载失败时静默
|
||||
});
|
||||
goodsCommentNum(skuDetail.value.goodsId).then(res => {
|
||||
if (res.success) {
|
||||
commentTypeNum.value = res.result;
|
||||
}
|
||||
}).catch(() => {
|
||||
// 评价统计为可选数据,加载失败时静默
|
||||
});
|
||||
}
|
||||
function viewByGrade (grade) {
|
||||
|
||||
Reference in New Issue
Block a user