更新部分公共样式代码

This commit is contained in:
YeMingfei666 2024-09-28 15:05:30 +08:00
parent 789557183f
commit c3d4f1d78c
3 changed files with 68 additions and 1 deletions

45
commons/class/list.js Normal file
View File

@ -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

View File

@ -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 */

View File

@ -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"