123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- <template>
- <view class="container">
- <view class="container_text" >
- <image src="../../static/icon/logo.png" mode="" class="logo"></image>
- <view class="logo-tit"><text>博·赢</text></view>
- <!-- <image class="banner-img" src="/static/img/img01.png" mode="scaleToFill"></image> -->
- </view>
- <!-- <view class="loginTitle"><text>手机号登录</text></view> -->
- <view class="login_text">
- <view class="login_input flex">
- <view class="login_img"><image src="../../static/icon/icon-phone.png"></image></view>
- <view class="login_name"><input class="uni-input" v-model="phone" focus :placeholder="$t('hea.srsj')" /></view>
- </view>
- <view class="login_input flex">
- <view class="login_img"><image src="../../static/icon/icon-code.png"></image></view>
- <view class="login_name"><input class="uni-input" type="password" v-model="password" focus :placeholder="$t('hea.srxmm')" /></view>
- </view>
- <view class="login_input flex">
- <view class="login_img"><image src="../../static/icon/icon-code.png"></image></view>
- <view class="login_name"><input class="uni-input" type="password" v-model="repassword" focus :placeholder="$t('hea.srxmmt')" /></view>
- </view>
- <view class="login_input flex">
- <view class="login_img"><image src="../../static/icon/icon-yzm.png"></image></view>
- <view class="login_name flex">
- <input class="uni-input width" v-model="code" focus :placeholder="$t('hea.sryzm')" />
- <view class="code" @click="verification">{{ countDown == 0 ? $t('hea.yzm') : countDown }}</view>
- </view>
- </view>
- <view>
- <button type="green" @click="loding?register():''" class="uni-button uni-button-green">{{$t('hea.qrxg')}}</button>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { mapMutations } from 'vuex';
- import { verify, loginMobile, getUserInfo } from '@/api/login.js';
- import { registerReset } from '@/api/set.js';
- export default {
- data() {
- return {
- phone: '', //用户
- code: '', //验证码
- time: '', //保存倒计时对象
- countDown: 0, //倒计时
- password: '',
- repassword: '',
- loding:true,//是否载入中
-
- };
- },
- onLoad() {
- uni.setNavigationBarTitle({
- title:this.$t('foo.wjmm')
- })
- },
- watch: {
- // 监听倒计时
- countDown(i) {
- if (i == 0) {
- clearInterval(this.time);
- }
- }
- },
- methods: {
- ...mapMutations('user', ['setUserInfo', 'login']),
- // 手机登录
- register() {
- let obj = this;
- console.log('dianji')
- if (obj.phone == '') {
- obj.$api.msg('请输入电话号码');
- return;
- }
- if (!/(^1[3|4|5|7|8][0-9]{9}$)/.test(this.phone)) {
- obj.$api.msg('请输入正确的手机号');
- return;
- }
- if(obj.password == '') {
- obj.$api.msg('请输入新密码')
- return
- }
- if(obj.password != obj.repassword) {
- obj.$api.msg('两次密码不一致')
- return
- }
- if (obj.code == '') {
- obj.$api.msg('请输入验证码');
- return;
- }
- obj.loding = false
- registerReset({
- // phone: obj.phone, //账号
- // captcha: obj.code,
- type:'mobile',
- mobile: obj.phone,
- captcha: obj.code,
- newpassword: obj.password,
- }).then(function(e) {
- console.log(e)
- obj.$api.msg('修改成功');
- uni.navigateTo({
- url: '/pages/public/login'
- });
- }).catch((e) => {
- console.log(e);
- });
- },
- //发送验证码
- verification() {
- let obj = this;
- if (this.phone == '') {
- this.$api.msg('请输入手机号');
- return;
- }
- if (this.phone.length < 11) {
- this.$api.msg('请输入正确的手机号');
- return;
- }
- // 判断是否在倒计时
- if (obj.countDown > 0) {
- return false;
- } else {
- obj.countDown = 60;
- obj.time = setInterval(() => {
- obj.countDown--;
- }, 1000);
- //调用验证码接口
- verify({
- mobile: obj.phone,
- event: 'resetpwd'
- })
- .then(({ data }) => {})
- .catch(err => {
- console.log(err);
- });
- }
- },
- login() {
- //返回登录
- uni.navigateTo({
- url: '/pages/public/login'
- });
- }
- }
- };
- </script>
- <style lang="scss">
- page {
- height: 100%;
- }
- .container {
- width: 100%;
- height: 100%;
- background-size: 100%;
- }
- .container_text {
- width: 100%;
- height: 500rpx;
- top: 0rpx;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- .banner-img {
- width: 100%;
- height: 100%;
- }
- .logo {
- width: 186rpx;
- height: 196rpx;
- }
- .logo-tit {
- text-align: center;
- font-size: 36rpx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #FAD6B0;
- }
- }
- .login_text {
- margin: auto 30rpx;
- position: relative;
- padding: 50rpx 102rpx 0;
- background-color: #000;
- // margin-top: -180rpx;
- border-radius: 20rpx;
- .login_input {
- padding-bottom: 20rpx;
- border-bottom: 1px solid #f0f0f0;
- margin-bottom: 65rpx;
- .login_img image {
- height: 35rpx;
- width: 29rpx;
- margin-right: 20rpx;
- }
- .uni-input {
- text-align: left;
- width: 470rpx;
- font-size: 28rpx !important;
- }
- .login_name {
- color: #fff;
- .width {
- width: 325rpx !important;
- }
- .code {
- color: #dbb189;
- font-size: 23rpx;
- border-left: 1px solid #eeeeee;
- width: 150rpx;
- flex-shrink: 0;
- text-align: center;
- }
- }
- }
- .uni-button-green {
- background: linear-gradient(-74deg, #CE9C6D, #FFECD6);
- // border: 1px solid;
- border-image: linear-gradient(115deg, #FEEBD5, #FFFFFF, #E1AD7D) 1 1;
- box-shadow: 3rpx 4rpx 5rpx 0px rgba(151, 118, 74, 0.5);
- border-radius: 10rpx;
- font-size: 34rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #874B19;
- }
- .uni-button {
- height: 85rpx;
- line-height: 85rpx;
- }
- }
- .loginTitle {
- position: absolute;
- top: 250rpx;
- width: 100%;
- text-align: center;
- color: white;
- font-size: 40rpx;
- }
- uni-button {
- height: 80rpx !important;
- line-height: 80rpx !important;
- }
- </style>
|