gx
queenwuli
2021-01-15 4b80c98ef5fda8d6358778f2efe8bb35cb20ccf9
hive-app/pages/login/newPassword.vue
@@ -2,23 +2,63 @@
   <!-- 新密码 -->
   <view>
      <view class="input-box">
         <input placeholder="请输入新密码" placeholder-class="placeholder" class="input-group-row"/>
         <input placeholder="请确认密码" placeholder-class="placeholder" class="input-group-row"/>
         <input type="password" v-model="newPassword" placeholder="请输入新密码" placeholder-class="placeholder" class="input-group-row"/>
         <input type="password" v-model="password" placeholder="请确认密码" placeholder-class="placeholder" class="input-group-row"/>
      </view>
      <navigator url="./" hover-class="none" class="next">
         <button class="blue-btn">提交</button>
      </navigator>
      <button class="blue-btn sticky-footer" @click="submit">提交</button>
   </view>
</template>
<script>
   export default{
      data(){
         return{
            newPassword:'',
            password:'',
            sendCode:'',
            telphone:''
         }
      },
      onLoad(options) {
         this.sendCode = options.code;
         this.telphone = options.phone;
      },
      methods:{
         valid(){
            if(!this.newPassword.trim()){
               this.$toast.info('请输入新密码');
               return false;
            }
            if(this.password.trim()!==this.newPassword.trim()){
               this.$toast.info('两次密码不一致');
               return false;
            }
         },
         submit(){
            if(this.valid() === false){
               return;
            }
            this.$httpUtils.request('/api/common/resetLoginPwd',{
               code: this.sendCode,
               newPwd: this.newPassword,
               telphone: this.telphone
            },'POST').then((res)=>{
               if(res.status==200){
                  this.$toast.info(res.info);
                  uni.navigateBack({
                     delta:2
                  })
               }
            }).catch((err) => {
               this.$toast.info(res.info);
            })
         }
      }
   }
</script>
<style>
   .input-box{
      margin: 40px 20px;
   }
   .next{
      margin: 60px 20px;
      margin: 20px 15px;
   }
</style>