fix: 缓存并显示新手机号
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m23s
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m23s
This commit is contained in:
@@ -39,6 +39,10 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref, onMounted } from 'vue';
|
import { reactive, ref, onMounted } from 'vue';
|
||||||
import { authApi } from '@/api/index.js';
|
import { authApi } from '@/api/index.js';
|
||||||
|
import { useUserStore } from '@/store/index.js';
|
||||||
|
import { setPhoneBindStatus } from '@/utils/phone-bind.js';
|
||||||
|
|
||||||
|
const userStore = useUserStore();
|
||||||
|
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
oldPhone: '',
|
oldPhone: '',
|
||||||
@@ -133,6 +137,8 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await authApi.changePhone(form.oldPhone, form.oldCode, form.newPhone, form.newCode);
|
await authApi.changePhone(form.oldPhone, form.oldCode, form.newPhone, form.newCode);
|
||||||
|
setPhoneBindStatus(userStore.state.identifier, form.newPhone);
|
||||||
|
form.oldPhone = form.newPhone;
|
||||||
uni.showToast({ title: '更换成功', icon: 'success' });
|
uni.showToast({ title: '更换成功', icon: 'success' });
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
@@ -160,4 +166,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -273,7 +273,7 @@
|
|||||||
deviceInfo.imei = data.imei || '-';
|
deviceInfo.imei = data.imei || '-';
|
||||||
deviceInfo.asset_type = data.asset_type || 'device';
|
deviceInfo.asset_type = data.asset_type || 'device';
|
||||||
const apiBoundPhone = data.bound_phone || '';
|
const apiBoundPhone = data.bound_phone || '';
|
||||||
const effectiveBoundPhone = apiBoundPhone || localBindStatus?.phone || '';
|
const effectiveBoundPhone = localBindStatus?.phone || apiBoundPhone || '';
|
||||||
deviceInfo.bound_phone = effectiveBoundPhone;
|
deviceInfo.bound_phone = effectiveBoundPhone;
|
||||||
deviceInfo.packageName = data.current_package || '-';
|
deviceInfo.packageName = data.current_package || '-';
|
||||||
deviceInfo.currentPackageId = Number(data.current_package_id || 0);
|
deviceInfo.currentPackageId = Number(data.current_package_id || 0);
|
||||||
@@ -291,7 +291,7 @@
|
|||||||
userStore.setRealNameStatus(data.real_name_status);
|
userStore.setRealNameStatus(data.real_name_status);
|
||||||
boundPhone.value = effectiveBoundPhone;
|
boundPhone.value = effectiveBoundPhone;
|
||||||
alreadyBindPhone.value = !!(apiBoundPhone || localBindStatus?.bound);
|
alreadyBindPhone.value = !!(apiBoundPhone || localBindStatus?.bound);
|
||||||
if (apiBoundPhone) {
|
if (apiBoundPhone && (!localBindStatus || apiBoundPhone === localBindStatus.phone)) {
|
||||||
setPhoneBindStatus(identifier, apiBoundPhone);
|
setPhoneBindStatus(identifier, apiBoundPhone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user