You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
124 lines
3.6 KiB
124 lines
3.6 KiB
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: {
|
|
join(e) {
|
|
console.log(app.globalData.userRoleList);
|
|
const type = e.currentTarget.dataset.type;
|
|
const gid = e.currentTarget.dataset.gid;
|
|
let userRoleList = app.globalData.userRoleList;
|
|
if (type === "branch") {
|
|
if (userRoleList.indexOf("partymember") >= 0) {
|
|
this.pureJoinGroup(gid);
|
|
} else {
|
|
wx.showModal({
|
|
content: "该小组需党员才能加入,是否注册党员",
|
|
confirmText: "是",
|
|
cancelText: "否",
|
|
success: (res) => {
|
|
if (res.confirm) {
|
|
console.log("用户点击确定");
|
|
wx.navigateTo({
|
|
url: "/subpages/mine/pages/register/communist/index",
|
|
});
|
|
} else if (res.cancel) {
|
|
console.log("用户点击取消");
|
|
}
|
|
},
|
|
});
|
|
}
|
|
} else {
|
|
if (userRoleList.indexOf("registered_resi") >= 0) {
|
|
// 认证居民
|
|
console.log("gid=" + gid);
|
|
this.pureJoinGroup(gid);
|
|
} else {
|
|
this.setData({
|
|
visible: true,
|
|
});
|
|
}
|
|
}
|
|
},
|
|
applyJoinGroupData(params: any) {
|
|
return request({
|
|
method: "POST",
|
|
url: "resi/group/member/applyjoingroup",
|
|
options: params,
|
|
ifToken: true,
|
|
});
|
|
},
|
|
async pureJoinGroup(groupId) {
|
|
const $ele = this.selectComponent("#joinGroup");
|
|
const addReturn = await $ele.show({ groupId });
|
|
|
|
if (!addReturn) return;
|
|
await this.selectComponent("#requestMsg").handleMsg();
|
|
this.triggerEvent("callSomeFun");
|
|
},
|
|
|
|
gotoGroup(e) {
|
|
let gid = e.currentTarget.dataset.gid;
|
|
let status = e.currentTarget.dataset.status;
|
|
if (status != "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],
|
|
});
|
|
},
|
|
},
|
|
});
|
|
|