const app = getApp(); Component({ data: { showMyGroup: false, }, properties: { list: { type: Array, value: [], }, noDataVisible: { type: Boolean, value: true, }, }, lifetimes: { attached: async function () { console.log("my-group-list attached"); console.log(app.globalData.userRoleList); let userRoleList = app.globalData.userRoleList; if ( userRoleList.indexOf("warmhearted") >= 0 || userRoleList.indexOf("partymember") >= 0 ) { this.setData({ showMyGroup: true, }); } else { this.setData({ showMyGroup: false, }); } }, }, methods: { gotoGroup(e) { let gid = e.currentTarget.dataset.gid; let sts = e.currentTarget.dataset.sts; if (sts !== "approved") return; wx.navigateTo({ url: "/subpages/group/pages/topic/topicIndex/topicIndex?gid=" + gid, }); }, gotomanage(e) { let gid = e.currentTarget.dataset.gid; wx.navigateTo({ url: "/subpages/group/pages/group/groupManage/groupManage?gid=" + gid, }); }, // toAssociationDetail (e) { // const { state, groupid, groupname, description } = e.currentTarget.dataset // if (state === 0 || state === 5) { // wx.navigateTo({ // url: `/subpages/association/pages/unpassAssociation/unpassAssociation?id=${groupid}&state=${state}&description=${encodeURIComponent(description)}` // }) // } else if (state === 10 || state === 15) { // wx.navigateTo({ // url: `/subpages/association/pages/topicList/topicList?groupId=${groupid}&groupName=${groupname}&state=${state}` // }) // } // }, previewImage(e) { app.globalData.previewImage = true; wx.previewImage({ urls: [e.currentTarget.dataset.src], }); }, }, });