From 7072d8c86668393e3084c5a8b7f6d76b6475619f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?= <15778543+xufeiyang6017@user.noreply.gitee.com> Date: Fri, 9 Jan 2026 09:57:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9checkIsAdmin=E5=87=BD?= =?UTF-8?q?=E6=95=B0=EF=BC=8C=E5=A4=84=E7=90=86=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=A4=9A=E6=9D=A1=E8=AE=B0=E5=BD=95=E7=9A=84?= =?UTF-8?q?=E6=83=85=E5=86=B5=EF=BC=8C=E5=8F=AA=E8=A6=81=E6=9C=89=E4=B8=80?= =?UTF-8?q?=E6=9D=A1=E8=AE=B0=E5=BD=95=E4=B8=BA=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E5=B0=B1=E8=BF=94=E5=9B=9Etrue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/goods-update/goods-update.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pages/goods-update/goods-update.js b/pages/goods-update/goods-update.js index 253ccbc..c04790f 100644 --- a/pages/goods-update/goods-update.js +++ b/pages/goods-update/goods-update.js @@ -36,9 +36,11 @@ function checkIsAdmin(phoneNumber) { .then(res => { console.log('checkPersonnelByPhone响应:', res); if (res.exists && res.data) { - // 检查projectName是否为管理员标识 - const projectName = res.data.projectName || ''; - resolve(projectName === '管理员'); + // 处理数据库返回多条记录的情况 + const dataArray = Array.isArray(res.data) ? res.data : [res.data]; + // 检查是否有记录的projectName为管理员标识 + const isAdmin = dataArray.some(item => item.projectName === '管理员'); + resolve(isAdmin); } else { resolve(false); }