s-auth-modal.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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. const getPhoneNumber = async (e) => {
  115. if (e.detail.errMsg !== "getPhoneNumber:ok") {
  116. sheep_index.sheep.$helper.toast("快捷登录失败");
  117. return;
  118. }
  119. let result = await sheep_index.sheep.$platform.useProvider().mobileLogin(e.detail);
  120. if (result) {
  121. sheep_hooks_useModal.closeAuthModal();
  122. }
  123. };
  124. return (_ctx, _cache) => {
  125. return common_vendor.e({
  126. a: ["smsLogin", "accountLogin", "register"].includes(authType.value)
  127. }, ["smsLogin", "accountLogin", "register"].includes(authType.value) ? common_vendor.e({
  128. b: common_vendor.n(isActive.value == "accountLogin" ? `head-title ss-m-r-40 head-title-animation` : `head-title-active ss-m-r-40`),
  129. c: common_vendor.o(($event) => {
  130. isActive.value = "accountLogin";
  131. common_vendor.unref(sheep_hooks_useModal.showAuthModal)("accountLogin", "accountLogin");
  132. }),
  133. 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`),
  134. e: common_vendor.o(($event) => {
  135. isActive.value = "smsLogin";
  136. common_vendor.unref(sheep_hooks_useModal.showAuthModal)("smsLogin", "smsLogin");
  137. }),
  138. f: common_vendor.unref(linkId)
  139. }, common_vendor.unref(linkId) ? {
  140. g: common_vendor.n(isActive.value == "register" ? `head-title head-title-line head-title-animation` : `head-title-active head-title-line`),
  141. h: common_vendor.o(($event) => {
  142. isActive.value = "register";
  143. common_vendor.unref(sheep_hooks_useModal.showAuthModal)("register", "register");
  144. })
  145. } : {}) : {}, {
  146. i: ["smsLogin", "accountLogin", "register"].includes(authType.value)
  147. }, ["smsLogin", "accountLogin", "register"].includes(authType.value) ? {
  148. j: state.protocol,
  149. k: common_vendor.o(onChange),
  150. l: common_vendor.o(($event) => onProtocol("用户协议")),
  151. m: common_vendor.o(($event) => onProtocol("隐私协议")),
  152. n: common_vendor.o(onChange),
  153. o: currentProtocol.value ? 1 : ""
  154. } : {}, {
  155. p: ["accountLogin", "smsLogin"].includes(authType.value)
  156. }, ["accountLogin", "smsLogin"].includes(authType.value) ? common_vendor.e({
  157. q: ["WechatOfficialAccount", "WechatMiniProgram", "App"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) && common_vendor.unref(sheep_index.sheep).$platform.isWechatInstalled
  158. }, ["WechatOfficialAccount", "WechatMiniProgram", "App"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) && common_vendor.unref(sheep_index.sheep).$platform.isWechatInstalled ? {
  159. r: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/wechat.png"),
  160. s: common_vendor.o(($event) => thirdLogin("wechat"))
  161. } : {}) : {}, {
  162. t: ["register"].includes(authType.value)
  163. }, ["register"].includes(authType.value) ? common_vendor.e({
  164. v: ["WechatOfficialAccount", "WechatMiniProgram", "App"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) && common_vendor.unref(sheep_index.sheep).$platform.isWechatInstalled
  165. }, ["WechatOfficialAccount", "WechatMiniProgram", "App"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) && common_vendor.unref(sheep_index.sheep).$platform.isWechatInstalled ? {
  166. w: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/wechat.png"),
  167. x: common_vendor.o(($event) => thirdRegister("wechat"))
  168. } : {}) : {}, {
  169. y: authType.value === "officialAccountFirstLogin"
  170. }, authType.value === "officialAccountFirstLogin" ? {
  171. z: common_vendor.o(onConfirm),
  172. A: common_vendor.p({
  173. agreeStatus: state.protocol
  174. })
  175. } : {}, {
  176. B: authType.value === "accountLogin"
  177. }, authType.value === "accountLogin" ? {
  178. C: common_vendor.o(onConfirm),
  179. D: common_vendor.p({
  180. agreeStatus: state.protocol
  181. })
  182. } : {}, {
  183. E: authType.value === "smsLogin"
  184. }, authType.value === "smsLogin" ? {
  185. F: common_vendor.o(onConfirm),
  186. G: common_vendor.p({
  187. agreeStatus: state.protocol
  188. })
  189. } : {}, {
  190. H: authType.value === "register"
  191. }, authType.value === "register" ? {
  192. I: common_vendor.o(onConfirm),
  193. J: common_vendor.p({
  194. agreeStatus: state.protocol
  195. })
  196. } : {}, {
  197. K: authType.value === "resetPassword"
  198. }, authType.value === "resetPassword" ? {} : {}, {
  199. L: authType.value === "changeMobile"
  200. }, authType.value === "changeMobile" ? {} : {}, {
  201. M: authType.value === "changePassword"
  202. }, authType.value === "changePassword" ? {} : {}, {
  203. N: authType.value === "mpAuthorization"
  204. }, authType.value === "mpAuthorization" ? {} : {}, {
  205. O: ["accountLogin", "smsLogin"].includes(authType.value)
  206. }, ["accountLogin", "smsLogin"].includes(authType.value) ? common_vendor.e({
  207. P: common_vendor.unref(sheep_index.sheep).$platform.name === "WechatMiniProgram"
  208. }, common_vendor.unref(sheep_index.sheep).$platform.name === "WechatMiniProgram" ? {
  209. Q: common_vendor.o(getPhoneNumber)
  210. } : {}, {
  211. R: common_vendor.unref(sheep_index.sheep).$platform.os === "ios" && common_vendor.unref(sheep_index.sheep).$platform.name === "App"
  212. }, common_vendor.unref(sheep_index.sheep).$platform.os === "ios" && common_vendor.unref(sheep_index.sheep).$platform.name === "App" ? {
  213. S: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/apple.png"),
  214. T: common_vendor.o(($event) => thirdLogin("apple"))
  215. } : {}) : {}, {
  216. U: common_vendor.o(common_vendor.unref(sheep_hooks_useModal.closeAuthModal)),
  217. V: common_vendor.p({
  218. show: authType.value !== "",
  219. round: "10",
  220. showClose: true
  221. })
  222. });
  223. };
  224. }
  225. };
  226. 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"]]);
  227. wx.createComponent(Component);