日照项目的居民端小程序
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.

101 lines
2.1 KiB

import { wxRequestPost, wxNavigateTo, wxGetUserProfile } from "@utils/promise-wx-api";
let tempReslove = () => {};
Component({
properties: {
from: {
type: String,
value: "",
},
shareLinkId: {
type: String,
value: "",
},
content:{
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();
},
},
});