清理下 login 相关无用的代码

pull/1/MERGE
YunaiV 2023-08-19 23:40:59 +08:00
parent 475a681300
commit 3ec70daafc
5 changed files with 53 additions and 176 deletions

View File

@ -17,7 +17,6 @@
}, },
onLoad(option) { onLoad(option) {
let that = this
const { const {
code, code,
state state

View File

@ -11,21 +11,12 @@
<script> <script>
const app = getApp(); const app = getApp();
import sendVerifyCode from "@/mixins/SendVerifyCode"; import sendVerifyCode from "@/mixins/SendVerifyCode";
import Routine from '@/libs/routine';
import { import {
loginMobile,
registerVerify, registerVerify,
getCodeApi, getCodeApi,
getUserInfo, getUserInfo,
phoneSilenceAuth, phoneSilenceAuth,
phoneWxSilenceAuth
} from "@/api/user"; } from "@/api/user";
import {
bindingPhone
} from '@/api/api.js'
import {
getUserPhone
} from '@/api/public';
import mobileLogin from '@/components/login_mobile/index.vue' import mobileLogin from '@/components/login_mobile/index.vue'
export default { export default {
name: 'login_mobile', name: 'login_mobile',
@ -42,16 +33,12 @@
isPos: false, isPos: false,
platform: '', // platform: '', //
appleShow: '' // appleShow: '' //
} }
}, },
components: { components: {
mobileLogin mobileLogin
}, },
mixins: [sendVerifyCode], mixins: [sendVerifyCode],
mounted() {
//this.getCode();
},
onLoad: function(options) { onLoad: function(options) {
let that = this; let that = this;
// //
@ -177,7 +164,6 @@
} }
} }
</script> </script>
<style> <style>
page { page {
height: 100%; height: 100%;
@ -199,9 +185,6 @@
justify-content: center; justify-content: center;
width: 100%; width: 100%;
image { image {
width: 180rpx; width: 180rpx;
height: 180rpx; height: 180rpx;

View File

@ -1,16 +1,14 @@
<template> <template>
<div class="login-wrapper"> <div class="login-wrapper">
<div class="shading"> <div class="shading">
<!-- <image :src="logoUrl"/> --> <image src="/static/images/logo2.png" />
<image :src="logoUrl"/>
<!-- <image src="/static/images/logo2.png" v-if="!logoUrl" /> -->
</div> </div>
<div class="whiteBg" v-if="formItem === 1"> <div class="whiteBg">
<div class="list" v-if="current !== 1"> <div class="list" v-if="current !== 1">
<form @submit.prevent="submit"> <form @submit.prevent="submit">
<div class="item"> <div class="item">
<div class="acea-row row-middle"> <div class="acea-row row-middle">
<image src="/static/images/phone_1.png" style="width: 24rpx; height: 34rpx;"></image> <image src="/static/images/phone_1.png" style="width: 24rpx; height: 34rpx;" />
<input type="text" class="texts" placeholder="输入手机号码" v-model="account" required/> <input type="text" class="texts" placeholder="输入手机号码" v-model="account" required/>
</div> </div>
</div> </div>
@ -42,63 +40,34 @@
<div class="acea-row row-middle"> <div class="acea-row row-middle">
<image src="/static/images/code_2.png" style="width: 28rpx; height: 32rpx;"></image> <image src="/static/images/code_2.png" style="width: 28rpx; height: 32rpx;"></image>
<input type="text" placeholder="填写验证码" class="codeIput" v-model="codeVal" /> <input type="text" placeholder="填写验证码" class="codeIput" v-model="codeVal" />
<div class="code" @click="again"><img :src="codeUrl" /></div>
</div> </div>
</div> </div>
</div> </div>
<div class="logon" @click="loginMobile" v-if="current !== 0"></div> <div class="logon" @click="loginMobile" v-if="current !== 0"></div>
<div class="logon" @click="submit" v-if="current === 0"></div> <div class="logon" @click="submit" v-if="current === 0"></div>
<div class="tips"> <div class="tips">
<div v-if="current==0" @click="current = 1"></div> <div v-if="current === 0" @click="current = 1"></div>
<div v-if="current==1" @click="current = 0"></div> <div v-if="current === 1" @click="current = 0"></div>
</div> </div>
</div> </div>
<div class="bottom"></div> <div class="bottom"></div>
</div> </div>
</template> </template>
<script> <script>
import dayjs from "@/plugin/dayjs/dayjs.min.js";
import sendVerifyCode from "@/mixins/SendVerifyCode"; import sendVerifyCode from "@/mixins/SendVerifyCode";
import { import { loginH5, loginMobile, registerVerify, getUserInfo } from "@/api/user";
loginH5, import { appAuth, appleLogin } from "@/api/public";
loginMobile,
registerVerify,
register,
// getCodeApi,
getUserInfo
} from "@/api/user";
import attrs, {
required,
alpha_num,
chs_phone
} from "@/utils/validate";
import {
validatorDefaultCatch
} from "@/utils/dialog";
import {
getLogo, appAuth, appleLogin
} from "@/api/public";
import {
VUE_APP_API_URL
} from "@/utils";
const BACK_URL = "login_back_url"; const BACK_URL = "login_back_url";
export default { export default {
name: "Login", name: "Login",
mixins: [sendVerifyCode], mixins: [sendVerifyCode],
data: function() { data: function() {
return { return {
navList: ["快速登录", "账号登录"], current: 1, // 12
current: 1,
account: "", account: "",
password: "", password: "",
captcha: "", captcha: "",
formItem: 1,
type: "login", type: "login",
logoUrl: "",
keyCode: "",
codeUrl: "",
codeVal: "", codeVal: "",
isShowCode: false, isShowCode: false,
platform: '', platform: '',
@ -109,24 +78,11 @@
appleShow: false // ios13 appleShow: false // ios13
}; };
}, },
watch:{
formItem:function(nval,oVal){
if(nval == 1){
this.type = 'login'
}else{
this.type = 'register'
}
}
},
mounted: function() {
this.getCode();
this.getLogoImage();
},
onLoad() { onLoad() {
let self = this let self = this
uni.getSystemInfo({ uni.getSystemInfo({
success: function(res) { success: function(res) {
if (res.platform.toLowerCase() == 'ios' && res.system.split(' ')[1] >= 13) { if (res.platform.toLowerCase() === 'ios' && res.system.split(' ')[1] >= 13) {
self.appleShow = true self.appleShow = true
} }
} }
@ -259,28 +215,16 @@
}); });
}); });
}, },
again() { /**
this.codeUrl = * 手机 + 验证码登录
VUE_APP_API_URL + */
"/sms_captcha?" + async loginMobile() {
"key=" +
this.keyCode +
Date.parse(new Date());
},
getCode() {
let that = this
},
async getLogoImage() {
let that = this; let that = this;
getLogo().then(res => { if (!this.account) {
that.logoUrl = res.data.logoUrl?res.data.logoUrl:'/static/images/logo2.png'; return that.$util.Tips({
}); title: '请填写手机号码'
}, });
async loginMobile() { }
let that = this;
if (!that.account) return that.$util.Tips({
title: '请填写手机号码'
});
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({ if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
title: '请输入正确的手机号码' title: '请输入正确的手机号码'
}); });
@ -309,44 +253,6 @@
}); });
}); });
}, },
async register() {
let that = this;
if (!that.account) return that.$util.Tips({
title: '请填写手机号码'
});
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
title: '请输入正确的手机号码'
});
if (!that.captcha) return that.$util.Tips({
title: '请填写验证码'
});
if (!/^[\w\d]+$/i.test(that.captcha)) return that.$util.Tips({
title: '请输入正确的验证码'
});
if (!that.password) return that.$util.Tips({
title: '请填写密码'
});
if (!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/i.test(that.password)) return that.$util.Tips({
title: '您输入的密码过于简单'
});
register({
account: that.account,
captcha: that.captcha,
password: that.password,
spread: that.$Cache.get("spread")
})
.then(res => {
that.$util.Tips({
title: res
});
that.formItem = 1;
})
.catch(res => {
that.$util.Tips({
title: res
});
});
},
async code() { async code() {
let that = this; let that = this;
if (!that.account) return that.$util.Tips({ if (!that.account) return that.$util.Tips({
@ -367,9 +273,9 @@
}); });
}); });
}, },
navTap: function(index) { /**
this.current = index; * 手机 + 密码登录
}, */
async submit() { async submit() {
let that = this; let that = this;
if (!that.account) return that.$util.Tips({ if (!that.account) return that.$util.Tips({
@ -392,7 +298,7 @@
this.$store.commit("LOGIN", { this.$store.commit("LOGIN", {
'token': data.token 'token': data.token
}); });
that.getUserInfo(data); that.getUserInfo(data);
}) })
.catch(e => { .catch(e => {
that.$util.Tips({ that.$util.Tips({
@ -422,31 +328,31 @@
} }
.appLogin { .appLogin {
margin-top: 60rpx; margin-top: 60rpx;
.hds { .hds {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
font-size: 24rpx; font-size: 24rpx;
color: #B4B4B4; color: #B4B4B4;
.line { .line {
width: 68rpx; width: 68rpx;
height: 1rpx; height: 1rpx;
background: #CCCCCC; background: #CCCCCC;
} }
p { p {
margin: 0 20rpx; margin: 0 20rpx;
} }
} }
.btn-wrapper { .btn-wrapper {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin-top: 30rpx; margin-top: 30rpx;
.btn { .btn {
display: flex; display: flex;
align-items: center; align-items: center;
@ -455,7 +361,7 @@
height: 68rpx; height: 68rpx;
border-radius: 50%; border-radius: 50%;
} }
.apple-btn { .apple-btn {
display: flex; display: flex;
align-items: center; align-items: center;
@ -464,85 +370,85 @@
background: #000; background: #000;
border-radius: 34rpx; border-radius: 34rpx;
font-size: 40rpx; font-size: 40rpx;
.icon-s-pingguo { .icon-s-pingguo {
color: #fff; color: #fff;
font-size: 40rpx; font-size: 40rpx;
} }
} }
.iconfont { .iconfont {
font-size: 40rpx; font-size: 40rpx;
color: #fff; color: #fff;
} }
.wx { .wx {
margin-right: 30rpx; margin-right: 30rpx;
background-color: #61C64F; background-color: #61C64F;
} }
.mima { .mima {
background-color: #28B3E9; background-color: #28B3E9;
} }
.yanzheng { .yanzheng {
background-color: #F89C23; background-color: #F89C23;
} }
} }
} }
.code img { .code img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.acea-row.row-middle { .acea-row.row-middle {
input { input {
margin-left: 20rpx; margin-left: 20rpx;
display: block; display: block;
} }
} }
.login-wrapper { .login-wrapper {
padding: 30rpx; padding: 30rpx;
.shading { .shading {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 100%; width: 100%;
/* #ifdef APP-VUE */ /* #ifdef APP-VUE */
margin-top: 50rpx; margin-top: 50rpx;
/* #endif */ /* #endif */
/* #ifndef APP-VUE */ /* #ifndef APP-VUE */
margin-top: 200rpx; margin-top: 200rpx;
/* #endif */ /* #endif */
image { image {
width: 180rpx; width: 180rpx;
height: 180rpx; height: 180rpx;
} }
} }
.whiteBg { .whiteBg {
margin-top: 100rpx; margin-top: 100rpx;
.list { .list {
border-radius: 16rpx; border-radius: 16rpx;
overflow: hidden; overflow: hidden;
.item { .item {
border-bottom: 1px solid #F0F0F0; border-bottom: 1px solid #F0F0F0;
background: #fff; background: #fff;
.row-middle { .row-middle {
position: relative; position: relative;
padding: 16rpx 45rpx; padding: 16rpx 45rpx;
.texts{ .texts{
flex: 1; flex: 1;
font-size: 28rpx; font-size: 28rpx;
@ -552,7 +458,7 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
input { input {
flex: 1; flex: 1;
font-size: 28rpx; font-size: 28rpx;
@ -562,7 +468,7 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.code { .code {
position: absolute; position: absolute;
right: 30rpx; right: 30rpx;
@ -574,7 +480,7 @@
} }
} }
} }
.logon { .logon {
display: flex; display: flex;
align-items: center; align-items: center;
@ -587,7 +493,7 @@
color: #FFFFFF; color: #FFFFFF;
font-size: 30rpx; font-size: 30rpx;
} }
.tips { .tips {
margin: 30rpx; margin: 30rpx;
text-align: center; text-align: center;

View File

@ -41,22 +41,11 @@
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px'; let statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
import mobileLogin from '@/components/login_mobile/index.vue' import mobileLogin from '@/components/login_mobile/index.vue'
import routinePhone from '@/components/login_mobile/routine_phone.vue' import routinePhone from '@/components/login_mobile/routine_phone.vue'
import {
mapGetters
} from "vuex";
import { import {
getLogo, getLogo,
getUserPhone getUserPhone
} from '@/api/public'; } from '@/api/public';
import { import { getUserInfo } from '@/api/user.js'
LOGO_URL,
EXPIRES_TIME,
USER_INFO,
STATE_R_KEY
} from '@/config/cache';
import {
getUserInfo
} from '@/api/user.js'
import Routine from '@/libs/routine'; import Routine from '@/libs/routine';
import wechat from "@/libs/wechat"; import wechat from "@/libs/wechat";
export default { export default {
@ -347,7 +336,7 @@
background: #fff; background: #fff;
height: 100%; height: 100%;
} }
.page { .page {
background: #fff; background: #fff;
height: 100%; height: 100%;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB