configStore.js 757 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import { defineStore } from 'pinia';
  2. import http from '../api/httpRequest.js'
  3. export default defineStore('configStore', {
  4. state: () => {
  5. return {
  6. appInit: false, // 应用是否完成初始化
  7. fullScreen: true, // 当前是否全屏
  8. webrtc: {}
  9. }
  10. },
  11. actions: {
  12. setConfig(config) {
  13. this.webrtc = config.webrtc;
  14. },
  15. setAppInit(appInit) {
  16. this.appInit = appInit;
  17. },
  18. setFullScreen(fullScreen) {
  19. this.fullScreen = fullScreen;
  20. },
  21. loadConfig() {
  22. return new Promise((resolve, reject) => {
  23. http({
  24. url: '/system/config',
  25. method: 'GET'
  26. }).then(config => {
  27. console.log("系统配置", config)
  28. this.setConfig(config);
  29. resolve();
  30. }).catch((res) => {
  31. reject(res);
  32. });
  33. })
  34. }
  35. }
  36. });