import { inputSync } from "@utils/tools"; import { wxRequestPost } from "@utils/promise-wx-api"; let tempReslove = () => {}; Component({ properties: { groupId: String, }, data: { hidden: true, title: "", confirmText: "确定", info: { groupHeadPhoto: "", groupIntroduction: "", groupName: "", totalMember: "", totalPartyMember: "", }, fmData: { operateDes: "", }, }, lifetimes: { // 页面初始化 attached() {}, }, methods: { inputSync, async show(opts) { const { groupId } = this.data; this.setData({ ...opts, }); if (groupId != opts.groupId) { await this.getInfo(); } this.setData({ hidden: false, }); return new Promise((reslove) => { tempReslove = reslove; }); }, hide() { this.setData({ hidden: true }); }, confirm() { this.submit(); }, cancel() { tempReslove(false); this.hide(); }, resetFm() { this.setData({ "fmData.operateDes": "", }); }, // 注册 async getInfo() { const { groupId } = this.data; wx.showLoading({ mask: true, }); const { data: { data: { code, data }, }, msg, } = await wxRequestPost( "resi/group/group/getgroupsummarize", { groupId, }, { // isMock: true, // isQuiet: true, // extraCodes: [8103] } ); wx.hideLoading(); if (msg === "success" && code === 0) { this.setData({ info: data, }); this.resetFm(); } }, // 注册 async submit() { const { fmData, groupId } = this.data; if (fmData.operateDes == "") { return wx.showToast({ title: "申请理由不能为空", icon: "none", duration: 2000, }); } wx.showLoading({ title: "", mask: true, }); const { data: { data: { code, data }, }, msg, } = await wxRequestPost( "resi/group/member/applyjoingroup", { groupId, ...fmData, }, { // isMock: true, // isQuiet: true, // extraCodes: [8103] } ); wx.hideLoading(); if (msg === "success" && code === 0) { wx.showToast({ title: "提交成功,请等待组长确认", icon: "none", duration: 1500, }); this.hide(); this.resetFm(); tempReslove(true); } }, }, });