You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
1.6 KiB
72 lines
1.6 KiB
7 months ago
|
import web from '@/components/utils/request.js';
|
||
|
const navBar = {
|
||
|
state: {
|
||
|
navHeight: 0,
|
||
|
capsule: {},
|
||
|
isBottomLine: false,
|
||
|
sessionkey:'',//用户sessionkey
|
||
|
openId:'',//用户openId
|
||
|
isAccount:false,//是否注册
|
||
|
isLogin:false,//是否登录
|
||
|
lon:120.21201,
|
||
|
lat:30.2084,
|
||
|
carNo:'',
|
||
|
phone:''
|
||
|
},
|
||
|
mutations: {
|
||
|
SET_NAVHEIGHT: (state, navHeight) => {
|
||
|
state.navHeight = navHeight
|
||
|
},
|
||
|
SET_CAPSULE: (state, capsule) => {
|
||
|
state.capsule = capsule
|
||
|
},
|
||
|
SET_ISBOTTOMLINE: (state, isBottomLine) => {
|
||
|
state.isBottomLine = isBottomLine
|
||
|
},
|
||
|
SET_SESSIONKEY: (state, sessionkey) => {
|
||
|
state.sessionkey = sessionkey
|
||
|
},
|
||
|
SET_OPENID: (state, openId) => {
|
||
|
state.openId = openId
|
||
|
},
|
||
|
SET_ISACCOUNT: (state, isAccount) => {
|
||
|
state.isAccount = isAccount
|
||
|
},
|
||
|
SET_ISLOGIN: (state, isLogin) => {
|
||
|
state.isLogin = isLogin
|
||
|
},
|
||
|
SET_LON: (state, lon) => {
|
||
|
state.lon = lon
|
||
|
},
|
||
|
SET_LAT: (state, lat) => {
|
||
|
state.lat = lat
|
||
|
},
|
||
|
SET_CARNO: (state, carNo) => {
|
||
|
state.carNo = carNo
|
||
|
},
|
||
|
SET_PHONE: (state, phone) => {
|
||
|
state.phone = phone
|
||
|
}
|
||
|
},
|
||
|
actions: {
|
||
|
getNavHeight({commit}) {
|
||
|
return new Promise(() => {
|
||
|
uni.getSystemInfo({
|
||
|
success(res) {
|
||
|
commit('SET_NAVHEIGHT', res.statusBarHeight + 46)
|
||
|
let capsule = uni.getMenuButtonBoundingClientRect()
|
||
|
commit('SET_CAPSULE', capsule)
|
||
|
}
|
||
|
})
|
||
|
})
|
||
|
},
|
||
|
judgingAbnormity({commit}) {
|
||
|
return new Promise(() => {
|
||
|
const modelsInfo = uni.getSystemInfoSync(); //x及以上的异形屏top为44,非异形屏为20
|
||
|
modelsInfo.safeArea.top > 20 ? commit('SET_ISBOTTOMLINE', true) : commit('SET_ISBOTTOMLINE',false)
|
||
|
})
|
||
|
},
|
||
|
}
|
||
|
}
|
||
|
export default navBar
|