<template>
<view>
<view >
<input style="border-bottom: 1rpx solid #eee;margin-top: 30rpx;" v-model="newPassword" placeholder="新密码" />
<input style="border-bottom: 1rpx solid #eee;margin-top: 30rpx;" v-model="oldPassword" placeholder="旧密码" />
</view>
<button @click="getmima()" :style="[inputStyle]" class="getCaptcha">确定修改</button>
</view>
</template>
<script>
export default {
data() {
return {
newPassword:'',
oldPassword:''
}
},
computed: {
inputStyle() {
let style = {};
if(this.newPassword&&this.oldPassword) {
style.color = "#fff";
style.backgroundColor = this.$u.color['warning'];
}
return style;
}
},
methods: {
getmima(){
uni.request({
url:'http://124.93.196.45:10091/prod-api/api/common/user/resetPwd',
data:{
newPassword:this.newPassword,
oldPassword:this.oldPassword
},
method:"PUT",
header:{
Authorization:uni.getStorageSync('token')
},
success(res) {
console.log(res)
if(res.data.code==200){
uni.showToast({
title:res.data.msg
})
setTimeout(()=>{
uni.switchTab({
url:'index'
})
},1000)
}
if(res.data.code>=400){
uni.showToast({
title:res.data.msg
})
}
}
})
}
}
}
</script>