请问小程序开发者怎么添加呢?

请问小程序开发者怎么添加呢?,第1张

关于小程序的开发者添加,具体步骤如下:

1、在电脑登录你的微信小程序,在首页点击添加猛尘开发者;

2、这时候会看到已认证过的管理者的资料,数谨他就是默认的开发者之一,点击箭头所指的倒三角;

3、然后点击添加成员,如图所示,最多可以添加60个成员;

4、然后输入成员枝毕禅的微信号,勾选指定给他的权限设置,如图所示;

5、然后用最初的管理员的微信扫一扫就可以了。

希望以上 *** 作帮到你。

小程序所有新进用户的昵称全部变成了“微信昵称”,当时我就

吓得我赶紧爬起来翻文档(需要代码直接往后翻)

原因就像微信所说的,很多开发者在打开小程序时就通过组件方式唤起getUserInfod窗,如果用户点击拒绝,无法使用小程序,这种做法打断了用户正常使用小程序的流程,同时也不利于小程序获取新用户。

这里我会给出Uni-app的适配代码,针对CRMEB系统进行修复,各位同学举一反三(4.13号之前发布的正式包暂不影响)

1.修改pages/users/wechat_login/index.vue中关于微信登录的按钮

<button span=""

class="bg-green btn1">微信登录

<button span=""

class="bg-green btn1">微信登录

2.默认仔局data中添加canUseGetUserProfile: false,然后在加载页面调用的方法里面增加uni.getUserProfile的判断,是老郑否显示新的按钮。

canUseGetUserProfile: false

if (uni.getUserProfile) {

this.canUseGetUserProfile = true

}

3.方法中新增getUserProfile方法用户获取用户信息

//小程序授权api替换 getUserInfo

getUserProfile() {

uni.showLoading({

title: '正在登录中'

})

let self = this

Routine.getUserProfile()

.then(res =>{

let userInfo = res.userInfo

userInfo.code = this.code

userInfo.spread_spid = app.globalData.spid//获取推广人ID

userInfo.spread_code = app.globalData.code//获取推广人分享二维码ID

Routine.authUserInfo(userInfo)

.then(res =>{

if (res.data.key !== undefined &&res.data.key) {

uni.hideLoading()

self.authKey = res.data.key

self.isPhoneBox = true

} else {

uni.hideLoading()

let time = res.data.expires_time - self.$Cache.time()

self.$store.commit('LOGIN', {

token: res.data.token,

time: time

})

this.getUserInfo()

}

})

.catch(res =>{

uni.hideLoading()

uni.showToast({

title: res.msg,

icon: 'none',

duration: 2000

})

})

})

.catch(res =>{

uni.hideLoading()

})

},

4.然后在libs/routine.js中增加getUserProfile方法

/**

* 新版小程序获取用户信息 2021 4.13微信小程序侍戚颂开始正式启用

*/

getUserProfile(code) {

return new Promise((resolve, reject) =>{

uni.getUserProfile({

lang: 'zh_CN',

success(user) {

if (code) user.code = code

resolve({

userInfo: user,

islogin: false

})

},

fail(res) {

reject(res)

}

})

})

}

这里要注意

if (!isset($userInfoCong['openid'])) {

throw new ValidateException('openid获取失败')

}

if (!isset($userInfoCong['openid'])) {

throw new ValidateException('openid获取失败')

}

userInfo['unionId'] = isset( userInfo [′ unionId ′]= isset (userInfoCong['unionid']) ? $userInfoCong['unionid'] : ''

userInfo['openId'] = userInfo [′ openId ′]=openid = $userInfoCong['openid']

修复完成之后重新编译小程序就可以解决授权之后微信用户的问题啦。

1、<open-data></open-data>:只是简单的获取头像、用户名用于显示

其中,type="userAvatarUrl"是获取用户头像,type="userNickName"是获取用户昵称,具体使用详情查看 小程序开发文档 ,此方法仅用于直接简单的展示用户信息。

2、使用 <button open-type="getUserInfo">获取用户信息

在用户未授权过的情况下调用此接孙笑口,将不再出现授权d窗,会直接进入 fail 回调。

在用户已授权的情况下调用此接口,可成功获取用户信息则链含。

1、唤拿在项目首页直接调用getUserInfo方法,若从未授权过,跳转到授权页面引导用户手动授权

需注意: bindgetuserinfo="onGetUserInfo"

用户点击该按钮时,会返回获取到的用户信息,回调的detail数据与wx.getUserInfo返回的一致,open-type="getUserInfo"时有效。

所以,不再需要写设置页提示框以及对应的设置页面,好方便啊!!!


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/12335906.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-22
下一篇2023-05-22

发表评论

登录后才能评论

评论列表(0条)

    保存