This commit is contained in:
2023-10-18 14:44:29 +08:00
commit e6aabd4da9
153 changed files with 20976 additions and 0 deletions

95
src/vuex/modules/com.js Normal file
View File

@@ -0,0 +1,95 @@
import * as types from '../types'
import { getStore, setStore } from '@config/utils.js'
const baseUrl = process.env.NODE_ENV === 'development' ? 'http://43.139.166.161:8018' : 'http://43.139.166.161:8018'
const setTime = '5000'
const state = {
baseUrl: getStore('baseUrl') || baseUrl,
setTime: getStore('setTime') || setTime,
loading: false,
showToast: false,
showAlert: false,
showSuccess: true,
showFail: false,
toastMsg: '',
alertMsg: ''
}
const getters = {
baseUrl: state => state.baseUrl,
setTime: state => state.setTime,
loading: state => state.loading,
showToast: state => state.showToast,
showAlert: state => state.showAlert
}
const actions = {
setConfig ({commit}, res) {
setStore('baseUrl', res.baseUrl)
setStore('setTime', res.setTime)
commit(types.COM_CONFIG, res)
},
setLoadingState ({ commit }, status) {
commit(types.COM_LOADING_STATUS, status)
},
showToast ({ commit }, status) {
commit(types.COM_SHOW_TOAST, status)
},
showAlert ({ commit }, status) {
commit(types.COM_SHOW_ALERT, status)
},
showSuccess ({ commit }, status) {
commit(types.COM_SHOW_SUCCESS, status)
},
showFail ({ commit }, status) {
commit(types.COM_SHOW_FAIL, status)
},
toastMsg ({ commit }, str) {
commit(types.COM_TOAST_MSG, str)
},
alertMsg ({ commit }, str) {
commit(types.COM_ALERT_MSG, str)
}
}
const mutations = {
[types.COM_CONFIG] (state, res) {
state.baseUrl = res.baseUrl
state.setTime = res.setTime
},
[types.COM_LOADING_STATUS] (state, status) {
state.loading = status
},
[types.COM_SHOW_TOAST] (state, status) {
state.showToast = status
},
[types.COM_SHOW_ALERT] (state, status) {
state.showAlert = status
},
[types.COM_SHOW_SUCCESS] (state, status) {
state.showSuccess = status
},
[types.COM_SHOW_FAIL] (state, status) {
state.showFail = status
},
[types.COM_TOAST_MSG] (state, str) {
state.toastMsg = str
},
[types.COM_ALERT_MSG] (state, str) {
state.alertMsg = str
}
}
export default {
state,
actions,
getters,
mutations
}