Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-starter
提交
4a61d31f
U
uni-starter
项目概览
DCloud
/
uni-starter
通知
4684
Star
229
Fork
210
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-starter
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
4a61d31f
编写于
5月 20, 2021
作者:
DCloud_JSON
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
321
上级
1deb8646
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
376 addition
and
119 deletion
+376
-119
README.md
README.md
+1
-1
changelog.md
changelog.md
+3
-1
common/appInit.js
common/appInit.js
+8
-62
manifest.json
manifest.json
+100
-1
uniCloud-aliyun/cloudfunctions/uni-id-cf/index.js
uniCloud-aliyun/cloudfunctions/uni-id-cf/index.js
+15
-4
uni_modules.config.json
uni_modules.config.json
+6
-0
uni_modules/json-interceptor-chooseImage/changelog.md
uni_modules/json-interceptor-chooseImage/changelog.md
+4
-0
uni_modules/json-interceptor-chooseImage/js_sdk/main.js
uni_modules/json-interceptor-chooseImage/js_sdk/main.js
+70
-0
uni_modules/json-interceptor-chooseImage/package.json
uni_modules/json-interceptor-chooseImage/package.json
+76
-0
uni_modules/json-interceptor-chooseImage/readme.md
uni_modules/json-interceptor-chooseImage/readme.md
+30
-0
uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json
...loudfunctions/common/uni-config-center/uni-id/config.json
+63
-50
未找到文件。
README.md
浏览文件 @
4a61d31f
changelog.md
浏览文件 @
4a61d31f
## 1.0.5(2021-05-20)
改用uni_modules方式处理图片选择api时无权限,引导用户快捷打开系统设置
## 1.0.4(2021-05-19)
12
为方便部署,添加空的manifest.json uni-config-center下的uni-id配置
## 1.0.3(2021-05-18)
重大调整,原云函数名称:user-center改名叫uni-id-cf
修复,绑定手机号码场景。因手机未插SIM导致的一键登录失败后未直接跳到获取短信验证码方式绑定
...
...
common/appInit.js
浏览文件 @
4a61d31f
...
...
@@ -3,6 +3,7 @@ import uniStarterConfig from '@/uni-starter.config.js';
// #ifdef APP-PLUS
import
checkUpdate
from
'
@/uni_modules/uni-upgrade-center-app/utils/check-update
'
;
import
callCheckVersion
from
'
@/uni_modules/uni-upgrade-center-app/utils/call-check-version
'
;
import
interceptorChooseImage
from
'
@/uni_modules/json-interceptor-chooseImage/js_sdk/main.js
'
;
// #endif
export
default
function
()
{
...
...
@@ -14,9 +15,13 @@ export default function() {
// 初始化appVersion(仅app生效)
initAppVersion
();
/*
这里应用了[拦截器](https://uniapp.dcloud.io/api/interceptor?id=addinterceptor)实现了,路由拦截。当应用无访问摄像头/相册权限,引导跳到设置界面
*/
// #ifdef APP-PLUS
// 实现,路由拦截。当应用无访问摄像头/相册权限,引导跳到设置界面
interceptorChooseImage
()
// #endif
//自定义路由拦截
const
{
"
router
"
:
{
needLogin
,
login
}
}
=
uniStarterConfig
//需要登录的页面
let
list
=
[
"
navigateTo
"
,
"
redirectTo
"
,
"
reLaunch
"
,
"
switchTab
"
];
...
...
@@ -54,39 +59,6 @@ export default function() {
},
})
})
//当应用无访问摄像头/相册权限,引导跳到设置界面
uni
.
addInterceptor
(
'
chooseImage
'
,
{
fail
(
e
)
{
// 失败回调拦截
console
.
log
(
e
);
if
(
uni
.
getSystemInfoSync
().
platform
==
"
android
"
&&
e
.
errMsg
==
'
chooseImage:fail No Permission
'
){
if
(
e
.
code
===
11
){
uni
.
showModal
({
title
:
"
无法访问摄像头
"
,
content
:
"
当前无摄像头访问权限,建议前往设置
"
,
confirmText
:
"
前往设置
"
,
success
(
e
)
{
if
(
e
.
confirm
)
{
openAppPermissionSetting
()
}
}
});
}
else
{
uni
.
showModal
({
title
:
"
无法访问相册
"
,
content
:
"
当前无系统相册访问权限,建议前往设置
"
,
confirmText
:
"
前往设置
"
,
success
(
e
)
{
if
(
e
.
confirm
)
{
openAppPermissionSetting
()
}
}
});
}
}
}
})
// #ifdef APP-PLUS
// 监听并提示设备网络状态变化
uni
.
onNetworkStatusChange
(
res
=>
{
...
...
@@ -140,29 +112,3 @@ function initAppVersion() {
checkUpdate
();
// #endif
}
\ No newline at end of file
function
openAppPermissionSetting
(){
// 跳转到**应用**的权限页面
if
(
uni
.
getSystemInfoSync
().
platform
==
"
ios
"
)
{
var
UIApplication
=
plus
.
ios
.
import
(
"
UIApplication
"
);
var
application2
=
UIApplication
.
sharedApplication
();
var
NSURL2
=
plus
.
ios
.
import
(
"
NSURL
"
);
// var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
var
setting2
=
NSURL2
.
URLWithString
(
"
app-settings:
"
);
application2
.
openURL
(
setting2
);
plus
.
ios
.
deleteObject
(
setting2
);
plus
.
ios
.
deleteObject
(
NSURL2
);
plus
.
ios
.
deleteObject
(
application2
);
}
else
{
// console.log(plus.device.vendor);
var
Intent
=
plus
.
android
.
importClass
(
"
android.content.Intent
"
);
var
Settings
=
plus
.
android
.
importClass
(
"
android.provider.Settings
"
);
var
Uri
=
plus
.
android
.
importClass
(
"
android.net.Uri
"
);
var
mainActivity
=
plus
.
android
.
runtimeMainActivity
();
var
intent
=
new
Intent
();
intent
.
setAction
(
Settings
.
ACTION_APPLICATION_DETAILS_SETTINGS
);
var
uri
=
Uri
.
fromParts
(
"
package
"
,
mainActivity
.
getPackageName
(),
null
);
intent
.
setData
(
uri
);
mainActivity
.
startActivity
(
intent
);
}
}
\ No newline at end of file
manifest.json
浏览文件 @
4a61d31f
{
"name"
:
"uni-starter"
,
"appid"
:
""
,
"description"
:
"集成了商用项目开发常见功能的项目模板"
,
"versionName"
:
"1.0.0"
,
"versionCode"
:
"100"
,
"transformPx"
:
false
,
"app-plus"
:{
"privacy"
:{
"prompt"
:
"template"
,
"template"
:{
"title"
:
"服务协议和隐私政策"
,
"message"
:
" 请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/> 你可阅读<a href=
\"
https://ask.dcloud.net.cn/protocol.html
\"
>《服务协议》</a>和<a href=
\"
https://ask.dcloud.net.cn/protocol.html
\"
>《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。"
,
"buttonAccept"
:
"同意"
,
"buttonRefuse"
:
"暂不同意"
}},
"compatible"
:{
"ignoreVersion"
:
true
},
"usingComponents"
:
true
,
"nvueStyleCompiler"
:
"uni-app"
,
"compilerVersion"
:
3
,
"splashscreen"
:{
"alwaysShowBeforeRender"
:
true
,
"waiting"
:
true
,
"autoclose"
:
true
,
"delay"
:
0
},
"modules"
:{
"Fingerprint"
:{},
"Share"
:{},
"Push"
:{},
"OAuth"
:{}},
"distribute"
:{
"android"
:{
"permissions"
:[
"<uses-feature android:name=
\"
android.hardware.camera
\"
/>"
,
"<uses-feature android:name=
\"
android.hardware.camera.autofocus
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_NETWORK_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_WIFI_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CAMERA
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CHANGE_NETWORK_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CHANGE_WIFI_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.FLASHLIGHT
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.GET_ACCOUNTS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.MODIFY_AUDIO_SETTINGS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.MOUNT_UNMOUNT_FILESYSTEMS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.READ_LOGS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.READ_PHONE_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.USE_FINGERPRINT
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.VIBRATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WAKE_LOCK
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WRITE_SETTINGS
\"
/>"
],
"abiFilters"
:[
"armeabi-v7a"
,
"arm64-v8a"
,
"x86"
]},
"ios"
:{},
"sdkConfigs"
:{
"oauth"
:{
"univerify"
:{},
"apple"
:{}},
"ad"
:{},
"share"
:{},
"geolocation"
:{},
"push"
:{
"unipush"
:{}},
"payment"
:{}}},
"nvueLaunchMode"
:
""
},
"quickapp"
:{},
"mp-weixin"
:{
"appid"
:
""
,
"setting"
:{
"urlCheck"
:
false
,
"es6"
:
false
},
"usingComponents"
:
true
,
"betterScopedSlots"
:
true
},
"mp-alipay"
:{
"usingComponents"
:
true
},
"mp-baidu"
:{
"usingComponents"
:
true
},
"mp-toutiao"
:{
"usingComponents"
:
true
},
"uniStatistics"
:{
"enable"
:
false
},
"h5"
:{
"template"
:
""
}}
\ No newline at end of file
{
"name"
:
"uni-starter"
,
"appid"
:
""
,
"description"
:
"云端一体应用快速开发模版"
,
"versionName"
:
"1.0.0"
,
"versionCode"
:
"100"
,
"transformPx"
:
false
,
"app-plus"
:
{
"privacy"
:
{
"prompt"
:
"template"
,
"template"
:
{
"title"
:
"服务协议和隐私政策"
,
"message"
:
" 请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/> 你可阅读<a href=
\"
https://ask.dcloud.net.cn/protocol.html
\"
>《服务协议》</a>和<a href=
\"
https://ask.dcloud.net.cn/protocol.html
\"
>《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。"
,
"buttonAccept"
:
"同意"
,
"buttonRefuse"
:
"暂不同意"
}
},
"compatible"
:
{
"ignoreVersion"
:
true
},
"usingComponents"
:
true
,
"nvueStyleCompiler"
:
"uni-app"
,
"compilerVersion"
:
3
,
"splashscreen"
:
{
"alwaysShowBeforeRender"
:
true
,
"waiting"
:
true
,
"autoclose"
:
true
,
"delay"
:
0
},
"modules"
:
{
"Fingerprint"
:
{},
"Share"
:
{},
"Push"
:
{},
"OAuth"
:
{}
},
"distribute"
:
{
"android"
:
{
"permissions"
:
[
"<uses-feature android:name=
\"
android.hardware.camera
\"
/>"
,
"<uses-feature android:name=
\"
android.hardware.camera.autofocus
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_NETWORK_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_WIFI_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CAMERA
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CHANGE_NETWORK_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CHANGE_WIFI_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.FLASHLIGHT
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.GET_ACCOUNTS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.MODIFY_AUDIO_SETTINGS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.MOUNT_UNMOUNT_FILESYSTEMS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.READ_LOGS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.READ_PHONE_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.USE_FINGERPRINT
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.VIBRATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WAKE_LOCK
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WRITE_SETTINGS
\"
/>"
],
"abiFilters"
:
[
"armeabi-v7a"
,
"arm64-v8a"
,
"x86"
]
},
"ios"
:
{},
"sdkConfigs"
:
{
"oauth"
:
{
"univerify"
:
{},
"apple"
:
{}
},
"ad"
:
{},
"share"
:
{},
"geolocation"
:
{},
"push"
:
{
"unipush"
:
{}
},
"payment"
:
{}
}
},
"nvueLaunchMode"
:
""
},
"quickapp"
:
{},
"mp-weixin"
:
{
"appid"
:
""
,
"setting"
:
{
"urlCheck"
:
false
,
"es6"
:
false
},
"usingComponents"
:
true
,
"betterScopedSlots"
:
true
},
"mp-alipay"
:
{
"usingComponents"
:
true
},
"mp-baidu"
:
{
"usingComponents"
:
true
},
"mp-toutiao"
:
{
"usingComponents"
:
true
},
"uniStatistics"
:
{
"enable"
:
false
},
"h5"
:
{
"template"
:
""
}
}
uniCloud-aliyun/cloudfunctions/uni-id-cf/index.js
浏览文件 @
4a61d31f
...
...
@@ -200,15 +200,12 @@ exports.main = async (event, context) => {
res
=
await
uniID
.
logout
(
event
.
uniIdToken
)
break
;
case
'
sendSmsCode
'
:
// 测试期间短信统一用 123456 正式项目删除即可
return
uniID
.
setVerifyCode
({
mobile
:
params
.
mobile
,
code
:
'
123456
'
,
type
:
params
.
type
})
// 简单限制一下客户端调用频率
const
ipLimit
=
await
db
.
collection
(
'
uni-verify
'
).
where
({
ip
:
context
.
CLIENTIP
,
...
...
@@ -314,6 +311,21 @@ exports.main = async (event, context) => {
case
'
refreshCaptcha
'
:
res
=
await
uniCaptcha
.
refresh
(
params
)
break
;
case
'
registerAdmin
'
:
let
{
username
,
password
}
=
params
let
{
total
}
=
await
db
.
collection
(
'
uni-id-users
'
).
where
({
role
:
'
admin
'
}).
count
()
if
(
total
)
{
return
{
code
:
10001
,
message
:
'
超级管理员已存在,请登录...
'
}
}
return
this
.
ctx
.
uniID
.
register
({
username
,
password
,
role
:
[
"
admin
"
]
})
break
;
default
:
res
=
{
code
:
403
,
...
...
@@ -321,7 +333,6 @@ exports.main = async (event, context) => {
}
break
;
}
//返回数据给客户端
return
res
};
uni_modules.config.json
0 → 100644
浏览文件 @
4a61d31f
{
"scripts"
:
{
"preupload"
:
"node /Users/dcloud_linju/Desktop/uni_modules_tool/tool.js change"
,
"postupload"
:
"node /Users/dcloud_linju/Desktop/uni_modules_tool/tool.js recovery"
}
}
\ No newline at end of file
uni_modules/json-interceptor-chooseImage/changelog.md
0 → 100644
浏览文件 @
4a61d31f
## 1.0.1(2021-05-20)
新增文档和示例代码
## 1.0.0(2021-05-20)
第一版本发布
uni_modules/json-interceptor-chooseImage/js_sdk/main.js
0 → 100644
浏览文件 @
4a61d31f
export
default
function
(){
//当应用无访问摄像头/相册权限,引导跳到设置界面
uni
.
addInterceptor
(
'
chooseImage
'
,
{
fail
(
e
)
{
// 失败回调拦截 更多拦截器用法 [详情](https://uniapp.dcloud.io/api/interceptor?id=addinterceptor)
console
.
log
(
e
);
if
(
uni
.
getSystemInfoSync
().
platform
==
"
android
"
&&
e
.
errMsg
==
'
chooseImage:fail No Permission
'
)
{
if
(
e
.
code
===
11
)
{
uni
.
showModal
({
title
:
"
无法访问摄像头
"
,
content
:
"
当前无摄像头访问权限,建议前往设置
"
,
confirmText
:
"
前往设置
"
,
success
(
e
)
{
if
(
e
.
confirm
)
{
gotoAppPermissionSetting
()
}
}
});
}
else
{
uni
.
showModal
({
title
:
"
无法访问相册
"
,
content
:
"
当前无系统相册访问权限,建议前往设置
"
,
confirmText
:
"
前往设置
"
,
success
(
e
)
{
if
(
e
.
confirm
)
{
gotoAppPermissionSetting
()
}
}
});
}
}
else
if
(
e
.
errCode
===
2
&&
e
.
errMsg
==
"
chooseImage:fail No filming permission
"
)
{
console
.
log
(
'
e.errMsg === 2 ios无法拍照权限
'
);
// 注:e.errCode === 8 ios无从相册选择图片的权限 api已内置无需自己用拦截器实现
uni
.
showModal
({
title
:
"
无法访问相册
"
,
content
:
"
当前无系统相册访问权限,建议前往设置
"
,
confirmText
:
"
前往设置
"
,
success
(
e
)
{
if
(
e
.
confirm
)
{
gotoAppPermissionSetting
()
}
}
});
}
}
})
//跳转到**应用**的权限页面 参考来源:https://ext.dcloud.net.cn/plugin?id=594
function
gotoAppPermissionSetting
()
{
if
(
uni
.
getSystemInfoSync
().
platform
==
"
ios
"
)
{
var
UIApplication
=
plus
.
ios
.
import
(
"
UIApplication
"
);
var
application2
=
UIApplication
.
sharedApplication
();
var
NSURL2
=
plus
.
ios
.
import
(
"
NSURL
"
);
var
setting2
=
NSURL2
.
URLWithString
(
"
app-settings:
"
);
application2
.
openURL
(
setting2
);
plus
.
ios
.
deleteObject
(
setting2
);
plus
.
ios
.
deleteObject
(
NSURL2
);
plus
.
ios
.
deleteObject
(
application2
);
}
else
{
var
Intent
=
plus
.
android
.
importClass
(
"
android.content.Intent
"
);
var
Settings
=
plus
.
android
.
importClass
(
"
android.provider.Settings
"
);
var
Uri
=
plus
.
android
.
importClass
(
"
android.net.Uri
"
);
var
mainActivity
=
plus
.
android
.
runtimeMainActivity
();
var
intent
=
new
Intent
();
intent
.
setAction
(
Settings
.
ACTION_APPLICATION_DETAILS_SETTINGS
);
var
uri
=
Uri
.
fromParts
(
"
package
"
,
mainActivity
.
getPackageName
(),
null
);
intent
.
setData
(
uri
);
mainActivity
.
startActivity
(
intent
);
}
}
}
\ No newline at end of file
uni_modules/json-interceptor-chooseImage/package.json
0 → 100644
浏览文件 @
4a61d31f
{
"id"
:
"json-interceptor-chooseImage"
,
"displayName"
:
"拦截器应用示例:图片选择api时无权限,引导用户快捷打开系统设置"
,
"version"
:
"1.0.1"
,
"description"
:
"拦截器应用示例:图片选择api时无权限,引导用户快捷打开系统设置"
,
"keywords"
:
[
"interceptor,拦截器,相册权限"
],
"repository"
:
""
,
"engines"
:
{
"HBuilderX"
:
"^3.1.0"
},
"dcloudext"
:
{
"category"
:
[
"JS SDK"
,
"通用 SDK"
],
"sale"
:
{
"regular"
:
{
"price"
:
"0.00"
},
"sourcecode"
:
{
"price"
:
"0.00"
}
},
"contact"
:
{
"qq"
:
""
},
"declaration"
:
{
"ads"
:
"无"
,
"data"
:
"无"
,
"permissions"
:
"无"
},
"npmurl"
:
""
},
"uni_modules"
:
{
"dependencies"
:
[],
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"y"
,
"aliyun"
:
"y"
},
"client"
:
{
"App"
:
{
"app-vue"
:
"y"
,
"app-nvue"
:
"y"
},
"H5-mobile"
:
{
"Safari"
:
"n"
,
"Android Browser"
:
"n"
,
"微信浏览器(Android)"
:
"n"
,
"QQ浏览器(Android)"
:
"n"
},
"H5-pc"
:
{
"Chrome"
:
"n"
,
"IE"
:
"n"
,
"Edge"
:
"n"
,
"Firefox"
:
"n"
,
"Safari"
:
"n"
},
"小程序"
:
{
"微信"
:
"n"
,
"阿里"
:
"n"
,
"百度"
:
"n"
,
"字节跳动"
:
"n"
,
"QQ"
:
"n"
},
"快应用"
:
{
"华为"
:
"n"
,
"联盟"
:
"n"
}
}
}
}
}
\ No newline at end of file
uni_modules/json-interceptor-chooseImage/readme.md
0 → 100644
浏览文件 @
4a61d31f
拦截器顾名思义,是在框架方法执行的各个环节(包含:拦截前触发、成功回调拦截、失败回调拦截、完成回调拦截)
插入逻辑,篡改参数或终止运行。
#### 优势
-
这种方式相当于改写了api的内部逻辑,相比语法糖他更加直观,不影响ide的代码提示。
-
将常规固定的逻辑封装到框架的api内,且支持个性化设计。如你可以在本插件路径:
`/uni_modules/json-interceptor-chooseImage/js_sdk/main.js`
修改弹出框元素,绘制更漂亮的样式和文字说明。
#### 使用示例,App.vue页代码如下:
```
<script>
// #ifdef APP-PLUS
import interceptorChooseImage from '@/uni_modules/json-interceptor-chooseImage/js_sdk/main.js';
// #endif
export default {
onLaunch: function() {
console.log('App Launch')
// #ifdef APP-PLUS
interceptorChooseImage()
// #endif
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
</script>
```
> 跳转到**应用**的权限页面 参考来源:[https://ext.dcloud.net.cn/plugin?id=594](https://ext.dcloud.net.cn/plugin?id=594) 感谢作者@DCloud_heavensoft
uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json
浏览文件 @
4a61d31f
/*
重要的事情说三遍:
本文件不能有任何注释,删除后才能正常使用
本文件不能有任何注释,删除后才能正常使用
本文件不能有任何注释,删除后才能正常使用
*/
{
"passwordSecret"
:
"passwordSecret-demo"
,
"tokenSecret"
:
"tokenSecret-demo"
,
"tokenExpiresIn"
:
7200
,
"tokenExpiresThreshold"
:
600
,
"passwordErrorLimit"
:
6
,
"bindTokenToDevice"
:
true
,
"passwordErrorRetryTime"
:
3600
,
"autoSetInviteCode"
:
false
,
"forceInviteCode"
:
false
,
"passwordSecret"
:
"passwordSecret-demo"
,
//
数据库中password字段是加密存储的,这里的passwordSecret即为加密密码所用的密钥,注意修改为自己的密钥,使用一个较长的字符串即可
"tokenSecret"
:
"tokenSecret-demo"
,
//
生成token所用的密钥,注意修改为自己的,使用一个较长的字符串即可
"tokenExpiresIn"
:
7200
,
//
全平台token过期时间,未指定过期时间的平台会使用此值
"tokenExpiresThreshold"
:
600
,
//
新增于uni-id
1.1
.
7
版本,checkToken时如果token有效期小于此值则自动获取新token,请注意将新token返回给前端保存,如果不配置此参数则不开启自动获取新token功能
"bindTokenToDevice"
:
false
,
//
是否将token和设备绑定,设置为
true
会进行ua校验,uni-id
3.0
.
12
前默认为
true
,
3.0
.
12
及以后版本默认调整为
false
"passwordErrorLimit"
:
6
,
//
密码错误最大重试次数
"passwordErrorRetryTime"
:
3600
,
//
密码错误重试次数超限之后的冻结时间
"autoSetInviteCode"
:
false
,
//
是否在用户注册时自动设置邀请码,默认不自动设置
"forceInviteCode"
:
false
,
//
是否强制用户注册时必填邀请码,默认为
false
(需要注意的是目前只有短信验证码注册才可以填写邀请码)
,
设置为
true
时需要在loginBySms时指定type为register来使用注册,登录时也要传入type为login
"removePermissionAndRoleFromToken"
:
false
,
//
新增于uni-id
3.0
.
0
版本,如果配置为
false
则自动缓存用户的角色、权限到token中,默认值为
false
。详细说明见https://uniapp.dcloud.io/uniCloud/uni-id?id=cachepermissionintoken
"app-plus"
:
{
"tokenExpiresIn"
:
2592000
,
"oauth"
:
{
//
App微信登录所用到的appid、appsecret需要在微信开放平台获取,注意:不是公众平台而是开放平台
"weixin"
:
{
"appid"
:
"
"
,
"appsecret"
:
"
"
"appid"
:
"weixin appid
"
,
"appsecret"
:
"weixin appsecret
"
},
"apple"
:
{
"bundleId"
:
"
"
"apple"
:
{
//
使用苹果登录时需要
"bundleId"
:
"your bundleId
"
}
}
},
"mp-weixin"
:
{
"tokenExpiresIn"
:
259200
,
"oauth"
:
{
//
微信小程序登录所用的appid、appsecret需要在对应的小程序管理控制台获取
"weixin"
:
{
"appid"
:
"
"
,
"appsecret"
:
"
"
"appid"
:
"weixin appid
"
,
"appsecret"
:
"weixin appsecret
"
}
}
},
"mp-alipay"
:
{
"tokenExpiresIn"
:
259200
,
"oauth"
:
{
//
支付宝小程序登录用到的appid、privateKey请参考支付宝小程序的文档进行设置或者获取,https://opendocs.alipay.com/open/
291
/
105971
#LDsXr
"alipay"
:
{
"appid"
:
""
,
"privateKey"
:
""
"appid"
:
"alipay appid"
,
"privateKey"
:
"alipay privateKey"
,
//
私钥
"keyType"
:
"PKCS8"
//
私钥类型,如果私钥类型不是PKCS
8
,需要填写此字段,否则会出现“error:
0
D
0680
A
8
:asn
1
encoding
routines:ASN
1
_CHECK_TLEN:wrong
tag”错误
}
}
},
"service"
:
{
"sms"
:
{
"name"
:
"DCloud"
,
"codeExpiresIn"
:
300
,
"smsKey"
:
""
,
"smsSecret"
:
""
"name"
:
"your app name"
,
//
应用名称,对应短信模版的name
"codeExpiresIn"
:
180
,
//
验证码过期时间,单位为秒,注意一定要是
60
的整数倍
"smsKey"
:
"your sms key"
,
//
短信密钥key,开通短信服务处可以看到
"smsSecret"
:
"your sms secret"
//
短信密钥secret,开通短信服务处可以看到
},
"univerify"
:
{
"appid"
:
""
,
"apiKey"
:
""
,
"apiSecret"
:
"
"
"appid"
:
"your appid"
,
//
当前应用的appid,使用云函数URL化,此项必须配置
"apiKey"
:
"your apiKey"
,
//
apiKey
和
apiSecret
在开发者中心获取,开发者中心:https://dev.dcloud.net.cn/uniLogin/index?type=
0
,文档:https://ask.dcloud.net.cn/article/
37965
"apiSecret"
:
"your apiSecret
"
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录