绩效考核手机版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

138 lines
3.6 KiB

<template>
<view class="editpwd">
<uni-forms ref="baseForm" :rules="baseFormDataViery" :model="baseFormData" labelWidth="80px">
<uni-forms-item label="新密码" required name="newpwd">
<view class="example-body">
<uni-easyinput type="password" v-model="baseFormData.newpwd" placeholder="请输入新密码" />
</view>
</uni-forms-item>
<uni-forms-item label="确认密码" required name="querenpwd">
<view class="example-body">
<uni-easyinput type="password" v-model="baseFormData.querenpwd" placeholder="请确认密码" />
</view>
</uni-forms-item>
<button type="primary" plain="true" :disabled="loading" :loading="loading" @click="sendJiafen('baseForm')">提交</button>
</uni-forms>
</view>
</template>
<script>
export default {
data() {
return {
loading:false,
headerVerify:{
userkey:"",
token:"",
userCont:""
},
baseFormData:{
newpwd:"",
querenpwd:""
},
baseFormDataViery:{
newpwd:{
rules: [{
required: true,
errorMessage: '新密码不能为空'
}]
},
querenpwd:{
rules: [{
required: true,
errorMessage: '请确认密码'
}]
}
}
};
},
onLoad(option) {
let _this = this
//判断Token是否有效
let systemCache = _this.$commonMethod.getSystemCacheDate('myCache')
if(!systemCache){
_this.$commonMethod.JumpUrl('/pages/login/login')
}else{
let currentTime = new Date().getTime() - systemCache.tokenTime
if (currentTime >= 10800000){
_this.$commonMethod.verifyPowerIsTrue('myCache')
}
}
_this.headerVerify.userkey = systemCache.userKey
_this.headerVerify.token = systemCache.token
_this.headerVerify.userCont = systemCache.userInfo
},
methods:{
//验证密码是否一直
sendJiafen(ref){
let _this=this
_this.loading=true
console.log("baseFormData-------》",_this.baseFormData);
this.$refs[ref].validate().then(res => {
// if(_this.baseFormData.newpwd != _this.baseFormData.querenpwd){
// reject(new Error('两次密码不一致'))
// return
// }
let sendData = {
id:_this.headerVerify.userCont.key.toString(),
pwd:_this.baseFormData.newpwd,
pwdes:_this.baseFormData.querenpwd
}
uni.request({
url:_this.$commonMethod.localhostUrl+'/kpiapi/staff/editpassword',
header: {
'Content-Type': 'application/json', //自定义请求头信息
// 'User-Agent':250,
'user-key': _this.headerVerify.userkey,
'user-token': _this.headerVerify.token
},
method:'POST',//请求方式,必须为大写
data:sendData,
success: (res) => {
console.log(res)
let callBackDate = res.data
if(callBackDate.code == 0){
_this.$refs.uToast.show({
message: callBackDate.msg,
duration: 1000 * 2,
position:'bottom',
complete(){
uni.navigateBack();
}
})
}else{
_this.$refs.uToast.show({
message: callBackDate.msg,
duration: 1000 * 2,
position:'bottom',
complete(){
_this.loading=false
}
})
}
},
fail:function(e){
// console.log('接口返回--login--2--',e);
_this.$refs.uToast.show({
message: e,
duration: 1000 * 2,
position:'bottom',
})
},
})
}).catch(err => {
console.log('err', err);
_this.loading=false
})
}
}
}
</script>
<style lang="scss">
.editpwd{
background-color: #FFFFFF;
padding: 20px 10px;
}
</style>