configStore.js 649 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { defineStore } from 'pinia';
  2. import http from '../common/request'
  3. export default defineStore('configStore', {
  4. state: () => {
  5. return {
  6. appInit: false,
  7. webrtc: {}
  8. }
  9. },
  10. actions: {
  11. setConfig(config) {
  12. this.webrtc = config.webrtc;
  13. },
  14. setAppInit(appInit) {
  15. this.appInit = appInit;
  16. },
  17. clear() {
  18. this.webrtc = {};
  19. },
  20. loadConfig() {
  21. return new Promise((resolve, reject) => {
  22. http({
  23. url: '/system/config',
  24. method: 'GET'
  25. }).then((config) => {
  26. console.log("系统配置", config)
  27. this.setConfig(config);
  28. resolve();
  29. }).catch((res) => {
  30. reject(res);
  31. });
  32. })
  33. }
  34. }
  35. })