config.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { defineStore } from 'pinia';
  2. import { ref, computed } from 'vue';
  3. import client from "./client";
  4. import icpList from "../../utils/ipc";
  5. const clientStore = client();
  6. export const configInfo = defineStore('config',()=>{
  7. //作废了
  8. const digiCamControlPath = ref("C:\\Program Files (x86)\\digiCamControl")
  9. const updateDigiCamControlPath = (data:string)=>{
  10. digiCamControlPath.value = data
  11. }
  12. const appConfig = ref({})
  13. const getAppConfig = async ()=>{
  14. return new Promise((resolve, reject) => {
  15. clientStore.ipc.send(icpList.utils.getAppConfig);
  16. clientStore.ipc.on(icpList.utils.getAppConfig, async (event, result) => {
  17. appConfig.value = result;
  18. resolve(appConfig.value)
  19. })
  20. })
  21. }
  22. clientStore.ipc.send(icpList.utils.getAppConfig);
  23. clientStore.ipc.on(icpList.utils.getAppConfig, async (event, result) => {
  24. appConfig.value = result;
  25. })
  26. // 1 为拍照并处理图像 2 为仅处理图像
  27. const appModel = ref(1)
  28. const updateAppModel = (data:number)=>{
  29. appModel.value = data
  30. }
  31. return {
  32. digiCamControlPath,
  33. updateDigiCamControlPath,
  34. appModel,
  35. updateAppModel,
  36. appConfig,
  37. getAppConfig,
  38. }
  39. },{
  40. persist:true,
  41. })
  42. export default configInfo;