vue-layout-gitcode 1.10.8 → 1.10.9

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,3 +1,6 @@
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);
1
4
  import { defineComponent, computed, createBlock, createElementBlock, openBlock, unref, normalizeProps, mergeProps, normalizeClass, renderSlot, normalizeStyle, createElementVNode, reactive, readonly, inject, effectScope, ref, shallowRef, watch, isRef, getCurrentInstance, h, Fragment, onBeforeMount, onMounted, onUnmounted, createVNode, Text, provide, createCommentVNode, withCtx, toDisplayString as toDisplayString$1, renderList, createTextVNode, Transition, withModifiers, resolveComponent, watchEffect, guardReactiveProps, onBeforeUnmount, resolveDynamicComponent, nextTick, defineAsyncComponent, withDirectives, vShow, withKeys, useCssVars, createSlots, render, toRaw, mergeModels, useModel as useModel$1, watchPostEffect, useSlots } from "vue";
2
5
  import { Button } from "vue-devui-lal/button";
3
6
  import { Popover } from "vue-devui-lal/popover";
@@ -13772,14 +13775,15 @@ function headRequest(request) {
13772
13775
  },
13773
13776
  /** 获取gitcode手机号验证码 */
13774
13777
  verifyRegisterCode(data) {
13775
- const { mobile, type, raw_data, captchaId, token, authenticate } = data;
13778
+ const { mobile, type, raw_data, captchaId, token, authenticate, validate } = data;
13776
13779
  const requestData = filterApiParams({
13777
13780
  biz_enum: type,
13778
13781
  mobile,
13779
13782
  raw_data: raw_data || "",
13780
13783
  captcha_id: captchaId,
13781
13784
  token,
13782
- authenticate
13785
+ authenticate,
13786
+ validate
13783
13787
  });
13784
13788
  return reqCatch(
13785
13789
  () => request({
@@ -13791,13 +13795,14 @@ function headRequest(request) {
13791
13795
  },
13792
13796
  /** 快捷注册短信验证 */
13793
13797
  getQuickLoginMsg(data) {
13794
- const { mobile, biz_enum, captchaId, token, authenticate } = data;
13798
+ const { mobile, biz_enum, captchaId, token, authenticate, validate } = data;
13795
13799
  const requestData = filterApiParams({
13796
13800
  mobile,
13797
13801
  biz_enum: biz_enum || "LOGIN",
13798
13802
  captcha_id: captchaId,
13799
13803
  token,
13800
- authenticate
13804
+ authenticate,
13805
+ validate
13801
13806
  });
13802
13807
  return reqCatch(
13803
13808
  () => request({
@@ -13808,10 +13813,10 @@ function headRequest(request) {
13808
13813
  );
13809
13814
  },
13810
13815
  /** 重置密码 - 获取手机或者邮箱验证码 */
13811
- getMobileEmailCode({ mobile_email = "", captcha_id = "", token = "", authenticate = "" }) {
13816
+ getMobileEmailCode({ mobile_email = "", captcha_id = "", token = "", authenticate = "", validate = "" }) {
13812
13817
  return reqCatch(
13813
13818
  () => request({
13814
- url: `/api/v1/user/forgetCode?mobile_email=${mobile_email}&captcha_id=${captcha_id}&token=${token}&authenticate=${authenticate}`
13819
+ url: `/api/v1/user/forgetCode?mobile_email=${mobile_email}&captcha_id=${captcha_id}&token=${token}&authenticate=${authenticate}&validate=${validate}`
13815
13820
  })
13816
13821
  );
13817
13822
  },
@@ -13901,7 +13906,8 @@ function headRequest(request) {
13901
13906
  password: cryptoCode.toString(),
13902
13907
  captcha_id: data == null ? void 0 : data.captchaId,
13903
13908
  token: data == null ? void 0 : data.token,
13904
- authenticate: data == null ? void 0 : data.authenticate
13909
+ authenticate: data == null ? void 0 : data.authenticate,
13910
+ validate: data == null ? void 0 : data.validate
13905
13911
  });
13906
13912
  return reqCatch(
13907
13913
  () => request({
@@ -14002,6 +14008,15 @@ function headRequest(request) {
14002
14008
  })
14003
14009
  );
14004
14010
  },
14011
+ /** 获取配置的图片验证码类型 */
14012
+ getCaptchaType() {
14013
+ return reqCatch(
14014
+ () => request({
14015
+ url: `/uc/api/v1/captcha/config`,
14016
+ method: "get"
14017
+ })
14018
+ );
14019
+ },
14005
14020
  // mfa 恢复码登陆
14006
14021
  postMfaRecover(data) {
14007
14022
  return reqCatchV2(
@@ -14915,13 +14930,13 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
14915
14930
  var _a;
14916
14931
  const layoutConfig2 = useLayoutConfig();
14917
14932
  const { t: $t } = i18n.global;
14918
- const ProjectSearch = defineAsyncComponent(() => import("./ProjectSearch-BySngJUv.js"));
14919
- const UserSearch = defineAsyncComponent(() => import("./UserSearch-BzW_dJiy.js"));
14920
- const GloabarSearch = defineAsyncComponent(() => import("./GloabarSearch-DKCXfZGU.js"));
14921
- const SearchHistoryList = defineAsyncComponent(() => import("./SearchHistoryList-CHdkZ8FO.js"));
14922
- const SearchScopeList = defineAsyncComponent(() => import("./SearchScopeList-BmfJjVtL.js"));
14923
- const SearchPrefixTag = defineAsyncComponent(() => import("./SearchPrefixTag-DP1LYFTn.js"));
14924
- const SearchRecommed = defineAsyncComponent(() => import("./SearchRecommed-CvDllUte.js"));
14933
+ const ProjectSearch = defineAsyncComponent(() => import("./ProjectSearch-BaW9j7jM.js"));
14934
+ const UserSearch = defineAsyncComponent(() => import("./UserSearch-B9f_e7lG.js"));
14935
+ const GloabarSearch = defineAsyncComponent(() => import("./GloabarSearch-ExbtF8-g.js"));
14936
+ const SearchHistoryList = defineAsyncComponent(() => import("./SearchHistoryList-BHpQc4do.js"));
14937
+ const SearchScopeList = defineAsyncComponent(() => import("./SearchScopeList-CBc-RbqA.js"));
14938
+ const SearchPrefixTag = defineAsyncComponent(() => import("./SearchPrefixTag-DE_FH3nS.js"));
14939
+ const SearchRecommed = defineAsyncComponent(() => import("./SearchRecommed-CuExGAND.js"));
14925
14940
  const props = __props;
14926
14941
  const repoInfo = inject("repoInfo");
14927
14942
  const orgInfo = inject("orgInfo");
@@ -15694,7 +15709,7 @@ const autoAvokeLogin = ({ isLogin, loginFunc, openHarmonyGuide, loginSuccess, lo
15694
15709
  loginFunc({ type: "login", triggerType: "", loginTriggerSource: "router_login_auth", ...loginFuncOpts }, loginSuccess, openHarmonyGuide);
15695
15710
  }
15696
15711
  };
15697
- const NoticeModal = defineAsyncComponent(() => import("./notice-Bm6PXt-o.js"));
15712
+ const NoticeModal = defineAsyncComponent(() => import("./notice-BM-9d-tw.js"));
15698
15713
  function clearNotice() {
15699
15714
  if (localStorage$2.getItem("validator_email")) {
15700
15715
  localStorage$2.removeItem("validator_email");
@@ -16496,9 +16511,9 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
16496
16511
  const layoutConfig2 = useLayoutConfig();
16497
16512
  const { t: t2 } = i18n.global;
16498
16513
  const route = useRoute();
16499
- const MenuItem = defineAsyncComponent(() => import("./MenuItem-5nvII1-H.js"));
16500
- const ProjectMenuListV2 = defineAsyncComponent(() => import("./ProjectMenuListV2-J07632cN.js"));
16501
- const ProjectMenuList = defineAsyncComponent(() => import("./ProjectMenuList-D4XsZQj3.js"));
16514
+ const MenuItem = defineAsyncComponent(() => import("./MenuItem-BAw5BtBb.js"));
16515
+ const ProjectMenuListV2 = defineAsyncComponent(() => import("./ProjectMenuListV2-BIFEaq9E.js"));
16516
+ const ProjectMenuList = defineAsyncComponent(() => import("./ProjectMenuList-Ce9S11ma.js"));
16502
16517
  const props = __props;
16503
16518
  console.log("slotKeys", props.slotKeys);
16504
16519
  console.log("props", props);
@@ -18273,6 +18288,10 @@ const layoutConfig = useLayoutConfig();
18273
18288
  const { t: t$2 } = i18n.global;
18274
18289
  const GRAPH_CODE = 400017;
18275
18290
  const YUNPIAN_GRAPH_CODE = 400018;
18291
+ const needGraphCode = (errorCode) => {
18292
+ if (!errorCode) return false;
18293
+ return [GRAPH_CODE, YUNPIAN_GRAPH_CODE].includes(errorCode);
18294
+ };
18276
18295
  const REMOTE_LOGIN_CODE = 400015;
18277
18296
  const MAX_MOBILE_COUNT = 10;
18278
18297
  const createLoginConfig = (request) => {
@@ -18302,23 +18321,34 @@ const createLoginConfig = (request) => {
18302
18321
  }
18303
18322
  },
18304
18323
  // 密码登录
18305
- async password({ param, loginParams, graphValidate, lintRemoteLogin, yunpianGraphValidate }) {
18306
- var _a, _b, _c;
18324
+ async password({
18325
+ param,
18326
+ loginParams,
18327
+ graphValidate,
18328
+ lintRemoteLogin,
18329
+ yunpianGraphValidate,
18330
+ yiDunGraphValidate
18331
+ }) {
18332
+ var _a, _b, _c, _d;
18307
18333
  const { validFunc, successFunc = () => {
18308
18334
  }, failFunc = () => {
18309
- } } = param;
18335
+ }, captchaType } = param;
18310
18336
  const check = validFunc ? await validFunc() : true;
18311
18337
  if (!check) return;
18312
18338
  const result2 = await API.toLogin(loginParams);
18313
- if (((_a = result2 == null ? void 0 : result2.error) == null ? void 0 : _a.error_code) === GRAPH_CODE) {
18339
+ if (needGraphCode((_a = result2 == null ? void 0 : result2.error) == null ? void 0 : _a.error_code) && (captchaType == null ? void 0 : captchaType.provider) === "SELF") {
18314
18340
  graphValidate();
18315
18341
  return;
18316
18342
  }
18317
- if (((_b = result2 == null ? void 0 : result2.error) == null ? void 0 : _b.error_code) === YUNPIAN_GRAPH_CODE) {
18343
+ if (needGraphCode((_b = result2 == null ? void 0 : result2.error) == null ? void 0 : _b.error_code) && (captchaType == null ? void 0 : captchaType.provider) === "YUNPIAN") {
18318
18344
  yunpianGraphValidate();
18319
18345
  return;
18320
18346
  }
18321
- if (((_c = result2 == null ? void 0 : result2.error) == null ? void 0 : _c.error_code) === REMOTE_LOGIN_CODE) {
18347
+ if (needGraphCode((_c = result2 == null ? void 0 : result2.error) == null ? void 0 : _c.error_code) && (captchaType == null ? void 0 : captchaType.provider) === "YIDUN") {
18348
+ yiDunGraphValidate();
18349
+ return;
18350
+ }
18351
+ if (((_d = result2 == null ? void 0 : result2.error) == null ? void 0 : _d.error_code) === REMOTE_LOGIN_CODE) {
18322
18352
  lintRemoteLogin();
18323
18353
  return;
18324
18354
  }
@@ -22441,10 +22471,200 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
22441
22471
  }
22442
22472
  });
22443
22473
  const MFA = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-vue-layout-gitcode"]]);
22444
- const SlidCaptcha = defineAsyncComponent(() => import("./index-B5_lp60l.js"));
22474
+ const _SlidCaptchaManager = class _SlidCaptchaManager {
22475
+ constructor() {
22476
+ __publicField(this, "tacInstance", null);
22477
+ __publicField(this, "isScriptLoaded", false);
22478
+ }
22479
+ static getInstance() {
22480
+ if (!_SlidCaptchaManager.instance) {
22481
+ _SlidCaptchaManager.instance = new _SlidCaptchaManager();
22482
+ }
22483
+ return _SlidCaptchaManager.instance;
22484
+ }
22485
+ /**
22486
+ * 等待 TAC 脚本加载
22487
+ * 脚本通常在 index.html 中通过 load.min.js 加载
22488
+ */
22489
+ waitForTACScript(retryCount = 0) {
22490
+ return new Promise((resolve, reject) => {
22491
+ if (this.isScriptLoaded && window.initTAC) {
22492
+ resolve();
22493
+ return;
22494
+ }
22495
+ if (window.initTAC) {
22496
+ this.isScriptLoaded = true;
22497
+ resolve();
22498
+ return;
22499
+ }
22500
+ const checkInterval = setInterval(() => {
22501
+ if (window.initTAC) {
22502
+ this.isScriptLoaded = true;
22503
+ clearInterval(checkInterval);
22504
+ resolve();
22505
+ }
22506
+ }, 100);
22507
+ setTimeout(() => {
22508
+ clearInterval(checkInterval);
22509
+ if (window.initTAC) {
22510
+ this.isScriptLoaded = true;
22511
+ resolve();
22512
+ } else {
22513
+ if (retryCount < 1) {
22514
+ console.warn("TAC 脚本未加载,尝试动态加载");
22515
+ this.loadScriptElement(retryCount, resolve, reject);
22516
+ } else {
22517
+ reject(new Error("TAC 脚本加载失败,initTAC 方法不可用"));
22518
+ }
22519
+ }
22520
+ }, 1e4);
22521
+ });
22522
+ }
22523
+ /**
22524
+ * 动态加载脚本元素(备用方案)
22525
+ */
22526
+ loadScriptElement(_retryCount, resolve, reject) {
22527
+ const script = document.createElement("script");
22528
+ script.type = "text/javascript";
22529
+ script.src = "https://cdn-static.gitcode.com/js/tac/load.min.js";
22530
+ script.onload = () => {
22531
+ setTimeout(() => {
22532
+ if (window.initTAC) {
22533
+ this.isScriptLoaded = true;
22534
+ resolve();
22535
+ } else {
22536
+ reject(new Error("TAC SDK 初始化失败"));
22537
+ }
22538
+ }, 500);
22539
+ };
22540
+ script.onerror = () => {
22541
+ reject(new Error("TAC 脚本加载失败"));
22542
+ };
22543
+ document.head.appendChild(script);
22544
+ }
22545
+ /**
22546
+ * 初始化 TAC 实例
22547
+ */
22548
+ async initTAC(path, config, style, onload, onerror) {
22549
+ if (!config.requestCaptchaDataUrl) {
22550
+ throw new Error("TAC 配置缺少必需的 requestCaptchaDataUrl");
22551
+ }
22552
+ if (!config.validCaptchaUrl) {
22553
+ throw new Error("TAC 配置缺少必需的 validCaptchaUrl");
22554
+ }
22555
+ if (!config.bindEl) {
22556
+ throw new Error("TAC 配置缺少必需的 bindEl 元素");
22557
+ }
22558
+ if (!config.validSuccess) {
22559
+ throw new Error("TAC 配置缺少必需的 validSuccess 回调函数");
22560
+ }
22561
+ if (!window.initTAC) {
22562
+ try {
22563
+ await this.waitForTACScript();
22564
+ } catch (error) {
22565
+ console.error("等待 TAC 脚本加载失败:", error);
22566
+ if (onerror) {
22567
+ onerror(error);
22568
+ }
22569
+ throw error;
22570
+ }
22571
+ }
22572
+ if (this.tacInstance) {
22573
+ this.destroyTAC();
22574
+ }
22575
+ return new Promise((resolve, reject) => {
22576
+ if (!window.initTAC) {
22577
+ const error = new Error("initTAC 方法不可用");
22578
+ if (onerror) {
22579
+ onerror(error);
22580
+ }
22581
+ reject(error);
22582
+ return;
22583
+ }
22584
+ try {
22585
+ window.initTAC(path, config, style || {}).then((tac) => {
22586
+ this.tacInstance = tac;
22587
+ if (onload) {
22588
+ onload(tac);
22589
+ }
22590
+ resolve();
22591
+ }).catch((err) => {
22592
+ console.error("创建 TAC 实例失败:", err);
22593
+ this.tacInstance = null;
22594
+ if (onerror) {
22595
+ onerror(err);
22596
+ }
22597
+ reject(err);
22598
+ });
22599
+ } catch (error) {
22600
+ console.error("创建 TAC 实例失败:", error);
22601
+ this.tacInstance = null;
22602
+ if (onerror) {
22603
+ onerror(error);
22604
+ }
22605
+ reject(error);
22606
+ }
22607
+ });
22608
+ }
22609
+ /**
22610
+ * 销毁 TAC 实例
22611
+ */
22612
+ destroyTAC() {
22613
+ if (this.tacInstance) {
22614
+ try {
22615
+ if (typeof this.tacInstance.destroyWindow === "function") {
22616
+ this.tacInstance.destroyWindow();
22617
+ }
22618
+ this.tacInstance = null;
22619
+ } catch (error) {
22620
+ console.error("销毁 TAC 实例失败:", error);
22621
+ }
22622
+ }
22623
+ }
22624
+ /**
22625
+ * 获取当前实例状态
22626
+ */
22627
+ hasInstance() {
22628
+ return !!this.tacInstance;
22629
+ }
22630
+ /**
22631
+ * 获取当前实例
22632
+ */
22633
+ getInstance() {
22634
+ return this.tacInstance;
22635
+ }
22636
+ /**
22637
+ * 初始化验证码(如果实例存在)
22638
+ */
22639
+ init() {
22640
+ if (this.tacInstance && typeof this.tacInstance.init === "function") {
22641
+ this.tacInstance.init();
22642
+ } else {
22643
+ console.warn("TAC 实例不存在或 init 方法不可用");
22644
+ }
22645
+ }
22646
+ /**
22647
+ * 重新加载验证码(如果实例存在)
22648
+ */
22649
+ reloadCaptcha() {
22650
+ if (this.tacInstance && typeof this.tacInstance.reloadCaptcha === "function") {
22651
+ this.tacInstance.reloadCaptcha();
22652
+ } else {
22653
+ console.warn("TAC 实例不存在或 reloadCaptcha 方法不可用");
22654
+ }
22655
+ }
22656
+ };
22657
+ __publicField(_SlidCaptchaManager, "instance");
22658
+ let SlidCaptchaManager = _SlidCaptchaManager;
22659
+ const slidCaptchaManager = SlidCaptchaManager.getInstance();
22660
+ const SlidCaptcha = defineAsyncComponent(() => import("./index-B6hVcI95.js"));
22445
22661
  const useSlidCaptcha = () => {
22446
- const { mount, unMount } = usePopup("slid-captcha-popup");
22662
+ const { mount, unMount, isMounted } = usePopup("slid-captcha-popup");
22447
22663
  const open = (config) => {
22664
+ if (isMounted()) {
22665
+ unMount();
22666
+ slidCaptchaManager.destroyTAC();
22667
+ }
22448
22668
  mount(SlidCaptcha, {
22449
22669
  onSuccess: (resData) => {
22450
22670
  var _a;
@@ -22452,15 +22672,22 @@ const useSlidCaptcha = () => {
22452
22672
  (_a = config == null ? void 0 : config.onSuccess) == null ? void 0 : _a.call(config, resData);
22453
22673
  },
22454
22674
  modelValue: true,
22455
- onClose: () => unMount()
22675
+ onClose: () => {
22676
+ unMount();
22677
+ slidCaptchaManager.destroyTAC();
22678
+ }
22456
22679
  });
22457
22680
  };
22681
+ const close = () => {
22682
+ unMount();
22683
+ slidCaptchaManager.destroyTAC();
22684
+ };
22458
22685
  return {
22459
22686
  open,
22460
- close: unMount
22687
+ close
22461
22688
  };
22462
22689
  };
22463
- const YunpianCaptcha = defineAsyncComponent(() => import("./index-Br3aHHVv.js"));
22690
+ const YunpianCaptcha = defineAsyncComponent(() => import("./index-B-WQyJsC.js"));
22464
22691
  const useYunpianCaptcha = () => {
22465
22692
  const { mount, unMount } = usePopup("yunpian-captcha-popup");
22466
22693
  const open = (config) => {
@@ -22486,6 +22713,370 @@ const useYunpianCaptcha = () => {
22486
22713
  close: unMount
22487
22714
  };
22488
22715
  };
22716
+ const _YidunCaptchaManager = class _YidunCaptchaManager {
22717
+ constructor() {
22718
+ __publicField(this, "neCaptchaInstance", null);
22719
+ __publicField(this, "isScriptLoaded", false);
22720
+ }
22721
+ static getInstance() {
22722
+ if (!_YidunCaptchaManager.instance) {
22723
+ _YidunCaptchaManager.instance = new _YidunCaptchaManager();
22724
+ }
22725
+ return _YidunCaptchaManager.instance;
22726
+ }
22727
+ /**
22728
+ * 加载易盾验证码脚本
22729
+ */
22730
+ loadNECaptchaScript(retryCount = 0) {
22731
+ return new Promise((resolve, reject) => {
22732
+ if (this.isScriptLoaded && window.initNECaptchaWithFallback) {
22733
+ resolve();
22734
+ return;
22735
+ }
22736
+ const existingScript = document.querySelector('script[src*="yidun-captcha.js"]');
22737
+ if (existingScript) {
22738
+ const checkInterval = setInterval(() => {
22739
+ if (window.initNECaptchaWithFallback) {
22740
+ this.isScriptLoaded = true;
22741
+ clearInterval(checkInterval);
22742
+ resolve();
22743
+ }
22744
+ }, 100);
22745
+ setTimeout(() => {
22746
+ clearInterval(checkInterval);
22747
+ if (window.initNECaptchaWithFallback) {
22748
+ this.isScriptLoaded = true;
22749
+ resolve();
22750
+ } else {
22751
+ if (existingScript.parentNode) {
22752
+ existingScript.parentNode.removeChild(existingScript);
22753
+ }
22754
+ this.loadScriptElement(retryCount, resolve, reject);
22755
+ }
22756
+ }, 5e3);
22757
+ return;
22758
+ }
22759
+ this.loadScriptElement(retryCount, resolve, reject);
22760
+ });
22761
+ }
22762
+ /**
22763
+ * 创建并加载脚本元素
22764
+ */
22765
+ loadScriptElement(retryCount, resolve, reject) {
22766
+ const script = document.createElement("script");
22767
+ script.type = "text/javascript";
22768
+ script.src = "https://cdn-static.gitcode.com/js/yidun/yidun-captcha.js";
22769
+ script.onload = () => {
22770
+ setTimeout(() => {
22771
+ if (window.initNECaptchaWithFallback) {
22772
+ this.isScriptLoaded = true;
22773
+ resolve();
22774
+ } else {
22775
+ reject(new Error("易盾验证码 SDK 初始化失败"));
22776
+ }
22777
+ }, 200);
22778
+ };
22779
+ script.onerror = () => {
22780
+ if (retryCount < 2) {
22781
+ console.warn(`易盾验证码脚本加载失败,正在重试 (${retryCount + 1}/2)`);
22782
+ setTimeout(() => {
22783
+ this.loadNECaptchaScript(retryCount + 1).then(resolve).catch(reject);
22784
+ }, 1e3);
22785
+ } else {
22786
+ reject(new Error("易盾验证码脚本加载失败,已达到最大重试次数"));
22787
+ }
22788
+ };
22789
+ document.head.appendChild(script);
22790
+ }
22791
+ /**
22792
+ * 初始化易盾验证码实例
22793
+ */
22794
+ async initNECaptcha(config, onload, onerror) {
22795
+ if (!config.captchaId) {
22796
+ throw new Error("易盾验证码配置缺少必需的 captchaId");
22797
+ }
22798
+ if (!config.element) {
22799
+ throw new Error("易盾验证码配置缺少必需的 element 元素");
22800
+ }
22801
+ if (!config.onVerify) {
22802
+ throw new Error("易盾验证码配置缺少必需的 onVerify 回调函数");
22803
+ }
22804
+ if (!window.initNECaptchaWithFallback) {
22805
+ try {
22806
+ await this.loadNECaptchaScript();
22807
+ } catch (error) {
22808
+ console.error("加载易盾验证码脚本失败:", error);
22809
+ if (onerror) {
22810
+ onerror(error);
22811
+ }
22812
+ throw error;
22813
+ }
22814
+ }
22815
+ if (this.neCaptchaInstance) {
22816
+ this.destroyNECaptcha();
22817
+ }
22818
+ return new Promise((resolve, reject) => {
22819
+ if (!window.initNECaptchaWithFallback) {
22820
+ const error = new Error("initNECaptchaWithFallback 方法不可用");
22821
+ if (onerror) {
22822
+ onerror(error);
22823
+ }
22824
+ reject(error);
22825
+ return;
22826
+ }
22827
+ try {
22828
+ window.initNECaptchaWithFallback(
22829
+ config,
22830
+ (instance) => {
22831
+ this.neCaptchaInstance = instance;
22832
+ if (onload) {
22833
+ onload(instance);
22834
+ }
22835
+ resolve();
22836
+ },
22837
+ (err) => {
22838
+ console.error("易盾验证码初始化失败:", err);
22839
+ this.neCaptchaInstance = null;
22840
+ if (onerror) {
22841
+ onerror(err);
22842
+ }
22843
+ reject(err);
22844
+ }
22845
+ );
22846
+ } catch (error) {
22847
+ console.error("创建易盾验证码实例失败:", error);
22848
+ this.neCaptchaInstance = null;
22849
+ if (onerror) {
22850
+ onerror(error);
22851
+ }
22852
+ reject(error);
22853
+ }
22854
+ });
22855
+ }
22856
+ /**
22857
+ * 销毁易盾验证码实例
22858
+ */
22859
+ destroyNECaptcha() {
22860
+ if (this.neCaptchaInstance) {
22861
+ try {
22862
+ if (typeof this.neCaptchaInstance.destroy === "function") {
22863
+ this.neCaptchaInstance.destroy();
22864
+ }
22865
+ this.neCaptchaInstance = null;
22866
+ } catch (error) {
22867
+ console.error("销毁易盾验证码实例失败:", error);
22868
+ }
22869
+ }
22870
+ }
22871
+ /**
22872
+ * 获取当前实例状态
22873
+ */
22874
+ hasInstance() {
22875
+ return !!this.neCaptchaInstance;
22876
+ }
22877
+ /**
22878
+ * 获取当前实例
22879
+ */
22880
+ getInstance() {
22881
+ return this.neCaptchaInstance;
22882
+ }
22883
+ /**
22884
+ * 触发验证码验证
22885
+ */
22886
+ verify() {
22887
+ if (this.neCaptchaInstance && typeof this.neCaptchaInstance.verify === "function") {
22888
+ this.neCaptchaInstance.verify();
22889
+ } else {
22890
+ console.warn("验证码实例不存在或 verify 方法不可用");
22891
+ }
22892
+ }
22893
+ /**
22894
+ * 刷新验证码
22895
+ */
22896
+ refresh() {
22897
+ if (this.neCaptchaInstance && typeof this.neCaptchaInstance.refresh === "function") {
22898
+ this.neCaptchaInstance.refresh();
22899
+ } else {
22900
+ console.warn("验证码实例不存在或 refresh 方法不可用");
22901
+ }
22902
+ }
22903
+ /**
22904
+ * 重新初始化(用于更新配置)
22905
+ */
22906
+ async reinitialize(config, onload, onerror) {
22907
+ this.destroyNECaptcha();
22908
+ await this.initNECaptcha(config, onload, onerror);
22909
+ }
22910
+ };
22911
+ __publicField(_YidunCaptchaManager, "instance");
22912
+ let YidunCaptchaManager = _YidunCaptchaManager;
22913
+ const yidunCaptchaManager = YidunCaptchaManager.getInstance();
22914
+ let globalStyleElement = null;
22915
+ let globalStyleRefCount = 0;
22916
+ const useYiDunCaptcha = () => {
22917
+ const { isMobile } = usePageResize();
22918
+ const captchaInstance = ref(null);
22919
+ const hiddenElement = ref(null);
22920
+ const verifyTimeoutId = ref(null);
22921
+ const injectStyle = () => {
22922
+ if (globalStyleElement) {
22923
+ globalStyleRefCount++;
22924
+ return;
22925
+ }
22926
+ const style = document.createElement("style");
22927
+ style.id = "yidun-captcha-trigger-style";
22928
+ style.textContent = `
22929
+ #yidun-captcha-trigger .yidun_tips__img {
22930
+ max-width: unset;
22931
+ }
22932
+ #yidun-captcha-trigger .yidun_modal {
22933
+ top: 36% !important;
22934
+ }
22935
+ `;
22936
+ document.head.appendChild(style);
22937
+ globalStyleElement = style;
22938
+ globalStyleRefCount = 1;
22939
+ };
22940
+ const removeStyle = () => {
22941
+ globalStyleRefCount--;
22942
+ if (globalStyleRefCount <= 0 && globalStyleElement && globalStyleElement.parentNode) {
22943
+ globalStyleElement.parentNode.removeChild(globalStyleElement);
22944
+ globalStyleElement = null;
22945
+ globalStyleRefCount = 0;
22946
+ }
22947
+ };
22948
+ const createHiddenElement = () => {
22949
+ if (hiddenElement.value) {
22950
+ return hiddenElement.value;
22951
+ }
22952
+ injectStyle();
22953
+ const el = document.createElement("div");
22954
+ el.id = "yidun-captcha-trigger";
22955
+ el.style.position = "absolute";
22956
+ el.style.left = "-9999px";
22957
+ el.style.top = "-9999px";
22958
+ el.style.width = "1px";
22959
+ el.style.height = "1px";
22960
+ el.style.overflow = "hidden";
22961
+ document.body.appendChild(el);
22962
+ hiddenElement.value = el;
22963
+ return el;
22964
+ };
22965
+ const removeHiddenElement = () => {
22966
+ if (hiddenElement.value && hiddenElement.value.parentNode) {
22967
+ hiddenElement.value.parentNode.removeChild(hiddenElement.value);
22968
+ hiddenElement.value = null;
22969
+ }
22970
+ };
22971
+ const cleanup = () => {
22972
+ if (verifyTimeoutId.value !== null) {
22973
+ clearTimeout(verifyTimeoutId.value);
22974
+ verifyTimeoutId.value = null;
22975
+ }
22976
+ if (captchaInstance.value) {
22977
+ yidunCaptchaManager.destroyNECaptcha();
22978
+ captchaInstance.value = null;
22979
+ }
22980
+ removeHiddenElement();
22981
+ removeStyle();
22982
+ };
22983
+ const open = (config) => {
22984
+ if (!(config == null ? void 0 : config.captchaId)) {
22985
+ console.error("captcha captchaId 不能为空");
22986
+ return;
22987
+ }
22988
+ cleanup();
22989
+ const isZh = getLocaleLang() === LANG_ZH;
22990
+ const hiddenEl = createHiddenElement();
22991
+ const captchaConfig = {
22992
+ captchaId: config.captchaId,
22993
+ apiVersion: 2,
22994
+ element: hiddenEl,
22995
+ width: isMobile.value ? "80%" : "400px",
22996
+ mode: "popup",
22997
+ lang: isZh ? "zh-CN" : "en",
22998
+ feedbackEnable: false,
22999
+ defaultFallback: false,
23000
+ popupStyles: {
23001
+ position: "fixed",
23002
+ top: "20%"
23003
+ },
23004
+ onVerify: (err, data) => {
23005
+ var _a;
23006
+ if (err) {
23007
+ console.warn("验证失败:", err);
23008
+ return;
23009
+ }
23010
+ (_a = config == null ? void 0 : config.onSuccess) == null ? void 0 : _a.call(config, data);
23011
+ cleanup();
23012
+ },
23013
+ onClose: () => {
23014
+ cleanup();
23015
+ },
23016
+ onError: (error) => {
23017
+ var _a;
23018
+ console.error("captcha初始化失败:", error);
23019
+ (_a = config == null ? void 0 : config.onFallback) == null ? void 0 : _a.call(config, config == null ? void 0 : config.onSuccess);
23020
+ removeHiddenElement();
23021
+ captchaInstance.value = null;
23022
+ },
23023
+ // 当行为验证码所需静态资源或者接口不可用时,且请求验证码失败次数达到阈值(默认为 3 次,可根据需求配置),最后一次会触发降级逻辑
23024
+ onFallback: (_data) => {
23025
+ var _a;
23026
+ console.warn("captcha触发降级");
23027
+ (_a = config == null ? void 0 : config.onFallback) == null ? void 0 : _a.call(config, config == null ? void 0 : config.onSuccess);
23028
+ removeHiddenElement();
23029
+ captchaInstance.value = null;
23030
+ }
23031
+ };
23032
+ yidunCaptchaManager.initNECaptcha(
23033
+ captchaConfig,
23034
+ (instance) => {
23035
+ if (!yidunCaptchaManager.hasInstance()) {
23036
+ return;
23037
+ }
23038
+ captchaInstance.value = instance;
23039
+ verifyTimeoutId.value = window.setTimeout(() => {
23040
+ if (yidunCaptchaManager.hasInstance() && captchaInstance.value) {
23041
+ yidunCaptchaManager.verify();
23042
+ }
23043
+ verifyTimeoutId.value = null;
23044
+ }, 0);
23045
+ },
23046
+ (err) => {
23047
+ var _a;
23048
+ console.error("captcha初始化失败:", err);
23049
+ (_a = config == null ? void 0 : config.onFallback) == null ? void 0 : _a.call(config, config == null ? void 0 : config.onSuccess);
23050
+ removeHiddenElement();
23051
+ captchaInstance.value = null;
23052
+ }
23053
+ ).catch((error) => {
23054
+ var _a;
23055
+ console.error("captcha初始化异常:", error);
23056
+ (_a = config == null ? void 0 : config.onFallback) == null ? void 0 : _a.call(config, config == null ? void 0 : config.onSuccess);
23057
+ removeHiddenElement();
23058
+ captchaInstance.value = null;
23059
+ });
23060
+ };
23061
+ const verify = () => {
23062
+ if (yidunCaptchaManager.hasInstance()) {
23063
+ yidunCaptchaManager.verify();
23064
+ } else {
23065
+ console.warn("captcha实例不存在,请先调用 open 方法初始化");
23066
+ }
23067
+ };
23068
+ const close = () => {
23069
+ cleanup();
23070
+ };
23071
+ onBeforeUnmount(() => {
23072
+ cleanup();
23073
+ });
23074
+ return {
23075
+ open,
23076
+ verify,
23077
+ close
23078
+ };
23079
+ };
22489
23080
  const _sfc_main$3 = {};
22490
23081
  const _hoisted_1$2 = { class: "content-loading" };
22491
23082
  function _sfc_render(_ctx, _cache) {
@@ -23221,9 +23812,34 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23221
23812
  extraData: {}
23222
23813
  });
23223
23814
  };
23224
- let captchaMode = "yunpian";
23815
+ const captchaLocalMode = ref("yidun");
23225
23816
  const slidCaptcha = useSlidCaptcha();
23226
23817
  const yunpianCaptcha = useYunpianCaptcha();
23818
+ const yiDunCaptcha = useYiDunCaptcha();
23819
+ const captchaType = ref({
23820
+ provider: "SELF"
23821
+ });
23822
+ const getCurrentCaptchaType = async () => {
23823
+ var _a;
23824
+ const res = await API.getCaptchaType();
23825
+ if (!res.error) {
23826
+ captchaType.value = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.data) || { provider: "SELF" };
23827
+ switch (captchaType.value.provider) {
23828
+ case "SELF":
23829
+ captchaLocalMode.value = "tianai";
23830
+ break;
23831
+ case "YUNPIAN":
23832
+ captchaLocalMode.value = "yunpian";
23833
+ break;
23834
+ case "YIDUN":
23835
+ captchaLocalMode.value = "yidun";
23836
+ break;
23837
+ default:
23838
+ captchaLocalMode.value = "tianai";
23839
+ break;
23840
+ }
23841
+ }
23842
+ };
23227
23843
  const LoginCheck = async () => {
23228
23844
  let agreementFlag = false;
23229
23845
  if (!status.value || !dataShareChecked.value) {
@@ -23333,6 +23949,180 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23333
23949
  }
23334
23950
  });
23335
23951
  };
23952
+ const yiDunGraphValidate = () => {
23953
+ loading.value = false;
23954
+ const currentCaptchaId = getYiDunCaptchaId({ scene: "password" });
23955
+ if (!currentCaptchaId) {
23956
+ console.error("验证码 ID 未获取到");
23957
+ return;
23958
+ }
23959
+ yiDunCaptcha.open({
23960
+ captchaId: currentCaptchaId,
23961
+ onSuccess: (captchaData) => {
23962
+ const captchaId = (captchaData == null ? void 0 : captchaData.fallback) ? (captchaData == null ? void 0 : captchaData.captchaId) || (captchaData == null ? void 0 : captchaData.id) : currentCaptchaId;
23963
+ if (!captchaId) {
23964
+ console.error("验证码 ID 无效");
23965
+ return;
23966
+ }
23967
+ handleConfirm({
23968
+ validate: captchaData == null ? void 0 : captchaData.validate,
23969
+ token: captchaData == null ? void 0 : captchaData.token,
23970
+ authenticate: captchaData == null ? void 0 : captchaData.authenticate,
23971
+ captchaId
23972
+ });
23973
+ },
23974
+ onFallback: (originalOnSuccess) => {
23975
+ slidCaptcha.open({
23976
+ onSuccess: (captchaData) => {
23977
+ if (!(captchaData == null ? void 0 : captchaData.id)) {
23978
+ console.error("天爱验证码返回数据无效,缺少 id 字段");
23979
+ return;
23980
+ }
23981
+ originalOnSuccess == null ? void 0 : originalOnSuccess({
23982
+ captchaId: captchaData.id,
23983
+ fallback: true
23984
+ });
23985
+ }
23986
+ });
23987
+ }
23988
+ });
23989
+ };
23990
+ const getYiDunCaptchaId = ({ scene, isDomesticNumber = true }) => {
23991
+ var _a, _b, _c;
23992
+ if (captchaType.value.provider !== "YIDUN") {
23993
+ return "";
23994
+ }
23995
+ if (scene === "password") {
23996
+ return (_a = captchaType.value.international) == null ? void 0 : _a.captcha_id;
23997
+ }
23998
+ if (scene === "sendCode") {
23999
+ return isDomesticNumber ? (_b = captchaType.value.domestic) == null ? void 0 : _b.captcha_id : (_c = captchaType.value.international) == null ? void 0 : _c.captcha_id;
24000
+ }
24001
+ return "";
24002
+ };
24003
+ const handleCaptchaVerification = (conf, options = {}) => {
24004
+ try {
24005
+ const { isDomesticNumber = true, checkCondition, extraParams = {} } = options;
24006
+ if (checkCondition && !checkCondition(conf)) {
24007
+ return false;
24008
+ }
24009
+ if (captchaLocalMode.value === "yunpian") {
24010
+ yunpianCaptcha.open({
24011
+ onSuccess: (captchaData) => {
24012
+ handleCountDown({
24013
+ ...conf,
24014
+ token: captchaData == null ? void 0 : captchaData.token,
24015
+ authenticate: captchaData == null ? void 0 : captchaData.authenticate,
24016
+ captchaId: captchaData == null ? void 0 : captchaData.captchaId,
24017
+ ...extraParams
24018
+ });
24019
+ },
24020
+ onFallback: (originalOnSuccess) => {
24021
+ captchaLocalMode.value = "tianai";
24022
+ slidCaptcha.open({
24023
+ onSuccess: (captchaData) => originalOnSuccess == null ? void 0 : originalOnSuccess({
24024
+ captchaId: captchaData.id
24025
+ })
24026
+ });
24027
+ }
24028
+ });
24029
+ return true;
24030
+ }
24031
+ if (captchaLocalMode.value === "tianai") {
24032
+ slidCaptcha.open({
24033
+ onSuccess: (captchaData) => {
24034
+ handleCountDown({
24035
+ ...conf,
24036
+ captchaId: captchaData.id,
24037
+ ...extraParams
24038
+ });
24039
+ }
24040
+ });
24041
+ return true;
24042
+ }
24043
+ if (captchaLocalMode.value === "yidun") {
24044
+ const currentCaptchaId = getYiDunCaptchaId({ scene: "sendCode", isDomesticNumber });
24045
+ if (!currentCaptchaId) {
24046
+ console.error("易盾验证码 ID 未获取到,降级到天爱验证码");
24047
+ captchaLocalMode.value = "tianai";
24048
+ slidCaptcha.open({
24049
+ onSuccess: (captchaData) => {
24050
+ handleCountDown({
24051
+ ...conf,
24052
+ captchaId: captchaData.id,
24053
+ ...extraParams
24054
+ });
24055
+ }
24056
+ });
24057
+ return true;
24058
+ }
24059
+ yiDunCaptcha.open({
24060
+ captchaId: currentCaptchaId,
24061
+ onSuccess: (captchaData) => {
24062
+ const captchaId = (captchaData == null ? void 0 : captchaData.fallback) ? (captchaData == null ? void 0 : captchaData.captchaId) || (captchaData == null ? void 0 : captchaData.id) : currentCaptchaId;
24063
+ if (!captchaId) {
24064
+ console.error("验证码 ID 无效");
24065
+ return;
24066
+ }
24067
+ handleCountDown({
24068
+ ...conf,
24069
+ token: captchaData == null ? void 0 : captchaData.token,
24070
+ authenticate: captchaData == null ? void 0 : captchaData.authenticate,
24071
+ captchaId,
24072
+ validate: captchaData == null ? void 0 : captchaData.validate,
24073
+ ...extraParams
24074
+ });
24075
+ },
24076
+ onFallback: (originalOnSuccess) => {
24077
+ captchaLocalMode.value = "tianai";
24078
+ slidCaptcha.open({
24079
+ onSuccess: (captchaData) => {
24080
+ if (!(captchaData == null ? void 0 : captchaData.id)) {
24081
+ console.error("天爱验证码返回数据无效,缺少 id 字段");
24082
+ return;
24083
+ }
24084
+ originalOnSuccess == null ? void 0 : originalOnSuccess({
24085
+ captchaId: captchaData.id,
24086
+ fallback: true
24087
+ });
24088
+ }
24089
+ });
24090
+ }
24091
+ });
24092
+ return true;
24093
+ }
24094
+ console.warn(`未知的验证码模式: ${captchaLocalMode.value},降级到天爱验证码`);
24095
+ captchaLocalMode.value = "tianai";
24096
+ slidCaptcha.open({
24097
+ onSuccess: (captchaData) => {
24098
+ handleCountDown({
24099
+ ...conf,
24100
+ captchaId: captchaData.id,
24101
+ ...extraParams
24102
+ });
24103
+ }
24104
+ });
24105
+ return true;
24106
+ } catch (error) {
24107
+ console.error("处理验证码时发生错误:", error);
24108
+ try {
24109
+ captchaLocalMode.value = "tianai";
24110
+ slidCaptcha.open({
24111
+ onSuccess: (captchaData) => {
24112
+ handleCountDown({
24113
+ ...conf,
24114
+ captchaId: captchaData.id,
24115
+ ...options.extraParams
24116
+ });
24117
+ }
24118
+ });
24119
+ return true;
24120
+ } catch (fallbackError) {
24121
+ console.error("降级验证码也失败:", fallbackError);
24122
+ return false;
24123
+ }
24124
+ }
24125
+ };
23336
24126
  const errForRemoteLogin = ref(false);
23337
24127
  const handleRemoteLogin = () => {
23338
24128
  errForRemoteLogin.value = true;
@@ -23381,6 +24171,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23381
24171
  const passwordParams = {
23382
24172
  type: "password",
23383
24173
  ...res,
24174
+ validate: info == null ? void 0 : info.validate,
23384
24175
  captchaId: info == null ? void 0 : info.captchaId,
23385
24176
  token: info == null ? void 0 : info.token,
23386
24177
  authenticate: info == null ? void 0 : info.authenticate
@@ -23391,12 +24182,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23391
24182
  successFunc: loginSuccess,
23392
24183
  failFunc: loginFail,
23393
24184
  loginDeviceType: "pc",
23394
- country
24185
+ country,
24186
+ captchaType: captchaType.value
23395
24187
  },
23396
24188
  loginParams: passwordParams,
23397
- graphValidate,
23398
24189
  lintRemoteLogin: handleRemoteLogin,
23399
- yunpianGraphValidate
24190
+ graphValidate,
24191
+ yunpianGraphValidate,
24192
+ yiDunGraphValidate
23400
24193
  });
23401
24194
  break;
23402
24195
  }
@@ -23481,7 +24274,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23481
24274
  mobile,
23482
24275
  captchaId: conf == null ? void 0 : conf.captchaId,
23483
24276
  token: conf == null ? void 0 : conf.token,
23484
- authenticate: conf == null ? void 0 : conf.authenticate
24277
+ authenticate: conf == null ? void 0 : conf.authenticate,
24278
+ validate: conf == null ? void 0 : conf.validate
23485
24279
  });
23486
24280
  break;
23487
24281
  }
@@ -23490,7 +24284,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23490
24284
  mobile_email: mobile,
23491
24285
  captcha_id: conf == null ? void 0 : conf.captchaId,
23492
24286
  token: conf == null ? void 0 : conf.token,
23493
- authenticate: conf == null ? void 0 : conf.authenticate
24287
+ authenticate: conf == null ? void 0 : conf.authenticate,
24288
+ validate: conf == null ? void 0 : conf.validate
23494
24289
  });
23495
24290
  res = await API.getMobileEmailCode(requestData);
23496
24291
  break;
@@ -23501,7 +24296,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23501
24296
  type: "BINDING_MOBILE",
23502
24297
  captchaId: conf == null ? void 0 : conf.captchaId,
23503
24298
  token: conf == null ? void 0 : conf.token,
23504
- authenticate: conf == null ? void 0 : conf.authenticate
24299
+ authenticate: conf == null ? void 0 : conf.authenticate,
24300
+ validate: conf == null ? void 0 : conf.validate
23505
24301
  });
23506
24302
  break;
23507
24303
  }
@@ -23511,7 +24307,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23511
24307
  type: "REGISTER",
23512
24308
  captchaId: conf == null ? void 0 : conf.captchaId,
23513
24309
  token: conf == null ? void 0 : conf.token,
23514
- authenticate: conf == null ? void 0 : conf.authenticate
24310
+ authenticate: conf == null ? void 0 : conf.authenticate,
24311
+ validate: conf == null ? void 0 : conf.validate
23515
24312
  });
23516
24313
  break;
23517
24314
  }
@@ -23519,7 +24316,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23519
24316
  return res;
23520
24317
  };
23521
24318
  const handleCountDown = async (conf) => {
23522
- var _a, _b, _c;
24319
+ var _a, _b, _c, _d, _e;
23523
24320
  const formData = await FormRef.value.ValidateFormKeys([conf.key]);
23524
24321
  const mobile = getPhone(conf);
23525
24322
  if (formData.type === "success") {
@@ -23531,98 +24328,49 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23531
24328
  const isDomesticNumber = country === "CN" || !country;
23532
24329
  const isLoginOrRegister = formType.value === "login" || formType.value === "register";
23533
24330
  if (!isDomesticNumber && !conf.noVerificationRequired && isLoginOrRegister) {
23534
- if (captchaMode === "yunpian") {
23535
- yunpianCaptcha.open({
23536
- onSuccess: (captchaData) => {
23537
- handleCountDown({
23538
- ...conf,
23539
- token: captchaData == null ? void 0 : captchaData.token,
23540
- authenticate: captchaData == null ? void 0 : captchaData.authenticate,
23541
- captchaId: captchaData == null ? void 0 : captchaData.captchaId,
23542
- noVerificationRequired: true,
23543
- smsReported: true
23544
- });
23545
- },
23546
- onFallback: (originalOnSuccess) => {
23547
- captchaMode = "tianai";
23548
- slidCaptcha.open({
23549
- onSuccess: (captchaData) => originalOnSuccess == null ? void 0 : originalOnSuccess({
23550
- captchaId: captchaData.id
23551
- })
23552
- });
23553
- }
23554
- });
23555
- return;
23556
- } else if (captchaMode === "tianai") {
23557
- slidCaptcha.open({
23558
- onSuccess: (captchaData) => handleCountDown({ ...conf, captchaId: captchaData.id, noVerificationRequired: true, smsReported: true })
23559
- });
24331
+ if (handleCaptchaVerification(conf, {
24332
+ isDomesticNumber,
24333
+ extraParams: {
24334
+ noVerificationRequired: true,
24335
+ smsReported: true
24336
+ }
24337
+ })) {
23560
24338
  return;
23561
24339
  }
23562
24340
  }
23563
24341
  if (formType.value === "forget") {
23564
- if (captchaMode === "yunpian") {
23565
- if (!conf.token || !conf.authenticate) {
23566
- yunpianCaptcha.open({
23567
- onSuccess: (captchaData) => {
23568
- handleCountDown({
23569
- ...conf,
23570
- token: captchaData == null ? void 0 : captchaData.token,
23571
- authenticate: captchaData == null ? void 0 : captchaData.authenticate,
23572
- captchaId: captchaData == null ? void 0 : captchaData.captchaId,
23573
- smsReported: true
23574
- });
23575
- },
23576
- onFallback: (originalOnSuccess) => {
23577
- captchaMode = "tianai";
23578
- slidCaptcha.open({
23579
- onSuccess: (captchaData) => originalOnSuccess == null ? void 0 : originalOnSuccess({
23580
- captchaId: captchaData.id
23581
- })
23582
- });
23583
- }
23584
- });
24342
+ const needVerification = captchaLocalMode.value === "yunpian" && (!conf.token || !conf.authenticate) || captchaLocalMode.value === "tianai" && !conf.captchaId || captchaLocalMode.value === "yidun" && !conf.validate;
24343
+ if (needVerification) {
24344
+ if (handleCaptchaVerification(conf, {
24345
+ isDomesticNumber,
24346
+ checkCondition: () => needVerification,
24347
+ extraParams: {
24348
+ smsReported: true
24349
+ }
24350
+ })) {
23585
24351
  return;
23586
24352
  }
23587
- } else if (captchaMode === "tianai" && !conf.captchaId) {
23588
- slidCaptcha.open({
23589
- onSuccess: (captchaData) => {
23590
- handleCountDown({ ...conf, captchaId: captchaData.id, smsReported: true });
23591
- }
23592
- });
23593
- return;
23594
24353
  }
23595
24354
  }
23596
24355
  if (tabPanel.value === "verifyCode" || ["register", "forget", "bindPhone"].includes(formType.value)) {
23597
24356
  const verifyCodeRes = await handleCountDownSubmission(conf, mobile);
23598
24357
  if (["login", "register", "bindPhone"].includes(formType.value)) {
23599
- if (((_b = verifyCodeRes == null ? void 0 : verifyCodeRes.error) == null ? void 0 : _b.error_code) === GRAPH_CODE) {
23600
- captchaMode = "tianai";
23601
- slidCaptcha.open({
23602
- onSuccess: (captchaData) => handleCountDown({ ...conf, captchaId: captchaData.id, smsReported: true })
23603
- });
23604
- return;
23605
- }
23606
- if (((_c = verifyCodeRes == null ? void 0 : verifyCodeRes.error) == null ? void 0 : _c.error_code) === YUNPIAN_GRAPH_CODE) {
23607
- captchaMode = "yunpian";
23608
- yunpianCaptcha.open({
23609
- onSuccess: (captchaData) => handleCountDown({
23610
- ...conf,
23611
- token: captchaData == null ? void 0 : captchaData.token,
23612
- authenticate: captchaData == null ? void 0 : captchaData.authenticate,
23613
- captchaId: captchaData == null ? void 0 : captchaData.captchaId,
24358
+ if (needGraphCode((_b = verifyCodeRes == null ? void 0 : verifyCodeRes.error) == null ? void 0 : _b.error_code)) {
24359
+ if (((_c = captchaType.value) == null ? void 0 : _c.provider) === "SELF") {
24360
+ captchaLocalMode.value = "tianai";
24361
+ } else if (((_d = captchaType.value) == null ? void 0 : _d.provider) === "YUNPIAN") {
24362
+ captchaLocalMode.value = "yunpian";
24363
+ } else if (((_e = captchaType.value) == null ? void 0 : _e.provider) === "YIDUN") {
24364
+ captchaLocalMode.value = "yidun";
24365
+ }
24366
+ if (handleCaptchaVerification(conf, {
24367
+ isDomesticNumber,
24368
+ extraParams: {
23614
24369
  smsReported: true
23615
- }),
23616
- onFallback: (originalOnSuccess) => {
23617
- captchaMode = "tianai";
23618
- slidCaptcha.open({
23619
- onSuccess: (captchaData) => originalOnSuccess == null ? void 0 : originalOnSuccess({
23620
- captchaId: captchaData.id
23621
- })
23622
- });
23623
24370
  }
23624
- });
23625
- return;
24371
+ })) {
24372
+ return;
24373
+ }
23626
24374
  }
23627
24375
  }
23628
24376
  if (!(verifyCodeRes == null ? void 0 : verifyCodeRes.error)) {
@@ -24057,6 +24805,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
24057
24805
  const resetPwdDirectly = ref(false);
24058
24806
  const resetPwdWhiteList = ["change_password"];
24059
24807
  onMounted(() => {
24808
+ getCurrentCaptchaType();
24060
24809
  if (tabPanel.value === "miniProgram" && formType.value === "login") {
24061
24810
  getMiniProgramQrCode();
24062
24811
  }
@@ -24777,29 +25526,30 @@ const index = {
24777
25526
  }
24778
25527
  };
24779
25528
  export {
24780
- currentTheme as A,
24781
- LANG_EN as B,
24782
- emitEvent as C,
24783
- isHttps as D,
25529
+ ThemeType as A,
25530
+ currentTheme as B,
25531
+ LANG_EN as C,
25532
+ emitEvent as D,
24784
25533
  EVENT_NAME as E,
24785
- asideRequest as F,
25534
+ isHttps as F,
24786
25535
  GIcon as G,
24787
- _sfc_main$A as H,
24788
- loadAsideData as I,
24789
- ToolsFloat as J,
24790
- _sfc_main as K,
25536
+ asideRequest as H,
25537
+ _sfc_main$A as I,
25538
+ loadAsideData as J,
25539
+ ToolsFloat as K,
24791
25540
  LANG_ZH as L,
24792
- GitCodeAside as M,
24793
- GitCodeHeader as N,
24794
- SiteAnnouncement as O,
24795
- useLogin as P,
24796
- setLayoutConfig as Q,
25541
+ _sfc_main as M,
25542
+ GitCodeAside as N,
25543
+ GitCodeHeader as O,
25544
+ SiteAnnouncement as P,
25545
+ useLogin as Q,
24797
25546
  REPO_MODULE as R,
24798
25547
  SceneValue as S,
24799
25548
  TOPIC_TYPE as T,
24800
- GitCodeLayoutEmitter as U,
24801
- setTheme as V,
24802
- index as W,
25549
+ setLayoutConfig as U,
25550
+ GitCodeLayoutEmitter as V,
25551
+ setTheme as W,
25552
+ index as X,
24803
25553
  _export_sfc as _,
24804
25554
  i18n as a,
24805
25555
  REPO_EVENT as b,
@@ -24825,6 +25575,6 @@ export {
24825
25575
  vElementExposure as v,
24826
25576
  LANG_KEY as w,
24827
25577
  getLocaleLang as x,
24828
- useLayoutConfig as y,
24829
- ThemeType as z
25578
+ slidCaptchaManager as y,
25579
+ useLayoutConfig as z
24830
25580
  };