icve-sso-vue3 0.0.3 → 0.0.4

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.
package/README.md CHANGED
@@ -1,37 +1,123 @@
1
1
  # 智慧职教-统一用户中心
2
2
 
3
3
  #### 介绍
4
- 智慧职教-统一用户中心
5
-
6
- #### 软件架构
7
- 软件架构说明
8
-
4
+ 智慧职教-统一用户中心 Vue3 组件库
9
5
 
10
6
  #### 安装教程
11
7
 
12
- 1. xxxx
13
- 2. xxxx
14
- 3. xxxx
8
+ ```bash
9
+ npm install icve-sso-vue3
10
+ ```
15
11
 
16
12
  #### 使用说明
17
13
 
18
- 1. xxxx
19
- 2. xxxx
20
- 3. xxxx
14
+ ##### 1. 基础使用
21
15
 
22
- #### 参与贡献
16
+ ```vue
17
+ <template>
18
+ <div>
19
+ <!-- 登录组件 -->
20
+ <userCenterLogin
21
+ v-model:loginModalShow="loginModalShow"
22
+ @loginSuccess="handleLoginSuccess"
23
+ />
24
+
25
+ <!-- 信息完善组件 -->
26
+ <userCenterCompleteInformation
27
+ @completeInformation="handleCompleteInformation"
28
+ :token="token"
29
+ />
30
+ </div>
31
+ </template>
32
+
33
+ <script>
34
+ import { userCenterLogin, userCenterCompleteInformation } from 'icve-sso-vue3';
35
+
36
+ export default {
37
+ components: {
38
+ userCenterLogin,
39
+ userCenterCompleteInformation
40
+ },
41
+ data() {
42
+ return {
43
+ loginModalShow: true,
44
+ token: ''
45
+ };
46
+ },
47
+ methods: {
48
+ handleLoginSuccess(data) {
49
+ console.log('登录成功', data);
50
+ this.loginModalShow = false;
51
+ },
52
+ handleCompleteInformation() {
53
+ console.log('信息完善');
54
+ }
55
+ }
56
+ };
57
+ </script>
58
+ ```
59
+
60
+ ##### 2. 全局注册
61
+
62
+ ```javascript
63
+ // main.js
64
+ import { createApp } from 'vue';
65
+ import IcveSso from 'icve-sso-vue3';
66
+ import 'icve-sso-vue3/dist/icve-sso-vue3.css';
67
+
68
+ const app = createApp(App);
69
+
70
+ // 安装插件(默认会自动加载验证码脚本)
71
+ app.use(IcveSso);
72
+
73
+ // 或者手动控制验证码脚本加载
74
+ app.use(IcveSso, { loadCaptcha: false });
75
+ ```
76
+
77
+ ##### 3. 手动加载验证码脚本(可选)
23
78
 
24
- 1. Fork 本仓库
25
- 2. 新建 Feat_xxx 分支
26
- 3. 提交代码
27
- 4. 新建 Pull Request
79
+ 如果你想在应用启动时提前加载验证码脚本,可以使用以下方法:
28
80
 
81
+ ```javascript
82
+ // 在 main.js 中
83
+ import { loadCaptchaScripts } from 'icve-sso-vue3';
29
84
 
30
- #### 特技
85
+ // 提前加载验证码脚本
86
+ loadCaptchaScripts();
87
+ ```
88
+
89
+ ##### 4. 注意事项
90
+
91
+ - 组件库会自动处理验证码脚本的加载,无需手动在 HTML 中添加 script 标签
92
+ - 支持腾讯验证码和阿里云验证码,会根据后端配置自动选择
93
+ - 组件库内部已包含完整的错误处理和降级方案
94
+ - 需要引入样式文件:`import 'icve-sso-vue3/dist/icve-sso-vue3.css'`
95
+
96
+ #### 组件Props
97
+
98
+ ##### userCenterLogin
99
+
100
+ | 属性 | 类型 | 默认值 | 说明 |
101
+ |-----|------|--------|------|
102
+ | loginModalShow | Boolean | true | 控制登录弹窗显示/隐藏 |
103
+
104
+ | 事件 | 参数 | 说明 |
105
+ |-----|------|------|
106
+ | loginSuccess | data | 登录成功回调,返回登录数据 |
107
+
108
+ ##### userCenterCompleteInformation
109
+
110
+ | 属性 | 类型 | 默认值 | 说明 |
111
+ |-----|------|--------|------|
112
+ | token | String | - | 用户token(必需) |
113
+
114
+ | 事件 | 参数 | 说明 |
115
+ |-----|------|------|
116
+ | completeInformation | - | 信息完成回调 |
117
+
118
+ #### 参与贡献
31
119
 
32
- 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
33
- 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
34
- 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
35
- 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
36
- 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
37
- 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
120
+ 1. Fork 本仓库
121
+ 2. 新建 Feat_xxx 分支
122
+ 3. 提交代码
123
+ 4. 新建 Pull Request
@@ -11206,6 +11206,7 @@ __webpack_require__.r(__webpack_exports__);
11206
11206
  // EXPORTS
11207
11207
  __webpack_require__.d(__webpack_exports__, {
11208
11208
  "default": () => (/* binding */ entry_lib),
11209
+ loadCaptchaScripts: () => (/* reexport */ loadCaptchaScripts),
11209
11210
  userCenterCompleteInformation: () => (/* reexport */ userCenterCompleteInformation),
11210
11211
  userCenterLogin: () => (/* reexport */ userCenterLogin)
11211
11212
  });
@@ -32716,45 +32717,45 @@ function unBindMobile(data) {
32716
32717
  data: data
32717
32718
  });
32718
32719
  }
32719
- ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/verifyComponents.vue?vue&type=template&id=5ed3cdce
32720
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/verifyComponents.vue?vue&type=template&id=7d804fae
32720
32721
 
32721
- var verifyComponentsvue_type_template_id_5ed3cdce_hoisted_1 = {
32722
+ var verifyComponentsvue_type_template_id_7d804fae_hoisted_1 = {
32722
32723
  "class": "verify"
32723
32724
  };
32724
- var verifyComponentsvue_type_template_id_5ed3cdce_hoisted_2 = {
32725
+ var verifyComponentsvue_type_template_id_7d804fae_hoisted_2 = {
32725
32726
  key: 1,
32726
32727
  "class": "aly"
32727
32728
  };
32728
- var verifyComponentsvue_type_template_id_5ed3cdce_hoisted_3 = {
32729
+ var verifyComponentsvue_type_template_id_7d804fae_hoisted_3 = {
32729
32730
  id: "clickButton",
32730
32731
  ref: "clickButton"
32731
32732
  };
32732
- function verifyComponentsvue_type_template_id_5ed3cdce_render(_ctx, _cache, $props, $setup, $data, $options) {
32733
+ function verifyComponentsvue_type_template_id_7d804fae_render(_ctx, _cache, $props, $setup, $data, $options) {
32733
32734
  var _component_TJCaptcha = (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.resolveComponent)("TJCaptcha");
32734
32735
  var _component_AliyunCaptchaModal = (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.resolveComponent)("AliyunCaptchaModal");
32735
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)("div", verifyComponentsvue_type_template_id_5ed3cdce_hoisted_1, [$data.type == 1 ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createBlock)(_component_TJCaptcha, {
32736
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)("div", verifyComponentsvue_type_template_id_7d804fae_hoisted_1, [$data.type == 1 ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createBlock)(_component_TJCaptcha, {
32736
32737
  key: 0,
32737
32738
  ref: "TJCaptcha",
32738
32739
  CaptchaAppId: $data.CaptchaAppId,
32739
32740
  onSuccess: $options.success
32740
- }, null, 8, ["CaptchaAppId", "onSuccess"])) : ((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)("div", verifyComponentsvue_type_template_id_5ed3cdce_hoisted_2, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createVNode)(_component_AliyunCaptchaModal, {
32741
+ }, null, 8, ["CaptchaAppId", "onSuccess"])) : ((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)("div", verifyComponentsvue_type_template_id_7d804fae_hoisted_2, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createVNode)(_component_AliyunCaptchaModal, {
32741
32742
  id: "clickButton",
32742
32743
  ref: "aliyunCaptcha",
32743
32744
  sceneId: $data.sceneId,
32744
32745
  onSuccess: $options.success
32745
- }, null, 8, ["sceneId", "onSuccess"]), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", verifyComponentsvue_type_template_id_5ed3cdce_hoisted_3, null, 512)]))]);
32746
+ }, null, 8, ["sceneId", "onSuccess"]), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", verifyComponentsvue_type_template_id_7d804fae_hoisted_3, null, 512)]))]);
32746
32747
  }
32747
- ;// ./src/components/verifyComponents.vue?vue&type=template&id=5ed3cdce
32748
+ ;// ./src/components/verifyComponents.vue?vue&type=template&id=7d804fae
32748
32749
 
32749
- ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/TJCaptcha.vue?vue&type=template&id=4adf8476
32750
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/TJCaptcha.vue?vue&type=template&id=9e7b3c90
32750
32751
 
32751
- var TJCaptchavue_type_template_id_4adf8476_hoisted_1 = {
32752
+ var TJCaptchavue_type_template_id_9e7b3c90_hoisted_1 = {
32752
32753
  "class": "TJCaptcha"
32753
32754
  };
32754
- function TJCaptchavue_type_template_id_4adf8476_render(_ctx, _cache, $props, $setup, $data, $options) {
32755
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)("div", TJCaptchavue_type_template_id_4adf8476_hoisted_1);
32755
+ function TJCaptchavue_type_template_id_9e7b3c90_render(_ctx, _cache, $props, $setup, $data, $options) {
32756
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)("div", TJCaptchavue_type_template_id_9e7b3c90_hoisted_1);
32756
32757
  }
32757
- ;// ./src/components/TJCaptcha.vue?vue&type=template&id=4adf8476
32758
+ ;// ./src/components/TJCaptcha.vue?vue&type=template&id=9e7b3c90
32758
32759
 
32759
32760
  ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/TJCaptcha.vue?vue&type=script&lang=js
32760
32761
 
@@ -32773,24 +32774,51 @@ function TJCaptchavue_type_template_id_4adf8476_render(_ctx, _cache, $props, $se
32773
32774
  },
32774
32775
  data: function data() {
32775
32776
  return {
32776
- captcha: null
32777
+ captcha: null,
32778
+ scriptLoaded: false
32777
32779
  };
32778
32780
  },
32779
32781
  mounted: function mounted() {
32780
- // 获取CaptchaAppid加密
32782
+ // 动态加载腾讯验证码脚本
32783
+ this.loadTencentCaptchaScript();
32781
32784
  },
32782
32785
  methods: {
32783
- //获取验证码加密
32784
- getCaptchaAppid: function getCaptchaAppid() {
32786
+ // 动态加载腾讯验证码脚本
32787
+ loadTencentCaptchaScript: function loadTencentCaptchaScript() {
32785
32788
  var _this = this;
32789
+ if (this.scriptLoaded || typeof window.TencentCaptcha !== 'undefined') {
32790
+ this.scriptLoaded = true;
32791
+ return;
32792
+ }
32793
+ var script = document.createElement('script');
32794
+ script.src = 'https://turing.captcha.qcloud.com/TJCaptcha.js';
32795
+ script.onload = function () {
32796
+ _this.scriptLoaded = true;
32797
+ };
32798
+ script.onerror = function () {
32799
+ console.error('腾讯验证码脚本加载失败');
32800
+ };
32801
+ document.head.appendChild(script);
32802
+ },
32803
+ // 获取验证码加密
32804
+ getCaptchaAppid: function getCaptchaAppid() {
32805
+ var _this2 = this;
32806
+ if (typeof window.TencentCaptcha === 'undefined') {
32807
+ console.warn('腾讯验证码库未加载,使用容错处理');
32808
+ this.loadErrorCallback();
32809
+ return;
32810
+ }
32786
32811
  login_getCaptchaAppid().then(function (res) {
32787
- _this.init(res.data.data);
32812
+ _this2.init(res.data.data);
32813
+ })["catch"](function (error) {
32814
+ console.error('获取验证码AppId失败:', error);
32815
+ _this2.loadErrorCallback();
32788
32816
  });
32789
32817
  },
32790
32818
  init: function init(aidEncrypted) {
32791
32819
  try {
32792
32820
  // 检查环境是否支持腾讯验证码
32793
- if (typeof TencentCaptcha === 'undefined') {
32821
+ if (typeof window.TencentCaptcha === 'undefined') {
32794
32822
  console.warn('腾讯验证码库未加载,使用容错处理');
32795
32823
  this.loadErrorCallback();
32796
32824
  return;
@@ -32798,14 +32826,14 @@ function TJCaptchavue_type_template_id_4adf8476_render(_ctx, _cache, $props, $se
32798
32826
 
32799
32827
  // 生成一个验证码对象
32800
32828
  // CaptchaAppId:登录验证码控制台,从【验证管理】页面进行查看。如果未创建过验证,请先新建验证。注意:不可使用客户端类型为小程序的CaptchaAppId,会导致数据统计错误。
32801
- //callback:定义的回调函数
32802
- this.captcha = new TencentCaptcha(this.CaptchaAppId, this.callback, {
32829
+ // callback:定义的回调函数
32830
+ this.captcha = new window.TencentCaptcha(this.CaptchaAppId, this.callback, {
32803
32831
  aidEncrypted: aidEncrypted
32804
32832
  });
32805
32833
  // 调用方法,显示验证码
32806
32834
  this.captcha.show();
32807
32835
  } catch (error) {
32808
- console.log("%c Line:32 🥛 error", "color:#93c0a4", error);
32836
+ console.error("验证码初始化失败:", error);
32809
32837
  // 加载异常,调用验证码js加载错误处理函数
32810
32838
  this.loadErrorCallback();
32811
32839
  }
@@ -32841,18 +32869,18 @@ function TJCaptchavue_type_template_id_4adf8476_render(_ctx, _cache, $props, $se
32841
32869
 
32842
32870
 
32843
32871
  ;
32844
- const TJCaptcha_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(TJCaptchavue_type_script_lang_js, [['render',TJCaptchavue_type_template_id_4adf8476_render]])
32872
+ const TJCaptcha_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(TJCaptchavue_type_script_lang_js, [['render',TJCaptchavue_type_template_id_9e7b3c90_render]])
32845
32873
 
32846
32874
  /* harmony default export */ const TJCaptcha = (TJCaptcha_exports_);
32847
- ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/AliyunCaptchaModal.vue?vue&type=template&id=283e7c5a
32875
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/AliyunCaptchaModal.vue?vue&type=template&id=1572512c
32848
32876
 
32849
- var AliyunCaptchaModalvue_type_template_id_283e7c5a_hoisted_1 = ["id"];
32850
- function AliyunCaptchaModalvue_type_template_id_283e7c5a_render(_ctx, _cache, $props, $setup, $data, $options) {
32877
+ var AliyunCaptchaModalvue_type_template_id_1572512c_hoisted_1 = ["id"];
32878
+ function AliyunCaptchaModalvue_type_template_id_1572512c_render(_ctx, _cache, $props, $setup, $data, $options) {
32851
32879
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)("div", null, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", {
32852
32880
  id: "captcha-element-".concat($data.uniqueId)
32853
- }, null, 8, AliyunCaptchaModalvue_type_template_id_283e7c5a_hoisted_1)]);
32881
+ }, null, 8, AliyunCaptchaModalvue_type_template_id_1572512c_hoisted_1)]);
32854
32882
  }
32855
- ;// ./src/components/AliyunCaptchaModal.vue?vue&type=template&id=283e7c5a
32883
+ ;// ./src/components/AliyunCaptchaModal.vue?vue&type=template&id=1572512c
32856
32884
 
32857
32885
  ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/AliyunCaptchaModal.vue?vue&type=script&lang=js
32858
32886
 
@@ -32874,14 +32902,17 @@ function AliyunCaptchaModalvue_type_template_id_283e7c5a_render(_ctx, _cache, $p
32874
32902
  data: function data() {
32875
32903
  return {
32876
32904
  captcha: null,
32877
- uniqueId: '' // Vue 3 兼容的唯一ID
32905
+ uniqueId: '',
32906
+ // Vue 3 兼容的唯一ID
32907
+ scriptLoaded: false
32878
32908
  };
32879
32909
  },
32880
32910
  mounted: function mounted() {
32881
32911
  this.uniqueId = 'captcha-' + Math.random().toString(36).substr(2, 9);
32882
32912
  try {
32883
32913
  if (typeof window.initAliyunCaptcha === 'undefined') {
32884
- console.warn('阿里云验证码库未加载');
32914
+ console.warn('阿里云验证码库未加载,尝试动态加载');
32915
+ this.loadAliyunCaptchaScript();
32885
32916
  return;
32886
32917
  }
32887
32918
  this.initAliyunCaptcha();
@@ -32890,8 +32921,31 @@ function AliyunCaptchaModalvue_type_template_id_283e7c5a_render(_ctx, _cache, $p
32890
32921
  }
32891
32922
  },
32892
32923
  methods: {
32893
- initAliyunCaptcha: function initAliyunCaptcha() {
32924
+ // 动态加载阿里云验证码脚本
32925
+ loadAliyunCaptchaScript: function loadAliyunCaptchaScript() {
32894
32926
  var _this = this;
32927
+ if (this.scriptLoaded) return;
32928
+
32929
+ // 先加载配置
32930
+ if (!window.AliyunCaptchaConfig) {
32931
+ window.AliyunCaptchaConfig = {
32932
+ region: 'cn',
32933
+ prefix: '106eu7'
32934
+ };
32935
+ }
32936
+ var script = document.createElement('script');
32937
+ script.src = 'https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js';
32938
+ script.onload = function () {
32939
+ _this.scriptLoaded = true;
32940
+ _this.initAliyunCaptcha();
32941
+ };
32942
+ script.onerror = function () {
32943
+ console.error('阿里云验证码脚本加载失败');
32944
+ };
32945
+ document.head.appendChild(script);
32946
+ },
32947
+ initAliyunCaptcha: function initAliyunCaptcha() {
32948
+ var _this2 = this;
32895
32949
  try {
32896
32950
  if (typeof window.initAliyunCaptcha === 'undefined') {
32897
32951
  console.warn('阿里云验证码库未加载,跳过初始化');
@@ -32911,8 +32965,8 @@ function AliyunCaptchaModalvue_type_template_id_283e7c5a_render(_ctx, _cache, $p
32911
32965
  try {
32912
32966
  // 入参为验签captchaVerifyParam
32913
32967
  // 1.根据校验结果来进行业务处理
32914
- _this.$emit("success", captchaVerifyParam);
32915
- _this.initAliyunCaptcha();
32968
+ _this2.$emit("success", captchaVerifyParam);
32969
+ _this2.initAliyunCaptcha();
32916
32970
  } catch (error) {
32917
32971
  console.error('验证码成功回调处理失败:', error);
32918
32972
  }
@@ -32926,8 +32980,8 @@ function AliyunCaptchaModalvue_type_template_id_283e7c5a_render(_ctx, _cache, $p
32926
32980
  // 绑定验证码实例回调函数,该回调会在验证码初始化成功后调用
32927
32981
  getInstance: function getInstance(instance) {
32928
32982
  try {
32929
- _this.$emit("getInstance", instance);
32930
- _this.captcha = instance;
32983
+ _this2.$emit("getInstance", instance);
32984
+ _this2.captcha = instance;
32931
32985
  } catch (error) {
32932
32986
  console.error('验证码实例绑定失败:', error);
32933
32987
  }
@@ -32953,7 +33007,7 @@ function AliyunCaptchaModalvue_type_template_id_283e7c5a_render(_ctx, _cache, $p
32953
33007
 
32954
33008
 
32955
33009
  ;
32956
- const AliyunCaptchaModal_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(AliyunCaptchaModalvue_type_script_lang_js, [['render',AliyunCaptchaModalvue_type_template_id_283e7c5a_render]])
33010
+ const AliyunCaptchaModal_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(AliyunCaptchaModalvue_type_script_lang_js, [['render',AliyunCaptchaModalvue_type_template_id_1572512c_render]])
32957
33011
 
32958
33012
  /* harmony default export */ const AliyunCaptchaModal = (AliyunCaptchaModal_exports_);
32959
33013
  ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/verifyComponents.vue?vue&type=script&lang=js
@@ -33011,9 +33065,10 @@ const AliyunCaptchaModal_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)
33011
33065
  if (this.type === 'tencent') {
33012
33066
  this.$refs.TJCaptcha.getCaptchaAppid();
33013
33067
  } else if (this.type === 'alibaba') {
33014
- if (window.AliyunCaptcha) {
33068
+ if (typeof window.AliyunCaptcha !== 'undefined' && this.$refs.aliyunCaptcha.captcha) {
33015
33069
  this.$refs.aliyunCaptcha.captcha.show();
33016
33070
  } else {
33071
+ console.warn('阿里云验证码未加载,使用容错处理');
33017
33072
  var VerifyParam = {
33018
33073
  specialKey: true
33019
33074
  };
@@ -33043,7 +33098,7 @@ const AliyunCaptchaModal_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)
33043
33098
 
33044
33099
 
33045
33100
  ;
33046
- const verifyComponents_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(verifyComponentsvue_type_script_lang_js, [['render',verifyComponentsvue_type_template_id_5ed3cdce_render]])
33101
+ const verifyComponents_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(verifyComponentsvue_type_script_lang_js, [['render',verifyComponentsvue_type_template_id_7d804fae_render]])
33047
33102
 
33048
33103
  /* harmony default export */ const verifyComponents = (verifyComponents_exports_);
33049
33104
  ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/QRCodeLogin.vue?vue&type=template&id=6badd114&scoped=true
@@ -35228,12 +35283,42 @@ const userCenterLogin_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(us
35228
35283
 
35229
35284
 
35230
35285
 
35286
+ // 预加载验证码脚本(可选,用于提前加载)
35287
+ function loadCaptchaScripts() {
35288
+ // 加载腾讯验证码
35289
+ if (typeof window.TencentCaptcha === 'undefined') {
35290
+ var tencentScript = document.createElement('script');
35291
+ tencentScript.src = 'https://turing.captcha.qcloud.com/TJCaptcha.js';
35292
+ tencentScript.async = true;
35293
+ document.head.appendChild(tencentScript);
35294
+ }
35295
+
35296
+ // 加载阿里云验证码
35297
+ if (typeof window.AliyunCaptcha === 'undefined') {
35298
+ if (!window.AliyunCaptchaConfig) {
35299
+ window.AliyunCaptchaConfig = {
35300
+ region: 'cn',
35301
+ prefix: '106eu7'
35302
+ };
35303
+ }
35304
+ var aliyunScript = document.createElement('script');
35305
+ aliyunScript.src = 'https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js';
35306
+ aliyunScript.async = true;
35307
+ document.head.appendChild(aliyunScript);
35308
+ }
35309
+ }
35310
+
35231
35311
  // 导出组件
35232
35312
 
35233
35313
 
35234
35314
  // 添加 install 方法以支持 Vue.use()
35235
35315
  /* harmony default export */ const index = ({
35236
35316
  install: function install(app) {
35317
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
35318
+ // 自动加载验证码脚本(如果未手动禁用)
35319
+ if (options.loadCaptcha !== false) {
35320
+ loadCaptchaScripts();
35321
+ }
35237
35322
  app.component("userCenterCompleteInformation", userCenterCompleteInformation);
35238
35323
  app.component("userCenterLogin", userCenterLogin);
35239
35324
  }