li-guang
2021-01-08 86773d61655cd653b3feb70401aa2edf242aa29c
hive-app/pages/login/newPassword.vue
@@ -2,16 +2,58 @@
   <!-- 新密码 -->
   <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="sticky-footer">
         <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)=>{
               console.log(res)
               if(res.status==200){
                  this.$toast.info(res.info);
                  uni.navigateBack();
               }
            }).catch((err) => {
               this.$toast.info(res.info);
            })
         }
      }
   }
</script>
<style>