浏览代码

校验客户端时间差异

Michael Wang 6 年之前
父节点
当前提交
737b29ff2d
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      src/features/Login/Login.vue

+ 6 - 3
src/features/Login/Login.vue

@@ -190,12 +190,15 @@ export default {
         domain: this.$route.params.domain
       });
       let data = response.data;
-      if (Math.abs(moment(response.headers.date).diff(moment())) > 30 * 1000) {
+      if (
+        Math.abs(moment(response.headers.date).diff(moment())) >
+        5 * 60 * 1000
+      ) {
         this.$Message.error({
-          content: "与服务器时间差异超过30秒,请校准本机时间之后再重试!",
+          content: "与服务器时间差异超过5分钟,请校准本机时间之后再重试!",
           duration: 30
         });
-        throw "与服务器时间差异超过30秒,请校准本机时间之后再重试!";
+        throw "与服务器时间差异超过5分钟,请校准本机时间之后再重试!";
       }
       if (data.token) {
         this.errorInfo = "";