1234567891011121314151617181920212223242526 |
- export default {
- namespaced: true,
- state: {
- index_tabbar_index: 0,
- version: '1.0.0',
- navtabbarHeight: uni.upx2px(128), // 自定义导航栏高
- indextabbarHeight: uni.upx2px(98), // 首页 tabbar 高
- // token: uni.getStorageSync('token'),
- token: document.cookie.split(';').findIndex((e) => e.match('DWBSTOKEN')) == -1 ? '' : document.cookie.split(';')[document.cookie.split(';').findIndex((e) => e.match('DWBSTOKEN'))].split('=')[1],
- statusbarHeight: 30 // 状态栏高度
- },
- mutations: {
- LOGIN(state, payload) { // 登录 保存 token
- state.token = payload
- document.cookie = `DWBSTOKEN=${payload}; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/;`
- // uni.setStorage({ key: 'token', data: payload })
- },
- LOGOUT(state) { // 退出登录 删除 token
- state.token = ''
- // token: uni.removeStorageSync('token')
- }
- // SWITCHINDEXTAABARINDEX(state, payload) { // 切换首页 tabbar
- // state.index_tabbar_index = payload
- // }
- }
- }
|