vue-layout-gitcode 1.10.4 → 1.10.5
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-By3gMqr5.js → GloabarSearch-DE6yg5WO.js} +3 -3
- package/{MenuItem-Cm9MfzFK.js → MenuItem-DbkBMWXk.js} +1 -1
- package/{ProjectMenuList-Bc9kQJxY.js → ProjectMenuList-CC8q9Vs8.js} +8 -8
- package/{ProjectMenuListV2-hrS6FDx2.js → ProjectMenuListV2-Cq0XI_gH.js} +3 -3
- package/{ProjectSearch-Dn7KpEXq.js → ProjectSearch-DP4mdU20.js} +1 -1
- package/{SearchHistoryList-BhGjwV79.js → SearchHistoryList-x6o0K-RJ.js} +5 -5
- package/{SearchPrefixTag-DnMJrNAb.js → SearchPrefixTag-DOds9Jt2.js} +3 -3
- package/{SearchRecommed-DrJjIXTk.js → SearchRecommed-C3xneFLl.js} +2 -2
- package/{SearchScopeList-RzX52eKP.js → SearchScopeList-CCrcO_Uc.js} +3 -3
- package/{UserSearch-B9_DTuGr.js → UserSearch-CM0x_99f.js} +1 -1
- package/{index-hbNP7Gxd.js → index-Bi2-Ajqt.js} +994 -1228
- package/{index-vy7s96fo.js → index-BuOdNCQf.js} +3 -3
- package/{index-iC2vZB0n.js → index-DN4cdFnh.js} +1 -1
- package/{index-R5u6vIQd.js → index-L6eIbpC-.js} +41 -41
- package/index.js +1 -1
- package/{notice-IqJyqZQT.js → notice-C7DFXBHP.js} +8 -8
- package/package.json +2 -2
- package/style.css +1 -1
- package/{transWebUrl-htNmNx0Y.js → transWebUrl-DcTAoihL.js} +1 -1
- package/index-dzjfyxs4.js +0 -335
package/index-dzjfyxs4.js
DELETED
|
@@ -1,335 +0,0 @@
|
|
|
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
|
-
};
|