From d1448cb0ef10f358bb7bddb4e1ec268515e0b787 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 15 七月 2025 11:46:57 +0800
Subject: [PATCH] 项目初始化

---
 store/modules/system.js |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/store/modules/system.js b/store/modules/system.js
new file mode 100644
index 0000000..fb78f12
--- /dev/null
+++ b/store/modules/system.js
@@ -0,0 +1,48 @@
+
+import storage from '@/utils/storage'
+
+export const state = {
+  systemInfo: null
+}
+
+export const mutations = {
+  SET_SYSTEM_INFO: (state, value) => {
+    state.systemInfo = value
+  },
+}
+
+export const actions = {
+  // 鑾峰彇鐢ㄦ埛缁堢绯荤粺淇℃伅
+  SystemInfo ({ commit, state }) {
+    return new Promise((resolve, reject) => {
+      if (state.info) {
+        resolve(res)
+      } else {
+        uni.getSystemInfo({
+          success (res) {
+            commit('SET_SYSTEM_INFO', res)
+            // 淇℃伅瀛樺叆缂撳瓨锛堟湁鏁堟湡1澶╋級
+            storage.set('SYSTEM_INFO', res, 86400);
+            resolve(res)
+          },
+          fail (err) {
+            reject(err)
+          }
+        })
+      }
+    })
+  },
+}
+
+export const getters = {
+
+  getSystemInfo (state) {
+    if (state.systemInfo) {
+      return state.systemInfo
+    } else if (storage.get('SYSTEM_INFO')) {
+      return JSON.parse(storage.get('SYSTEM_INFO'))
+    }
+    return {}
+  }
+
+}

--
Gitblit v1.9.3