demingshangjia/pages/user/updatePassword.vue

84 lines
2.1 KiB
Vue
Raw Normal View History

2020-06-12 18:05:39 +08:00
<template>
<view class="password">
<view class="form-class">
2020-06-13 17:36:24 +08:00
<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>
2020-06-12 18:05:39 +08:00
</u-form-item>
<u-form-item label="新密码" label-width="160" prop="newPassword">
2020-06-13 17:36:24 +08:00
<u-input type="password" :password="true" v-model="model.newPassword" placeholder="请输入新密码"></u-input>
2020-06-12 18:05:39 +08:00
</u-form-item>
<!-- right-icon="eye-off" -->
<u-form-item label="确认新密码" label-width="160" prop="rePassword">
2020-06-13 17:36:24 +08:00
<u-input type="password" :password="true" v-model="model.rePassword" placeholder="请再次输入新密码"></u-input>
2020-06-12 18:05:39 +08:00
</u-form-item>
</u-form>
</view>
<text class="tips">密码必须是8-16至少含数字/字母/字符两种组合</text>
2020-07-29 20:35:33 +08:00
<view class="btn" @click="update">确定</view>
<u-toast ref="uToast" />
2020-06-12 18:05:39 +08:00
</view>
</template>
<script>
export default {
data() {
return {
model: {
password: '',
newPassword: '',
rePassword: ''
},
}
2020-07-29 20:35:33 +08:00
},
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'
});
}
});
},
2020-06-12 18:05:39 +08:00
}
};
</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>