import { wxRequestPost, wxNavigateTo, wxGetUserProfile } from "@utils/promise-wx-api"; let tempReslove = () => {}; Component({ properties: { from: { type: String, value: "", }, shareLinkId: { type: String, value: "", }, }, data: { hidden: true, showCancel: true, title: "", content: "只有注册成为党员才可以创建该小组,请先前往注册。", partyText: "注册党员", resiText: "注册居民", }, methods: { show(opts) { this.setData({ ...opts, hidden: false, }); return new Promise((reslove) => { tempReslove = reslove; }); }, hide() { tempReslove(false); this.setData({ hidden: true }); }, async confirm(e) { const {msg, data} = await wxGetUserProfile({ desc: '用于完善党员信息' }); if (msg=='success') { const { nickName, gender, avatarUrl, province, country, city, } = data.userInfo; // 同意授权,更新用户信息 await wxRequestPost( "epmetuser/user/updatewxuserinfo", { nickName, gender, avatarUrl, province, country, city, }, { // isMock: true, } ); } else { return; } const { currentTarget: { dataset: { type }, }, } = e; const route = type === "party" ? "/subpages/mine/pages/register/communist/index" : "/subpages/mine/pages/register/resident/index"; const { from, shareLinkId } = this.data; wxNavigateTo(route, { from, shareLinkId, }); }, cancel() { this.hide(); }, }, });