sync changes: 出场顺序优化、联系人功能

This commit is contained in:
Z-WICK
2026-01-15 15:57:08 +08:00
committed by DevOps
parent 412069524e
commit 7c4507c3ed
7 changed files with 81 additions and 16 deletions
+30
View File
@@ -124,6 +124,36 @@ export default {
try {
await athleteAPI.saveContact(this.formData);
uni.showToast({ title: '保存成功', icon: 'success' });
// Set flag to notify previous page
uni.setStorageSync('contactListNeedRefresh', true);
// Notify previous page to refresh contact list
try {
const pages = getCurrentPages();
console.log('页面栈长度:', pages.length);
console.log('页面栈:', pages);
if (pages.length >= 2) {
const prevPage = pages[pages.length - 2];
console.log('上一页:', prevPage);
// Try different ways to access the component
const vm = prevPage.$vm || prevPage;
console.log('vm:', vm);
if (vm && typeof vm.loadContactList === 'function') {
console.log('调用 loadContactList');
vm.loadContactList();
} else if (vm && vm.$refs && vm.$refs.page && typeof vm.$refs.page.loadContactList === 'function') {
console.log('通过 $refs 调用');
vm.$refs.page.loadContactList();
}
}
} catch (e) {
console.error('通知上一页失败:', e);
}
// Also emit event as backup
uni.$emit('contactAdded');
setTimeout(() => { uni.navigateBack(); }, 1500);
} catch (err) {
console.error('保存联系人失败:', err);