123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- <template>
- <view class="container">
- <view class="logo-img"><image src="../../static/user/logo.png"></image></view>
- <!-- <view class="logo">LOGO</view> -->
- <view class="login_text">
- <view class="login_input flex_item">
- <view class="login_img"><image class="phone" src="/static/img/img25.png"></image></view>
- <view class="login_name"><input class="uni-input" type="number" v-model="phone" focus placeholder="请输入手机号码" /></view>
- </view>
- <view class="login_input flex_item">
- <view class="login_img"><image src="/static/img/img26.png"></image></view>
- <view class="login_name"><input class="uni-input" type="password" v-model="password" placeholder=" 请输入新的不少于6位的密码" /></view>
- </view>
- <view class="login_input flex_item">
- <view class="login_img"><image src="/static/img/img26.png"></image></view>
- <view class="login_name"><input class="uni-input" type="password" v-model="password2" placeholder="请重复输入新密码" /></view>
- </view>
- <view class="login_input flex">
- <view class="login_img"><image class="codeimg" src="/static/img/img27.png"></image></view>
- <view class="login_name flex">
- <input class="uni-input width" v-model="code" type="number" placeholder="请输入验证码" />
- <view class="code" @click="verification">{{ countDown == 0 ? '发送验证码' : countDown }}</view>
- </view>
- </view>
- </view>
- <view class="login" @click="updatalogin">确认修改</view>
- </view>
- </template>
- <script>
- import { updatalogin } from '@/api/set.js';
- import { verify } from '@/api/login.js';
- export default {
- data() {
- return {
- phone: '', //用户
- code: '', //验证码
- password2:'',
- password:'',
- time: '', //保存倒计时对象
- countDown: 0 //倒计时
- };
- },
- onLoad() {},
- watch: {
- // 监听倒计时
- countDown(i) {
- if (i == 0) {
- clearInterval(this.time);
- }
- }
- },
- methods: {
- updatalogin() {
- let obj = this;
- if (obj.phone == '') {
- obj.$api.msg('请输入手机号码');
- return;
- }
- if (!/(^1[3|4|5|7|8][0-9]{9}$)/.test(obj.phone)) {
- obj.$api.msg('请输入正确的手机号');
- return;
- }
- if (obj.password == '') {
- obj.$api.msg('请输入密码');
- return;
- }
- if (obj.password2 == '') {
- obj.$api.msg('请再次输入密码');
- return;
- }
- if (obj.password2 != obj.password) {
- obj.$api.msg('两次密码不正确');
- return;
- }
- if (obj.code == '') {
- obj.$api.msg('请输入验证码');
- return;
- }
- updatalogin({
- account: obj.phone, //账号
- password:obj.password,
- password2:obj.password2,
- type:1,
- captcha: obj.code
- }).then(function(e) {
- obj.$api.msg(e.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({
- phone: obj.phone,
- type: 'login'
- })
- .then(({ data }) => {})
- .catch(err => {
- console.log(err);
- });
- }
- },
- }
- };
- </script>
- <style lang="scss">
- page {
- min-height: 100%;
- background-color: #ffffff;
- .container {
- width: 100%;
- padding: 60rpx 70rpx;
- }
- }
- .logo-img{
- width: 161rpx;
- height: 161rpx;
- margin: auto;
- margin-bottom: 15rpx !important;
- // background: #5771DF;
- // box-shadow: 0px 12rpx 13rpx 0px rgba(51, 145, 255, 0.47);
- border-radius: 50%;
- image{
- width: 161rpx;
- height: 161rpx;
- border-radius: 50%;
- }
- }
- .logo{
- font-size: 36rpx;
- font-weight: 400;
- color: #5771DF;
- text-align: center;
- }
- .phone{
- height: 43rpx !important;
- width: 27rpx !important;
- }
- .codeimg{
- height: 39rpx !important;
- width: 31rpx !important;
- }
- .login_text {
- border-radius: 20rpx;
- margin-top: 80rpx;
- .login_input {
- // border-bottom: 1px solid #C5CEE0;
- margin-bottom:35rpx;
- padding-bottom: 60rpx;
- .login_img image {
- height: 35rpx;
- width: 31rpx;
- margin-right: 20rpx;
- }
- .uni-input {
- text-align: left;
- width: 400rpx;
- font-size:32rpx !important;
- }
- .login_name {
- color: #333333;
- .code {
- color: #141E47;
- font-size: 23rpx;
- border-left: 1px solid #eeeeee;
- width: 150rpx;
- flex-shrink: 0;
- text-align: center;
- }
- }
- }
- }
- .login{
- background-color: #141E47;
- margin-top: 96rpx;
- color: #FFFFFF;
- text-align: center;
- padding: 26rpx 0rpx;
- border-radius: 20rpx;
- }
- </style>
|