123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324 |
- <template>
- <view class="login-register" v-if="userStore.showLoginModal">
- <div class="lr-box" v-if="!userStore.isRegister">
- <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/c79318ee-e219-4f01-9dfb-91d7180a0972.png" class="lr-box-topbg" mode="widthFix"></image>
- <div class="lr-box-top adfacjb">
- <image class="lr-box-top-left" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/64d76db1-be28-4ba2-a8f0-57e2408beebc.png"></image>
- <image class="lr-box-top-right" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/c3c4fa76-32d2-4d11-915d-5e655c6b5c72.png" @tap="close"></image>
- </div>
- <div class="lr-box-title">
- <p class="p">欢迎来到善行少年</p>
- <p class="p tip">首次登录需要简单填写信息即可进入</p>
- </div>
- <div class="lr-box-form">
- <div class="lr-box-form-item adfacjb">
- <div class="lr-box-form-item-left adfac">
- <div class="text" style="margin-right: 32rpx;"><span style="color: #F4657A;">*</span>手机号码</div>
- <up-input v-model="register.phone" border="none" placeholder="请输入手机号码"></up-input>
- </div>
- <div class="lr-box-form-item-right">
- <button class="yjsq" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">一键授权</button>
- </div>
- </div>
- <div class="lr-box-form-item adfacjb">
- <div class="lr-box-form-item-left adfac">
- <div class="text"><span style="color: #F4657A;">*</span>头像</div>
- <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/a2944f51-2c7b-41e7-8206-8a3be1f76d11.png" v-if="!register.avatar"></image>
- <image :src="register.avatar"></image>
- </div>
- <div class="lr-box-form-item-right">
- <button class="yjsq" open-type="chooseAvatar" @bindchooseavatar="onChooseAvatar">设置</button>
- </div>
- </div>
- <div class="lr-box-form-item adfacjb">
- <div class="lr-box-form-item-left">
- <div class="text"><span style="color: #F4657A;">*</span>用户名</div>
- </div>
- <div class="lr-box-form-item-right">
- <up-input v-model="register.userName" border="none" inputAlign="right" placeholder="请输入真实姓名"></up-input>
- </div>
- </div>
- <div class="lr-box-form-item adfacjb">
- <div class="lr-box-form-item-left">
- <div class="text">家庭公益名称</div>
- </div>
- <div class="lr-box-form-item-right">
- <up-input v-model="register.nonprofitName" border="none" inputAlign="right" placeholder="请输入至少三个字"></up-input>
- </div>
- </div>
- <div class="lr-box-form-item adfacjb">
- <div class="lr-box-form-item-left">
- <div class="text">家庭公益口号</div>
- </div>
- <div class="lr-box-form-item-right">
- <up-input v-model="register.nonprofitNumber" border="none" inputAlign="right" placeholder="家庭公益口号"></up-input>
- </div>
- </div>
- </div>
- <div class="lr-box-btns">
- <div class="btn" @tap="toRegister">立即注册</div>
- <div class="btn login" @tap="readLogin">已有账号,去登录</div>
- </div>
- </div>
- <div class="lr-box login" v-else>
- <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/c79318ee-e219-4f01-9dfb-91d7180a0972.png" class="lr-box-topbg" mode="widthFix"></image>
- <div class="lr-box-top login adfacjb">
- <image class="lr-box-top-left login" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/d0f892c8-1f96-4c86-b62b-a8b027b4bf6e.png"></image>
- <image class="lr-box-top-right" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/c3c4fa76-32d2-4d11-915d-5e655c6b5c72.png" @tap="close"></image>
- </div>
- <div class="lr-box-memo">公益献爱心 真情暖人心!</div>
- <div class="lr-box-agree adfac">
- <image v-if="agree" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/87b5b244-d14f-43cd-991b-4ac9f48d909e.png" @tap="changeAgree"></image>
- <image v-else src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/b8a5cabd-57f8-4ad7-9677-f6372423c50a.png" @tap="changeAgree"></image>
- <div class="text">我已阅读并同意<span>《善行少年小程序隐私政策》</span>及<span>《善行少年服务协议》</span></div>
- </div>
- <div class="lr-box-login">
- <button class="phone-login" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumberLogin">手机号登录</button>
- </div>
- </div>
- </view>
- </template>
- <script setup name="">
- import { ref, getCurrentInstance } from 'vue'
- const { proxy } = getCurrentInstance()
- import { useUserStore } from '@/common/stores/user.js';
- const userStore = useUserStore();
-
- const register = ref({
- phone:null,
- avatar:null,
- userName:null,
- nonprofitName:null,
- nonprofitNumber:null,
- })
- const agree = ref(false)
-
- const close = () => {
- userStore.closeLoginModal();
- }
-
- const decryptPhoneNumber = e => {
- if(e.detail.code) getPhone(e.detail.code);
- }
-
- const onChooseAvatar = e => {
-
- }
-
- const getPhone = code => {
-
- }
-
- const toRegister = () => {
- if(!proxy.$reg.mobile(register.value.phone)) return proxy.$showToast('请输入正确的手机号码')
- if(!register.value.avatar) return proxy.$showToast('请设置头像')
- if(!register.value.userName) return proxy.$showToast('请输入真实姓名')
-
- userStore.register();
- }
-
- const readLogin = () => {
- userStore.isRegister = true;
- }
-
- const changeAgree = () => {
- agree.value = !agree.value;
- }
-
-
- const decryptPhoneNumberLogin = e => {
- if(e.detail.code) toPhoneLogin(e.detail.code);
- }
-
- const toPhoneLogin = code => {
- if(!agree.value) return proxy.$showToast('请勾选隐私政策和服务协议')
- userStore.login({});
- }
- </script>
- <style scoped lang="scss">
- .login-register{
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: rgba(0, 0, 0, .4);
- z-index: 9999;
- display: flex;
- flex-direction: column;
- justify-content: flex-end;
- .lr-box{
- background: #F7F7F7;
- border-radius: 24rpx 24rpx 0rpx 0rpx;
- padding: 58rpx 30rpx 68rpx;
- position: relative;
- &.login{
- padding: 32rpx 40rpx 88rpx;
- }
- &-topbg{
- width: 100%;
- position: absolute;
- left: 0;
- top: 0;
- }
- &-top{
- position: relative;
- padding: 0 10rpx 0 34rpx;
- &.login{
- padding: 0;
- }
- &-left{
- width: 158rpx;
- height: 88rpx;
- &.login{
- width: 224rpx;
- height: 48rpx;
- }
- }
- &-right{
- width: 28rpx;
- height: 28rpx;
- }
- }
- &-title{
- position: relative;
- margin-top: 18rpx;
- padding-left: 34rpx;
- .p{
- font-family: PingFangSC, PingFang SC;
- font-weight: 600;
- font-size: 44rpx;
- color: #151B29;
- line-height: 62rpx;
- &.tip{
- font-weight: 400;
- font-size: 26rpx;
- color: rgba(21,27,41,0.61);
- line-height: 37rpx;
- margin-top: 10rpx;
- }
- }
- }
- &-form{
- position: relative;
- margin-top: 10rpx;
- &-item{
- height: 120rpx;
- background: #FFFFFF;
- border-radius: 16rpx;
- border: 1rpx solid #E0E1E4;
- padding: 0 30rpx;
- margin-top: 20rpx;
- &-left{
- width: 370rpx;
- .text{
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 30rpx;
- color: #151B29;
- line-height: 42rpx;
- }
- image{
- width: 60rpx;
- height: 60rpx;
- margin-left: 28rpx;
- }
- }
- &-right{
- width: calc(100% - 370rpx);
- padding-left: 20rpx;
- box-sizing: border-box;
- .yjsq{
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 28rpx;
- color: #0593FE;
- line-height: 40rpx;
- background-color: transparent;
- text-align: right;
- padding: 0;
- &::after{
- width: auto;
- border: none;
- }
- }
- }
- }
- }
- &-btns{
- margin-top: 20rpx;
- padding: 0 10rpx;
- overflow: hidden;
- .btn{
- width: 100%;
- height: 90rpx;
- background: #B7F358;
- border-radius: 45rpx;
- font-family: PingFang-SC, PingFang-SC;
- font-weight: bold;
- font-size: 32rpx;
- color: #151B29;
- line-height: 90rpx;
- text-align: center;
- letter-spacing: 2rpx;
- margin-top: 20rpx;
- &.login{
- background: #ECEEF5;
- }
- }
- }
- &-memo{
- position: relative;
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 26rpx;
- color: #151B29;
- line-height: 36rpx;
- letter-spacing: 4rpx;
- margin-top: 41rpx;
- }
- &-agree{
- position: relative;
- margin-top: 95rpx;
- image{
- width: 48rpx;
- height: 48rpx;
- }
- .text{
- width: calc(100% - 48rpx);
- padding-left: 19rpx;
- box-sizing: border-box;
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 26rpx;
- color: #151B29;
- line-height: 36rpx;
- label{
- color: #E77687;
- }
- }
- }
- &-login{
- margin-top: 122rpx;
- .phone-login{
- width: 100%;
- height: 90rpx;
- background: #B7F358;
- border-radius: 45rpx;
- font-family: PingFang-SC, PingFang-SC;
- font-weight: bold;
- font-size: 32rpx;
- color: #151B29;
- line-height: 90rpx;
- text-align: center;
- letter-spacing: 2rpx;
- &::after{
- border: none;
- }
- }
- }
- }
- }
- </style>
|