import { inputSync, nextTick } from "@utils/tools"; import { wxRequestPost, wxRedirectTo, wxNavigateTo, } from "@utils/promise-wx-api"; const app = getApp(); Component({ properties: { tid: { type: String, value: "", }, gid: { type: String, value: "", }, shareLinkId: { type: String, value: "", }, }, data: { iniLoaded: false, groupId: "", groupMember: { loading: false, page: 1, pageSize: 10, isNone: false, list: [ ], }, refreshFlag: false, //onshow用判断 }, ready() { // this.requestMsg = this.selectComponent('#requestMsg') }, methods: { async onLoad(options) { let groupId = options.gid; this.setData({groupId: groupId }); await this.getmemberList(); this.setData({ iniLoaded: true }); }, async onShow() { }, onReachBottom() { this.getmemberList(); }, // 获取人员列表 async getmemberList() { const { groupId, groupMember } = this.data; // 如果正在加载或没有更多,返回 if (groupMember.loading || groupMember.isNone) return; groupMember.loading = true; this.setData({ groupMember }); const { data: { data: { code, data }, }, msg, } = await wxRequestPost( "data/aggregator/resigroup/candidatelist", { groupId, pageNo: groupMember.page, pageSize: groupMember.pageSize, }, { // isMock: true } ); groupMember.loading = false; if (msg === "success" && code === 0) { let newList = data // .map((item) => { // return { // id: item.commentId, // avatar: item.commentUserHeadPhoto, // content: item.commentContent, // name: item.commentUserName || "匿名用户", // date: item.commentTime, // unbold: false, // }; // }) // .filter( // (item) => // groupMember.list.findIndex((sItem) => sItem.id === item.id) === -1 // ); groupMember.list = groupMember.list.concat(newList); groupMember.page = groupMember.page + 1; if (data.length < groupMember.pageSize) { groupMember.isNone = true; } } this.setData({ groupMember }); }, confirm(e){ const { currentTarget: { dataset: { id,name }, }, } = e; const text="转让给"+name+"后您将失去组长身份。" wx.showModal({ content: text, success: (res) => { if (res.confirm) { this.transfer(id) } }, }); }, //转让组长 async transfer(id){ const { data: { data: { code, data }, }, msg, } = await wxRequestPost( "resi/group/leadertransfer/confirmtransfer", { groupId:this.data.groupId, newLeaderUserId: id, type: "resi", }, { // isMock: true } ); if (msg === "success" && code === 0) { wx.showToast({ title: "转让成功", icon: "none", duration: 1000, }); // await this.requestMsg.handleMsg() wx.navigateBack() } }, //转议题 toIssue() { wx.navigateTo({ url: `/subpages/group/pages/topic/topicToDiscussion/index?topicid=${this.data.topicId}&from=topicdetail`, }); }, }, });