59 lines
1.3 KiB
JavaScript
59 lines
1.3 KiB
JavaScript
/**
|
|
* 活动互选结果页 U36
|
|
* 展示活动中双方互相表达的意向结果
|
|
*/
|
|
const api = require('../../utils/api');
|
|
|
|
Page({
|
|
data: {
|
|
activityId: '',
|
|
activityTitle: '',
|
|
matches: [],
|
|
loading: true
|
|
},
|
|
|
|
onLoad(options) {
|
|
if (options.activityId) {
|
|
this.setData({ activityId: options.activityId });
|
|
this.loadMatches();
|
|
}
|
|
},
|
|
|
|
async loadMatches() {
|
|
this.setData({ loading: true });
|
|
try {
|
|
const token = wx.getStorageSync('accessToken');
|
|
const res = await api.get(`/activities/${this.data.activityId}/interests/mutual`, {}, {
|
|
Authorization: `Bearer ${token}`
|
|
});
|
|
// 获取活动标题
|
|
const actRes = await api.get(`/activities/${this.data.activityId}`, {}, {
|
|
Authorization: `Bearer ${token}`
|
|
});
|
|
this.setData({
|
|
activityTitle: actRes.title,
|
|
matches: res || [],
|
|
loading: false
|
|
});
|
|
} catch (err) {
|
|
this.setData({ loading: false });
|
|
}
|
|
},
|
|
|
|
onRefresh() {
|
|
this.loadMatches();
|
|
},
|
|
|
|
goToProfile(userId) {
|
|
wx.navigateTo({
|
|
url: `/pages/profile-detail/profile-detail?id=${userId}&activityId=${this.data.activityId}`
|
|
});
|
|
},
|
|
|
|
startChat(userId) {
|
|
wx.navigateTo({
|
|
url: `/pages/chat/chat?userId=${userId}&activityId=${this.data.activityId}`
|
|
});
|
|
}
|
|
});
|