登录逻辑+注册有礼

This commit is contained in:
2024-03-13 22:43:59 +08:00
parent c17b70af2d
commit 0602dc6c72
18 changed files with 289 additions and 44 deletions

View File

@@ -92,7 +92,11 @@ function getCode() {
}
function wechatLogin() {
userStore.authLogin();
uni.showLoading();
userStore.authLogin().then(() => {
uni.hideLoading();
uni.reLaunch({ url: '/pages/home/index' });
});
}
function submit() {

View File

@@ -0,0 +1,143 @@
<template>
<view class='content'>
<image class='bg-image' :src='assetsUrl("bg_register.png")' />
<view class='card-view'>
<view class='mobile-view c-flex-row'>
<image :src='assetsUrl("ic_register_mobile.png")' />
<input placeholder='请输入手机号' inputmode='number' maxlength='11' />
</view>
<view class='captcha-view c-flex-row'>
<view class='c-flex-row'>
<image :src='assetsUrl("ic_register_captcha.png")' />
<input placeholder='请输入验证码' inputmode='number' maxlength='6' />
</view>
<text @click.stop='startCountdown'>{{ countdown }}</text>
</view>
<text class='btn_register' @click.stop='register'>注册领券</text>
</view>
</view>
</template>
<script lang='ts' setup>
import { assetsUrl } from '@/utils/assets';
const countdown = ref('获取验证码');
onLoad((e) => {
});
const startCountdown = () => {
if(countdown.value !== '获取验证码') {
return;
}
let time = 120;
let interval = setInterval(() => {
time--;
countdown.value = `${time}s 重新获取`;
if(time == 0) {
clearInterval(interval);
countdown.value = '获取验证码';
}
}, 1000);
};
const register = () => {
};
</script>
<style lang='scss' scoped>
.content {
position: relative;
height: 100vh;
background: #F32B2B;
}
.bg-image {
position: fixed;
height: 100vh;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.card-view {
background: #FFFFFF;
border-radius: 10rpx;
margin: 230px 50rpx 0 50rpx;
padding: 40rpx;
position: relative;
.mobile-view {
border-radius: 10rpx;
border: 1rpx solid #D8D8D8;
padding-left: 28rpx;
image {
width: 36rpx;
height: 36rpx;
}
input {
flex: 1;
height: 80rpx;
font-size: 30rpx;
color: #333333;
margin-left: 26rpx;
}
}
.captcha-view {
margin-top: 20rpx;
.c-flex-row {
border-radius: 10rpx;
border: 1rpx solid #D8D8D8;
padding-left: 28rpx;
flex: 1;
image {
width: 33rpx;
height: 26rpx;
}
input {
height: 80rpx;
font-size: 30rpx;
color: #333333;
margin-left: 26rpx;
}
}
text {
display: flex;
height: 80rpx;
background: #FFD436;
border-radius: 10rpx;
margin-left: 12rpx;
padding: 0 15rpx;
font-size: 28rpx;
align-items: center;
justify-content: center;
color: #FFFFFF;
}
}
.btn_register {
display: flex;
align-items: center;
justify-content: center;
height: 90rpx;
background: #F53636;
border-radius: 10rpx;
font-weight: 400;
font-size: 30rpx;
color: #FFFFFF;
margin-top: 46rpx;
}
}
</style>

View File

@@ -15,15 +15,15 @@
</view>
<view class='user-info-card'>
<image class='user-avatar' :src='bannerList[0]' mode='aspectFill' />
<text class='user-name primary-text-color'>设计小仙女</text>
<image class='user-avatar' :src='userInfo.image' mode='aspectFill' />
<text class='user-name primary-text-color'>{{ userInfo?.nickName }}</text>
<view class='integral-view primary-text-color'>
<text>1000</text>
<text>{{ userInfo?.integration }}</text>
<text>积分</text>
</view>
<view class='divider' style='height: 83rpx' />
<view class='balance-view'>
<text class='accent-text-color'>998.00</text>
<text class='accent-text-color'>{{ userInfo?.balance }}</text>
<text>余额</text>
</view>
</view>
@@ -67,9 +67,10 @@ import { getCompanyInfo } from '@/api/company';
import { useUserStore } from '@/store';
import { assetsUrl } from '@/utils/assets';
import { goPath } from '@/utils';
import { storeToRefs } from 'pinia';
const store = useUserStore();
const { userInfo } = storeToRefs(store);
const bannerList = ref<string[]>([]);
const currentBannerIndex = ref(0);
const recommendBannerList = ref<string[]>([]);
@@ -78,7 +79,7 @@ const submenuList = [
{
title: '注册有礼',
icon: assetsUrl('ic_register_gift.png'),
path: '/pages/order/order'
path: '/pages/common/register/index'
},
{
title: '团购秒杀',
@@ -102,8 +103,6 @@ onLoad(async (e) => {
const swiperChange = (e: any) => {
currentBannerIndex.value = e.detail.current;
};
console.log('store.user_name', store.user_name);
</script>
<style lang='scss'>

View File

@@ -7,23 +7,23 @@
/>
<view class='top-row'>
<image :src=' assetsUrl("ic_coupon.png")' />
<image :src='userInfo.image' />
<view class='u-flex-column'>
<text>设计小仙女</text>
<text>15542535625</text>
<text>{{ userInfo.nickName}}</text>
<text>{{ userInfo.telephone }}</text>
</view>
<image :src=' assetsUrl("ic_qrcode_white.png")' />
<image :src='assetsUrl("ic_qrcode_white.png")' />
</view>
<view class='bottom-row'>
<view>
<text>100</text>
<text>{{ userInfo.integration }}</text>
<text>积分</text>
</view>
<view @click.stop='goPath("/pages/mine/subs/recharge/index")'>
<text>255.00</text>
<text>{{ userInfo.balance }}</text>
<text>余额</text>
</view>
<view @click.stop='goPath("/pages/mine/subs/coupon/coupon-list")'>
@@ -121,7 +121,8 @@ const title = ref<string>();
title.value = import.meta.env.VITE_APP_TITLE;
const store = useUserStore();
console.log('store.user_name', store.user_name);
const { userInfo } = storeToRefs(store);
</script>
<style lang='scss' scoped>

View File

@@ -53,7 +53,7 @@ const codeRefreshInterval = ref(30);
onLoad(() => {
generateCode();
getDynamicCode()
// getDynamicCode()
setInterval(() => {
codeRefreshInterval.value -= 1;