From f11b0ee085e891660031b455ede23797d58956e3 Mon Sep 17 00:00:00 2001 From: ch Date: Wed, 29 Jun 2022 17:42:59 +0800 Subject: [PATCH] config --- src/common/api/comment.js | 15 +++++++-------- src/common/utils/requset.js | 8 ++++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/common/api/comment.js b/src/common/api/comment.js index 2c84564..7b790db 100644 --- a/src/common/api/comment.js +++ b/src/common/api/comment.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-06-20 11:38:48 * @LastEditors: ch - * @LastEditTime: 2022-06-29 16:04:59 + * @LastEditTime: 2022-06-29 17:41:44 * @Description: file content */ @@ -15,17 +15,16 @@ const BASE_URL = '/mall/comment'; * @param {*} param0 */ export const ApiGetCommentList = (params) => - ToAsyncAwait(MsbRequestTk.get(`${BASE_URL}/app/comment`, { - ...params, - notVerifyToken : true + ToAsyncAwait(MsbRequestTk.get(`${BASE_URL}/app/comment`,params, { + notVerifyToken: true })); /** * 根据商品获取评论总数 * @param {*} param0 */ export const ApiGetCommentCount = ({productId}) => - ToAsyncAwait(MsbRequestTk.get(`${BASE_URL}/app/comment/getAllCommentCountByProductId/${productId}`, { - notVerifyToken : true + ToAsyncAwait(MsbRequestTk.get(`${BASE_URL}/app/comment/getAllCommentCountByProductId/${productId}`,{}, { + notVerifyToken: true })); /** * 根据商品获取标签评论总数 @@ -44,8 +43,8 @@ export const ApiGetOrderCommentDetail = ({orderId}) => * @param {*} param0 */ export const ApiGetCommentDetail = ({commentId}) => - ToAsyncAwait(MsbRequestTk.get(`${BASE_URL}/app/comment/getCommentDetail/${commentId}`, { - notVerifyToken : true + ToAsyncAwait(MsbRequestTk.get(`${BASE_URL}/app/comment/getCommentDetail/${commentId}`,{}, { + notVerifyToken: true })); /** * 新增评论 diff --git a/src/common/utils/requset.js b/src/common/utils/requset.js index 28a2fd3..fc78686 100644 --- a/src/common/utils/requset.js +++ b/src/common/utils/requset.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-03-17 17:42:32 * @LastEditors: ch - * @LastEditTime: 2022-06-29 17:33:30 + * @LastEditTime: 2022-06-29 17:37:04 * @Description: 项目接口请求统一处理器,返回一个需要token和不需要token的请求封装方法 */ @@ -107,15 +107,15 @@ MsbRequestTk.baseUrl = ENV.baseUrl; MsbRequestTk.use('request', (option) => { const token = $store.state.token; option.header.uid = uuid; - - if(!token && !option.headers.notVerifyToken){ + debugger + if(!token && !option.header.notVerifyToken){ // 登录状态处理,没有token直接跳转至登录 uni.redirectTo({ url: '/login' }); return Promise.reject({message:'要先登录才能操作哦~'}); } - delete option.headers.notVerifyToken + delete option.header.notVerifyToken option.header = {...option.header, Authorization:token}; if(option.header.repeat){