s-auth-modal.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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("../../api/index.js");
  6. require("../../api/distri/score.js");
  7. require("../../request/index.js");
  8. require("../../config/index.js");
  9. require("../../store/index.js");
  10. require("../../store/app.js");
  11. require("../../api/promotion/diy.js");
  12. require("../../platform/index.js");
  13. require("../../platform/provider/wechat/index.js");
  14. require("../../platform/provider/wechat/miniProgram.js");
  15. require("../../api/member/auth.js");
  16. require("../../api/member/social.js");
  17. require("../../api/member/user.js");
  18. require("../../platform/provider/apple/index.js");
  19. require("../../platform/share.js");
  20. require("../../router/index.js");
  21. require("../../helper/throttle.js");
  22. require("../../url/index.js");
  23. require("../../platform/pay.js");
  24. require("../../helper/index.js");
  25. require("../../helper/test.js");
  26. require("../../helper/digit.js");
  27. require("../../api/pay/order.js");
  28. require("../../store/user.js");
  29. require("../../store/cart.js");
  30. require("../../api/trade/cart.js");
  31. require("../../api/pay/wallet.js");
  32. require("../../api/trade/order.js");
  33. require("../../api/promotion/coupon.js");
  34. require("../../store/sys.js");
  35. require("../../store/modal.js");
  36. require("../../api/distri/share.js");
  37. require("../../api/distri/team.js");
  38. require("../../api/infra/file.js");
  39. require("../../api/member/address.js");
  40. require("../../api/member/point.js");
  41. require("../../api/member/signin.js");
  42. require("../../api/migration/app.js");
  43. require("../../api/migration/chat.js");
  44. require("../../api/migration/index.js");
  45. require("../../api/migration/third.js");
  46. require("../../api/pay/channel.js");
  47. require("../../api/product/category.js");
  48. require("../../api/product/comment.js");
  49. require("../../api/product/favorite.js");
  50. require("../../api/product/history.js");
  51. require("../../api/product/spu.js");
  52. require("../../api/promotion/activity.js");
  53. require("../../api/promotion/article.js");
  54. require("../../api/promotion/bargain.js");
  55. require("../../api/promotion/combination.js");
  56. require("../../api/promotion/rewardActivity.js");
  57. require("../../api/promotion/seckill.js");
  58. require("../../api/system/area.js");
  59. require("../../api/system/voice.js");
  60. require("../../api/trade/afterSale.js");
  61. require("../../api/trade/brokerage.js");
  62. require("../../api/trade/config.js");
  63. require("../../api/trade/delivery.js");
  64. require("../../config/zIndex.js");
  65. if (!Array) {
  66. const _easycom_su_popup2 = common_vendor.resolveComponent("su-popup");
  67. _easycom_su_popup2();
  68. }
  69. const _easycom_su_popup = () => "../../ui/su-popup/su-popup.js";
  70. if (!Math) {
  71. (common_vendor.unref(officialAccountFirstLogin) + accountLogin + smsLogin + register + resetPassword + changeMobile + changePassword + mpAuthorization + _easycom_su_popup)();
  72. }
  73. const accountLogin = () => "./components/account-login.js";
  74. const smsLogin = () => "./components/sms-login.js";
  75. const register = () => "./components/register.js";
  76. const resetPassword = () => "./components/reset-password.js";
  77. const changeMobile = () => "./components/change-mobile.js";
  78. const changePassword = () => "./components/change-password.js";
  79. const mpAuthorization = () => "./components/mp-authorization.js";
  80. const officialAccountFirstLogin = () => "./components/officialAccountFirstLogin.js";
  81. const _sfc_main = {
  82. __name: "s-auth-modal",
  83. setup(__props) {
  84. common_vendor.computed(() => sheep_index.sheep.$store("app").info);
  85. const linkId = common_vendor.index.getStorageSync("linkId");
  86. const modalStore = sheep_index.sheep.$store("modal");
  87. const authType = common_vendor.computed(() => modalStore.auth);
  88. const isActive = common_vendor.computed(() => modalStore.isActive);
  89. const state = common_vendor.reactive({
  90. protocol: false
  91. });
  92. const currentProtocol = common_vendor.ref(false);
  93. function onChange() {
  94. state.protocol = !state.protocol;
  95. }
  96. function onProtocol(title) {
  97. sheep_hooks_useModal.closeAuthModal();
  98. sheep_index.sheep.$router.go("/pages/public/richtext", {
  99. title
  100. });
  101. }
  102. function onConfirm(e) {
  103. currentProtocol.value = e;
  104. setTimeout(() => {
  105. currentProtocol.value = false;
  106. }, 1e3);
  107. }
  108. const thirdLogin = async (provider) => {
  109. if (!state.protocol) {
  110. currentProtocol.value = true;
  111. setTimeout(() => {
  112. currentProtocol.value = false;
  113. }, 1e3);
  114. sheep_index.sheep.$helper.toast("请勾选同意");
  115. return;
  116. }
  117. const loginRes = await sheep_index.sheep.$platform.useProvider(provider).login();
  118. if (loginRes) {
  119. sheep_hooks_useModal.closeAuthModal();
  120. sheep_hooks_useModal.showAuthModal("mpAuthorization");
  121. }
  122. };
  123. const thirdRegister = async (provider) => {
  124. if (!state.protocol) {
  125. currentProtocol.value = true;
  126. setTimeout(() => {
  127. currentProtocol.value = false;
  128. }, 1e3);
  129. sheep_index.sheep.$helper.toast("请勾选同意");
  130. return;
  131. }
  132. const linkId2 = common_vendor.index.getStorageSync("linkId");
  133. if (!linkId2) {
  134. sheep_index.sheep.$helper.toast("您只能通过分享注册");
  135. return false;
  136. }
  137. const loginRes = await sheep_index.sheep.$platform.useProvider(provider).register();
  138. if (loginRes) {
  139. sheep_hooks_useModal.closeAuthModal();
  140. sheep_hooks_useModal.showAuthModal("mpAuthorization");
  141. }
  142. };
  143. return (_ctx, _cache) => {
  144. return common_vendor.e({
  145. a: ["smsLogin", "accountLogin", "register"].includes(authType.value)
  146. }, ["smsLogin", "accountLogin", "register"].includes(authType.value) ? common_vendor.e({
  147. b: common_vendor.n(isActive.value == "accountLogin" ? `head-title ss-m-r-40 head-title-animation` : `head-title-active ss-m-r-40`),
  148. c: common_vendor.o(($event) => {
  149. isActive.value = "accountLogin";
  150. common_vendor.unref(sheep_hooks_useModal.showAuthModal)("accountLogin", "accountLogin");
  151. }),
  152. 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`),
  153. e: common_vendor.o(($event) => {
  154. isActive.value = "smsLogin";
  155. common_vendor.unref(sheep_hooks_useModal.showAuthModal)("smsLogin", "smsLogin");
  156. }),
  157. f: common_vendor.unref(linkId)
  158. }, common_vendor.unref(linkId) ? {
  159. g: common_vendor.n(isActive.value == "register" ? `head-title head-title-line head-title-animation` : `head-title-active head-title-line`),
  160. h: common_vendor.o(($event) => {
  161. isActive.value = "register";
  162. common_vendor.unref(sheep_hooks_useModal.showAuthModal)("register", "register");
  163. })
  164. } : {}) : {}, {
  165. i: ["smsLogin", "accountLogin", "register"].includes(authType.value)
  166. }, ["smsLogin", "accountLogin", "register"].includes(authType.value) ? {
  167. j: state.protocol,
  168. k: common_vendor.o(onChange),
  169. l: common_vendor.o(($event) => onProtocol("用户协议")),
  170. m: common_vendor.o(($event) => onProtocol("隐私协议")),
  171. n: common_vendor.o(onChange),
  172. o: currentProtocol.value ? 1 : ""
  173. } : {}, {
  174. p: ["accountLogin", "smsLogin"].includes(authType.value)
  175. }, ["accountLogin", "smsLogin"].includes(authType.value) ? common_vendor.e({
  176. q: ["WechatOfficialAccount", "WechatMiniProgram", "App"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) && common_vendor.unref(sheep_index.sheep).$platform.isWechatInstalled
  177. }, ["WechatOfficialAccount", "WechatMiniProgram", "App"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) && common_vendor.unref(sheep_index.sheep).$platform.isWechatInstalled ? {
  178. r: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/wechat.png"),
  179. s: common_vendor.o(($event) => thirdLogin("wechat"))
  180. } : {}) : {}, {
  181. t: ["register"].includes(authType.value)
  182. }, ["register"].includes(authType.value) ? common_vendor.e({
  183. v: ["WechatOfficialAccount", "WechatMiniProgram", "App"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) && common_vendor.unref(sheep_index.sheep).$platform.isWechatInstalled
  184. }, ["WechatOfficialAccount", "WechatMiniProgram", "App"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) && common_vendor.unref(sheep_index.sheep).$platform.isWechatInstalled ? {
  185. w: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/wechat.png"),
  186. x: common_vendor.o(($event) => thirdRegister("wechat"))
  187. } : {}) : {}, {
  188. y: authType.value === "officialAccountFirstLogin"
  189. }, authType.value === "officialAccountFirstLogin" ? {
  190. z: common_vendor.o(onConfirm),
  191. A: common_vendor.p({
  192. agreeStatus: state.protocol
  193. })
  194. } : {}, {
  195. B: authType.value === "accountLogin"
  196. }, authType.value === "accountLogin" ? {
  197. C: common_vendor.o(onConfirm),
  198. D: common_vendor.p({
  199. agreeStatus: state.protocol
  200. })
  201. } : {}, {
  202. E: authType.value === "smsLogin"
  203. }, authType.value === "smsLogin" ? {
  204. F: common_vendor.o(onConfirm),
  205. G: common_vendor.p({
  206. agreeStatus: state.protocol
  207. })
  208. } : {}, {
  209. H: authType.value === "register"
  210. }, authType.value === "register" ? {
  211. I: common_vendor.o(onConfirm),
  212. J: common_vendor.p({
  213. agreeStatus: state.protocol
  214. })
  215. } : {}, {
  216. K: authType.value === "resetPassword"
  217. }, authType.value === "resetPassword" ? {} : {}, {
  218. L: authType.value === "changeMobile"
  219. }, authType.value === "changeMobile" ? {} : {}, {
  220. M: authType.value === "changePassword"
  221. }, authType.value === "changePassword" ? {} : {}, {
  222. N: authType.value === "mpAuthorization"
  223. }, authType.value === "mpAuthorization" ? {} : {}, {
  224. O: common_vendor.o(common_vendor.unref(sheep_hooks_useModal.closeAuthModal)),
  225. P: common_vendor.p({
  226. show: authType.value !== "",
  227. round: "10",
  228. showClose: true
  229. })
  230. });
  231. };
  232. }
  233. };
  234. 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"]]);
  235. wx.createComponent(Component);