s-auth-modal.js 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. require("../../api/member/signin.js");
  36. if (!Array) {
  37. const _easycom_su_popup2 = common_vendor.resolveComponent("su-popup");
  38. _easycom_su_popup2();
  39. }
  40. const _easycom_su_popup = () => "../../ui/su-popup/su-popup.js";
  41. if (!Math) {
  42. (common_vendor.unref(officialAccountFirstLogin) + accountLogin + smsLogin + register + resetPassword + changeMobile + changePassword + mpAuthorization + _easycom_su_popup)();
  43. }
  44. const accountLogin = () => "./components/account-login.js";
  45. const smsLogin = () => "./components/sms-login.js";
  46. const register = () => "./components/register.js";
  47. const resetPassword = () => "./components/reset-password.js";
  48. const changeMobile = () => "./components/change-mobile.js";
  49. const changePassword = () => "./components/change-password.js";
  50. const mpAuthorization = () => "./components/mp-authorization.js";
  51. const officialAccountFirstLogin = () => "./components/officialAccountFirstLogin.js";
  52. const _sfc_main = {
  53. __name: "s-auth-modal",
  54. setup(__props) {
  55. common_vendor.computed(() => sheep_index.sheep.$store("app").info);
  56. const linkId = common_vendor.index.getStorageSync("linkId");
  57. const modalStore = sheep_index.sheep.$store("modal");
  58. const authType = common_vendor.computed(() => modalStore.auth);
  59. const isActive = common_vendor.computed(() => modalStore.isActive);
  60. const state = common_vendor.reactive({
  61. protocol: false
  62. });
  63. const currentProtocol = common_vendor.ref(false);
  64. function onChange() {
  65. state.protocol = !state.protocol;
  66. }
  67. function onProtocol(title) {
  68. sheep_hooks_useModal.closeAuthModal();
  69. sheep_index.sheep.$router.go("/pages/public/richtext", {
  70. title
  71. });
  72. }
  73. function onConfirm(e) {
  74. currentProtocol.value = e;
  75. setTimeout(() => {
  76. currentProtocol.value = false;
  77. }, 1e3);
  78. }
  79. const thirdLogin = async (provider) => {
  80. if (!state.protocol) {
  81. currentProtocol.value = true;
  82. setTimeout(() => {
  83. currentProtocol.value = false;
  84. }, 1e3);
  85. sheep_index.sheep.$helper.toast("请勾选同意");
  86. return;
  87. }
  88. const loginRes = await sheep_index.sheep.$platform.useProvider(provider).login();
  89. if (loginRes) {
  90. sheep_hooks_useModal.closeAuthModal();
  91. sheep_hooks_useModal.showAuthModal("mpAuthorization");
  92. }
  93. };
  94. const thirdRegister = async (provider) => {
  95. if (!state.protocol) {
  96. currentProtocol.value = true;
  97. setTimeout(() => {
  98. currentProtocol.value = false;
  99. }, 1e3);
  100. sheep_index.sheep.$helper.toast("请勾选同意");
  101. return;
  102. }
  103. const linkId2 = common_vendor.index.getStorageSync("linkId");
  104. if (!linkId2) {
  105. sheep_index.sheep.$helper.toast("您只能通过分享注册");
  106. return false;
  107. }
  108. const loginRes = await sheep_index.sheep.$platform.useProvider(provider).register();
  109. if (loginRes) {
  110. sheep_hooks_useModal.closeAuthModal();
  111. sheep_hooks_useModal.showAuthModal("mpAuthorization");
  112. }
  113. };
  114. return (_ctx, _cache) => {
  115. return common_vendor.e({
  116. a: ["smsLogin", "accountLogin", "register"].includes(authType.value)
  117. }, ["smsLogin", "accountLogin", "register"].includes(authType.value) ? common_vendor.e({
  118. b: common_vendor.n(isActive.value == "accountLogin" ? `head-title ss-m-r-40 head-title-animation` : `head-title-active ss-m-r-40`),
  119. c: common_vendor.o(($event) => {
  120. isActive.value = "accountLogin";
  121. common_vendor.unref(sheep_hooks_useModal.showAuthModal)("accountLogin", "accountLogin");
  122. }),
  123. d: common_vendor.n(isActive.value == "smsLogin" ? `head-title head-title-line head-title-animation ss-m-r-40` : ` ss-m-r-40 head-title-active head-title-line`),
  124. e: common_vendor.o(($event) => {
  125. isActive.value = "smsLogin";
  126. common_vendor.unref(sheep_hooks_useModal.showAuthModal)("smsLogin", "smsLogin");
  127. }),
  128. f: common_vendor.unref(linkId)
  129. }, common_vendor.unref(linkId) ? {
  130. g: common_vendor.n(isActive.value == "register" ? `head-title head-title-line head-title-animation` : `head-title-active head-title-line`),
  131. h: common_vendor.o(($event) => {
  132. isActive.value = "register";
  133. common_vendor.unref(sheep_hooks_useModal.showAuthModal)("register", "register");
  134. })
  135. } : {}) : {}, {
  136. i: ["smsLogin", "accountLogin", "register"].includes(authType.value)
  137. }, ["smsLogin", "accountLogin", "register"].includes(authType.value) ? {
  138. j: state.protocol,
  139. k: common_vendor.o(onChange),
  140. l: common_vendor.o(($event) => onProtocol("用户协议")),
  141. m: common_vendor.o(($event) => onProtocol("隐私协议")),
  142. n: common_vendor.o(onChange),
  143. o: currentProtocol.value ? 1 : ""
  144. } : {}, {
  145. p: ["accountLogin", "smsLogin"].includes(authType.value)
  146. }, ["accountLogin", "smsLogin"].includes(authType.value) ? common_vendor.e({
  147. q: ["WechatOfficialAccount", "WechatMiniProgram", "App"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) && common_vendor.unref(sheep_index.sheep).$platform.isWechatInstalled
  148. }, ["WechatOfficialAccount", "WechatMiniProgram", "App"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) && common_vendor.unref(sheep_index.sheep).$platform.isWechatInstalled ? {
  149. r: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/wechat.png"),
  150. s: common_vendor.o(($event) => thirdLogin("wechat"))
  151. } : {}) : {}, {
  152. t: ["register"].includes(authType.value)
  153. }, ["register"].includes(authType.value) ? common_vendor.e({
  154. v: ["WechatOfficialAccount", "WechatMiniProgram", "App"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) && common_vendor.unref(sheep_index.sheep).$platform.isWechatInstalled
  155. }, ["WechatOfficialAccount", "WechatMiniProgram", "App"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) && common_vendor.unref(sheep_index.sheep).$platform.isWechatInstalled ? {
  156. w: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/wechat.png"),
  157. x: common_vendor.o(($event) => thirdRegister("wechat"))
  158. } : {}) : {}, {
  159. y: authType.value === "officialAccountFirstLogin"
  160. }, authType.value === "officialAccountFirstLogin" ? {
  161. z: common_vendor.o(onConfirm),
  162. A: common_vendor.p({
  163. agreeStatus: state.protocol
  164. })
  165. } : {}, {
  166. B: authType.value === "accountLogin"
  167. }, authType.value === "accountLogin" ? {
  168. C: common_vendor.o(onConfirm),
  169. D: common_vendor.p({
  170. agreeStatus: state.protocol
  171. })
  172. } : {}, {
  173. E: authType.value === "smsLogin"
  174. }, authType.value === "smsLogin" ? {
  175. F: common_vendor.o(onConfirm),
  176. G: common_vendor.p({
  177. agreeStatus: state.protocol
  178. })
  179. } : {}, {
  180. H: authType.value === "register"
  181. }, authType.value === "register" ? {
  182. I: common_vendor.o(onConfirm),
  183. J: common_vendor.p({
  184. agreeStatus: state.protocol
  185. })
  186. } : {}, {
  187. K: authType.value === "resetPassword"
  188. }, authType.value === "resetPassword" ? {} : {}, {
  189. L: authType.value === "changeMobile"
  190. }, authType.value === "changeMobile" ? {} : {}, {
  191. M: authType.value === "changePassword"
  192. }, authType.value === "changePassword" ? {} : {}, {
  193. N: authType.value === "mpAuthorization"
  194. }, authType.value === "mpAuthorization" ? {} : {}, {
  195. O: common_vendor.o(common_vendor.unref(sheep_hooks_useModal.closeAuthModal)),
  196. P: common_vendor.p({
  197. show: authType.value !== "",
  198. round: "10",
  199. showClose: true
  200. })
  201. });
  202. };
  203. }
  204. };
  205. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-21181321"], ["__file", "D:/zx/mall-front-app/sheep/components/s-auth-modal/s-auth-modal.vue"]]);
  206. wx.createComponent(Component);