| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- export const login_types = {
- mutations: {
- userLogin: 'userLogin',
- userLogout: 'userLogout',
- SET_IS_LOGIN: 'SET_IS_LOGIN',
- SET_CAPTCHA: 'SET_CAPTCHA'
- },
- actions: {
- tryLogin: 'tryLogin',
- },
- }
- export const state = function (){
- return {
- userInfo: {
- id: '',
- name: '',
- },
- isLogin: false,
- captcha: '1'
- }
- }
- export const mutations = {
- [login_types.mutations.userLogin](state, userInfo) {
- state.userInfo = userInfo;
- state.isLogin = true;
- },
- [login_types.mutations.userLogout](state) {
- state.userInfo = {};
- state.isLogin = false;
- },
- [login_types.mutations.SET_IS_LOGIN](state, isLogin) {
- state.isLogin = isLogin;
- },
- [login_types.mutations.SET_CAPTCHA](state, captcha) {
- state.captcha = captcha;
- }
- }
- export const actions = {
- }
- export const getters = {
- userInfo: state => state.userInfo,
- isLogin: state => state.isLogin,
- captcha: state => state.captcha
- }
- export default {
- state,
- mutations,
- actions,
- getters
- }
|