| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306 |
- <!-- 蓝色简洁登录页面 -->
- <template>
- <view class="t-login">
- <view class="img-a">
- <view class="t-login-p">
- <view style="display: flex;justify-content: center;padding: 205rpx 0 30rpx 0;">
- <image src="/static/images/login/login (2).png" style="width:518rpx;height: 144rpx;"
- mode="scaleToFill">
- </image>
- </view>
- <view style="color: #fff;font-size: 26rpx;margin-bottom: 100rpx;display: flex;justify-content: center;">
- 欢迎来到库比森!</view>
- <view style="display: flex;justify-content: center;">
- <view class="login-card">
- <form>
- <view style="padding:100rpx 50rpx">
- <view style="display: flex;align-items: center;">
- <image style="width: 23rpx;height: 32rpx;" src="/static/images/login/login (3).png">
- </image>
- <uni-easyinput type="number" name="phone" placeholder="请输入手机号" maxlength="11"
- v-model="phone" :inputBorder="false" :clearable="false"/>
- </view>
- <view style="height: 2rpx;background: #E4E4E4;">
- </view>
- </view>
- <view style="padding: 0 50rpx">
- <view style="display: flex;align-items: center;">
- <image style="width: 25rpx;height: 30rpx;" src="/static/images/login/login (4).png">
- </image>
- <uni-easyinput type="number" name="code" maxlength="6" placeholder="请输入验证码"
- v-model="code" :inputBorder="false" :clearable="false"/>
- <view v-if="showText" class="code" @tap="getCode()">获取验证码</view>
- <view v-else class="code">重新发送({{ second }})
- </view>
- </view>
- <view style="height: 2rpx;background: #E4E4E4;">
- </view>
- </view>
- <view style="margin:80rpx 0 50rpx;display: flex;justify-content: center;">
- <debounce-button style="width: 474rpx;" bgColor='#03803B' @tap="login()" :loading="loading">登 录</debounce-button>
- </view>
- </form>
- </view>
- </view>
- </view>
- </view>
- <view class="pact">
- <view class="pact-a">
- <radio value="pactChecked" activeBackgroundColor="#3ba662" activeBorderColor="#3ba662"
- borderColor="#3ba662" color="#fff" @click="pactChange" />
- <view>我已阅读并同意<text @click="toPact">《用户协议》</text>和<text @click="toPact">《隐私协议》</text></view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- v4 as uuidv4
- } from 'uuid';
- import {
- getPhoneVerifyCode
- } from '@/api/user.js'
- export default {
- data() {
- return {
- loading: false,
- pactChecked: false,
- second: 60, //默认60秒
- showText: true, //判断短信是否发送
- phone:uni.getStorageSync('phone'), //手机号码
- code: '', //验证码
- uuid: uuidv4(),
- sendBtn:false,
- };
- },
- onLoad() {},
- methods: {
- pactChange() {
- this.pactChecked = true
- },
- //当前登录按钮操作
- login() {
- if (!this.phone) {
- uni.showToast({
- title: '请输入手机号',
- icon: 'none'
- });
- return;
- }
- if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(this.phone)) {
- uni.showToast({
- title: '请输入正确手机号',
- icon: 'none'
- });
- return;
- }
- if (!this.code) {
- uni.showToast({
- title: '请输入验证码',
- icon: 'none'
- });
- return;
- }
- if (!this.pactChecked) {
- uni.showToast({
- title: '请选中协议',
- icon: 'none'
- });
- return;
- }
- this.loading = true
- this.$u.api.token(
- this.uuid,
- this.phone,
- this.code
- ).then(data => {
- uni.setStorageSync('uuid', this.uuid)
- uni.setStorageSync('phone', this.phone);
- uni.showToast({
- icon: 'none',
- title: '登录成功',
- position: "bottom",
- mask: true
- })
- let _this = this
- setTimeout(function() {
- _this.$u.func.login(data)
- }, 1000);
- })
- .finally(() => {
- this.loading = false;
- });
- },
- //获取短信验证码
- getCode() {
- if (!this.phone) {
- uni.showToast({
- title: '请输入手机号',
- icon: 'none'
- });
- return;
- }
- if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(this.phone)) {
- uni.showToast({
- title: '请输入正确手机号',
- icon: 'none'
- });
- return;
- }
- let obj = {
- phone: this.phone,
- uuid: this.uuid
- }
- if (this.sendBtn) return
- this.sendBtn = true
- getPhoneVerifyCode(obj).then(res => {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- });
- if (res.code == 200) {
- this.showText = false;
- var that = this;
- var interval = setInterval(() => {
- var times = that.second - 1;
- that.second = times < 10 ? '0' + times : times; //小于10秒补 0
- that.second = times;
- }, 1000);
- setTimeout(() => {
- clearInterval(interval);
- that.second = 60;
- that.showText = true;
- }, 60000);
- }
- }).finally(() => {
- this.sendBtn = false
- });
- },
- //等三方微信登录
- wxLogin() {
- uni.showToast({
- title: '微信登录',
- icon: 'none'
- });
- },
- //第三方支付宝登录
- zfbLogin() {
- uni.showToast({
- title: '支付宝登录',
- icon: 'none'
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .img-a {
- width: 100%;
- height: 100vh;
- background: url(../../static/images/login/heae.png) no-repeat;
- background-size: 100%;
- }
- .t-login {
- width: 100%;
- height: 100vh;
- font-size: 28rpx;
- color: #000;
- background-color: #0C7C3E;
- }
- .t-login-p {
- position: relative;
- }
- .login-card {
- width: 649rpx;
- background: rgba(7, 97, 47, 0.6);
- box-shadow: 0rpx 4rpx 54rpx 0rpx #131413;
- border-radius: 12rpx;
- }
- ::v-deep .uni-easyinput__content {
- background-color: transparent !important;
- }
- ::v-deep .uni-input-input {
- color: #fff;
- }
- ::v-deep .uni-input-placeholder {
- color: #FFF !important;
- font-size: 28rpx;
- }
- .t-login .t-a {
- position: relative;
- }
- .t-login .t-a image {
- width: 40rpx;
- height: 40rpx;
- position: absolute;
- left: 40rpx;
- top: 28rpx;
- border-right: 2rpx solid #dedede;
- padding-right: 20rpx;
- }
- .t-login .t-b {
- text-align: left;
- font-size: 46rpx;
- color: #000;
- padding: 200rpx 0 120rpx 0;
- font-weight: bold;
- }
- .t-login .t-c {
- position: absolute;
- right: 22rpx;
- top: 22rpx;
- background: #03803B;
- color: #fff;
- font-size: 24rpx;
- border-radius: 50rpx;
- height: 50rpx;
- line-height: 50rpx;
- padding: 0 25rpx;
- }
- .code{
- width: 160rpx;
- text-align: center;
- font-size: 26rpx;
- color: #FFF;
- border-radius: 8rpx;
- border: 1rpx solid #FFFFFF;
- padding:3rpx 4rpx ;
- }
- .pact {
- position: absolute;
- width: 100%;
- bottom: 60rpx;
- font-size: 24rpx;
- text {
- color: #3ba662;
- }
- .pact-a {
- display: flex;
- align-items: center;
- justify-content: center;
- radio {
- :deep(.uni-radio-input) {
- border: 1rpx solid #3ba662;
- }
- transform:scale(0.6)
- }
- }
- }
- </style>
|