对接设置接口

This commit is contained in:
zhouyanli
2026-05-12 14:28:40 +08:00
parent 78c69cdb10
commit f2f5c5e050
7 changed files with 344 additions and 379 deletions

View File

@@ -34,98 +34,57 @@
</template>
<script>
export default {
onReady: function(e) {},
components: {
},
computed: {
},
created() {
},
onShow() {
},
onLoad() {
},
mounted() {},
data() {
return {
/* 设定状态栏默认高度 */
statusBarHeight: 20,
oldPwd: '',
newPwd: '',
confirmPwd: '',
<script setup>
import { ref } from 'vue'
import { authChangePassword } from '../api/apiSub.js'
const statusBarHeight = ref(20);
const oldPwd = ref('');
const newPwd = ref('');
const confirmPwd = ref('')
// 方法
const onSubmit = () => {
if (!oldPwd.value) {
uni.showToast({ title: '请输入原密码', icon: 'none' })
return
}
if (!newPwd.value) {
uni.showToast({ title: '请输入新密码', icon: 'none' })
return
}
if (newPwd.value !== confirmPwd.value) {
uni.showToast({ title: '两次密码不一致', icon: 'none' })
return
}
uni.showLoading({ title: '修改中...', mask: true })
authChangePassword({
oldPassword: oldPwd.value,
newPassword: newPwd.value,
confirmPassword: confirmPwd.value
}).then(res => {
uni.hideLoading()
if (res.code === 200) {
uni.showToast({ title: '修改成功', icon: 'success' })
setTimeout(() => goBack(), 1500)
} else {
uni.showToast({ title: res.msg || '修改失败', icon: 'none' })
}
},
methods: {
// 提交修改
onSubmit() {
// 1. 基础校验
if (!this.oldPwd) {
uni.showToast({
title: '请输入原密码',
icon: 'none'
})
return
}
if (!this.newPwd) {
uni.showToast({
title: '请输入新密码',
icon: 'none'
})
return
}
if (this.newPwd !== this.confirmPwd) {
uni.showToast({
title: '两次密码不一致',
icon: 'none'
})
return
}
uni.showLoading({
title: '修改中...',
mask: true
});
setTimeout(() => {
uni.showToast({
title: '修改成功',
icon: 'success'
});
}, 1000);
setTimeout(() => {
// 提交成功后跳转列表页
uni.hideLoading();
this.goBack();
}, 2500);
},
goBack() {
uni.redirectTo({
url: '/pageSubPack/my/settingIndex',
success: res => {},
fail: () => {},
complete: () => {}
});
},
},
}).catch((err) => {
uni.hideLoading()
uni.showToast({ title: err.msg || '修改失败', icon: 'none' })
})
}
const goBack = () =>{
uni.redirectTo({
url: '/pageSubPack/my/settingIndex',
});
}
</script>
<style lang="scss">
page {