vue-layout-gitcode 1.10.10 → 1.10.11

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