useConfigStore.js 705 B

1234567891011121314151617181920212223242526272829303132
  1. import {defineStore} from "pinia";
  2. import storage from "@/utils/storage";
  3. import platform from "@/utils/platform";
  4. export const useConfigStore = defineStore('config', {
  5. state: () => ({
  6. mType: 0, // 7 BMI;8 肺活量;9 视力;
  7. mName: '',
  8. platform,
  9. }),
  10. getters: {},
  11. actions: {
  12. _init() {
  13. // this.platform = ()
  14. this.getMachineType()
  15. this.mType = 7
  16. },
  17. setMachineType(item) {
  18. storage.setKey('machineType', {
  19. name: item.name,
  20. type: item.type,
  21. })
  22. },
  23. getMachineType() {
  24. let info = storage.getKey('machineType')
  25. if (info) {
  26. this.mType = info.mType
  27. this.mName = info.mName
  28. }
  29. },
  30. }
  31. })