|
@ -14,6 +14,7 @@ |
|
|
<view class="new_btn_bot"> |
|
|
<view class="new_btn_bot"> |
|
|
<button class="new_save_btn" @click="submit">确认修改</button> |
|
|
<button class="new_save_btn" @click="submit">确认修改</button> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
<comMessage ref="comMessage"></comMessage> |
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
@ -21,12 +22,13 @@ |
|
|
import { ref, getCurrentInstance, onMounted, nextTick, watch } from 'vue' |
|
|
import { ref, getCurrentInstance, onMounted, nextTick, watch } from 'vue' |
|
|
import { onReady } from '@dcloudio/uni-app' |
|
|
import { onReady } from '@dcloudio/uni-app' |
|
|
import { updateUserPwd } from '@/api/request2.js' |
|
|
import { updateUserPwd } from '@/api/request2.js' |
|
|
|
|
|
import {navigateBack,} from '@/common/basic.js'; |
|
|
const formData = ref({ |
|
|
const formData = ref({ |
|
|
oldpassword: '', |
|
|
oldpassword: '', |
|
|
newpassword: '', |
|
|
newpassword: '', |
|
|
newpassword2: '' |
|
|
newpassword2: '' |
|
|
}) |
|
|
}) |
|
|
|
|
|
const comMessage = ref(null) |
|
|
const rules = ref({ |
|
|
const rules = ref({ |
|
|
oldpassword: [{ required: true, message: '请输入密码', trigger: ['change', 'blur'] }], |
|
|
oldpassword: [{ required: true, message: '请输入密码', trigger: ['change', 'blur'] }], |
|
|
// 对name字段进行必填验证 |
|
|
// 对name字段进行必填验证 |
|
@ -68,13 +70,22 @@ const submit = () => { |
|
|
console.log(valid) |
|
|
console.log(valid) |
|
|
if (valid) { |
|
|
if (valid) { |
|
|
updateUserPwd(formData.value.oldpassword, formData.value.newpassword).then((ress) => { |
|
|
updateUserPwd(formData.value.oldpassword, formData.value.newpassword).then((ress) => { |
|
|
|
|
|
if(ress.data){ |
|
|
|
|
|
this.showCommitSuccessMessage("修改成功") |
|
|
|
|
|
} |
|
|
console.log('返回结果:', ress) |
|
|
console.log('返回结果:', ress) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
console.log('表单错误信息:', err) |
|
|
console.log('表单错误信息:', err) |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
const showCommitSuccessMessage = (hint)=> { |
|
|
|
|
|
comMessage.value.showSuccessMessage(hint, res => { |
|
|
|
|
|
navigateBack(1) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
onReady(() => { |
|
|
onReady(() => { |
|
|
form.value.setRules(rules.value) |
|
|
form.value.setRules(rules.value) |
|
|
}) |
|
|
}) |
|
|