uni.getUserProfile({
desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (infoRes) => {
const userInfo = infoRes.userInfo;
// 调用后端接口进行登录
在调用uni.getUserProfile不能获取完整的userInfo信息,调试发现有encryptedData加密数据的完整用户信息但是不知道怎么解密,获取用户信息用途主要防止恶意用户违法犯罪的行为时举报拉黑操作,因为今天有一个恶意用户上传色情视频,已经被删除了,并且关闭了上传视频功能和以前的账户注册功能,但是无法控制以后继续违法行为,视频上传代码在下面
chooseVideo() {
const that = this;
uni.chooseVideo({
count: 1, // 默认9
maxDuration: 60, // 最大时长,单位为秒
camera: 'back', // 前置或者后置摄像头,默认为前后都有
sourceType: ['album', 'camera'], // 视频来源,相册 album、相机 camera
compressed: true, // 是否压缩所选的视频源文件,默认值为true,需要压缩
success(res) {
console.log('Selected video:', res);
that.selectedVideo = res;
},
fail(err) {
console.error('Failed to select video:', err);
}
});
},
uploadVideo() {
const that = this;
if (!this.selectedVideo) {
uni.showToast({
title: '请选择一个视频',
icon: 'none'
});
return;
}
uni.showLoading({
title: '上传中...',
mask: true
});
$H.upload('/upload',{
filePath: this.selectedVideo.tempFilePath
},(p)=>{
console.log(p);
}).then(res=>{
let cover = $C.imageUrl + res.url;
$H.post('/personal/save',{
user_id:this.user.id,
cover:cover
});
console.log('Upload success:', res);
that.uploadResult = '上传成功';
uni.hideLoading();
this.$emit('confirm');
this.$refs.popup.close();
}).catch(res=>{
console.log('Upload failed:', res);
that.uploadResult = '上传失败';
uni.hideLoading();
});
}
现在非常头疼,请微信社区大牛帮忙解决一下这个问题
上传文字图片视频资料时接入腾讯检测api,若异常不允许上传。
该接口目前已无法获取用户信息。
如有获取用户信息需求,需使用头像昵称填写组件。参考https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/userProfile.html
担心用户上传非法信息,应接入内容安全检测。
},
declinePrivacyPolicy() {
this.$refs.popupPrivacy.close();
this.agreed=false;
uni.showToast({
title: '必须接受隐私政策才能登录',
icon: 'none',
});
},
acceptServicePolicy() {
this.$refs.popupService.close();
this.agreed=true;
this.wechatLogin();
},
declineServicePolicy() {
this.$refs.popupService.close();
this.agreed=false;
uni.showToast({
title: '必须接受服务协议才能登录',
icon: 'none',
});
},
onAgreeChange(e) {
this.agreed = e.detail.value.includes('agree');
},
getPhoneNumber(e) {
if (e.detail.errMsg === 'getPhoneNumber:ok') {
this.phonenumberCode=e.detail.code;
}
console.log(e.detail.code) // 动态令牌
console.log(e.detail.errMsg) // 回调信息(成功失败都会返回)
console.log(e.detail.errno) // 错误码(失败时返回)
},
wechatLogin() {
if(this.phonenumberCode == '') {
uni.showToast({
title: '请点击获取手机号码',
icon: 'none',
});
return;
}
中getPhoneNumber绑定的事件没有触发