uniapp如何获取微信和抖音小程序的用户图像及昵称?
网友回复
1、微信小程序之前的getuserprofile已经不能使用,微信官方的解释是:

现在只能使用新方案:
获取微信图像
<button type="balanced" open-type="chooseAvatar" @chooseavatar="onChooseavatar">点击获取图像</button>获取昵称
<input type="nickName" class="weui-input" :value="userName" @blur="bindblur" placeholder="请输入昵称" @input="bindinput" />
新的获取微信图像与昵称示例代码:
<template>
<view class="containar">
<view class="avatarUrl">
<button type="balanced" open-type="chooseAvatar" @chooseavatar="onChooseavatar">
<image :src="avatarUrl" class="refreshIcon"></image>
</button>
</view>
<view class="userName">
<text>昵称:</text>
<input type="nickName" class="weui-input" :value="userName" @blur="bindblur" placeholder="请输入昵称"
@input="bindinput" />
</view>
<view class="btn">
<view class="btn-sub" @click="onSubmit">保存</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
avatarUrl: '',
userName: ''
};
},
onLoad(option) {},
methods: {
bindblur(e) {
this.userName = e.detail.value; // 获取微信昵称
},
bindinput(e) {
this.userName = e.detail.value; // 获取微信昵称
},
onChooseavatar(e) {
let self = this;
let {
avatarUrl
...点击查看剩余70%
抖音小程序还可以使用getUserProfile
tt.getUserProfile({
success: (res) => {
console.log('tt.getUserProfile success,获取的用户信息:', res);
this.setData({
userI...点击查看剩余70%
阿里云ESA、cloudflare worker、腾讯云EdgeOne网站代理托管哪家更好?
剪映能打开.fcpxml格式的文件吗?
增量式编码器与绝对式编码器的区别是啥?
有没有开源的单张照片或者序列帧图片或视频就能重建4d场景动画项目?
chrome网页突然报错:错误代码:RESULT_CODE_KILLED_BAD_MESSAGE
openai的codex如何全程无需手动确认自动修改文件?
阿里云oss前端上传文件直传如何限制文件类型?
阿里云oss前端获取policy签名直传oss上传文件回调如何传?
如何将根据三维物体通过提示词变成可交互的4d场景动画?
浏览器中实时摄像头离线视觉ai模型有吗?


