From 6f4af4351f6c1ad1aef8b0d295ba8f457a9b4844 Mon Sep 17 00:00:00 2001
From: click33 <2393584716@qq.com>
Date: Tue, 19 May 2026 04:47:54 +0800
Subject: [PATCH] =?UTF-8?q?feat(doc):=20=E6=96=B0=E5=A2=9E=20star-guide=20?=
=?UTF-8?q?=E5=BC=95=E5=AF=BC=E7=BB=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
在 doc.html 和 index.html 中引入 star-guide.js,
新增 sa-token-doc/a/star-guide/ 目录,包含引导组件页面与脚本文件。
---
sa-token-doc/a/star-guide/index.html | 98 +++++++++++++++++++++++++
sa-token-doc/a/star-guide/star-guide.js | 78 ++++++++++++++++++++
sa-token-doc/doc.html | 1 +
sa-token-doc/index.html | 3 +
4 files changed, 180 insertions(+)
create mode 100644 sa-token-doc/a/star-guide/index.html
create mode 100644 sa-token-doc/a/star-guide/star-guide.js
diff --git a/sa-token-doc/a/star-guide/index.html b/sa-token-doc/a/star-guide/index.html
new file mode 100644
index 00000000..797fc63d
--- /dev/null
+++ b/sa-token-doc/a/star-guide/index.html
@@ -0,0 +1,98 @@
+
+
+
+
+ 点击 Star 支持我们
+
+
+
+
+

+

+
+
+
+
+
+
diff --git a/sa-token-doc/a/star-guide/star-guide.js b/sa-token-doc/a/star-guide/star-guide.js
new file mode 100644
index 00000000..331875e2
--- /dev/null
+++ b/sa-token-doc/a/star-guide/star-guide.js
@@ -0,0 +1,78 @@
+
+// 判断当前是否已弹出
+function isShowStarGuide() {
+ // 非PC端不检查
+ if(document.body.offsetWidth < 800) {
+ console.log('small screen ... isShowStarGuide ');
+ return;
+ }
+
+ // 检查成功后,多少天不再检查
+ const alertAllowDisparity = 1000 * 60 * 60 * 24 * 30; // 30天
+ // const allowDisparity = 1000 * 10;
+
+ // 判断是否近期已经判断过了
+ const SAVE_KEY = 'isShowStarGuide';
+ try{
+ const showAlert = localStorage[SAVE_KEY];
+ if(showAlert) {
+ // 记录 star 的时间,和当前时间的差距
+ const disparity = new Date().getTime() - parseInt(showAlert);
+
+ // 差距小于一月,不再检测,大于一月,再检测一下
+ if(disparity < alertAllowDisparity) {
+ console.log('checked ... wj ');
+ return;
+ }
+ }
+ }catch(e){
+ console.error(e);
+ }
+
+ // 本次打开页面的内存内已经弹出了的话,也不再弹了
+ if(window.isYtcXsjfkasjda3232) {
+ return;
+ }
+ window.isYtcXsjfkasjda3232 = true;
+
+ // 弹出弹框,邀请填写
+ const tipStr = `
+
+
+
+
+
+ Sa-Token 采用 Apache-2.0 开源协议,承诺框架本身与在线文档永久免费开放。
+
+
+ 如果 Sa-Token 帮助到了你,希望你可以为项目点个 star ⭐,这对我们非常重要,感谢支持!
+
+
+ `;
+
+ const index = layer.confirm(tipStr, {
+ title: '支持项目',
+ btn: ['确定'],
+ area: '570px',
+ offset: '10%',
+ cancel: function() {
+ localStorage[SAVE_KEY] = new Date().getTime();
+ }
+ },
+ // 点击确定
+ function(index) {
+ layer.close(index);
+ localStorage[SAVE_KEY] = new Date().getTime();
+ open('https://gitee.com/dromara/sa-token');
+ // open('https://github.com/dromara/sa-token');
+ // open('https://atomgit.com/dromara/sa-token');
+
+ },
+ // 点击取消
+ function(){
+ localStorage[SAVE_KEY] = new Date().getTime();
+ }
+ );
+}
+isShowStarGuide();
diff --git a/sa-token-doc/doc.html b/sa-token-doc/doc.html
index e1269003..d3a55982 100644
--- a/sa-token-doc/doc.html
+++ b/sa-token-doc/doc.html
@@ -514,5 +514,6 @@
-->
+