| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- <!-- 蓝色简洁登录页面 -->
- <template>
- <view class="">
- <view class="t-login">
- <u-top-tips ref="uTips"></u-top-tips>
- <u-toast ref="uToast"></u-toast>
- <!-- 页面装饰图片 -->
- <!-- <image class="img-a" src="@/static/login/2.png"></image> -->
- <!-- <image class="img-b" src="@/static/login/3.png"></image> -->
- <!-- 标题 -->
- <view class="t-b">{{ title }}</view>
- <form class="cl">
- <view class="t-a">
- <image src="@/static/login/sj.png"></image>
- <input type="number" name="phone" placeholder="请输入手机号" maxlength="11" v-model="phone" />
- </view>
- <view class="t-a">
- <image src="@/static/login/yz.png"></image>
- <input type="number" name="code" maxlength="6" placeholder="请输入验证码" v-model="yzm" />
- <view :style="showText?'':'background-color: #A7A7A7;'" class="t-c" @click="getCode()">{{tips}}</view>
- </view>
- <view @click="typeShow=true" class="flex padding-bottom-50" style="text-align: left">
- <view style="border: 1px solid #e9e9e9;background-color: #f8f7fc;" class="cu-btn df round">
- <text class="text-black">{{typeList[typeIndex].text}}登陆</text>
- <text class="text-black cuIcon-triangledownfill " style="font-size: 40rpx;padding-left: 4rpx;"></text>
- </view>
- </view>
-
- <view class="checkbox">
- <u-checkbox
- @change="checkboxChange"
- v-model="checked"
- >七天内免登录</u-checkbox>
- </view>
- <button @tap="login()">登 录</button>
- </form>
- <view v-if="typeIndex==0">
- <view class="t-f">
- <u-divider color="#aaa" border-color="#aaa">微信快速登陆</u-divider>
- </view>
- <!-- <view class="t-f"><text>————— 微信快速登录 —————</text></view> -->
- <view style="display: flex;justify-content: center;padding-top: 50rpx;">
- <view @tap="wxLogin()"><image style="width: 88rpx;height: 88rpx;" src="@/static/login/wx.png"></image></view>
- </view>
- </view>
- <u-action-sheet @click="typeClick" :list="typeList" v-model="typeShow"></u-action-sheet>
- <u-verification-code seconds="60" @end="end" @start="start" ref="uCode" @change="codeChange"></u-verification-code>
- </view>
- </view>
- </template>
- <script>
- let that
- export default {
- data() {
- return {
- typeList:[{text:'员工',value:'0'},{text:'企业',value:'1'}],
- typeShow:false,
- typeIndex:0,
- checked:false,//七天免登录
- title: '欢迎回来!',
- tips: '',
- showText:true,
- phone: '', //手机号码
- yzm: '' //验证码
- };
- },
- onLoad() {
- if (this.$cache.get('phone')) {
- //免登录
- uni.switchTab({
- url:"../index/index"
- })
- }
- },
- methods: {
- wxLogin(){
- this.$refs.uTips.show({
- title: '完成员工认证的用户才可以使用微信快速登陆',
- type: 'primary',
- duration: '2500'
- })
- },
- typeClick(index){
- this.typeIndex=index
- },
- getCode() {
- if(this.$refs.uCode.canGetCode) {
- // 模拟向后端请求验证码
- uni.showLoading({
- title: '正在获取验证码'
- })
- setTimeout(() => {
- uni.hideLoading();
- // 这里此提示会被this.start()方法中的提示覆盖
- this.$u.toast('验证码已发送');
- // 通知验证码组件内部开始倒计时
- this.$refs.uCode.start();
- }, 3000);
- } else {
- this.$u.toast('倒计时结束后再发送');
- }
- },
- checkboxChange(e){
- this.checked=e.value
- },
- codeChange(text) {
- this.tips = text;
- },
- end() {
- this.showText=true
- },
- start() {
- this.showText=false
- },
- //当前登录按钮操作
- login() {
- var that = this;
- if (!that.phone) {
- uni.showToast({ title: '请输入手机号', icon: 'none' });
- return;
- }
- if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(that.phone)) {
- uni.showToast({ title: '请输入正确手机号', icon: 'none' });
- return;
- }
- if (!that.yzm) {
- uni.showToast({ title: '请输入验证码', icon: 'none' });
- return;
- }
- if (that.checked) {
- //七天内免登录
- that.$cache.put("phone",that.phone,1*24*60*60*7)
- }else{
- //三十分内钟免登录
- that.$cache.put("phone",that.phone,1*60*30)
- }
- //存储登陆的用户类型
- if (that.typeIndex==0) {
- //员工登陆
- that.$cache.put('loginType','employees')
- }else if(that.typeIndex==1){
- //企业登陆
- that.$cache.put('loginType','enterprise')
- }
- uni.showLoading({
title: '登陆中...'
})
- setTimeout(()=>{
- uni.hideLoading()
- uni.switchTab({
- url:"../index/index"
- })
- },1500)
- },
-
- }
- };
- </script>
- <style lang="scss" >
- page{
- background-color: #FFFFFF;
- }
- .checkbox{
- padding-bottom: 50rpx;
- padding-left: 20rpx;
- margin-top: -10rpx;
- }
- .img-a {
- position: absolute;
- width: 100%;
- top: -300rpx;
- right: -100rpx;
- }
- .img-b {
- position: absolute;
- width: 50%;
- bottom: 0;
- left: -50rpx;
- margin-bottom: -200rpx;
- }
- .t-login {
- width: 600rpx;
- margin: -200rpx auto;
- font-size: 28rpx;
- color: #000;
- }
- .t-login button {
- font-size: 28rpx;
- background: #5677fc;
- color: #fff;
- height: 90rpx;
- line-height: 90rpx;
- border-radius: 50rpx;
- box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
- }
- .t-login input {
- padding: 0 20rpx 0 120rpx;
- height: 90rpx;
- line-height: 90rpx;
- margin-bottom: 50rpx;
- background: #f8f7fc;
- border: 1px solid #e9e9e9;
- font-size: 28rpx;
- border-radius: 50rpx;
- }
- .t-login .t-a {
- position: relative;
- }
- .t-login .t-a image {
- width: 40rpx;
- height: 42rpx;
- position: absolute;
- left: 20rpx;
- top: 28rpx;
- padding-right:4rpx;
- }
- .t-login .t-b {
- text-align: left;
- font-size: 46rpx;
- color: #000;
- padding: 300rpx 0 120rpx 0;
- font-weight: bold;
- }
- .t-login .t-c {
- position: absolute;
- right: 22rpx;
- top: 22rpx;
- background: #5677fc;
- color: #fff;
- font-size: 24rpx;
- border-radius: 50rpx;
- height: 50rpx;
- line-height: 50rpx;
- padding: 0 25rpx;
- z-index: 99999;
- }
- .t-login .t-d {
- text-align: center;
- color: #999;
- margin: 80rpx 0;
- }
- .t-login .t-e {
- text-align: center;
- width: 250rpx;
- margin: 80rpx auto;
- }
- .t-login .t-g {
- float: left;
- width: 50%;
- }
- .t-login .t-e image {
- width: 50rpx;
- height: 50rpx;
- }
- .t-login .t-f {
- text-align: center;
- margin: 100rpx 0 0 0;
- color: #666;
- }
- .t-login .t-f text {
- margin-left: 20rpx;
- color: #aaaaaa;
- font-size: 27rpx;
- }
- .t-login .uni-input-placeholder {
- color: #000;
- }
- .cl {
- zoom: 1;
- }
- .cl:after {
- clear: both;
- display: block;
- visibility: hidden;
- height: 0;
- content: '\20';
- }
- </style>
|