demingshangjia/pages/user/updatePassword.vue
2020-07-29 20:35:33 +08:00

84 lines
2.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="password">
<view class="form-class">
<u-form :model="model" ref="uForm">
<u-form-item label="原密码" label-width="160" prop="password">
<u-input type="password" :password="true" v-model="model.password" placeholder="请输入原密码"></u-input>
</u-form-item>
<u-form-item label="新密码" label-width="160" prop="newPassword">
<u-input type="password" :password="true" v-model="model.newPassword" placeholder="请输入新密码"></u-input>
</u-form-item>
<!-- right-icon="eye-off" -->
<u-form-item label="确认新密码" label-width="160" prop="rePassword">
<u-input type="password" :password="true" v-model="model.rePassword" placeholder="请再次输入新密码"></u-input>
</u-form-item>
</u-form>
</view>
<text class="tips">密码必须是8-16位至少含数字/字母/字符两种组合</text>
<view class="btn" @click="update">确定</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
export default {
data() {
return {
model: {
password: '',
newPassword: '',
rePassword: ''
},
}
},
methods:{
update(){
let that = this;
this.$u.api.editpassword({
old_password:that.model.password,
password:that.model.newPassword,
repassword:that.model.rePassword
}).then(res => {
console.log(res);
if (res.errCode != 0) {
this.$refs.uToast.show({
title: res.message,
type: 'error'
});
} else {
this.$refs.uToast.show({
title: res.message,
type: 'success'
});
}
});
},
}
};
</script>
<style lang="scss" scoped>
.password {
min-height: calc(100vh - var(--window-top));
background: #ececec;
.form-class {
background-color: #ffffff;
padding: 0 30rpx;
margin-bottom: 25rpx;
}
.tips {
margin: 0 30rpx;
font-size: 24rpx;
color: rgba(101,101,101,1);
}
.btn {
margin: 120rpx auto 0;
width: 690rpx;
height: 98rpx;
background: rgba(255,119,15,1);
border-radius: 49rpx;
line-height: 98rpx;
text-align: center;
font-size: 36rpx;
color: rgba(255,255,255,1);
}
}
</style>