68 lines
1.6 KiB
Vue
68 lines
1.6 KiB
Vue
<template>
|
|
<view class="password-page">
|
|
<u-form :model="form" ref="uForm">
|
|
<u-form-item label="密码:" label-width="100">
|
|
<u-input v-model="form.password" :type="type" :password-icon="passwordIcon" :clearable="true"/>
|
|
</u-form-item>
|
|
<u-form-item label="确认密码:" label-width="150">
|
|
<u-input v-model="form.password_confirmation" :type="type" :password-icon="passwordIcon" :clearable="true"/>
|
|
</u-form-item>
|
|
<view class="btns" style="margin-top: 68rpx;">
|
|
<u-button type="primary" @click="passwordEditFn()">确定</u-button>
|
|
</view>
|
|
</u-form>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
form: {
|
|
password: '',
|
|
password_confirmation: '',
|
|
},
|
|
type: 'password',
|
|
passwordIcon: true,
|
|
|
|
};
|
|
},
|
|
onLoad() {
|
|
|
|
},
|
|
methods:{
|
|
passwordEditFn(){
|
|
console.log(this.form);
|
|
if (!this.form.password) {
|
|
uni.showToast({ title: '请输入新密码', icon: 'none' });
|
|
return;
|
|
}
|
|
if (!this.form.password_confirmation) {
|
|
uni.showToast({ title: '请输入确认密码', icon: 'none' });
|
|
return;
|
|
}
|
|
if (this.form.password != this.form.password_confirmation) {
|
|
uni.showToast({ title: '两次密码不一致', icon: 'none' });
|
|
return;
|
|
}
|
|
this.$http.put('/api/users/reset-password',this.form).then(({data})=>{
|
|
console.log(data)
|
|
if(data.code==200){
|
|
|
|
}else{
|
|
uni.showToast({ title: data.message, icon: 'none' });
|
|
}
|
|
}).catch(()=>{
|
|
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.password-page{
|
|
padding: 32rpx;
|
|
}
|
|
</style>
|