From 18cd88872c5fcbcc94c6f259bbde27d18c495234 Mon Sep 17 00:00:00 2001 From: kele <1184860403@qq.com> Date: Wed, 9 Aug 2023 14:21:23 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=BF=AB?= =?UTF-8?q?=E6=8D=B7=E7=99=BB=E5=BD=95=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sheep/api/user.js | 8 + .../s-auth-modal/components/account-login.vue | 7 +- .../components/mp-authorization.vue | 145 ++++++++++++++++++ .../s-auth-modal/components/sms-login.vue | 6 +- .../s-auth-modal/components/sms-register.vue | 4 + .../components/s-auth-modal/s-auth-modal.vue | 134 +++++++++++++--- sheep/platform/provider/wechat/miniProgram.js | 51 ++++-- 7 files changed, 314 insertions(+), 41 deletions(-) create mode 100644 sheep/components/s-auth-modal/components/mp-authorization.vue diff --git a/sheep/api/user.js b/sheep/api/user.js index 5fe849e6..5cd9ae77 100644 --- a/sheep/api/user.js +++ b/sheep/api/user.js @@ -102,6 +102,14 @@ export default { }, }), + // 更新小程序信息 + updateMpUserInfo: (data) => + request({ + url: '/user/api/user/updateMpUserInfo', + method: 'POST', + data, + }), + // 第三方授权信息 thirdOauthInfo: () => request({ diff --git a/sheep/components/s-auth-modal/components/account-login.vue b/sheep/components/s-auth-modal/components/account-login.vue index 4d409428..7663204b 100644 --- a/sheep/components/s-auth-modal/components/account-login.vue +++ b/sheep/components/s-auth-modal/components/account-login.vue @@ -43,10 +43,6 @@ - - @@ -59,6 +55,8 @@ const accountLoginRef = ref(null); + const emits = defineEmits(['onConfirm']); + const props = defineProps({ agreeStatus: { type: Boolean, @@ -89,6 +87,7 @@ // 同意协议 if (!props.agreeStatus) { + emits('onConfirm', true) sheep.$helper.toast('请勾选同意'); return; } diff --git a/sheep/components/s-auth-modal/components/mp-authorization.vue b/sheep/components/s-auth-modal/components/mp-authorization.vue new file mode 100644 index 00000000..7c35144d --- /dev/null +++ b/sheep/components/s-auth-modal/components/mp-authorization.vue @@ -0,0 +1,145 @@ + + + + + + diff --git a/sheep/components/s-auth-modal/components/sms-login.vue b/sheep/components/s-auth-modal/components/sms-login.vue index 284d0da1..567866c5 100644 --- a/sheep/components/s-auth-modal/components/sms-login.vue +++ b/sheep/components/s-auth-modal/components/sms-login.vue @@ -55,8 +55,6 @@ - - @@ -65,10 +63,11 @@ import sheep from '@/sheep'; import { code, mobile } from '@/sheep/validate/form'; import { showAuthModal, closeAuthModal, getSmsCode, getSmsTimer } from '@/sheep/hooks/useModal'; - import throttle from '@/sheep/helper/throttle'; const smsLoginRef = ref(null); + const emits = defineEmits(['onConfirm']); + const props = defineProps({ agreeStatus: { type: Boolean, @@ -100,6 +99,7 @@ if (!validate) return; if (!props.agreeStatus) { + emits('onConfirm', true) sheep.$helper.toast('请勾选同意'); return; } diff --git a/sheep/components/s-auth-modal/components/sms-register.vue b/sheep/components/s-auth-modal/components/sms-register.vue index 8aaba46d..648102a2 100644 --- a/sheep/components/s-auth-modal/components/sms-register.vue +++ b/sheep/components/s-auth-modal/components/sms-register.vue @@ -80,8 +80,11 @@ }); const smsRegisterRef = ref(null); + const isLogin = computed(() => sheep.$store('user').isLogin); + const emits = defineEmits(['onConfirm']); + // 数据 const state = reactive({ isMobileEnd: false, // 手机号输入完毕 @@ -107,6 +110,7 @@ if (!validate) return; if (!props.agreeStatus) { + emits('onConfirm',true); sheep.$helper.toast('请勾选同意'); return; } diff --git a/sheep/components/s-auth-modal/s-auth-modal.vue b/sheep/components/s-auth-modal/s-auth-modal.vue index accb5ce8..ab3ef690 100644 --- a/sheep/components/s-auth-modal/s-auth-modal.vue +++ b/sheep/components/s-auth-modal/s-auth-modal.vue @@ -6,41 +6,56 @@ + @onConfirm="onConfirm" + /> - + + - + - + - + - + - + - + + + +