vue-layout-gitcode 1.10.9 → 1.10.10

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.
@@ -1,4 +1,4 @@
1
- import { z as useLayoutConfig } from "./index-DOhUtX7C.js";
1
+ import { y as useLayoutConfig } from "./index-BRrfHHfk.js";
2
2
  const layoutConfig = useLayoutConfig();
3
3
  const transWebUrl = (url, params) => {
4
4
  if (!url) return url;
package/index-B6hVcI95.js DELETED
@@ -1,120 +0,0 @@
1
- import { defineComponent, onMounted, nextTick, onUnmounted, createBlock, openBlock, unref, withCtx, createElementVNode } from "vue";
2
- import { x as getLocaleLang, L as LANG_ZH, y as slidCaptchaManager, z as useLayoutConfig, _ as _export_sfc } from "./index-DOhUtX7C.js";
3
- import { FixedOverlay } from "vue-devui-lal/overlay";
4
- import "vue-devui-lal/overlay/style.css";
5
- const TARGET_TEXT = "Click in order:";
6
- const _sfc_main = /* @__PURE__ */ defineComponent({
7
- ...{ name: "tianaiCaptcha" },
8
- __name: "index",
9
- emits: ["close", "success"],
10
- setup(__props, { emit: __emit }) {
11
- const isZh = getLocaleLang() === LANG_ZH;
12
- const emits = __emit;
13
- let timer = null;
14
- const captchaInit = async () => {
15
- try {
16
- const captchaBox = document.getElementById("captcha-box");
17
- if (!captchaBox) {
18
- console.error("验证码容器元素不存在");
19
- emits("close");
20
- return;
21
- }
22
- const baseURL = useLayoutConfig().VITE_API_HOST;
23
- const config = {
24
- requestCaptchaDataUrl: `${baseURL}/uc/api/v1/captcha/gen`,
25
- validCaptchaUrl: `${baseURL}/uc/api/v1/captcha/check`,
26
- bindEl: "#captcha-box",
27
- validSuccess: (res) => {
28
- stopTimer();
29
- slidCaptchaManager.destroyTAC();
30
- emits("success", res.data);
31
- },
32
- validFail: () => {
33
- slidCaptchaManager.reloadCaptcha();
34
- stopTimer();
35
- startTimer();
36
- },
37
- btnRefreshFun: () => {
38
- slidCaptchaManager.reloadCaptcha();
39
- stopTimer();
40
- startTimer();
41
- },
42
- btnCloseFun: () => {
43
- stopTimer();
44
- slidCaptchaManager.destroyTAC();
45
- emits("close");
46
- }
47
- };
48
- const style = {
49
- logoUrl: null
50
- // 去除logo
51
- };
52
- await slidCaptchaManager.initTAC(
53
- "https://cdn-static.gitcode.com/js/tac/",
54
- config,
55
- style,
56
- () => {
57
- slidCaptchaManager.init();
58
- nextTick(() => {
59
- replaceEnglishTip();
60
- });
61
- },
62
- (err) => {
63
- console.error("初始化 TAC 失败:", err);
64
- emits("close");
65
- }
66
- );
67
- } catch (error) {
68
- console.error("初始化 TAC 失败:", error);
69
- emits("close");
70
- }
71
- };
72
- const replaceEnglishTip = () => {
73
- if (isZh) return false;
74
- const tipDom = document.querySelector("#captcha-box #tianai-captcha-click-track-font");
75
- if (tipDom && tipDom.textContent !== TARGET_TEXT) {
76
- tipDom.textContent = TARGET_TEXT;
77
- return true;
78
- }
79
- if (tipDom && tipDom.textContent === TARGET_TEXT) {
80
- return true;
81
- }
82
- return false;
83
- };
84
- const startTimer = () => {
85
- if (isZh) return;
86
- stopTimer();
87
- timer = window.setInterval(() => {
88
- replaceEnglishTip();
89
- }, 100);
90
- };
91
- const stopTimer = () => {
92
- if (timer) {
93
- clearInterval(timer);
94
- timer = null;
95
- }
96
- };
97
- onMounted(() => {
98
- startTimer();
99
- nextTick(() => {
100
- captchaInit();
101
- });
102
- });
103
- onUnmounted(() => {
104
- stopTimer();
105
- slidCaptchaManager.destroyTAC();
106
- });
107
- return (_ctx, _cache) => {
108
- return openBlock(), createBlock(unref(FixedOverlay), { class: "captcha-overlay-slid" }, {
109
- default: withCtx(() => [..._cache[0] || (_cache[0] = [
110
- createElementVNode("div", { id: "captcha-box" }, null, -1)
111
- ])]),
112
- _: 1
113
- });
114
- };
115
- }
116
- });
117
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-vue-layout-gitcode"]]);
118
- export {
119
- index as default
120
- };