mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-27 09:33:55 +08:00
update:智控台可设置允许用户自由注册 (#809)
* update:修复默认模型没有修改到模版配置的bug * update:智控台可设置允许用户自由注册
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { goToPage } from "@/utils";
|
||||
import Vue from 'vue';
|
||||
import Vuex from 'vuex';
|
||||
import Api from '../apis/api';
|
||||
import Constant from '../utils/constant';
|
||||
|
||||
Vue.use(Vuex)
|
||||
@@ -9,7 +10,11 @@ export default new Vuex.Store({
|
||||
state: {
|
||||
token: '',
|
||||
userInfo: {}, // 添加用户信息存储
|
||||
isSuperAdmin: false // 添加superAdmin状态
|
||||
isSuperAdmin: false, // 添加superAdmin状态
|
||||
pubConfig: { // 添加公共配置存储
|
||||
version: '',
|
||||
allowUserRegister: false
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
getToken(state) {
|
||||
@@ -26,6 +31,9 @@ export default new Vuex.Store({
|
||||
return state.isSuperAdmin
|
||||
}
|
||||
return localStorage.getItem('isSuperAdmin') === 'true'
|
||||
},
|
||||
getPubConfig(state) {
|
||||
return state.pubConfig
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
@@ -39,6 +47,9 @@ export default new Vuex.Store({
|
||||
state.isSuperAdmin = isSuperAdmin
|
||||
localStorage.setItem('isSuperAdmin', isSuperAdmin)
|
||||
},
|
||||
setPubConfig(state, config) {
|
||||
state.pubConfig = config
|
||||
},
|
||||
clearAuth(state) {
|
||||
state.token = ''
|
||||
state.userInfo = {}
|
||||
@@ -55,6 +66,17 @@ export default new Vuex.Store({
|
||||
goToPage(Constant.PAGE.LOGIN, true);
|
||||
window.location.reload(); // 彻底重置状态
|
||||
})
|
||||
},
|
||||
// 添加获取公共配置的 action
|
||||
fetchPubConfig({ commit }) {
|
||||
return new Promise((resolve) => {
|
||||
Api.user.getPubConfig(({ data }) => {
|
||||
if (data.code === 0) {
|
||||
commit('setPubConfig', data.data);
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
modules: {
|
||||
|
||||
Reference in New Issue
Block a user