system.js 706 B

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const useSystemStore = common_vendor.defineStore("system", {
  4. state: () => {
  5. return {
  6. bgColor: "rgb(0, 255, 255, 0.2)",
  7. systemInfo: {}
  8. };
  9. },
  10. actions: {
  11. /*
  12. 系统信息
  13. */
  14. setInfo(info) {
  15. const value = common_vendor.index.getStorageSync("systemInfo");
  16. if (value) {
  17. this.systemInfo = value;
  18. } else {
  19. this.systemInfo = common_vendor.index.getSystemInfoSync();
  20. this.save();
  21. }
  22. },
  23. /* 本地保存 */
  24. save() {
  25. common_vendor.index.setStorageSync("systemInfo", this.systemInfo);
  26. }
  27. }
  28. });
  29. exports.useSystemStore = useSystemStore;