From 735d7a8ef593963df8d79f36bd7360f2fa4f1ff5 Mon Sep 17 00:00:00 2001 From: Agent Date: Sun, 29 Mar 2026 15:28:45 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BD=BF=E7=94=A8JSON.stringify?= =?UTF-8?q?=E7=A1=AE=E4=BF=9D=E6=95=B0=E6=8D=AE=E5=BA=8F=E5=88=97=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/product.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/api/product.js b/src/api/product.js index d5f8079..3eabe18 100644 --- a/src/api/product.js +++ b/src/api/product.js @@ -100,15 +100,13 @@ export default { saveCategoryAttributes(categoryId, attrs) { const token = uni.getStorageSync('token') const role = uni.getStorageSync('role') || '' - // 确保是数组格式 - const payload = Array.isArray(attrs) ? attrs : [attrs] return new Promise((resolve, reject) => { uni.request({ url: `${import.meta.env.VITE_API_BASE_URL}/products/categories/${categoryId}/attributes`, method: 'POST', - data: payload, + data: JSON.stringify(attrs), header: { - 'Content-Type': 'application/json', + 'Content-Type': 'application/json;charset=utf-8', 'Authorization': token ? `Bearer ${token}` : '', 'X-User-Role': role },