From c3d4f1d78c703b4a9179ab7dcc291ee4a39b0ead Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Sat, 28 Sep 2024 15:05:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=83=A8=E5=88=86=E5=85=AC?= =?UTF-8?q?=E5=85=B1=E6=A0=B7=E5=BC=8F=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commons/class/list.js | 45 ++++++++++++++++++++++++++++++++++ commons/style/common.scss | 4 ++- commons/utils/storageManage.js | 20 +++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 commons/class/list.js diff --git a/commons/class/list.js b/commons/class/list.js new file mode 100644 index 0000000..abdea5b --- /dev/null +++ b/commons/class/list.js @@ -0,0 +1,45 @@ +import { + reactive, ref +} from 'vue'; +function isSameType(a, b) { + return a instanceof b === true || b instanceof a === true; +} +class LIST{ + constructor(data) { + this.data=reactive({ + page:0, + totalPage:0, + total:0, + list:[], + hasAjax:false, + status:'',//loading fail success + query:{ + + } + }) + Object.assign(this.data, data) + } + add(item){ + this.data.list.push(item) + } + del(index){ + this.data.list.splice(index,1) + } + update(index,item){ + this.data.list[index]=item + } + get(index){ + return this.data.list[index] + } + getVal(key){ + return this.data[key] + } + setVal(key,val){ + this.data[key]=val + if(key=='page'){ + this.data['page']=val + } + } +} + +export default LIST \ No newline at end of file diff --git a/commons/style/common.scss b/commons/style/common.scss index d0a773a..1fe6db8 100644 --- a/commons/style/common.scss +++ b/commons/style/common.scss @@ -329,7 +329,9 @@ text { flex-direction: column; background: #F9F9F9; } - +.box-shadow{ + box-shadow: 0 0 5px #eee; +} .safe-bottom{ padding-bottom: env(safe-area-inset-bottom); /* #ifdef H5 */ diff --git a/commons/utils/storageManage.js b/commons/utils/storageManage.js index ab874a5..e22cc65 100644 --- a/commons/utils/storageManage.js +++ b/commons/utils/storageManage.js @@ -79,7 +79,27 @@ const model = { return appCache.shopId } }, + // 获取和放置useType就餐类型 + useType: (val, isDelete = false) => { + if (isDelete) { + appCache.useType = "" + return uni.removeStorageSync('useType') + } + if (val) { + // 有值,为放置 + appCache.useType = val + uni.setStorageSync('useType', val) + } else { + // 否则为获取 + + if (!appCache.useType) { + //缓存取不到,获取应用本地信息 + appCache.useType = uni.getStorageSync('useType') + } + return appCache.useType + } + }, // 已经登录的用户记录 loggedInUser: (addUserName = null, removeUserName = null) => { let key = "loggedInUserList"