sync changes: 出场顺序优化、联系人功能
This commit is contained in:
@@ -282,6 +282,11 @@ export default {
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
// Listen for contact added event
|
||||
uni.$on('contactAdded', () => {
|
||||
console.log('=== 收到 contactAdded 事件 ===')
|
||||
this.loadContactList()
|
||||
})
|
||||
if (options.eventId) {
|
||||
this.eventId = options.eventId
|
||||
this.loadEventDetail(options.eventId)
|
||||
@@ -309,9 +314,21 @@ export default {
|
||||
this.loadPlayerList()
|
||||
}
|
||||
},
|
||||
onUnload() {
|
||||
uni.$off('contactAdded')
|
||||
},
|
||||
onShow() {
|
||||
// Refresh contact list when returning from add-contact page
|
||||
this.loadContactList()
|
||||
console.log('=== onShow 被触发 ===')
|
||||
// Check if contact list needs refresh
|
||||
const needRefresh = uni.getStorageSync('contactListNeedRefresh')
|
||||
if (needRefresh) {
|
||||
console.log('检测到需要刷新联系人列表')
|
||||
uni.removeStorageSync('contactListNeedRefresh')
|
||||
this.loadContactList()
|
||||
} else {
|
||||
// Always refresh contact list when page shows
|
||||
this.loadContactList()
|
||||
}
|
||||
if (this.currentStep === 1) {
|
||||
if (this.isTeamProject) {
|
||||
this.loadTeamList()
|
||||
@@ -324,13 +341,19 @@ export default {
|
||||
// Contact methods
|
||||
async loadContactList() {
|
||||
try {
|
||||
console.log('=== 开始加载联系人列表 ===')
|
||||
const res = await athleteAPI.getContactList({ current: 1, size: 100 })
|
||||
this.contactList = (res.records || []).map(item => ({
|
||||
console.log('联系人API返回:', res)
|
||||
const records = res.records || res.data?.records || []
|
||||
console.log('联系人记录:', records)
|
||||
this.contactList = records.map(item => ({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
phone: item.phone,
|
||||
idCard: item.idCard
|
||||
idCard: item.idCard,
|
||||
isDefault: item.isDefault
|
||||
}))
|
||||
console.log('处理后的联系人列表:', this.contactList)
|
||||
// Auto select default contact if exists
|
||||
if (!this.selectedContact && this.contactList.length > 0) {
|
||||
const defaultContact = this.contactList.find(c => c.isDefault) || this.contactList[0]
|
||||
|
||||
Reference in New Issue
Block a user