| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- <template>
- <view 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/forgotPassword.png" mode=""></image>
- <image class="title" src="/static/image/login/title.png" mode=""></image>
- </view>
- <view class="info">
- <u--form labelPosition="left" :model="info" ref="ownerForm" labelWidth="60" errorType="message"
- :labelStyle="{fontWeight:'bold',color:'#333'}">
- <u-form-item label="手机号" borderBottom>
- <u--input v-model="info.mobile" border="none" clearable placeholder="请输入手机号" maxlength="11"
- placeholderStyle="color:#999"></u--input>
- </u-form-item>
- <u-form-item label="验证码" borderBottom>
- <u--input v-model="info.smsCode" border="none" clearable placeholder="请输入手机验证码" maxlength="6"
- placeholderStyle="color:#999">
- </u--input>
- <view class="suffixClass dis">
- <u-code ref="uCode2" @change="codeChange2" keep-running start-text="发送验证码"
- style="color: #F9E000;" uniqueKey="forgotPassword"></u-code>
- <view @tap="getCode2" :text="tips2" class="u-page__code-text">{{tips2}}</view>
- </view>
- </u-form-item>
- <u-form-item label="新密码" borderBottom>
- <u--input v-model="info.password" border="none" clearable placeholder="请输入密码"
- placeholderStyle="color:#999" :password="isHidePassword">
- </u--input>
- <view class="suffixClass">
- <image class="icon-img"
- :src="isHidePassword?'/static/image/login/icon-hide.png':'/static/image/login/icon-show.png'"
- mode="" @tap="isHidePassword=!isHidePassword"></image>
- </view>
- </u-form-item>
- </u--form>
- <view class="performLogin">
- <view class="buttom dis a-c j-c " @click="confirm">
- <text>确定</text>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- isHidePassword: true, //是否隐藏密码
- tips2: '',
- info: {
- mobile: "",
- password: "",
- smsCode: "",
- }
- }
- },
- onLoad(params) {
- if (params.phone) {
- this.info.mobile = params.phone;
- }
- },
- onShow() {},
- methods: {
- //修改密码
- async confirm() {
- if (!this.info.mobile) {
- return uni.showToast({
- title: '请输入手机号',
- icon: 'none'
- });
- }
- if (!this.info.smsCode) {
- return uni.showToast({
- title: '验证码不能为空',
- icon: 'none'
- });
- }
- if (!this.info.password) {
- return uni.showToast({
- title: '新密码不能为空',
- icon: 'none'
- });
- }
- let res = await this.$http.post('/auth/forgotPassword', this.info);
- if (res.code == '200') {
- uni.showToast({
- title: '密码修改成功',
- icon: 'none'
- });
- uni.navigateTo({
- url: "/pages/login/login"
- })
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- });
- }
- },
- codeChange2(text) {
- this.tips2 = text;
- },
- getCode2() {
- if (!this.info.mobile) {
- 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.mobile);
- },
- }
- }
- </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: 258rpx;
- height: 91rpx;
- }
- .title {
- position: absolute;
- top: 347rpx;
- left: 60rpx;
- width: 468rpx;
- height: 36rpx;
- }
- }
- .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;
- }
- .suffixClass {
- margin-left: 10rpx;
- font-size: 30rpx;
- }
- ::v-deep {
- .u-form-item__body {
- padding: 34rpx 0;
- }
- }
- </style>
|