vue-layout-gitcode 1.10.3 → 1.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{GloabarSearch-C-ufnLvF.js → GloabarSearch-By3gMqr5.js} +3 -3
- package/{MenuItem-CPFl05jE.js → MenuItem-Cm9MfzFK.js} +1 -1
- package/{ProjectMenuList-DSN0M_15.js → ProjectMenuList-Bc9kQJxY.js} +2 -2
- package/{ProjectMenuListV2-1b7qhT4G.js → ProjectMenuListV2-hrS6FDx2.js} +2 -2
- package/{ProjectSearch-D4Sw6ivM.js → ProjectSearch-Dn7KpEXq.js} +1 -1
- package/{SearchHistoryList-CS_CFBUo.js → SearchHistoryList-BhGjwV79.js} +1 -1
- package/{SearchPrefixTag-uN3Cgb9n.js → SearchPrefixTag-DnMJrNAb.js} +1 -1
- package/{SearchRecommed-6lHUWr1n.js → SearchRecommed-DrJjIXTk.js} +2 -2
- package/{SearchScopeList-DOJcRpNH.js → SearchScopeList-RzX52eKP.js} +1 -1
- package/{UserSearch-BfqmHJqu.js → UserSearch-B9_DTuGr.js} +1 -1
- package/{index-BGZZE9SF.js → index-R5u6vIQd.js} +2 -2
- package/index-dzjfyxs4.js +335 -0
- package/{index-DdptwjGd.js → index-hbNP7Gxd.js} +288 -116
- package/{index-CvWYO3_s.js → index-iC2vZB0n.js} +1 -1
- package/{index-D87UZqWQ.js → index-vy7s96fo.js} +1 -1
- package/index.js +1 -1
- package/{notice-J26BrWLM.js → notice-IqJyqZQT.js} +1 -1
- package/package.json +1 -1
- package/style.css +1 -1
- package/{transWebUrl-B7NuZV-x.js → transWebUrl-htNmNx0Y.js} +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defineComponent, inject, createElementBlock, openBlock, Fragment, createElementVNode, toDisplayString, createVNode, unref, renderList, withDirectives, createBlock, ref, watch, onMounted, createCommentVNode } from "vue";
|
|
2
2
|
import "vue-devui-lal/icon";
|
|
3
3
|
import "vue-devui-lal/icon/style.css";
|
|
4
|
-
import { h as headRequest, R as REPO_MODULE, a as i18n, G as GIcon, v as vElementExposure, b as REPO_EVENT, _ as _export_sfc, c as REPO_TYPE, e as extractRepoInfoWithURL } from "./index-
|
|
4
|
+
import { h as headRequest, R as REPO_MODULE, a as i18n, G as GIcon, v as vElementExposure, b as REPO_EVENT, _ as _export_sfc, c as REPO_TYPE, e as extractRepoInfoWithURL } from "./index-hbNP7Gxd.js";
|
|
5
5
|
import "lodash/debounce";
|
|
6
|
-
import { u as useReportRepo, S as SearchRepoCard, f as formatNameSpace } from "./index-
|
|
7
|
-
import "./transWebUrl-
|
|
6
|
+
import { u as useReportRepo, S as SearchRepoCard, f as formatNameSpace } from "./index-R5u6vIQd.js";
|
|
7
|
+
import "./transWebUrl-htNmNx0Y.js";
|
|
8
8
|
import "vue-devui-lal/tooltip";
|
|
9
9
|
import "vue-devui-lal/tooltip/style.css";
|
|
10
10
|
import "vue-router";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, inject, useSlots, ref, computed, createBlock, openBlock, unref, withCtx, createElementVNode, normalizeClass, createElementBlock, createTextVNode, createCommentVNode, toDisplayString, renderSlot } from "vue";
|
|
2
|
-
import { a as i18n, y as useLayoutConfig, z as ThemeType, A as currentTheme, L as LANG_ZH, B as LANG_EN, x as getLocaleLang, G as GIcon, C as emitEvent, D as isHttps, b as REPO_EVENT, _ as _export_sfc } from "./index-
|
|
2
|
+
import { a as i18n, y as useLayoutConfig, z as ThemeType, A as currentTheme, L as LANG_ZH, B as LANG_EN, x as getLocaleLang, G as GIcon, C as emitEvent, D as isHttps, b as REPO_EVENT, _ as _export_sfc } from "./index-hbNP7Gxd.js";
|
|
3
3
|
import { useRouter } from "vue-router";
|
|
4
4
|
import { Popover } from "vue-devui-lal/popover";
|
|
5
5
|
import "vue-devui-lal/popover/style.css";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, inject, ref, reactive, watch, computed, createElementBlock, openBlock, createCommentVNode, createBlock, withDirectives, Fragment, createElementVNode, createVNode, toDisplayString, unref, withModifiers, normalizeClass, withCtx, renderList, createTextVNode, vShow } from "vue";
|
|
2
|
-
import { a as i18n, y as useLayoutConfig, G as GIcon, t as transformUrl, H as _sfc_main$1, I as loadAsideData, C as emitEvent, s as setLoginTriggerSource, f as useRequestReport, F as asideRequest, _ as _export_sfc } from "./index-
|
|
2
|
+
import { a as i18n, y as useLayoutConfig, G as GIcon, t as transformUrl, H as _sfc_main$1, I as loadAsideData, C as emitEvent, s as setLoginTriggerSource, f as useRequestReport, F as asideRequest, _ as _export_sfc } from "./index-hbNP7Gxd.js";
|
|
3
3
|
import { useRouter } from "vue-router";
|
|
4
|
-
import { t as transWebUrl } from "./transWebUrl-
|
|
4
|
+
import { t as transWebUrl } from "./transWebUrl-htNmNx0Y.js";
|
|
5
5
|
import { Select, Option } from "vue-devui-lal/select";
|
|
6
6
|
import { Input } from "vue-devui-lal/input";
|
|
7
7
|
import { Skeleton } from "vue-devui-lal/skeleton";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, inject, ref, reactive, computed, watch, createElementBlock, openBlock, createElementVNode, createVNode, createBlock, createCommentVNode, withDirectives, toDisplayString, unref, withModifiers, normalizeClass, withCtx, Fragment, renderList, createTextVNode, vShow } from "vue";
|
|
2
|
-
import { a as i18n, y as useLayoutConfig, t as transformUrl, F as asideRequest, G as GIcon, C as emitEvent, s as setLoginTriggerSource, f as useRequestReport, _ as _export_sfc } from "./index-
|
|
2
|
+
import { a as i18n, y as useLayoutConfig, t as transformUrl, F as asideRequest, G as GIcon, C as emitEvent, s as setLoginTriggerSource, f as useRequestReport, _ as _export_sfc } from "./index-hbNP7Gxd.js";
|
|
3
3
|
import { useRouter } from "vue-router";
|
|
4
|
-
import { t as transWebUrl } from "./transWebUrl-
|
|
4
|
+
import { t as transWebUrl } from "./transWebUrl-htNmNx0Y.js";
|
|
5
5
|
import { Input } from "vue-devui-lal/input";
|
|
6
6
|
import { Skeleton } from "vue-devui-lal/skeleton";
|
|
7
7
|
import { MenuItem } from "vue-devui-lal/menu";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref, inject, computed, withDirectives, createElementBlock, openBlock, createElementVNode, toDisplayString, unref, Fragment, renderList, createVNode, vShow } from "vue";
|
|
2
|
-
import { a as i18n, h as headRequest, G as GIcon, r as reqCatch } from "./index-
|
|
2
|
+
import { a as i18n, h as headRequest, G as GIcon, r as reqCatch } from "./index-hbNP7Gxd.js";
|
|
3
3
|
import { useRoute, useRouter } from "vue-router";
|
|
4
4
|
import "vue-devui-lal/icon";
|
|
5
5
|
import "vue-devui-lal/icon/style.css";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, computed, createElementBlock, openBlock, createCommentVNode, Fragment, renderList, normalizeClass, createElementVNode, createVNode, toDisplayString, withModifiers } from "vue";
|
|
2
|
-
import { a as i18n, G as GIcon, _ as _export_sfc } from "./index-
|
|
2
|
+
import { a as i18n, G as GIcon, _ as _export_sfc } from "./index-hbNP7Gxd.js";
|
|
3
3
|
import "vue-devui-lal/icon";
|
|
4
4
|
import "vue-devui-lal/icon/style.css";
|
|
5
5
|
const _hoisted_1 = { class: "history-list" };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, createElementBlock, openBlock, createElementVNode, withDirectives, toDisplayString, withModifiers, createVNode, vShow } from "vue";
|
|
2
|
-
import { G as GIcon, _ as _export_sfc } from "./index-
|
|
2
|
+
import { G as GIcon, _ as _export_sfc } from "./index-hbNP7Gxd.js";
|
|
3
3
|
import "vue-devui-lal/icon";
|
|
4
4
|
import "vue-devui-lal/icon/style.css";
|
|
5
5
|
const _hoisted_1 = { class: "ellipsis" };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, inject, ref, onMounted, createElementBlock, openBlock, createElementVNode, toDisplayString, unref, Fragment, renderList, renderSlot, createBlock, createVNode, withCtx } from "vue";
|
|
2
|
-
import { u as useReportRepo, S as SearchRepoCard } from "./index-
|
|
3
|
-
import { a as i18n, h as headRequest, R as REPO_MODULE, b as REPO_EVENT, l as localStorage, _ as _export_sfc } from "./index-
|
|
2
|
+
import { u as useReportRepo, S as SearchRepoCard } from "./index-R5u6vIQd.js";
|
|
3
|
+
import { a as i18n, h as headRequest, R as REPO_MODULE, b as REPO_EVENT, l as localStorage, _ as _export_sfc } from "./index-hbNP7Gxd.js";
|
|
4
4
|
import { Row, Col } from "vue-devui-lal/grid";
|
|
5
5
|
import { SkeletonItem } from "vue-devui-lal/skeleton";
|
|
6
6
|
import "vue-devui-lal/grid/style.css";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, createElementBlock, openBlock, Fragment, renderList, createElementVNode, createVNode, createCommentVNode, toDisplayString, unref } from "vue";
|
|
2
|
-
import { a as i18n, G as GIcon, _ as _export_sfc } from "./index-
|
|
2
|
+
import { a as i18n, G as GIcon, _ as _export_sfc } from "./index-hbNP7Gxd.js";
|
|
3
3
|
import "vue-devui-lal/icon";
|
|
4
4
|
import "vue-devui-lal/icon/style.css";
|
|
5
5
|
const _hoisted_1 = ["onClick"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { inject, ref, watch, withDirectives, createElementBlock, openBlock, createElementVNode, toDisplayString, unref, Fragment, renderList, createVNode, vShow } from "vue";
|
|
2
|
-
import { a as i18n, h as headRequest, G as GIcon, t as transformUrl } from "./index-
|
|
2
|
+
import { a as i18n, h as headRequest, G as GIcon, t as transformUrl } from "./index-hbNP7Gxd.js";
|
|
3
3
|
import "vue-devui-lal/icon";
|
|
4
4
|
import "vue-devui-lal/icon/style.css";
|
|
5
5
|
const _hoisted_1 = { class: "px-[8px] history-list-project pl-[8px]" };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ref, watchEffect, defineComponent, toDisplayString, unref, mergeModels, useModel, watch, createElementBlock, openBlock, createVNode, withDirectives, normalizeClass, createElementVNode, vShow, inject, withModifiers, createBlock, Fragment, computed, createCommentVNode, normalizeStyle, createTextVNode, onMounted, onUnmounted, renderList, withCtx, reactive } from "vue";
|
|
2
2
|
import debounce from "lodash/debounce";
|
|
3
|
-
import { d as transferNumber, G as GIcon, _ as _export_sfc, s as setLoginTriggerSource, f as useRequestReport, r as reqCatch, h as headRequest, a as i18n, T as TOPIC_TYPE, g as useTimeFormat, j as useCookie, k as usePageResize, L as LANG_ZH, m as isGstarRepo, n as _sfc_main$b, o as isIncubationRepo, p as highlightWords, t as transformUrl, q as _frEventTrack, E as EVENT_NAME, c as REPO_TYPE, e as extractRepoInfoWithURL, w as LANG_KEY } from "./index-
|
|
4
|
-
import { t as transWebUrl } from "./transWebUrl-
|
|
3
|
+
import { d as transferNumber, G as GIcon, _ as _export_sfc, s as setLoginTriggerSource, f as useRequestReport, r as reqCatch, h as headRequest, a as i18n, T as TOPIC_TYPE, g as useTimeFormat, j as useCookie, k as usePageResize, L as LANG_ZH, m as isGstarRepo, n as _sfc_main$b, o as isIncubationRepo, p as highlightWords, t as transformUrl, q as _frEventTrack, E as EVENT_NAME, c as REPO_TYPE, e as extractRepoInfoWithURL, w as LANG_KEY } from "./index-hbNP7Gxd.js";
|
|
4
|
+
import { t as transWebUrl } from "./transWebUrl-htNmNx0Y.js";
|
|
5
5
|
import { useRouter } from "vue-router";
|
|
6
6
|
import { Row, Col } from "vue-devui-lal/grid";
|
|
7
7
|
import { Skeleton, SkeletonItem } from "vue-devui-lal/skeleton";
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import { defineComponent, ref, onMounted, nextTick, onBeforeUnmount, createBlock, openBlock, unref, withCtx, createElementVNode, withDirectives, createVNode, vShow } from "vue";
|
|
5
|
+
import { Button } from "vue-devui-lal/button";
|
|
6
|
+
import "vue-devui-lal/button/style.css";
|
|
7
|
+
import { FixedOverlay } from "vue-devui-lal/overlay";
|
|
8
|
+
import "vue-devui-lal/overlay/style.css";
|
|
9
|
+
import { a as i18n, k as usePageResize, x as getLocaleLang, L as LANG_ZH, _ as _export_sfc } from "./index-hbNP7Gxd.js";
|
|
10
|
+
const _YidunCaptchaManager = class _YidunCaptchaManager {
|
|
11
|
+
constructor() {
|
|
12
|
+
__publicField(this, "neCaptchaInstance", null);
|
|
13
|
+
__publicField(this, "isScriptLoaded", false);
|
|
14
|
+
}
|
|
15
|
+
static getInstance() {
|
|
16
|
+
if (!_YidunCaptchaManager.instance) {
|
|
17
|
+
_YidunCaptchaManager.instance = new _YidunCaptchaManager();
|
|
18
|
+
}
|
|
19
|
+
return _YidunCaptchaManager.instance;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 加载易盾验证码脚本
|
|
23
|
+
*/
|
|
24
|
+
loadNECaptchaScript(retryCount = 0) {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
if (this.isScriptLoaded && window.initNECaptchaWithFallback) {
|
|
27
|
+
resolve();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const existingScript = document.querySelector('script[src*="yidun-captcha.js"]');
|
|
31
|
+
if (existingScript) {
|
|
32
|
+
const checkInterval = setInterval(() => {
|
|
33
|
+
if (window.initNECaptchaWithFallback) {
|
|
34
|
+
this.isScriptLoaded = true;
|
|
35
|
+
clearInterval(checkInterval);
|
|
36
|
+
resolve();
|
|
37
|
+
}
|
|
38
|
+
}, 100);
|
|
39
|
+
setTimeout(() => {
|
|
40
|
+
clearInterval(checkInterval);
|
|
41
|
+
if (window.initNECaptchaWithFallback) {
|
|
42
|
+
this.isScriptLoaded = true;
|
|
43
|
+
resolve();
|
|
44
|
+
} else {
|
|
45
|
+
if (existingScript.parentNode) {
|
|
46
|
+
existingScript.parentNode.removeChild(existingScript);
|
|
47
|
+
}
|
|
48
|
+
this.loadScriptElement(retryCount, resolve, reject);
|
|
49
|
+
}
|
|
50
|
+
}, 5e3);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
this.loadScriptElement(retryCount, resolve, reject);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* 创建并加载脚本元素
|
|
58
|
+
*/
|
|
59
|
+
loadScriptElement(retryCount, resolve, reject) {
|
|
60
|
+
const script = document.createElement("script");
|
|
61
|
+
script.type = "text/javascript";
|
|
62
|
+
script.src = "https://cdn-static.gitcode.com/js/yidun/yidun-captcha.js";
|
|
63
|
+
script.onload = () => {
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
if (window.initNECaptchaWithFallback) {
|
|
66
|
+
this.isScriptLoaded = true;
|
|
67
|
+
resolve();
|
|
68
|
+
} else {
|
|
69
|
+
reject(new Error("易盾验证码 SDK 初始化失败"));
|
|
70
|
+
}
|
|
71
|
+
}, 200);
|
|
72
|
+
};
|
|
73
|
+
script.onerror = () => {
|
|
74
|
+
if (retryCount < 2) {
|
|
75
|
+
console.warn(`易盾验证码脚本加载失败,正在重试 (${retryCount + 1}/2)`);
|
|
76
|
+
setTimeout(() => {
|
|
77
|
+
this.loadNECaptchaScript(retryCount + 1).then(resolve).catch(reject);
|
|
78
|
+
}, 1e3);
|
|
79
|
+
} else {
|
|
80
|
+
reject(new Error("易盾验证码脚本加载失败,已达到最大重试次数"));
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
document.head.appendChild(script);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* 初始化易盾验证码实例
|
|
87
|
+
*/
|
|
88
|
+
async initNECaptcha(config, onload, onerror) {
|
|
89
|
+
if (!config.captchaId) {
|
|
90
|
+
throw new Error("易盾验证码配置缺少必需的 captchaId");
|
|
91
|
+
}
|
|
92
|
+
if (!config.element) {
|
|
93
|
+
throw new Error("易盾验证码配置缺少必需的 element 元素");
|
|
94
|
+
}
|
|
95
|
+
if (!config.onVerify) {
|
|
96
|
+
throw new Error("易盾验证码配置缺少必需的 onVerify 回调函数");
|
|
97
|
+
}
|
|
98
|
+
if (!window.initNECaptchaWithFallback) {
|
|
99
|
+
try {
|
|
100
|
+
await this.loadNECaptchaScript();
|
|
101
|
+
} catch (error) {
|
|
102
|
+
console.error("加载易盾验证码脚本失败:", error);
|
|
103
|
+
if (onerror) {
|
|
104
|
+
onerror(error);
|
|
105
|
+
}
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (this.neCaptchaInstance) {
|
|
110
|
+
this.destroyNECaptcha();
|
|
111
|
+
}
|
|
112
|
+
return new Promise((resolve, reject) => {
|
|
113
|
+
if (!window.initNECaptchaWithFallback) {
|
|
114
|
+
const error = new Error("initNECaptchaWithFallback 方法不可用");
|
|
115
|
+
if (onerror) {
|
|
116
|
+
onerror(error);
|
|
117
|
+
}
|
|
118
|
+
reject(error);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
try {
|
|
122
|
+
window.initNECaptchaWithFallback(
|
|
123
|
+
config,
|
|
124
|
+
(instance) => {
|
|
125
|
+
this.neCaptchaInstance = instance;
|
|
126
|
+
console.log("易盾验证码实例创建成功");
|
|
127
|
+
if (onload) {
|
|
128
|
+
onload(instance);
|
|
129
|
+
}
|
|
130
|
+
resolve();
|
|
131
|
+
},
|
|
132
|
+
(err) => {
|
|
133
|
+
console.error("易盾验证码初始化失败:", err);
|
|
134
|
+
this.neCaptchaInstance = null;
|
|
135
|
+
if (onerror) {
|
|
136
|
+
onerror(err);
|
|
137
|
+
}
|
|
138
|
+
reject(err);
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
} catch (error) {
|
|
142
|
+
console.error("创建易盾验证码实例失败:", error);
|
|
143
|
+
this.neCaptchaInstance = null;
|
|
144
|
+
if (onerror) {
|
|
145
|
+
onerror(error);
|
|
146
|
+
}
|
|
147
|
+
reject(error);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* 销毁易盾验证码实例
|
|
153
|
+
*/
|
|
154
|
+
destroyNECaptcha() {
|
|
155
|
+
if (this.neCaptchaInstance) {
|
|
156
|
+
try {
|
|
157
|
+
if (typeof this.neCaptchaInstance.destroy === "function") {
|
|
158
|
+
this.neCaptchaInstance.destroy();
|
|
159
|
+
}
|
|
160
|
+
this.neCaptchaInstance = null;
|
|
161
|
+
console.log("易盾验证码实例已销毁");
|
|
162
|
+
} catch (error) {
|
|
163
|
+
console.error("销毁易盾验证码实例失败:", error);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* 获取当前实例状态
|
|
169
|
+
*/
|
|
170
|
+
hasInstance() {
|
|
171
|
+
return !!this.neCaptchaInstance;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* 获取当前实例
|
|
175
|
+
*/
|
|
176
|
+
getInstance() {
|
|
177
|
+
return this.neCaptchaInstance;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* 触发验证码验证
|
|
181
|
+
*/
|
|
182
|
+
verify() {
|
|
183
|
+
if (this.neCaptchaInstance && typeof this.neCaptchaInstance.verify === "function") {
|
|
184
|
+
this.neCaptchaInstance.verify();
|
|
185
|
+
} else {
|
|
186
|
+
console.warn("验证码实例不存在或 verify 方法不可用");
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* 刷新验证码
|
|
191
|
+
*/
|
|
192
|
+
refresh() {
|
|
193
|
+
if (this.neCaptchaInstance && typeof this.neCaptchaInstance.refresh === "function") {
|
|
194
|
+
this.neCaptchaInstance.refresh();
|
|
195
|
+
} else {
|
|
196
|
+
console.warn("验证码实例不存在或 refresh 方法不可用");
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* 重新初始化(用于更新配置)
|
|
201
|
+
*/
|
|
202
|
+
async reinitialize(config, onload, onerror) {
|
|
203
|
+
this.destroyNECaptcha();
|
|
204
|
+
await this.initNECaptcha(config, onload, onerror);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
__publicField(_YidunCaptchaManager, "instance");
|
|
208
|
+
let YidunCaptchaManager = _YidunCaptchaManager;
|
|
209
|
+
const yidunCaptchaManager = YidunCaptchaManager.getInstance();
|
|
210
|
+
const _hoisted_1 = { id: "captcha-box" };
|
|
211
|
+
const _hoisted_2 = { class: "captcha-header" };
|
|
212
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
213
|
+
...{ name: "YiDunCaptcha" },
|
|
214
|
+
__name: "index",
|
|
215
|
+
props: {
|
|
216
|
+
captchaId: {}
|
|
217
|
+
},
|
|
218
|
+
emits: ["close", "success", "fallback"],
|
|
219
|
+
setup(__props, { emit: __emit }) {
|
|
220
|
+
const { t } = i18n.global;
|
|
221
|
+
const { isMobile } = usePageResize();
|
|
222
|
+
const isZh = getLocaleLang() === LANG_ZH;
|
|
223
|
+
const props = __props;
|
|
224
|
+
const emits = __emit;
|
|
225
|
+
const showCloseBtn = ref(false);
|
|
226
|
+
const captchaIns = ref(null);
|
|
227
|
+
const captchaInit = async () => {
|
|
228
|
+
try {
|
|
229
|
+
const captchaBox = document.getElementById("captcha-box");
|
|
230
|
+
if (!captchaBox) {
|
|
231
|
+
console.error("验证码容器元素不存在");
|
|
232
|
+
emits("close");
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const config = {
|
|
236
|
+
captchaId: props.captchaId,
|
|
237
|
+
apiVersion: 2,
|
|
238
|
+
element: "#captcha",
|
|
239
|
+
width: isMobile.value ? "80%" : "400px",
|
|
240
|
+
// 根据文档:PC 端默认 "float",移动端默认 "popup",这里使用 embed 模式嵌入到容器中
|
|
241
|
+
mode: "embed",
|
|
242
|
+
lang: isZh ? "zh-CN" : "en",
|
|
243
|
+
feedbackEnable: false,
|
|
244
|
+
closeEnable: true,
|
|
245
|
+
onVerify: function(err, data) {
|
|
246
|
+
if (err) {
|
|
247
|
+
console.warn("验证失败:", err);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
console.log("验证成功:", data);
|
|
251
|
+
emits("success", data);
|
|
252
|
+
yidunCaptchaManager.destroyNECaptcha();
|
|
253
|
+
},
|
|
254
|
+
onOpen: () => {
|
|
255
|
+
console.log("验证码弹框打开");
|
|
256
|
+
},
|
|
257
|
+
onClose: () => {
|
|
258
|
+
console.log("验证码弹框关闭");
|
|
259
|
+
},
|
|
260
|
+
onError: (error) => {
|
|
261
|
+
console.error("验证码初始化失败:", error);
|
|
262
|
+
emits("fallback");
|
|
263
|
+
},
|
|
264
|
+
onFallback: (data) => {
|
|
265
|
+
console.warn("验证码触发降级:", data);
|
|
266
|
+
emits("fallback");
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
await yidunCaptchaManager.initNECaptcha(
|
|
270
|
+
config,
|
|
271
|
+
(instance) => {
|
|
272
|
+
captchaIns.value = instance;
|
|
273
|
+
nextTick(() => {
|
|
274
|
+
showCloseBtn.value = true;
|
|
275
|
+
});
|
|
276
|
+
},
|
|
277
|
+
(err) => {
|
|
278
|
+
console.error("易盾验证码初始化失败:", err);
|
|
279
|
+
emits("close");
|
|
280
|
+
}
|
|
281
|
+
);
|
|
282
|
+
} catch (error) {
|
|
283
|
+
console.error("初始化易盾验证码失败:", error);
|
|
284
|
+
emits("close");
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
onMounted(() => {
|
|
288
|
+
nextTick(() => {
|
|
289
|
+
captchaInit();
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
onBeforeUnmount(() => {
|
|
293
|
+
const captchaBox = document.getElementById("captcha-box");
|
|
294
|
+
if (captchaBox) {
|
|
295
|
+
const captchaElement = document.getElementById("captcha");
|
|
296
|
+
if (captchaElement) {
|
|
297
|
+
captchaElement.innerHTML = "";
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
const closeOverlay = () => {
|
|
302
|
+
emits("close");
|
|
303
|
+
};
|
|
304
|
+
return (_ctx, _cache) => {
|
|
305
|
+
return openBlock(), createBlock(unref(FixedOverlay), {
|
|
306
|
+
class: "captcha-overlay",
|
|
307
|
+
"close-on-click-overlay": ""
|
|
308
|
+
}, {
|
|
309
|
+
default: withCtx(() => [
|
|
310
|
+
createElementVNode("div", _hoisted_1, [
|
|
311
|
+
createElementVNode("div", _hoisted_2, [
|
|
312
|
+
withDirectives(createVNode(unref(Button), {
|
|
313
|
+
class: "close-btn",
|
|
314
|
+
variant: "text",
|
|
315
|
+
icon: "close",
|
|
316
|
+
onClick: closeOverlay,
|
|
317
|
+
title: unref(t)("gitCodeLayout.common.close")
|
|
318
|
+
}, null, 8, ["title"]), [
|
|
319
|
+
[vShow, showCloseBtn.value]
|
|
320
|
+
])
|
|
321
|
+
]),
|
|
322
|
+
_cache[0] || (_cache[0] = createElementVNode("div", { class: "captcha-content" }, [
|
|
323
|
+
createElementVNode("div", { id: "captcha" })
|
|
324
|
+
], -1))
|
|
325
|
+
])
|
|
326
|
+
]),
|
|
327
|
+
_: 1
|
|
328
|
+
});
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-vue-layout-gitcode"]]);
|
|
333
|
+
export {
|
|
334
|
+
index as default
|
|
335
|
+
};
|