Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello_uni-id-pages
提交
f029334f
H
hello_uni-id-pages
项目概览
DCloud
/
hello_uni-id-pages
通知
1078
Star
34
Fork
43
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
2
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello_uni-id-pages
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
f029334f
编写于
8月 22, 2022
作者:
雪洛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: remove getH5WeixinConfig
上级
a6c3dde8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
71 addition
and
71 deletion
+71
-71
uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/hooks/index.js
...dfunctions/common/uni-config-center/uni-id/hooks/index.js
+10
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/index.obj.js
...i-id-pages/uniCloud/cloudfunctions/uni-id-co/index.obj.js
+2
-11
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/utils/get-h5-weixin-config.js
...dfunctions/uni-id-co/module/utils/get-h5-weixin-config.js
+0
-58
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/utils/index.js
...s/uniCloud/cloudfunctions/uni-id-co/module/utils/index.js
+1
-2
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/uni-id-co.param.js
...ages/uniCloud/cloudfunctions/uni-id-co/uni-id-co.param.js
+58
-0
未找到文件。
uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/hooks/index.js
0 → 100644
浏览文件 @
f029334f
module
.
exports
=
{
beforeRegister
:
function
({
userRecord
,
clientInfo
}
=
{}){
console
.
log
(
clientInfo
);
userRecord
.
role
=
[
'
test-role
'
]
return
userRecord
}
}
\ No newline at end of file
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/index.obj.js
浏览文件 @
f029334f
...
...
@@ -54,8 +54,7 @@ const {
}
=
require
(
'
./module/verify/index
'
)
const
{
refreshToken
,
setPushCid
,
getH5WeixinConfig
setPushCid
}
=
require
(
'
./module/utils/index
'
)
const
{
getInvitedUser
,
...
...
@@ -490,13 +489,5 @@ module.exports = {
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#get-supported-login-type
* @returns
*/
getSupportedLoginType
,
/**
* 获取微信公众号config参数
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#get-h5-weixin-config
* @param {object} params
* @param {string} params.url 当前页面url不带hash部分
* @returns
*/
getH5WeixinConfig
getSupportedLoginType
}
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/utils/get-h5-weixin-config.js
已删除
100644 → 0
浏览文件 @
a6c3dde8
const
{
getWeixinPlatform
}
=
require
(
'
../../lib/utils/weixin
'
)
const
{
getNonceStr
}
=
require
(
'
../../common/utils
'
)
const
{
createHash
}
=
require
(
'
crypto
'
)
/**
* 获取微信公众号config参数
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#get-h5-weixin-config
* @param {object} params
* @param {string} params.url 当前页面url不带hash部分
* @returns
*/
module
.
exports
=
async
function
(
params
)
{
const
schema
=
{
url
:
'
string
'
}
this
.
middleware
.
validate
(
params
,
schema
)
const
{
url
}
=
params
const
oauthConfig
=
this
.
configUtils
.
getOauthConfig
({
provider
:
'
weixin
'
})
const
{
appId
}
=
this
.
getClientInfo
()
const
weixinPlatform
=
getWeixinPlatform
.
call
(
this
)
const
getTicketRes
=
await
this
.
uniOpenBridge
.
getTicket
({
dcloudAppid
:
appId
,
platform
:
weixinPlatform
+
'
-weixin
'
})
if
(
!
getTicketRes
)
{
throw
new
Error
(
'
Wechat official account ticket not found, please referer to: https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#login-by-weixin-h5
'
)
}
const
ticket
=
getTicketRes
.
ticket
const
signContent
=
{
jsapi_ticket
:
ticket
,
noncestr
:
getNonceStr
(),
timestamp
:
Math
.
floor
(
Date
.
now
()
/
1000
),
url
:
url
.
split
(
'
#
'
)[
0
]
}
const
signStr
=
Object
.
keys
(
signContent
).
sort
().
reduce
(
function
(
str
,
key
)
{
return
str
+
key
+
'
=
'
+
signContent
[
key
]
+
'
&
'
},
''
).
replace
(
/&$/
,
''
)
const
signature
=
createHash
(
'
sha1
'
).
update
(
signStr
,
'
utf8
'
).
digest
(
'
hex
'
)
return
{
errCode
:
0
,
appId
:
oauthConfig
.
appid
,
// 公众号的唯一标识
timestamp
:
signContent
.
timestamp
,
// 生成签名的时间戳
nonceStr
:
signContent
.
noncestr
,
// 生成签名的随机串
signature
// 签名
}
}
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/utils/index.js
浏览文件 @
f029334f
module
.
exports
=
{
refreshToken
:
require
(
'
./refresh-token
'
),
setPushCid
:
require
(
'
./set-push-cid
'
),
getH5WeixinConfig
:
require
(
'
./get-h5-weixin-config
'
)
setPushCid
:
require
(
'
./set-push-cid
'
)
}
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/uni-id-co.param.js
0 → 100644
浏览文件 @
f029334f
const
clientInfo
=
{
"
PLATFORM
"
:
"
web
"
,
"
OS
"
:
"
ios
"
,
"
APPID
"
:
"
__UNI__ECAF623
"
,
"
DEVICEID
"
:
"
16558192370391366615
"
,
"
scene
"
:
1001
,
"
appId
"
:
"
__UNI__ECAF623
"
,
"
appLanguage
"
:
"
zh-Hans
"
,
"
appName
"
:
"
uni-id-pages
"
,
"
appVersion
"
:
"
1.0.0
"
,
"
appVersionCode
"
:
"
100
"
,
"
browserName
"
:
"
safari
"
,
"
browserVersion
"
:
"
13.0.3
"
,
"
deviceId
"
:
"
16558192370391366615
"
,
"
deviceModel
"
:
"
iPhone
"
,
"
deviceOrientation
"
:
"
portrait
"
,
"
devicePixelRatio
"
:
2.0000000298023224
,
"
deviceType
"
:
"
phone
"
,
"
hostLanguage
"
:
"
en-US
"
,
"
hostName
"
:
"
safari
"
,
"
hostVersion
"
:
"
13.0.3
"
,
"
osName
"
:
"
ios
"
,
"
osVersion
"
:
"
13.2.3
"
,
"
safeArea
"
:
{
"
left
"
:
0
,
"
right
"
:
375
,
"
top
"
:
0
,
"
bottom
"
:
667
,
"
width
"
:
375
,
"
height
"
:
667
},
"
safeAreaInsets
"
:
{
"
top
"
:
0
,
"
right
"
:
0
,
"
bottom
"
:
0
,
"
left
"
:
0
},
"
screenHeight
"
:
667
,
"
screenWidth
"
:
375
,
"
statusBarHeight
"
:
0
,
"
ua
"
:
"
Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1
"
,
"
uniCompileVersion
"
:
"
3.5.4
"
,
"
uniPlatform
"
:
"
web
"
,
"
uniRuntimeVersion
"
:
"
3.5.4
"
,
"
windowBottom
"
:
0
,
"
windowHeight
"
:
667
,
"
windowTop
"
:
0
,
"
windowWidth
"
:
375
,
"
locale
"
:
"
zh-Hans
"
,
"
LOCALE
"
:
"
zh-Hans
"
}
registerUser
({
"
username
"
:
"
qqq2
"
,
"
nickname
"
:
""
,
"
password
"
:
"
qqq11122
"
,
"
password2
"
:
"
qqq11122
"
,
"
captcha
"
:
"
3IPP
"
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录