多参数多条件的if...else如何优化?想把这两个函数优化成一个。
_chatMask: function () {
wx.hideLoading();
if (this.data.isLogin) {
this.setData({
dialogMask: true,
chatMaskA: true,
})
};
if (this.pureData.isSignIn && this.pureData.isChat && !this.pureData.isFollow) {
this.setData({
dialogMask: true,
chatMaskB: true,
})
return
};
if (this.pureData.isShare && this.pureData.isChat && !this.pureData.isFollow) {
this.setData({
dialogMask: true,
chatMaskC: true,
})
return
};
},
_flockMask: function () {
if (this.pureData.isSignIn && this.pureData.isFlock && !this.pureData.isFollow && !this.pureData.isExist) {
this.setData({
dialogMask: true,
flockMaskA: true,
})
return
};
if (this.pureData.isSignIn && this.pureData.isFlock && this.pureData.isExist && !this.data.isEqual) {
this.setData({
dialogMask: true,
flockMaskB: true
})
return
};
if (this.pureData.isShare && this.pureData.isFlock && !this.pureData.isFollow && !this.data.isEqual) {
this.setData({
dialogMask: true,
flockMaskC: true,
})
return
};
},