Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello_uni-id-pages
提交
7b579e89
H
hello_uni-id-pages
项目概览
DCloud
/
hello_uni-id-pages
通知
1054
Star
31
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看板
提交
7b579e89
编写于
7月 04, 2022
作者:
DCloud_JSON
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.0.2
上级
d49c657a
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
167 addition
and
150 deletion
+167
-150
App.vue
App.vue
+4
-4
manifest.json
manifest.json
+1
-1
uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-crypto/config.json
...functions/common/uni-config-center/uni-crypto/config.json
+0
-12
uni_modules/uni-id-pages/changelog.md
uni_modules/uni-id-pages/changelog.md
+4
-0
uni_modules/uni-id-pages/init.js
uni_modules/uni-id-pages/init.js
+57
-57
uni_modules/uni-id-pages/package.json
uni_modules/uni-id-pages/package.json
+1
-1
uni_modules/uni-id-pages/readme.md
uni_modules/uni-id-pages/readme.md
+15
-3
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/utils/set-push-cid.js
...oud/cloudfunctions/uni-id-co/module/utils/set-push-cid.js
+15
-3
uni_modules/uni-id-pages/uniCloud/database/uni-id-log.schema.json
...les/uni-id-pages/uniCloud/database/uni-id-log.schema.json
+0
-0
uni_modules/uni-id-pages/uniCloud/database/uni-id-permissions.schema.json
...id-pages/uniCloud/database/uni-id-permissions.schema.json
+0
-0
uni_modules/uni-id-pages/uniCloud/database/uni-id-roles.schema.json
...s/uni-id-pages/uniCloud/database/uni-id-roles.schema.json
+0
-0
uni_modules/uni-id-pages/uniCloud/database/uni-id-users.schema.json
...s/uni-id-pages/uniCloud/database/uni-id-users.schema.json
+0
-0
uni_modules_tools/config.js
uni_modules_tools/config.js
+70
-69
未找到文件。
App.vue
浏览文件 @
7b579e89
...
...
@@ -2,11 +2,11 @@
import
uniIdPageInit
from
'
@/uni_modules/uni-id-pages/init.js
'
;
export
default
{
onLaunch
:
async
function
()
{
console
.
log
(
'
App Launch
'
)
await
uniIdPageInit
()
console
.
log
(
'
App Launch
'
)
await
uniIdPageInit
()
},
onShow
:
function
()
{
console
.
log
(
'
App Show
'
)
console
.
log
(
'
App Show
'
)
},
onHide
:
function
()
{
console
.
log
(
'
App Hide
'
)
...
...
@@ -16,4 +16,4 @@
<
style
>
/*每个页面公共css */
</
style
>
</
style
>
manifest.json
浏览文件 @
7b579e89
...
...
@@ -131,7 +131,7 @@
"uniStatistics"
:
{
"enable"
:
false
},
"vueVersion"
:
"
3
"
,
"vueVersion"
:
"
2
"
,
"h5"
:
{
"unipush"
:
{
"enable"
:
true
...
...
uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-crypto/config.json
已删除
100644 → 0
浏览文件 @
d49c657a
{
"AES"
:
{
"mod"
:
"aes-128-cbc"
,
"pasword"
:
"DCloud&2*0^1#600"
,
"iv"
:
"HTML5PLUSRUNTIME"
,
"charset"
:
"utf8"
,
"encodeReturnType"
:
"base64"
},
"MD5"
:
{
"encodeReturnType"
:
"hex"
}
}
\ No newline at end of file
uni_modules/uni-id-pages/changelog.md
浏览文件 @
7b579e89
## 1.0.1(2022-06-28)
修复微信小程序登录时无unionid报错的Bug
[
详情
](
https://ask.dcloud.net.cn/question/148016
)
## 1.0.1(2022-06-28)
添加相关uni-id表
## 1.0.0(2022-06-23)
正式版
uni_modules/uni-id-pages/init.js
浏览文件 @
7b579e89
...
...
@@ -12,64 +12,64 @@ const {
export
default
async
function
()
{
// 有打开调试模式的情况下
if
(
debug
)
{
// 1. 检查本地uni-id-pages中配置的登录方式,服务器端是否已经配置正确。否则提醒并引导去配置
//调用云对象,获取服务端已正确配置的登录方式
let
{
supportedLoginType
}
=
await
uniIdCo
.
getSupportedLoginType
()
console
.
log
(
"
supportedLoginType:
"
+
JSON
.
stringify
(
supportedLoginType
));
//登录方式,服务端和客户端的映射关系
let
data
=
{
smsCode
:
'
mobile-code
'
,
univerify
:
'
univerify
'
,
username
:
'
username-password
'
,
weixin
:
'
weixin
'
,
qq
:
'
qq
'
,
xiaomi
:
'
xiaomi
'
,
sinaweibo
:
'
sinaweibo
'
,
taobao
:
'
taobao
'
,
facebook
:
'
facebook
'
,
google
:
'
google
'
,
alipay
:
'
alipay
'
,
apple
:
"
apple
"
}
//遍历客户端配置的登录方式,与服务端比对。并在错误时抛出错误提示
let
list
=
loginTypes
.
filter
(
type
=>
!
supportedLoginType
.
includes
(
data
[
type
]))
if
(
list
.
length
)
{
console
.
error
(
`错误:前端启用的登录方式:
${
list
.
join
(
'
,
'
)}
;没有在服务端完成配置。配置文件路径:"/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json"`
);
// 有打开调试模式的情况下
if
(
debug
)
{
// 1. 检查本地uni-id-pages中配置的登录方式,服务器端是否已经配置正确。否则提醒并引导去配置
//调用云对象,获取服务端已正确配置的登录方式
let
{
supportedLoginType
}
=
await
uniIdCo
.
getSupportedLoginType
()
console
.
log
(
"
supportedLoginType:
"
+
JSON
.
stringify
(
supportedLoginType
));
//登录方式,服务端和客户端的映射关系
let
data
=
{
smsCode
:
'
mobile-code
'
,
univerify
:
'
univerify
'
,
username
:
'
username-password
'
,
weixin
:
'
weixin
'
,
qq
:
'
qq
'
,
xiaomi
:
'
xiaomi
'
,
sinaweibo
:
'
sinaweibo
'
,
taobao
:
'
taobao
'
,
facebook
:
'
facebook
'
,
google
:
'
google
'
,
alipay
:
'
alipay
'
,
apple
:
"
apple
"
}
//遍历客户端配置的登录方式,与服务端比对。并在错误时抛出错误提示
let
list
=
loginTypes
.
filter
(
type
=>
!
supportedLoginType
.
includes
(
data
[
type
]))
if
(
list
.
length
)
{
console
.
error
(
`错误:前端启用的登录方式:
${
list
.
join
(
'
,
'
)}
;没有在服务端完成配置。配置文件路径:"/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json"`
);
}
}
}
// #ifdef APP-PLUS
//如果uni-id-pages配置的登录功能有一键登录,有则执行预登录(异步)
if
(
loginTypes
.
includes
(
'
univerify
'
))
{
uni
.
preLogin
({
provider
:
'
univerify
'
,
complete
:
e
=>
{
console
.
log
(
e
);
}
})
}
// #endif
// #ifdef APP-PLUS
//如果uni-id-pages配置的登录功能有一键登录,有则执行预登录(异步)
if
(
loginTypes
.
includes
(
'
univerify
'
))
{
uni
.
preLogin
({
provider
:
'
univerify
'
,
complete
:
e
=>
{
console
.
log
(
e
);
}
})
}
// #endif
//3. 绑定clientDB错误事件
// clientDB对象
const
db
=
uniCloud
.
database
()
db
.
on
(
'
error
'
,
onDBError
)
//clientDB的错误提示
function
onDBError
({
code
,
// 错误码详见https://uniapp.dcloud.net.cn/uniCloud/clientdb?id=returnvalue
message
})
{
console
.
error
(
'
onDBError
'
,
{
code
,
//3. 绑定clientDB错误事件
// clientDB对象
const
db
=
uniCloud
.
database
()
db
.
on
(
'
error
'
,
onDBError
)
//clientDB的错误提示
function
onDBError
({
code
,
// 错误码详见https://uniapp.dcloud.net.cn/uniCloud/clientdb?id=returnvalue
message
});
}
// 解绑clientDB错误事件
//db.off('error', onDBError)
}
})
{
console
.
error
(
'
onDBError
'
,
{
code
,
message
});
}
// 解绑clientDB错误事件
//db.off('error', onDBError)
}
uni_modules/uni-id-pages/package.json
浏览文件 @
7b579e89
{
"id"
:
"uni-id-pages"
,
"displayName"
:
"uni-id-pages"
,
"version"
:
"1.0.
0
"
,
"version"
:
"1.0.
1
"
,
"description"
:
"云端一体简单、统一、可扩展的用户中心页面模版"
,
"keywords"
:
[
"用户管理"
,
...
...
uni_modules/uni-id-pages/readme.md
浏览文件 @
7b579e89
<h2>
文档已移至
<a
href=
"https://uniapp.dcloud.io/uniCloud/uni-id-pages.html"
target=
"_blank"
>
uni-id-pages文档
</a>
</h2>
# 文档已移至uni-id-pages文档[https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html](https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html)
关于插件更新的说明:
所有uni_modules,在HBuilderX里点右键都可以直接升级。或者在插件市场导入覆盖。
覆盖时HBuilderX会弹出代码差异比对,可以决定接受哪些更改、拒绝哪些更改。
当拒绝局部修改时,注意可能产生兼容性问题。
你需要二次开发uni-id-pages的前端页面,
-
如果改动不大,那么每次更新uni-id-pages时,在HBuilderX的对比界面对比一下就好
-
如果改动较大,建议复制一套前端页面到自己工程的pages目录下,pages.json里只引用根目录pages下的页面,不引用uni_modules下的页面。然后每次uni-id-pages更新,你对比下比上一版uni-id-pages改了什么,看你是否需要再合并到你自己的pages里。pages.json里不引用uni_modules里的页面的话,打包时不会把这些页面打包进去,不影响发行后的包体积
\ No newline at end of file
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/utils/set-push-cid.js
浏览文件 @
7b579e89
...
...
@@ -18,8 +18,16 @@ module.exports = async function (params = {}) {
}
this
.
middleware
.
validate
(
params
,
schema
)
const
{
deviceId
deviceId
,
"
appId
"
:
dcloud_appid
,
uniPlatform
,
osName
}
=
this
.
getClientInfo
()
let
platform
=
uniPlatform
if
(
platform
==
"
app
"
){
platform
+=
osName
}
const
{
uid
,
exp
...
...
@@ -41,7 +49,9 @@ module.exports = async function (params = {}) {
user_id
:
uid
,
device_id
:
deviceId
,
token_expired
:
tokenExpired
,
unipush_clientid
:
pushClientId
push_clientid
:
pushClientId
,
dcloud_appid
,
platform
})
return
{
errCode
:
0
...
...
@@ -57,7 +67,9 @@ module.exports = async function (params = {}) {
}).
update
({
user_id
:
uid
,
token_expired
:
tokenExpired
,
unipush_clientid
:
pushClientId
push_clientid
:
pushClientId
,
dcloud_appid
,
platform
})
return
{
errCode
:
0
...
...
uni_modules/uni-id-
common
/uniCloud/database/uni-id-log.schema.json
→
uni_modules/uni-id-
pages
/uniCloud/database/uni-id-log.schema.json
浏览文件 @
7b579e89
文件已移动
uni_modules/uni-id-
common
/uniCloud/database/uni-id-permissions.schema.json
→
uni_modules/uni-id-
pages
/uniCloud/database/uni-id-permissions.schema.json
浏览文件 @
7b579e89
文件已移动
uni_modules/uni-id-
common
/uniCloud/database/uni-id-roles.schema.json
→
uni_modules/uni-id-
pages
/uniCloud/database/uni-id-roles.schema.json
浏览文件 @
7b579e89
文件已移动
uni_modules/uni-id-
common
/uniCloud/database/uni-id-users.schema.json
→
uni_modules/uni-id-
pages
/uniCloud/database/uni-id-users.schema.json
浏览文件 @
7b579e89
文件已移动
uni_modules_tools/config.js
浏览文件 @
7b579e89
// "文件路径" : {"键名":"改成什么"}
{
"
/manifest.json
"
:
{
"
appid
"
:
""
,
"
name
"
:
""
,
"
versionName
"
:
""
,
"
mp-weixin
"
:
{
"
appid
"
:
""
},
"
app-plus
"
:
{
"
modules
"
:
{
"
OAuth
"
:
{}
},
"
distribute
"
:
{
"
sdkConfigs
"
:
{
"
oauth
"
:
{
"
univerify
"
:
{},
"
weixin
"
:
{
"
appid
"
:
""
,
"
appsecret
"
:
""
,
"
UniversalLinks
"
:
""
},
"
apple
"
:
{}
}
}
}
}
},
"
/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json
"
:
{
"
tokenExpiresIn
"
:
7200
,
"
app
"
:
{
"
oauth
"
:
{
"
weixin
"
:
{
"
appid
"
:
"
填写来源微信开放平台https://open.weixin.qq.com/创建的应用的appid
"
,
"
appsecret
"
:
"
填写来源微信开放平台https://open.weixin.qq.com/创建的应用的appsecret
"
},
"
apple
"
:
{
"
bundleId
"
:
"
苹果开发者后台获取的bundleId
"
}
}
},
"
mp-weixin
"
:
{
"
oauth
"
:
{
"
weixin
"
:
{
"
appid
"
:
"
微信小程序登录所用的appid、appsecret需要在对应的小程序管理控制台获取
"
,
"
appsecret
"
:
"
微信小程序后台获取的appsecret
"
}
}
},
"
mp-alipay
"
:
{
"
oauth
"
:
{
"
alipay
"
:
{
"
appid
"
:
"
支付宝小程序登录用到的appid、privateKey请参考支付宝小程序的文档进行设置或者获取,https://opendocs.alipay.com/open/291/105971#LDsXr
"
,
"
privateKey
"
:
"
支付宝小程序登录用到的appid、privateKey请参考支付宝小程序的文档进行设置或者获取,https://opendocs.alipay.com/open/291/105971#LDsXr
"
}
}
},
"
service
"
:
{
"
sms
"
:
{
"
name
"
:
"
应用名称,对应短信模版的name
"
,
"
smsKey
"
:
"
短信密钥key,开通短信服务处可以看到
"
,
"
smsSecret
"
:
"
短信密钥secret,开通短信服务处可以看到
"
},
"
univerify
"
:
{
"
appid
"
:
"
当前应用的appid,使用云函数URL化,此项必须配置
"
,
"
apiKey
"
:
"
apiKey 和 apiSecret 在开发者中心获取,开发者中心:https://dev.dcloud.net.cn/uniLogin/index?type=0,文档:https://ask.dcloud.net.cn/article/37965
"
,
"
apiSecret
"
:
""
}
}
}
}
\ No newline at end of file
"
/manifest.json
"
:
{
"
appid
"
:
""
,
"
name
"
:
""
,
"
versionName
"
:
""
,
"
mp-weixin
"
:
{
"
appid
"
:
""
},
"
vueVersion
"
:
"
2
"
,
"
app-plus
"
:
{
"
modules
"
:
{
"
OAuth
"
:
{}
},
"
distribute
"
:
{
"
sdkConfigs
"
:
{
"
oauth
"
:
{
"
univerify
"
:
{},
"
weixin
"
:
{
"
appid
"
:
""
,
"
appsecret
"
:
""
,
"
UniversalLinks
"
:
""
},
"
apple
"
:
{}
}
}
}
}
},
"
/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json
"
:
{
"
tokenExpiresIn
"
:
7200
,
"
app
"
:
{
"
oauth
"
:
{
"
weixin
"
:
{
"
appid
"
:
"
填写来源微信开放平台https://open.weixin.qq.com/创建的应用的appid
"
,
"
appsecret
"
:
"
填写来源微信开放平台https://open.weixin.qq.com/创建的应用的appsecret
"
},
"
apple
"
:
{
"
bundleId
"
:
"
苹果开发者后台获取的bundleId
"
}
}
},
"
mp-weixin
"
:
{
"
oauth
"
:
{
"
weixin
"
:
{
"
appid
"
:
"
微信小程序登录所用的appid、appsecret需要在对应的小程序管理控制台获取
"
,
"
appsecret
"
:
"
微信小程序后台获取的appsecret
"
}
}
},
"
mp-alipay
"
:
{
"
oauth
"
:
{
"
alipay
"
:
{
"
appid
"
:
"
支付宝小程序登录用到的appid、privateKey请参考支付宝小程序的文档进行设置或者获取,https://opendocs.alipay.com/open/291/105971#LDsXr
"
,
"
privateKey
"
:
"
支付宝小程序登录用到的appid、privateKey请参考支付宝小程序的文档进行设置或者获取,https://opendocs.alipay.com/open/291/105971#LDsXr
"
}
}
},
"
service
"
:
{
"
sms
"
:
{
"
name
"
:
"
应用名称,对应短信模版的name
"
,
"
smsKey
"
:
"
短信密钥key,开通短信服务处可以看到
"
,
"
smsSecret
"
:
"
短信密钥secret,开通短信服务处可以看到
"
},
"
univerify
"
:
{
"
appid
"
:
"
当前应用的appid,使用云函数URL化,此项必须配置
"
,
"
apiKey
"
:
"
apiKey 和 apiSecret 在开发者中心获取,开发者中心:https://dev.dcloud.net.cn/uniLogin/index?type=0,文档:https://ask.dcloud.net.cn/article/37965
"
,
"
apiSecret
"
:
""
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录