From e0c008732e7919b955918b541ef328cd6a03e84b Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Thu, 24 Oct 2024 11:06:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=A3=E5=AE=A2=E4=B8=8B?= =?UTF-8?q?=E5=8D=95=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commons/utils/storageManage.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/commons/utils/storageManage.js b/commons/utils/storageManage.js index 1f60dcf..1f573e7 100644 --- a/commons/utils/storageManage.js +++ b/commons/utils/storageManage.js @@ -126,6 +126,27 @@ const model = { return appCache.useType } }, + // 缓存代客下单商品 + cacheGoods: (val, isDelete = false) => { + if (isDelete) { + appCache.cacheGoods = "" + return uni.removeStorageSync('cacheGoods') + } + + if (val) { + // 有值,为放置 + appCache.cacheGoods = val + uni.setStorageSync('cacheGoods', val) + } else { + // 否则为获取 + + if (!appCache.cacheGoods) { + //缓存取不到,获取应用本地信息 + appCache.cacheGoods = uni.getStorageSync('cacheGoods') + } + return appCache.cacheGoods + } + }, // 已经登录的用户记录 loggedInUser: (addUserName = null, removeUserName = null) => { let key = "loggedInUserList"