微信小程序编译
All checks were successful
Plugin Library CI / publish (00.BuildOriginality) (push) Successful in 13s
Plugin Library CI / publish (00.StaryEvo) (push) Successful in 17s
Plugin Library CI / publish (00.StaryEvoTools) (push) Successful in 35s
Plugin Library CI / publish (01.HybridCLR) (push) Successful in 15s
Plugin Library CI / publish (02.InformationSave) (push) Successful in 3s
Plugin Library CI / publish (03.YooAsset) (push) Successful in 33s
Plugin Library CI / publish (04.AudioCore) (push) Successful in 3s
Plugin Library CI / publish (05.TableTextConversion) (push) Successful in 5s
Plugin Library CI / publish (06.UIFarme) (push) Successful in 15s
Plugin Library CI / publish (07.RKTools) (push) Successful in 2s
Plugin Library CI / publish (08.UniTask) (push) Successful in 3s
Plugin Library CI / publish (09.CodeChecker) (push) Successful in 16s
Plugin Library CI / publish (10.StoryEditor) (push) Successful in 3s
Plugin Library CI / publish (10.XNode) (push) Successful in 3s
Plugin Library CI / publish (11.PointCloudTools) (push) Successful in 2s
Plugin Library CI / publish (12.WeixinMinigame) (push) Successful in 2m32s
All checks were successful
Plugin Library CI / publish (00.BuildOriginality) (push) Successful in 13s
Plugin Library CI / publish (00.StaryEvo) (push) Successful in 17s
Plugin Library CI / publish (00.StaryEvoTools) (push) Successful in 35s
Plugin Library CI / publish (01.HybridCLR) (push) Successful in 15s
Plugin Library CI / publish (02.InformationSave) (push) Successful in 3s
Plugin Library CI / publish (03.YooAsset) (push) Successful in 33s
Plugin Library CI / publish (04.AudioCore) (push) Successful in 3s
Plugin Library CI / publish (05.TableTextConversion) (push) Successful in 5s
Plugin Library CI / publish (06.UIFarme) (push) Successful in 15s
Plugin Library CI / publish (07.RKTools) (push) Successful in 2s
Plugin Library CI / publish (08.UniTask) (push) Successful in 3s
Plugin Library CI / publish (09.CodeChecker) (push) Successful in 16s
Plugin Library CI / publish (10.StoryEditor) (push) Successful in 3s
Plugin Library CI / publish (10.XNode) (push) Successful in 3s
Plugin Library CI / publish (11.PointCloudTools) (push) Successful in 2s
Plugin Library CI / publish (12.WeixinMinigame) (push) Successful in 2m32s
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
import moduleHelper from './module-helper';
|
||||
import { getListObject, uid } from './utils';
|
||||
const userInfoButtonList = {};
|
||||
const getObject = getListObject(userInfoButtonList, 'userInfoButton');
|
||||
export default {
|
||||
WXCreateUserInfoButton(x, y, width, height, lang, withCredentials) {
|
||||
const id = uid();
|
||||
const button = wx.createUserInfoButton({
|
||||
type: 'text',
|
||||
text: '',
|
||||
withCredentials,
|
||||
lang,
|
||||
style: {
|
||||
left: x / window.devicePixelRatio,
|
||||
top: y / window.devicePixelRatio,
|
||||
width: width / window.devicePixelRatio,
|
||||
height: height / window.devicePixelRatio,
|
||||
backgroundColor: 'rgba(0, 0, 0, 0)',
|
||||
color: 'rgba(0, 0, 0, 0)',
|
||||
textAlign: 'center',
|
||||
fontSize: 0,
|
||||
borderRadius: 0,
|
||||
borderColor: '#FFFFFF',
|
||||
borderWidth: 0,
|
||||
lineHeight: height / window.devicePixelRatio,
|
||||
},
|
||||
});
|
||||
userInfoButtonList[id] = button;
|
||||
return id;
|
||||
},
|
||||
WXUserInfoButtonShow(id) {
|
||||
const obj = getObject(id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
obj.show();
|
||||
},
|
||||
WXUserInfoButtonDestroy(id) {
|
||||
const obj = getObject(id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
obj.destroy();
|
||||
if (userInfoButtonList) {
|
||||
delete userInfoButtonList[id];
|
||||
}
|
||||
},
|
||||
WXUserInfoButtonHide(id) {
|
||||
const obj = getObject(id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
obj.hide();
|
||||
},
|
||||
WXUserInfoButtonOffTap(id) {
|
||||
const obj = getObject(id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
obj.offTap();
|
||||
},
|
||||
WXUserInfoButtonOnTap(id) {
|
||||
const obj = getObject(id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
obj.onTap((res) => {
|
||||
res.userInfo = res.userInfo || {};
|
||||
moduleHelper.send('UserInfoButtonOnTapCallback', JSON.stringify({
|
||||
callbackId: id,
|
||||
errCode: res.err_code || (res.errMsg.indexOf('getUserInfo:fail') === 0 ? 1 : 0),
|
||||
errMsg: res.errMsg || '',
|
||||
signature: res.signature || '',
|
||||
encryptedData: res.encryptedData || '',
|
||||
iv: res.iv || '',
|
||||
cloudID: res.cloudID || '',
|
||||
userInfoRaw: JSON.stringify({
|
||||
nickName: res.userInfo.nickName || '',
|
||||
avatarUrl: res.userInfo.avatarUrl || '',
|
||||
country: res.userInfo.country || '',
|
||||
province: res.userInfo.province || '',
|
||||
city: res.userInfo.city || '',
|
||||
language: res.userInfo.language || '',
|
||||
gender: res.userInfo.gender || 0,
|
||||
}),
|
||||
}));
|
||||
});
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user