CzRger před 1 rokem
rodič
revize
699a7b9a63
2 změnil soubory, kde provedl 18 přidání a 3 odebrání
  1. 8 0
      src/api/modules/sign.ts
  2. 10 3
      src/store/modules/app.ts

+ 8 - 0
src/api/modules/sign.ts

@@ -0,0 +1,8 @@
+import { handle } from '../index'
+
+const suffix = 'api'
+
+export const getSignTime = () => handle({
+  url: `/${suffix}/sign/time`,
+  method: 'get',
+})

+ 10 - 3
src/store/modules/app.ts

@@ -1,6 +1,7 @@
 import * as api from '@/api/index'
-// import {ztptGetUserInfo, ztptGetUserRoleList} from "@/api/modules/ztpt";
 import {getUserInfoByUsername} from "@/api/modules/account";
+import {getSignTime} from "@/api/modules/sign";
+import {ElMessage} from "element-plus";
 
 const state = {
 	apiProxy: {
@@ -52,9 +53,15 @@ const actions = {
 		})
 	},
 	LOAD_TIMESTAMP({ commit }: any) {
-		const date = new Date('2023-07-14')
-		commit('SET_TIMESTAMP', date)
+		getSignTime().then((res) => {
+			if (res.code === 200) {
+				commit('SET_TIMESTAMP', new Date(res.data))
+			} else {
+				ElMessage.error(res.message)
+			}
+		})
 	},
+
 }
 
 export default {