首次提交

This commit is contained in:
zeronline
2026-06-25 08:39:47 +08:00
parent 20a93c703a
commit c5cccd346b
169 changed files with 24720 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
const api = require('../../../services/api')
Page({
data: { friends: [], addPhone: '', loading: true },
onShow() { this.loadFriends() },
async loadFriends() {
try { const f = await api.get('/api/social/friends'); this.setData({ friends: f || [] }) } catch(e) {}
this.setData({ loading: false })
},
onPhoneInput(e) { this.setData({ addPhone: e.detail.value }) },
async onAdd() {
if (!this.data.addPhone.trim()) return
try { await api.post('/api/social/friends/request', { friendId: this.data.addPhone.trim() }); wx.showToast({ title: '请求已发送' }); this.setData({ addPhone: '' }) }
catch(e) { wx.showToast({ title: e.message || '添加失败', icon: 'none' }) }
},
async onRemove(e) {
const id = e.currentTarget.dataset.id
wx.showModal({ title: '确认', content: '确定删除好友?', success: async (res) => {
if (res.confirm) { try { await api.del('/api/social/friends/' + id); this.loadFriends() } catch(e) {} }
}})
}
})