Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
learn-online
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
learn-online
Commits
eac74259
提交
eac74259
authored
1月 14, 2022
作者:
haodaking
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:修复登录失败的问题
上级
b261504e
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
37 行增加
和
26 行删除
+37
-26
app.json
learnOnline/app.json
+1
-1
index.js
learnOnline/pages/login/index.js
+31
-22
project.config.json
learnOnline/project.config.json
+5
-3
没有找到文件。
learnOnline/app.json
浏览文件 @
eac74259
...
...
@@ -60,7 +60,7 @@
},
"plugins"
:
{
"tencentvideo"
:
{
"version"
:
"
1.5.2
"
,
"version"
:
"
2.0.5
"
,
"provider"
:
"wxa75efa648b60994b"
}
},
...
...
learnOnline/pages/login/index.js
浏览文件 @
eac74259
...
...
@@ -27,38 +27,48 @@ Page({
},
// 获取用户code
getCode
(
callback
)
{
wx
.
login
({
success
(
res
)
{
if
(
res
.
code
)
{
callback
&&
callback
(
res
.
code
)
}
else
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
login
({
success
(
res
)
{
if
(
res
.
code
)
{
callback
&&
callback
(
res
.
code
)
resolve
(
res
.
code
)
}
else
{
wx
.
showToast
({
title
:
`登录失败!
${
res
.
errMsg
}
`
,
icon
:
'none'
})
reject
(
res
)
}
},
fail
(
res
)
{
wx
.
showToast
({
title
:
`登录失败!
${
res
.
errMsg
}
`
,
icon
:
'none'
})
reject
(
res
)
}
},
fail
(
res
)
{
wx
.
showToast
({
title
:
`登录失败!
${
res
.
errMsg
}
`
,
icon
:
'none'
})
}
})
})
},
// 获取用户信息
getUserInfo
(
callback
)
{
wx
.
getUserProfile
({
desc
:
'登录注册'
,
success
(
res
)
{
callback
&&
callback
(
res
)
},
fail
(
res
)
{
wx
.
showToast
({
title
:
`获取用户信息失败!`
,
icon
:
'none'
})
}
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
getUserProfile
({
desc
:
'登录注册'
,
success
(
res
)
{
callback
&&
callback
(
res
)
resolve
(
res
)
},
fail
(
res
)
{
wx
.
showToast
({
title
:
`获取用户信息失败!`
,
icon
:
'none'
})
reject
(
res
)
}
})
})
},
// 微信登录
wechatLogin
()
{
// 获取code
const
p1
=
this
.
getCode
()
// 获取用户信息
this
.
getUserInfo
(
user
=>
{
// 获取code
this
.
getCode
(
code
=>
{
const
{
encryptedData
,
iv
}
=
user
const
p2
=
this
.
getUserInfo
()
Promise
.
all
([
p1
,
p2
]).
then
(([
code
,
user
])
=>
{
const
{
encryptedData
,
iv
}
=
user
api
.
wechatLogin
({
encryptedData
,
iv
,
code
,
identity
:
'caas-mini'
}).
then
(
response
=>
{
if
(
response
.
code
===
0
)
{
this
.
handleSuccess
(
response
.
data
)
...
...
@@ -69,7 +79,6 @@ Page({
wx
.
showToast
({
title
:
response
.
msg
,
icon
:
'none'
})
}
})
})
})
},
// 手机号登录
...
...
learnOnline/project.config.json
浏览文件 @
eac74259
...
...
@@ -26,17 +26,19 @@
"disablePlugins"
:
[],
"outputPath"
:
""
},
"useIsolateContext"
:
tru
e
,
"useIsolateContext"
:
fals
e
,
"userConfirmedBundleSwitch"
:
false
,
"packNpmManually"
:
false
,
"packNpmRelationList"
:
[],
"minifyWXSS"
:
true
,
"disableUseStrict"
:
false
,
"minifyWXML"
:
true
,
"showES6CompileOption"
:
false
,
"useCompilerPlugins"
:
false
"useCompilerPlugins"
:
false
,
"ignoreUploadUnusedFiles"
:
true
},
"compileType"
:
"miniprogram"
,
"libVersion"
:
"2.
12.2
"
,
"libVersion"
:
"2.
21.3
"
,
"appid"
:
"wxe26a76d121424527"
,
"projectname"
:
"learnOnline"
,
"isGameTourist"
:
false
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论