| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- <template>
- <div class="tab-page">
- <view class="backimage">
- <image class="back" src="/static/image/login/back.png" mode=""></image>
- <image class="title-img" src="/static/image/login/code.png" mode=""></image>
- <text class="title">验证码已发送至:+86 {{this.info.userName}}</text>
- </view>
- <view class="info">
- <u--input v-model="info.smsCode" border="bottom" clearable maxlength="6" placeholderStyle="color:#999"
- style="padding: 34rpx 0;box-sizing: border-box;" :focus="true">
- <template slot="suffix">
- <u-code ref="uCode2" @change="codeChange2" keep-running start-text="发送验证码"
- style="color: #F9E000;"></u-code>
- <view @tap="getCode2" :text="tips2" class="u-page__code-text">{{tips2}}</view>
- </template>
- </u--input>
- </view>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- isHidePassword: true, //是否隐藏密码
- tips2: '',
- info: {
- userName: "", //账号
- system: "APP", //系统code
- captcha: "", //验证码
- captchaId: "", //验证码id
- smsCode: "", //手机验证码
- }
- }
- },
- onLoad(options) {
- let info = JSON.parse(options.info);
- this.info.userName = info.userName;
- this.info.captcha = info.captcha;
- this.info.captchaId = info.captchaId;
- },
- watch: {
- "info.smsCode": {
- handler(val) {
- if (val.length == 6) {
- console.log(this.info);
- uni.showLoading({
- title: '请求登录'
- })
- setTimeout(() => {
- uni.hideLoading();
- this.$login({
- url: "/auth/login",
- data: this.info,
- }).then(res => {
- if (res) {
- return uni.showToast({
- title: res.msg,
- icon: 'none'
- });
- }
- return;
- })
- }, 1000);
- }
- },
- deep: true
- },
- },
- onShow() {},
- methods: {
- //修改密码
- confirm() {
- //重置密码逻辑
- uni.navigateTo({
- url: '/pages/login/login'
- })
- },
- codeChange2(text) {
- this.tips2 = text;
- },
- getCode2() {
- if (!this.info.userName) {
- uni.showToast({
- title: '手机号为空',
- icon: 'none'
- });
- return;
- }
- if (this.$refs.uCode2.canGetCode) {
- this.smsCode();
- // 模拟向后端请求验证码
- uni.showLoading({
- title: '正在获取验证码'
- })
- setTimeout(() => {
- uni.hideLoading();
- // 这里此提示会被this.start()方法中的提示覆盖
- uni.$u.toast('验证码已发送');
- // 通知验证码组件内部开始倒计时
- this.$refs.uCode2.start();
- }, 1000);
- } else {
- uni.$u.toast('倒计时结束后再发送');
- }
- },
- async smsCode() {
- let res = await this.$http.get('/auth/sendSmsCode?mobile=' + this.info.userName);
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- page {
- background-color: #fff;
- }
- .backimage {
- width: 100%;
- height: 503rpx;
- background-color: #fff;
- position: relative;
- .back {
- width: 100%;
- height: 100%;
- }
- .title-img {
- position: absolute;
- top: 247rpx;
- left: 60rpx;
- width: 387rpx;
- height: 91rpx;
- }
- .title {
- position: absolute;
- top: 347rpx;
- left: 60rpx;
- font-size: 36rpx;
- color: #1f1f1f;
- }
- }
- .info {
- padding: 0 75rpx;
- box-sizing: border-box;
- .icon-img {
- width: 30rpx;
- height: 30rpx;
- }
- }
- //登录
- .performLogin {
- margin-top: 100rpx;
- .buttom {
- width: 100%;
- padding: 19rpx;
- box-sizing: border-box;
- background-color: #FDE935;
- border-radius: 45rpx;
- font-weight: bold;
- font-size: 36rpx;
- color: #1f1f1f;
- }
- .arigon {
- font-size: 28rpx;
- color: #666;
- padding: 0 30rpx;
- box-sizing: border-box;
- }
- }
- .footer {
- position: fixed;
- left: 0;
- right: 0;
- bottom: 62rpx;
- text {
- font-size: 26rpx;
- color: #999;
- }
- }
- .codemodal {
- padding: 40rpx;
- box-sizing: border-box;
- .buttom {
- width: 100%;
- padding: 19rpx;
- box-sizing: border-box;
- background-color: #FDE935;
- border-radius: 45rpx;
- font-weight: bold;
- font-size: 36rpx;
- color: #1f1f1f;
- }
- }
- .sendcode {
- font-size: 28rpx;
- color: #F9E000;
- }
- .u-page__code-text {
- padding: 4rpx 18rpx;
- background: rgba(253, 233, 53, 0.2);
- border-radius: 6rpx 6rpx 6rpx 6rpx;
- border: 1rpx solid #FDE935;
- color: #333333;
- font-size: 26rpx;
- }
- </style>
|