data: {
loginShow: false,
modalShow: false,
content:'',
},
methods: {
onComment() {
//判断用户是否授权
wx.getSetting({
success: (res) => {
if (res.authSetting['scope.userInfo']) {
wx.getUserInfo({
success: (res) => {
userInfo = res.userInfo
// 显示评论弹出层
this.setData({
modalShow: true,
})
}
})
} else {
this.setData({
loginShow:true,
})
}
}
})
},
onLoginsuccess(event) {
userInfo = event.detail
this.setData({
// 登录框消失,评论框显示
loginShow: false
}), () => {
this.setData({
// 写评论框出现
modalShow: true
})
}
},