icve-sso-vue3 0.0.3 → 0.0.5

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.
@@ -11224,6 +11224,7 @@ __webpack_require__.r(__webpack_exports__);
11224
11224
  // EXPORTS
11225
11225
  __webpack_require__.d(__webpack_exports__, {
11226
11226
  "default": () => (/* binding */ entry_lib),
11227
+ loadCaptchaScripts: () => (/* reexport */ loadCaptchaScripts),
11227
11228
  userCenterCompleteInformation: () => (/* reexport */ userCenterCompleteInformation),
11228
11229
  userCenterLogin: () => (/* reexport */ userCenterLogin)
11229
11230
  });
@@ -32734,45 +32735,45 @@ function unBindMobile(data) {
32734
32735
  data: data
32735
32736
  });
32736
32737
  }
32737
- ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.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
32738
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.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
32738
32739
 
32739
- var verifyComponentsvue_type_template_id_5ed3cdce_hoisted_1 = {
32740
+ var verifyComponentsvue_type_template_id_7d804fae_hoisted_1 = {
32740
32741
  "class": "verify"
32741
32742
  };
32742
- var verifyComponentsvue_type_template_id_5ed3cdce_hoisted_2 = {
32743
+ var verifyComponentsvue_type_template_id_7d804fae_hoisted_2 = {
32743
32744
  key: 1,
32744
32745
  "class": "aly"
32745
32746
  };
32746
- var verifyComponentsvue_type_template_id_5ed3cdce_hoisted_3 = {
32747
+ var verifyComponentsvue_type_template_id_7d804fae_hoisted_3 = {
32747
32748
  id: "clickButton",
32748
32749
  ref: "clickButton"
32749
32750
  };
32750
- function verifyComponentsvue_type_template_id_5ed3cdce_render(_ctx, _cache, $props, $setup, $data, $options) {
32751
+ function verifyComponentsvue_type_template_id_7d804fae_render(_ctx, _cache, $props, $setup, $data, $options) {
32751
32752
  var _component_TJCaptcha = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)("TJCaptcha");
32752
32753
  var _component_AliyunCaptchaModal = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)("AliyunCaptchaModal");
32753
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)("div", verifyComponentsvue_type_template_id_5ed3cdce_hoisted_1, [$data.type == 1 ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createBlock)(_component_TJCaptcha, {
32754
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)("div", verifyComponentsvue_type_template_id_7d804fae_hoisted_1, [$data.type == 1 ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createBlock)(_component_TJCaptcha, {
32754
32755
  key: 0,
32755
32756
  ref: "TJCaptcha",
32756
32757
  CaptchaAppId: $data.CaptchaAppId,
32757
32758
  onSuccess: $options.success
32758
- }, null, 8, ["CaptchaAppId", "onSuccess"])) : ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)("div", verifyComponentsvue_type_template_id_5ed3cdce_hoisted_2, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.createVNode)(_component_AliyunCaptchaModal, {
32759
+ }, null, 8, ["CaptchaAppId", "onSuccess"])) : ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)("div", verifyComponentsvue_type_template_id_7d804fae_hoisted_2, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.createVNode)(_component_AliyunCaptchaModal, {
32759
32760
  id: "clickButton",
32760
32761
  ref: "aliyunCaptcha",
32761
32762
  sceneId: $data.sceneId,
32762
32763
  onSuccess: $options.success
32763
- }, null, 8, ["sceneId", "onSuccess"]), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("div", verifyComponentsvue_type_template_id_5ed3cdce_hoisted_3, null, 512)]))]);
32764
+ }, null, 8, ["sceneId", "onSuccess"]), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("div", verifyComponentsvue_type_template_id_7d804fae_hoisted_3, null, 512)]))]);
32764
32765
  }
32765
- ;// ./src/components/verifyComponents.vue?vue&type=template&id=5ed3cdce
32766
+ ;// ./src/components/verifyComponents.vue?vue&type=template&id=7d804fae
32766
32767
 
32767
- ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.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
32768
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.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
32768
32769
 
32769
- var TJCaptchavue_type_template_id_4adf8476_hoisted_1 = {
32770
+ var TJCaptchavue_type_template_id_9e7b3c90_hoisted_1 = {
32770
32771
  "class": "TJCaptcha"
32771
32772
  };
32772
- function TJCaptchavue_type_template_id_4adf8476_render(_ctx, _cache, $props, $setup, $data, $options) {
32773
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)("div", TJCaptchavue_type_template_id_4adf8476_hoisted_1);
32773
+ function TJCaptchavue_type_template_id_9e7b3c90_render(_ctx, _cache, $props, $setup, $data, $options) {
32774
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)("div", TJCaptchavue_type_template_id_9e7b3c90_hoisted_1);
32774
32775
  }
32775
- ;// ./src/components/TJCaptcha.vue?vue&type=template&id=4adf8476
32776
+ ;// ./src/components/TJCaptcha.vue?vue&type=template&id=9e7b3c90
32776
32777
 
32777
32778
  ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/TJCaptcha.vue?vue&type=script&lang=js
32778
32779
 
@@ -32791,24 +32792,51 @@ function TJCaptchavue_type_template_id_4adf8476_render(_ctx, _cache, $props, $se
32791
32792
  },
32792
32793
  data: function data() {
32793
32794
  return {
32794
- captcha: null
32795
+ captcha: null,
32796
+ scriptLoaded: false
32795
32797
  };
32796
32798
  },
32797
32799
  mounted: function mounted() {
32798
- // 获取CaptchaAppid加密
32800
+ // 动态加载腾讯验证码脚本
32801
+ this.loadTencentCaptchaScript();
32799
32802
  },
32800
32803
  methods: {
32801
- //获取验证码加密
32802
- getCaptchaAppid: function getCaptchaAppid() {
32804
+ // 动态加载腾讯验证码脚本
32805
+ loadTencentCaptchaScript: function loadTencentCaptchaScript() {
32803
32806
  var _this = this;
32807
+ if (this.scriptLoaded || typeof window.TencentCaptcha !== 'undefined') {
32808
+ this.scriptLoaded = true;
32809
+ return;
32810
+ }
32811
+ var script = document.createElement('script');
32812
+ script.src = 'https://turing.captcha.qcloud.com/TJCaptcha.js';
32813
+ script.onload = function () {
32814
+ _this.scriptLoaded = true;
32815
+ };
32816
+ script.onerror = function () {
32817
+ console.error('腾讯验证码脚本加载失败');
32818
+ };
32819
+ document.head.appendChild(script);
32820
+ },
32821
+ // 获取验证码加密
32822
+ getCaptchaAppid: function getCaptchaAppid() {
32823
+ var _this2 = this;
32824
+ if (typeof window.TencentCaptcha === 'undefined') {
32825
+ console.warn('腾讯验证码库未加载,使用容错处理');
32826
+ this.loadErrorCallback();
32827
+ return;
32828
+ }
32804
32829
  login_getCaptchaAppid().then(function (res) {
32805
- _this.init(res.data.data);
32830
+ _this2.init(res.data.data);
32831
+ })["catch"](function (error) {
32832
+ console.error('获取验证码AppId失败:', error);
32833
+ _this2.loadErrorCallback();
32806
32834
  });
32807
32835
  },
32808
32836
  init: function init(aidEncrypted) {
32809
32837
  try {
32810
32838
  // 检查环境是否支持腾讯验证码
32811
- if (typeof TencentCaptcha === 'undefined') {
32839
+ if (typeof window.TencentCaptcha === 'undefined') {
32812
32840
  console.warn('腾讯验证码库未加载,使用容错处理');
32813
32841
  this.loadErrorCallback();
32814
32842
  return;
@@ -32816,14 +32844,14 @@ function TJCaptchavue_type_template_id_4adf8476_render(_ctx, _cache, $props, $se
32816
32844
 
32817
32845
  // 生成一个验证码对象
32818
32846
  // CaptchaAppId:登录验证码控制台,从【验证管理】页面进行查看。如果未创建过验证,请先新建验证。注意:不可使用客户端类型为小程序的CaptchaAppId,会导致数据统计错误。
32819
- //callback:定义的回调函数
32820
- this.captcha = new TencentCaptcha(this.CaptchaAppId, this.callback, {
32847
+ // callback:定义的回调函数
32848
+ this.captcha = new window.TencentCaptcha(this.CaptchaAppId, this.callback, {
32821
32849
  aidEncrypted: aidEncrypted
32822
32850
  });
32823
32851
  // 调用方法,显示验证码
32824
32852
  this.captcha.show();
32825
32853
  } catch (error) {
32826
- console.log("%c Line:32 🥛 error", "color:#93c0a4", error);
32854
+ console.error("验证码初始化失败:", error);
32827
32855
  // 加载异常,调用验证码js加载错误处理函数
32828
32856
  this.loadErrorCallback();
32829
32857
  }
@@ -32859,18 +32887,18 @@ function TJCaptchavue_type_template_id_4adf8476_render(_ctx, _cache, $props, $se
32859
32887
 
32860
32888
 
32861
32889
  ;
32862
- const TJCaptcha_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(TJCaptchavue_type_script_lang_js, [['render',TJCaptchavue_type_template_id_4adf8476_render]])
32890
+ const TJCaptcha_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(TJCaptchavue_type_script_lang_js, [['render',TJCaptchavue_type_template_id_9e7b3c90_render]])
32863
32891
 
32864
32892
  /* harmony default export */ const TJCaptcha = (TJCaptcha_exports_);
32865
- ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.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
32893
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.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
32866
32894
 
32867
- var AliyunCaptchaModalvue_type_template_id_283e7c5a_hoisted_1 = ["id"];
32868
- function AliyunCaptchaModalvue_type_template_id_283e7c5a_render(_ctx, _cache, $props, $setup, $data, $options) {
32895
+ var AliyunCaptchaModalvue_type_template_id_1572512c_hoisted_1 = ["id"];
32896
+ function AliyunCaptchaModalvue_type_template_id_1572512c_render(_ctx, _cache, $props, $setup, $data, $options) {
32869
32897
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)("div", null, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("div", {
32870
32898
  id: "captcha-element-".concat($data.uniqueId)
32871
- }, null, 8, AliyunCaptchaModalvue_type_template_id_283e7c5a_hoisted_1)]);
32899
+ }, null, 8, AliyunCaptchaModalvue_type_template_id_1572512c_hoisted_1)]);
32872
32900
  }
32873
- ;// ./src/components/AliyunCaptchaModal.vue?vue&type=template&id=283e7c5a
32901
+ ;// ./src/components/AliyunCaptchaModal.vue?vue&type=template&id=1572512c
32874
32902
 
32875
32903
  ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/AliyunCaptchaModal.vue?vue&type=script&lang=js
32876
32904
 
@@ -32892,14 +32920,17 @@ function AliyunCaptchaModalvue_type_template_id_283e7c5a_render(_ctx, _cache, $p
32892
32920
  data: function data() {
32893
32921
  return {
32894
32922
  captcha: null,
32895
- uniqueId: '' // Vue 3 兼容的唯一ID
32923
+ uniqueId: '',
32924
+ // Vue 3 兼容的唯一ID
32925
+ scriptLoaded: false
32896
32926
  };
32897
32927
  },
32898
32928
  mounted: function mounted() {
32899
32929
  this.uniqueId = 'captcha-' + Math.random().toString(36).substr(2, 9);
32900
32930
  try {
32901
32931
  if (typeof window.initAliyunCaptcha === 'undefined') {
32902
- console.warn('阿里云验证码库未加载');
32932
+ console.warn('阿里云验证码库未加载,尝试动态加载');
32933
+ this.loadAliyunCaptchaScript();
32903
32934
  return;
32904
32935
  }
32905
32936
  this.initAliyunCaptcha();
@@ -32908,8 +32939,31 @@ function AliyunCaptchaModalvue_type_template_id_283e7c5a_render(_ctx, _cache, $p
32908
32939
  }
32909
32940
  },
32910
32941
  methods: {
32911
- initAliyunCaptcha: function initAliyunCaptcha() {
32942
+ // 动态加载阿里云验证码脚本
32943
+ loadAliyunCaptchaScript: function loadAliyunCaptchaScript() {
32912
32944
  var _this = this;
32945
+ if (this.scriptLoaded) return;
32946
+
32947
+ // 先加载配置
32948
+ if (!window.AliyunCaptchaConfig) {
32949
+ window.AliyunCaptchaConfig = {
32950
+ region: 'cn',
32951
+ prefix: '106eu7'
32952
+ };
32953
+ }
32954
+ var script = document.createElement('script');
32955
+ script.src = 'https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js';
32956
+ script.onload = function () {
32957
+ _this.scriptLoaded = true;
32958
+ _this.initAliyunCaptcha();
32959
+ };
32960
+ script.onerror = function () {
32961
+ console.error('阿里云验证码脚本加载失败');
32962
+ };
32963
+ document.head.appendChild(script);
32964
+ },
32965
+ initAliyunCaptcha: function initAliyunCaptcha() {
32966
+ var _this2 = this;
32913
32967
  try {
32914
32968
  if (typeof window.initAliyunCaptcha === 'undefined') {
32915
32969
  console.warn('阿里云验证码库未加载,跳过初始化');
@@ -32929,8 +32983,8 @@ function AliyunCaptchaModalvue_type_template_id_283e7c5a_render(_ctx, _cache, $p
32929
32983
  try {
32930
32984
  // 入参为验签captchaVerifyParam
32931
32985
  // 1.根据校验结果来进行业务处理
32932
- _this.$emit("success", captchaVerifyParam);
32933
- _this.initAliyunCaptcha();
32986
+ _this2.$emit("success", captchaVerifyParam);
32987
+ _this2.initAliyunCaptcha();
32934
32988
  } catch (error) {
32935
32989
  console.error('验证码成功回调处理失败:', error);
32936
32990
  }
@@ -32944,8 +32998,8 @@ function AliyunCaptchaModalvue_type_template_id_283e7c5a_render(_ctx, _cache, $p
32944
32998
  // 绑定验证码实例回调函数,该回调会在验证码初始化成功后调用
32945
32999
  getInstance: function getInstance(instance) {
32946
33000
  try {
32947
- _this.$emit("getInstance", instance);
32948
- _this.captcha = instance;
33001
+ _this2.$emit("getInstance", instance);
33002
+ _this2.captcha = instance;
32949
33003
  } catch (error) {
32950
33004
  console.error('验证码实例绑定失败:', error);
32951
33005
  }
@@ -32971,7 +33025,7 @@ function AliyunCaptchaModalvue_type_template_id_283e7c5a_render(_ctx, _cache, $p
32971
33025
 
32972
33026
 
32973
33027
  ;
32974
- const AliyunCaptchaModal_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(AliyunCaptchaModalvue_type_script_lang_js, [['render',AliyunCaptchaModalvue_type_template_id_283e7c5a_render]])
33028
+ const AliyunCaptchaModal_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(AliyunCaptchaModalvue_type_script_lang_js, [['render',AliyunCaptchaModalvue_type_template_id_1572512c_render]])
32975
33029
 
32976
33030
  /* harmony default export */ const AliyunCaptchaModal = (AliyunCaptchaModal_exports_);
32977
33031
  ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/verifyComponents.vue?vue&type=script&lang=js
@@ -33029,9 +33083,10 @@ const AliyunCaptchaModal_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)
33029
33083
  if (this.type === 'tencent') {
33030
33084
  this.$refs.TJCaptcha.getCaptchaAppid();
33031
33085
  } else if (this.type === 'alibaba') {
33032
- if (window.AliyunCaptcha) {
33086
+ if (typeof window.AliyunCaptcha !== 'undefined' && this.$refs.aliyunCaptcha.captcha) {
33033
33087
  this.$refs.aliyunCaptcha.captcha.show();
33034
33088
  } else {
33089
+ console.warn('阿里云验证码未加载,使用容错处理');
33035
33090
  var VerifyParam = {
33036
33091
  specialKey: true
33037
33092
  };
@@ -33061,7 +33116,7 @@ const AliyunCaptchaModal_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)
33061
33116
 
33062
33117
 
33063
33118
  ;
33064
- const verifyComponents_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(verifyComponentsvue_type_script_lang_js, [['render',verifyComponentsvue_type_template_id_5ed3cdce_render]])
33119
+ const verifyComponents_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(verifyComponentsvue_type_script_lang_js, [['render',verifyComponentsvue_type_template_id_7d804fae_render]])
33065
33120
 
33066
33121
  /* harmony default export */ const verifyComponents = (verifyComponents_exports_);
33067
33122
  ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.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
@@ -35246,12 +35301,42 @@ const userCenterLogin_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(us
35246
35301
 
35247
35302
 
35248
35303
 
35304
+ // 预加载验证码脚本(可选,用于提前加载)
35305
+ function loadCaptchaScripts() {
35306
+ // 加载腾讯验证码
35307
+ if (typeof window.TencentCaptcha === 'undefined') {
35308
+ var tencentScript = document.createElement('script');
35309
+ tencentScript.src = 'https://turing.captcha.qcloud.com/TJCaptcha.js';
35310
+ tencentScript.async = true;
35311
+ document.head.appendChild(tencentScript);
35312
+ }
35313
+
35314
+ // 加载阿里云验证码
35315
+ if (typeof window.AliyunCaptcha === 'undefined') {
35316
+ if (!window.AliyunCaptchaConfig) {
35317
+ window.AliyunCaptchaConfig = {
35318
+ region: 'cn',
35319
+ prefix: '106eu7'
35320
+ };
35321
+ }
35322
+ var aliyunScript = document.createElement('script');
35323
+ aliyunScript.src = 'https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js';
35324
+ aliyunScript.async = true;
35325
+ document.head.appendChild(aliyunScript);
35326
+ }
35327
+ }
35328
+
35249
35329
  // 导出组件
35250
35330
 
35251
35331
 
35252
35332
  // 添加 install 方法以支持 Vue.use()
35253
35333
  /* harmony default export */ const index = ({
35254
35334
  install: function install(app) {
35335
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
35336
+ // 自动加载验证码脚本(如果未手动禁用)
35337
+ if (options.loadCaptcha !== false) {
35338
+ loadCaptchaScripts();
35339
+ }
35255
35340
  app.component("userCenterCompleteInformation", userCenterCompleteInformation);
35256
35341
  app.component("userCenterLogin", userCenterLogin);
35257
35342
  }