登录车辆模块

This commit is contained in:
2023-12-15 16:49:40 +08:00
parent 5f78407bb3
commit 2cc425f64b
8 changed files with 28 additions and 5 deletions

View File

@@ -3,9 +3,13 @@ import { getStore, setStore } from '@config/utils.js'
const baseUrl = process.env.NODE_ENV === 'development' ? 'http://43.139.166.161:8018' : 'http://localhost:8018'
const setTime = '1000'
const username = 'admin'
const password = '123456'
const state = {
baseUrl: getStore('baseUrl') || baseUrl,
setTime: getStore('setTime') || setTime,
defaultUsername: getStore('defaultUsername') || username,
defaultPassword: getStore('defaultPassword') || password,
loading: false,
showToast: false,
showAlert: false,
@@ -18,6 +22,8 @@ const state = {
const getters = {
baseUrl: state => state.baseUrl,
setTime: state => state.setTime,
defaultUsername: state => state.defaultUsername,
defaultPassword: state => state.defaultPassword,
loading: state => state.loading,
showToast: state => state.showToast,
showAlert: state => state.showAlert
@@ -29,6 +35,11 @@ const actions = {
setStore('setTime', res.setTime)
commit(types.COM_CONFIG, res)
},
setLoginInfo ({commit}, res) {
setStore('defaultUsername', res.username)
setStore('defaultPassword', res.password)
commit(types.COM_LOGIN_INFO, res)
},
setLoadingState ({ commit }, status) {
commit(types.COM_LOADING_STATUS, status)
},
@@ -58,6 +69,11 @@ const mutations = {
state.setTime = res.setTime
},
[types.COM_LOGIN_INFO] (state, res) {
state.defaultUsername = res.username
state.defaultPassword = res.password
},
[types.COM_LOADING_STATUS] (state, status) {
state.loading = status
},