Procházet zdrojové kódy

防止多次提交

cuixq před 4 roky
rodič
revize
80bd99072d
1 změnil soubory, kde provedl 18 přidání a 0 odebrání
  1. 18 0
      front-vue/src/utils/common.js

+ 18 - 0
front-vue/src/utils/common.js

@@ -1,3 +1,5 @@
+import { getToken } from '@/utils/auth'
+
 // 日期格式化
 export function convertCurrency(money) {
     debugger;
@@ -85,4 +87,20 @@ export function convertCurrency(money) {
     }
     console.log("=========>"+chineseStr);
     return chineseStr;
+}
+
+export function getRepeatToken() {
+    var authTokent = getToken();
+    var date = new Date();
+    if (authTokent != null) {
+        return authTokent + ":" + date.getHours() + date.getMinutes() + date.getSeconds();
+    } else {
+        charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
+        var randomString = '';
+        for (var i = 0; i < 6; i++) {
+            var randomPoz = Math.floor(Math.random() * charSet.length);
+            randomString += charSet.substring(randomPoz,randomPoz+1);
+        }
+        return randomString + ":" + date.getTime()
+    }
 }