s-auth-modal.js 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const sheep_index = require("../../index.js");
  4. const sheep_hooks_useModal = require("../../hooks/useModal.js");
  5. require("../../url/index.js");
  6. require("../../store/index.js");
  7. require("../../store/app.js");
  8. require("../../api/promotion/diy.js");
  9. require("../../request/index.js");
  10. require("../../config/index.js");
  11. require("../../platform/index.js");
  12. require("../../platform/provider/wechat/index.js");
  13. require("../../platform/provider/wechat/miniProgram.js");
  14. require("../../api/member/auth.js");
  15. require("../../api/member/social.js");
  16. require("../../api/member/user.js");
  17. require("../../platform/provider/apple/index.js");
  18. require("../../platform/share.js");
  19. require("../../router/index.js");
  20. require("../../helper/throttle.js");
  21. require("../../platform/pay.js");
  22. require("../../helper/index.js");
  23. require("../../helper/test.js");
  24. require("../../helper/digit.js");
  25. require("../../api/pay/order.js");
  26. require("../../store/user.js");
  27. require("../../store/cart.js");
  28. require("../../api/trade/cart.js");
  29. require("../../api/pay/wallet.js");
  30. require("../../api/trade/order.js");
  31. require("../../api/promotion/coupon.js");
  32. require("../../store/sys.js");
  33. require("../../store/modal.js");
  34. require("../../config/zIndex.js");
  35. if (!Array) {
  36. const _easycom_su_popup2 = common_vendor.resolveComponent("su-popup");
  37. _easycom_su_popup2();
  38. }
  39. const _easycom_su_popup = () => "../../ui/su-popup/su-popup.js";
  40. if (!Math) {
  41. (accountLogin + smsLogin + resetPassword + changeMobile + changePassword + mpAuthorization + _easycom_su_popup)();
  42. }
  43. const accountLogin = () => "./components/account-login.js";
  44. const smsLogin = () => "./components/sms-login.js";
  45. const resetPassword = () => "./components/reset-password.js";
  46. const changeMobile = () => "./components/change-mobile.js";
  47. const changePassword = () => "./components/change-password.js";
  48. const mpAuthorization = () => "./components/mp-authorization.js";
  49. const _sfc_main = {
  50. __name: "s-auth-modal",
  51. setup(__props) {
  52. common_vendor.computed(() => sheep_index.sheep.$store("app").info);
  53. const modalStore = sheep_index.sheep.$store("modal");
  54. const authType = common_vendor.computed(() => modalStore.auth);
  55. const state = common_vendor.reactive({
  56. protocol: false
  57. });
  58. const currentProtocol = common_vendor.ref(false);
  59. function onChange() {
  60. state.protocol = !state.protocol;
  61. }
  62. function onProtocol(title) {
  63. sheep_hooks_useModal.closeAuthModal();
  64. sheep_index.sheep.$router.go("/pages/public/richtext", {
  65. title
  66. });
  67. }
  68. function onConfirm(e) {
  69. currentProtocol.value = e;
  70. setTimeout(() => {
  71. currentProtocol.value = false;
  72. }, 1e3);
  73. }
  74. const thirdLogin = async (provider) => {
  75. if (!state.protocol) {
  76. currentProtocol.value = true;
  77. setTimeout(() => {
  78. currentProtocol.value = false;
  79. }, 1e3);
  80. sheep_index.sheep.$helper.toast("请勾选同意");
  81. return;
  82. }
  83. const loginRes = await sheep_index.sheep.$platform.useProvider(provider).login();
  84. if (loginRes) {
  85. sheep_hooks_useModal.closeAuthModal();
  86. sheep_hooks_useModal.showAuthModal("mpAuthorization");
  87. }
  88. };
  89. const getPhoneNumber = async (e) => {
  90. if (e.detail.errMsg !== "getPhoneNumber:ok") {
  91. sheep_index.sheep.$helper.toast("快捷登录失败");
  92. return;
  93. }
  94. let result = await sheep_index.sheep.$platform.useProvider().mobileLogin(e.detail);
  95. if (result) {
  96. sheep_hooks_useModal.closeAuthModal();
  97. }
  98. };
  99. return (_ctx, _cache) => {
  100. return common_vendor.e({
  101. a: common_vendor.unref(authType) === "accountLogin"
  102. }, common_vendor.unref(authType) === "accountLogin" ? {
  103. b: common_vendor.o(onConfirm),
  104. c: common_vendor.p({
  105. agreeStatus: state.protocol
  106. })
  107. } : {}, {
  108. d: common_vendor.unref(authType) === "smsLogin"
  109. }, common_vendor.unref(authType) === "smsLogin" ? {
  110. e: common_vendor.o(onConfirm),
  111. f: common_vendor.p({
  112. agreeStatus: state.protocol
  113. })
  114. } : {}, {
  115. g: common_vendor.unref(authType) === "resetPassword"
  116. }, common_vendor.unref(authType) === "resetPassword" ? {} : {}, {
  117. h: common_vendor.unref(authType) === "changeMobile"
  118. }, common_vendor.unref(authType) === "changeMobile" ? {} : {}, {
  119. i: common_vendor.unref(authType) === "changePassword"
  120. }, common_vendor.unref(authType) === "changePassword" ? {} : {}, {
  121. j: common_vendor.unref(authType) === "mpAuthorization"
  122. }, common_vendor.unref(authType) === "mpAuthorization" ? {} : {}, {
  123. k: ["accountLogin", "smsLogin"].includes(common_vendor.unref(authType))
  124. }, ["accountLogin", "smsLogin"].includes(common_vendor.unref(authType)) ? common_vendor.e({
  125. l: common_vendor.unref(sheep_index.sheep).$platform.name === "WechatMiniProgram"
  126. }, common_vendor.unref(sheep_index.sheep).$platform.name === "WechatMiniProgram" ? {
  127. m: common_vendor.o(getPhoneNumber)
  128. } : {}, {
  129. n: ["WechatOfficialAccount", "WechatMiniProgram", "App"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) && common_vendor.unref(sheep_index.sheep).$platform.isWechatInstalled
  130. }, ["WechatOfficialAccount", "WechatMiniProgram", "App"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) && common_vendor.unref(sheep_index.sheep).$platform.isWechatInstalled ? {
  131. o: common_vendor.unref(sheep_index.sheep).$url.static("/static/img/shop/platform/wechat.png"),
  132. p: common_vendor.o(($event) => thirdLogin("wechat"))
  133. } : {}, {
  134. q: common_vendor.unref(sheep_index.sheep).$platform.os === "ios" && common_vendor.unref(sheep_index.sheep).$platform.name === "App"
  135. }, common_vendor.unref(sheep_index.sheep).$platform.os === "ios" && common_vendor.unref(sheep_index.sheep).$platform.name === "App" ? {
  136. r: common_vendor.unref(sheep_index.sheep).$url.static("/static/img/shop/platform/apple.png"),
  137. s: common_vendor.o(($event) => thirdLogin("apple"))
  138. } : {}) : {}, {
  139. t: ["accountLogin", "smsLogin"].includes(common_vendor.unref(authType))
  140. }, ["accountLogin", "smsLogin"].includes(common_vendor.unref(authType)) ? {
  141. v: state.protocol,
  142. w: common_vendor.o(onChange),
  143. x: common_vendor.o(($event) => onProtocol("用户协议")),
  144. y: common_vendor.o(($event) => onProtocol("隐私协议")),
  145. z: common_vendor.o(onChange),
  146. A: currentProtocol.value ? 1 : ""
  147. } : {}, {
  148. B: common_vendor.o(common_vendor.unref(sheep_hooks_useModal.closeAuthModal)),
  149. C: common_vendor.p({
  150. show: common_vendor.unref(authType) !== "",
  151. round: "10",
  152. showClose: true
  153. })
  154. });
  155. };
  156. }
  157. };
  158. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-21181321"], ["__file", "E:/GAOHP_2023/mall/newfeifan-front/yudao-mall-uniapp/mall-newfeifan-zx-app/sheep/components/s-auth-modal/s-auth-modal.vue"]]);
  159. wx.createComponent(Component);