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.
@@ -8,7 +8,7 @@ import { Message } from "vue-devui-lal/message";
8
8
  import "vue-devui-lal/message/style.css";
9
9
  import { FixedOverlay } from "vue-devui-lal/overlay";
10
10
  import "vue-devui-lal/overlay/style.css";
11
- import { a as i18n, k as usePageResize, x as getLocaleLang, L as LANG_ZH, _ as _export_sfc } from "./index-DOhUtX7C.js";
11
+ import { a as i18n, k as usePageResize, x as getLocaleLang, L as LANG_ZH, _ as _export_sfc } from "./index-BRrfHHfk.js";
12
12
  const _YunpianCaptchaManager = class _YunpianCaptchaManager {
13
13
  constructor() {
14
14
  __publicField(this, "ypRiddlerInstance", null);
@@ -60,6 +60,7 @@ const _YunpianCaptchaManager = class _YunpianCaptchaManager {
60
60
  */
61
61
  async initYpRiddler(config) {
62
62
  if (this.ypRiddlerInstance) {
63
+ console.log("YpRiddler 实例已存在,无需重复初始化");
63
64
  return;
64
65
  }
65
66
  if (!config.container) {
@@ -81,6 +82,7 @@ const _YunpianCaptchaManager = class _YunpianCaptchaManager {
81
82
  throw new Error("YpRiddler 构造函数不可用");
82
83
  }
83
84
  this.ypRiddlerInstance = new window.YpRiddler(config);
85
+ console.log("YpRiddler 全局实例创建成功");
84
86
  } catch (error) {
85
87
  console.error("创建 YpRiddler 实例失败:", error);
86
88
  this.ypRiddlerInstance = null;
@@ -97,6 +99,7 @@ const _YunpianCaptchaManager = class _YunpianCaptchaManager {
97
99
  this.ypRiddlerInstance.destroy();
98
100
  }
99
101
  this.ypRiddlerInstance = null;
102
+ console.log("YpRiddler 实例已销毁");
100
103
  } catch (error) {
101
104
  console.error("销毁 YpRiddler 实例失败:", error);
102
105
  }
@@ -243,7 +246,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
243
246
  };
244
247
  return (_ctx, _cache) => {
245
248
  return openBlock(), createBlock(unref(FixedOverlay), {
246
- class: "captcha-overlay-yunpian",
249
+ class: "captcha-overlay",
247
250
  "close-on-click-overlay": ""
248
251
  }, {
249
252
  default: withCtx(() => [
@@ -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-DOhUtX7C.js";
4
- import { t as transWebUrl } from "./transWebUrl-g9vRctZr.js";
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-BRrfHHfk.js";
4
+ import { t as transWebUrl } from "./transWebUrl-DN3m9R5c.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,101 @@
1
+ import { defineComponent, onMounted, onUnmounted, createBlock, openBlock, unref, withCtx, createElementVNode } from "vue";
2
+ import { x as getLocaleLang, L as LANG_ZH, y as useLayoutConfig, _ as _export_sfc } from "./index-BRrfHHfk.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 = () => {
15
+ if (!window.initTAC) {
16
+ return;
17
+ }
18
+ const baseURL = useLayoutConfig().VITE_API_HOST;
19
+ const config = {
20
+ requestCaptchaDataUrl: `${baseURL}/uc/api/v1/captcha/gen`,
21
+ validCaptchaUrl: `${baseURL}/uc/api/v1/captcha/check`,
22
+ bindEl: "#captcha-box",
23
+ validSuccess: (res, c, tac) => {
24
+ stopTimer();
25
+ tac.destroyWindow();
26
+ emits("success", res.data);
27
+ },
28
+ validFail: (res, c, tac) => {
29
+ tac.reloadCaptcha();
30
+ stopTimer();
31
+ startTimer();
32
+ },
33
+ btnRefreshFun: (el, tac) => {
34
+ tac.reloadCaptcha();
35
+ stopTimer();
36
+ startTimer();
37
+ },
38
+ btnCloseFun: (el, tac) => {
39
+ stopTimer();
40
+ tac.destroyWindow();
41
+ emits("close");
42
+ }
43
+ };
44
+ const style = {
45
+ logoUrl: null
46
+ // 去除logo
47
+ };
48
+ window.initTAC("https://cdn-static.gitcode.com/js/tac/", config, style).then((tac) => {
49
+ tac.init();
50
+ }).then(() => {
51
+ replaceEnglishTip();
52
+ }).catch((e) => {
53
+ console.error("初始化tac失败", e);
54
+ });
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
+ };
81
+ onMounted(() => {
82
+ startTimer();
83
+ captchaInit();
84
+ });
85
+ onUnmounted(() => {
86
+ stopTimer();
87
+ });
88
+ return (_ctx, _cache) => {
89
+ return openBlock(), createBlock(unref(FixedOverlay), { class: "captcha-overlay" }, {
90
+ default: withCtx(() => [..._cache[0] || (_cache[0] = [
91
+ createElementVNode("div", { id: "captcha-box" }, null, -1)
92
+ ])]),
93
+ _: 1
94
+ });
95
+ };
96
+ }
97
+ });
98
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-vue-layout-gitcode"]]);
99
+ export {
100
+ index as default
101
+ };
package/index.js CHANGED
@@ -1,15 +1,15 @@
1
- import { N, O, V, M, S, P, K, B, X, U, W, Q } from "./index-DOhUtX7C.js";
1
+ import { M, N, U, K, S, O, J, A, W, Q, V, P } from "./index-BRrfHHfk.js";
2
2
  export {
3
- N as GitCodeAside,
4
- O as GitCodeHeader,
5
- V as GitCodeLayoutEmitter,
6
- M as Login,
3
+ M as GitCodeAside,
4
+ N as GitCodeHeader,
5
+ U as GitCodeLayoutEmitter,
6
+ K as Login,
7
7
  S as SceneValue,
8
- P as SiteAnnouncement,
9
- K as ToolsFloat,
10
- B as currentTheme,
11
- X as default,
12
- U as setLayoutConfig,
13
- W as setTheme,
14
- Q as useLogin
8
+ O as SiteAnnouncement,
9
+ J as ToolsFloat,
10
+ A as currentTheme,
11
+ W as default,
12
+ Q as setLayoutConfig,
13
+ V as setTheme,
14
+ P as useLogin
15
15
  };
@@ -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-DOhUtX7C.js";
2
+ import { i as isPhone, u as useModel } from "./index-BRrfHHfk.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.10.9",
3
+ "version": "1.10.10",
4
4
  "description": "用于 gitcode 站点生产环境使用",
5
5
  "main": "index.js",
6
6
  "types": "./index.d.ts",