sync changes: 出场顺序优化、联系人功能
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user