25 lines
797 B
TypeScript
25 lines
797 B
TypeScript
const app = getApp<{ globalData: { apiBase: string; token: string } }>();
|
|||
|
|
|
||
|
|
Page({
|
||
|
|
data: { loading: true, results: [] as any[] },
|
||
|
|
onLoad() { this.loadResults(); },
|
||
|
|
onShow() { this.loadResults(); },
|
||
|
|
|
||
|
|
async loadResults() {
|
||
|
|
try {
|
||
|
|
const res = await wx.request({
|
||
|
|
url: `${app.globalData.apiBase}/activities/mutual/my-results`,
|
||
|
|
header: { 'Authorization': `Bearer ${app.globalData.token}` }
|
||
|
|
});
|
||
|
|
if (res.statusCode === 200 && res.data.success) {
|
||
|
|
this.setData({ results: res.data.data || [], loading: false });
|
||
|
|
}
|
||
|
|
} catch (e) { console.error(e); this.setData({ loading: false }); }
|
||
|
|
},
|
||
|
|
|
||
|
|
openChat(e: any) {
|
||
|
|
const partnerId = e.currentTarget.dataset.partnerid;
|
||
|
|
wx.navigateTo({ url: `/pages/chat/chat?partnerId=${partnerId}` });
|
||
|
|
}
|
||
|
|
});
|