From f9f71d08e503250ccc741855662799ef237b9d3d Mon Sep 17 00:00:00 2001
From: long <515897141@qq.com>
Date: 星期四, 20 六月 2024 11:08:03 +0800
Subject: [PATCH] 标题图片配置

---
 src/utils/fn.js |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/src/utils/fn.js b/src/utils/fn.js
index c569024..15fa356 100644
--- a/src/utils/fn.js
+++ b/src/utils/fn.js
@@ -330,6 +330,47 @@
   fn_obj[`timer_${pageKey}`] = null
 }
 
+/**
+ * 杞寮傛璋冪敤鎺ュ彛
+ * @param {Object} page 椤甸潰瀵硅薄this
+ * @param {String} fnName 瑕佽疆璇㈢殑鏂规硶鍚嶇О
+ * @param {String} pageKey 椤甸潰鍏抽敭瀛�
+ * @param {Number} timeStamp 澶氬皯绉掕疆璇�
+ */
+function pollingAjaxFn(page, fnName, pageKey, timeStamp = 1000) {
+  if (!page || !fnName || !pageKey) {
+    return
+  }
+  page[fnName] && page[fnName]()
+  fn_obj[`pollingTimer_${pageKey}`] = setTimeout(() => {
+    pollingAjaxFn(page, fnName, pageKey, timeStamp)
+  }, timeStamp)
+}
+
+/**
+ * 鍋滄杞
+ * @param {String} pageKey 椤甸潰鍏抽敭璇�
+ */
+function stopPollingAjaxFn(pageKey) {
+  clearTimeout(fn_obj[`pollingTimer_${pageKey}`])
+  fn_obj[`pollingTimer_${pageKey}`] = null
+}
+
+// 闅忔満12浣嶆暟
+function getCheckedId() {
+  var s = []
+  var hexDigits = '0123456789abcdef'
+  for (var i = 0; i < 12; i++) {
+    s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1)
+  }
+  // s[14] = '4';
+  // s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
+
+  // s[8] = s[13] = s[18] = s[23] = '-'
+  var uuid = s.join('')
+  return uuid
+}
+
 var fn = {
   getLocalStorage,
   getSessionStorage,
@@ -358,6 +399,9 @@
 
   countGetTime,
   stopCountGetTime,
+  pollingAjaxFn,
+  stopPollingAjaxFn,
+  getCheckedId,
 
   /**
      * 娣辨嫹璐�

--
Gitblit v1.8.0