mirror of
https://gitee.com/qingqing-coconut-tea/RcKtFezyRAZX
synced 2026-07-21 10:32:32 +08:00
init
This commit is contained in:
58
wechat/components/user-card/user-card.js
Normal file
58
wechat/components/user-card/user-card.js
Normal file
@@ -0,0 +1,58 @@
|
||||
// components/user-card/user-card.js
|
||||
// 用户卡片组件
|
||||
|
||||
Component({
|
||||
properties: {
|
||||
user: {
|
||||
type: Object,
|
||||
value: {}
|
||||
},
|
||||
showFollow: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
}
|
||||
},
|
||||
|
||||
data: {
|
||||
isFollowing: false
|
||||
},
|
||||
|
||||
lifetimes: {
|
||||
attached() {
|
||||
if (this.data.user) {
|
||||
this.setData({ isFollowing: this.data.user.isFollowing || false })
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
onTap() {
|
||||
const user = this.data.user
|
||||
if (user && user.id) {
|
||||
wx.navigateTo({
|
||||
url: `/pages/user-profile/user-profile?userId=${user.id}`
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
onFollow(e) {
|
||||
e.stopPropagation()
|
||||
const user = this.data.user
|
||||
if (!user || !user.id) return
|
||||
|
||||
const isFollowing = !this.data.isFollowing
|
||||
this.setData({ isFollowing })
|
||||
|
||||
this.triggerEvent('follow', {
|
||||
userId: user.id,
|
||||
isFollowing
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* @联系作者:16768118056
|
||||
* @描述:(此项目非免费分享)源码百分百可用,搞定毕设不发愁,支持远程调试安装、二次开发、定制、讲解、文档类。
|
||||
* @访问:https://www.notmaker.com/detail/8326a897119d4542896c863a69d7bbe7/gtt20260415,查看完整运行演示。
|
||||
*/
|
||||
Reference in New Issue
Block a user