vue-layout-gitcode 1.8.20 → 1.8.21

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,12 +1,16 @@
1
- import { defineComponent, onMounted, createBlock, openBlock, unref, withCtx, createElementVNode } from "vue";
1
+ import { defineComponent, onMounted, onUnmounted, createBlock, openBlock, unref, withCtx, createElementVNode } from "vue";
2
+ import { w as getLocaleLang, j as LANG_ZH, x as useLayoutConfig, _ as _export_sfc } from "./index-DXolqsNi.js";
2
3
  import { FixedOverlay } from "vue-devui-lal/overlay";
3
- import { w as useLayoutConfig, _ as _export_sfc } from "./index-CYat2b__.js";
4
4
  import "vue-devui-lal/overlay/style.css";
5
+ const TARGET_TEXT = "Click in order:";
5
6
  const _sfc_main = /* @__PURE__ */ defineComponent({
7
+ ...{ name: "tianaiCaptcha" },
6
8
  __name: "index",
7
9
  emits: ["close", "success"],
8
10
  setup(__props, { emit: __emit }) {
11
+ const isZh = getLocaleLang() === LANG_ZH;
9
12
  const emits = __emit;
13
+ let timer = null;
10
14
  const captchaInit = () => {
11
15
  if (!window.initTAC) {
12
16
  return;
@@ -17,16 +21,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
17
21
  validCaptchaUrl: `${baseURL}/uc/api/v1/captcha/check`,
18
22
  bindEl: "#captcha-box",
19
23
  validSuccess: (res, c, tac) => {
24
+ stopTimer();
20
25
  tac.destroyWindow();
21
26
  emits("success", res.data);
22
27
  },
23
28
  validFail: (res, c, tac) => {
24
29
  tac.reloadCaptcha();
30
+ stopTimer();
31
+ startTimer();
25
32
  },
26
33
  btnRefreshFun: (el, tac) => {
27
34
  tac.reloadCaptcha();
35
+ stopTimer();
36
+ startTimer();
28
37
  },
29
38
  btnCloseFun: (el, tac) => {
39
+ stopTimer();
30
40
  tac.destroyWindow();
31
41
  emits("close");
32
42
  }
@@ -35,15 +45,46 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
35
45
  logoUrl: null
36
46
  // 去除logo
37
47
  };
38
- window.initTAC("https://cdn-static.gitcode.host/js/tac/", config, style).then((tac) => {
48
+ window.initTAC("https://cdn-static.gitcode.com/js/tac/", config, style).then((tac) => {
39
49
  tac.init();
50
+ }).then(() => {
51
+ replaceEnglishTip();
40
52
  }).catch((e) => {
41
53
  console.error("初始化tac失败", e);
42
54
  });
43
55
  };
56
+ const replaceEnglishTip = () => {
57
+ if (isZh) return false;
58
+ const tipDom = document.querySelector("#captcha-box #tianai-captcha-click-track-font");
59
+ if (tipDom && tipDom.textContent !== TARGET_TEXT) {
60
+ tipDom.textContent = TARGET_TEXT;
61
+ return true;
62
+ }
63
+ if (tipDom && tipDom.textContent === TARGET_TEXT) {
64
+ return true;
65
+ }
66
+ return false;
67
+ };
68
+ const startTimer = () => {
69
+ if (isZh) return;
70
+ stopTimer();
71
+ timer = window.setInterval(() => {
72
+ replaceEnglishTip();
73
+ }, 100);
74
+ };
75
+ const stopTimer = () => {
76
+ if (timer) {
77
+ clearInterval(timer);
78
+ timer = null;
79
+ }
80
+ };
44
81
  onMounted(() => {
82
+ startTimer();
45
83
  captchaInit();
46
84
  });
85
+ onUnmounted(() => {
86
+ stopTimer();
87
+ });
47
88
  return (_ctx, _cache) => {
48
89
  return openBlock(), createBlock(unref(FixedOverlay), { class: "captcha-overlay" }, {
49
90
  default: withCtx(() => _cache[0] || (_cache[0] = [
package/index.js CHANGED
@@ -1,14 +1,14 @@
1
- import { M, N, Q, K, S, J, z, V, P, U, O } from "./index-CYat2b__.js";
1
+ import { K, M, P, J, S, I, z, U, O, Q, N } from "./index-DXolqsNi.js";
2
2
  export {
3
- M as GitCodeAside,
4
- N as GitCodeHeader,
5
- Q as GitCodeLayoutEmitter,
6
- K as Login,
3
+ K as GitCodeAside,
4
+ M as GitCodeHeader,
5
+ P as GitCodeLayoutEmitter,
6
+ J as Login,
7
7
  S as SceneValue,
8
- J as ToolsFloat,
8
+ I as ToolsFloat,
9
9
  z as currentTheme,
10
- V as default,
11
- P as setLayoutConfig,
12
- U as setTheme,
13
- O as useLogin
10
+ U as default,
11
+ O as setLayoutConfig,
12
+ Q as setTheme,
13
+ N as useLogin
14
14
  };
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, computed, createBlock, openBlock, unref, isRef, withCtx, createElementVNode, normalizeClass, createVNode, createTextVNode } from "vue";
2
- import { i as isPhone, u as useModel } from "./index-CYat2b__.js";
2
+ import { i as isPhone, u as useModel } from "./index-DXolqsNi.js";
3
3
  import { Notification } from "vue-devui-lal/notification";
4
4
  import { Button } from "vue-devui-lal/button";
5
5
  import "vue-devui-lal/notification/style.css";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-layout-gitcode",
3
- "version": "1.8.20",
3
+ "version": "1.8.21",
4
4
  "description": "用于 gitcode 站点生产环境使用",
5
5
  "main": "index.js",
6
6
  "types": "./index.d.ts",
@@ -10,4 +10,4 @@
10
10
  },
11
11
  "author": "lal,nevins",
12
12
  "license": "ISC"
13
- }
13
+ }