小程序
小游戏
企业微信
微信支付
扫描小程序码分享
大佬问一个问题,我们的小程序上线了,为什么我们管理员可以授权成功,为什么别的用户不能成功呢
4 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
这个我好像看见过 你们授权登录是需要所有的用户信息吗? 比如头像、地址、性别
如果是空会怎么样
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
嗯?! 抱歉走错了,我以为是微信开放社区呢,没想到是幼儿园
//页面跳转
_get
Go
() {
wx.redirect
To
({
url:
'../evaluate/evaluate'
})
},
_login() {//授权登录
wx.login({
success: res => {
console.log(res)
// 获取code
const code = res.code;
console.log(code)
wx.request({
'https://www.samewarm.com/Sandy/v2.0/userOpenIdHuiYiShi/fo'
,
data: {
code
method:
'get'
console.log(res.data.
Value
)
const str = res.data.
Status
;
const names = res.data.
.
WeChat
; //判断用户是否认证
if
(str == true) {
(names ==
"Initialize"
) { //新用户没有登录过
const open
Id
= res.data.
OpenId
; //获取的openid
const
SessionKey
; //获取的
UnionId
this.set
Data
({ //更新状态
open
wx.set
StorageSync
(
'key'
, { //缓存数据
SessionKey1
: this.data.
Id1
: this.data.open
UnionId1
const sfz = this.data.is
Hide
//如果是新用户就显示授权页面
is
: true
} else { //老用户 //把这些缓存上
UserId
Token
console.log(
"123"
this._get
()
/*缓存token和user
**/
'UTR'
, { /*缓存token和user
: res.data.
RefreshToken
: false
}
好问题,大家一起来猜吧
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
这个我好像看见过 你们授权登录是需要所有的用户信息吗? 比如头像、地址、性别
如果是空会怎么样
嗯?! 抱歉走错了,我以为是微信开放社区呢,没想到是幼儿园
//页面跳转_getGo() {wx.redirectTo({url:'../evaluate/evaluate'})},_login() {//授权登录wx.login({success: res => {console.log(res)// 获取codeconst code = res.code;console.log(code)wx.request({url:'https://www.samewarm.com/Sandy/v2.0/userOpenIdHuiYiShi/fo',data: {code},method:'get',success: res => {console.log(res.data.Value)const str = res.data.Status;const names = res.data.Value.WeChat; //判断用户是否认证if(str == true) {if(names =="Initialize") { //新用户没有登录过const openId= res.data.Value.OpenId; //获取的openidconstSessionKey= res.data.Value.SessionKey; //获取的SessionKeyconstUnionId= res.data.Value.UnionId; //获取的UnionIdthis.setData({ //更新状态openId,SessionKey,UnionId})wx.setStorageSync('key', { //缓存数据SessionKey1: this.data.SessionKey,openId1: this.data.openId,UnionId1: this.data.UnionId})const sfz = this.data.isHide//如果是新用户就显示授权页面this.setData({isHide: true})} else { //老用户 //把这些缓存上UserIdTokenconsole.log("123")this._getGo()/*缓存token和userId**/wx.setStorageSync('UTR', { /*缓存token和userId**/UserId: res.data.Value.UserId,Token: res.data.Value.Token,RefreshToken: res.data.Value.RefreshToken})this.setData({isHide: false})}}好问题,大家一起来猜吧