Appearance
dx-func-user
公共用户模块的云函数
注意事项
云函数无法直接运行,需搭配以下依赖:
- 1、【dx-router-admin】:https://ext.dcloud.net.cn/plugin?id=4818
- 2、uni-captcha,图形验证码插件:https://ext.dcloud.net.cn/plugin?id=4048
- 3、uni-config-center,配置中心:https://ext.dcloud.net.cn/plugin?id=4425
- 4、【uni-id-common】从HBuilderX 3.5起,新建uniCloud项目时,会自动加载 uni-id-common 依赖。也就是 uni-id-common 默认内置在每个项目中 详情见文档:https://uniapp.dcloud.net.cn/uniCloud/uni-id-common.html
安装
从插件市场的右上角,点击
使用HBuilderX
导入插件
如图:在项目里右键单击云函数
如下图:需要依赖以下公共模块
uni-id 配置示例
json
{
"passwordSecret": [{
"type": "hmac-sha256",
"version": 1
}],
"tokenSecret": "tokenSecret-demo",
"tokenExpiresIn": 7200,
"tokenExpiresThreshold": 600,
"passwordErrorLimit": 6,
"bindTokenToDevice": false,
"passwordErrorRetryTime": 3600,
"autoSetInviteCode": false,
"forceInviteCode": false,
"app-plus": {
"tokenExpiresIn": 2592000,
"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": "用户登录",
"codeExpiresIn": 600,
"smsKey": "",
"smsSecret": "",
"templateId": ""
},
"univerify": {
"appid": "",
"apiKey": "",
"apiSecret": ""
}
}
}
{
"passwordSecret": [{
"type": "hmac-sha256",
"version": 1
}],
"tokenSecret": "tokenSecret-demo",
"tokenExpiresIn": 7200,
"tokenExpiresThreshold": 600,
"passwordErrorLimit": 6,
"bindTokenToDevice": false,
"passwordErrorRetryTime": 3600,
"autoSetInviteCode": false,
"forceInviteCode": false,
"app-plus": {
"tokenExpiresIn": 2592000,
"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": "用户登录",
"codeExpiresIn": 600,
"smsKey": "",
"smsSecret": "",
"templateId": ""
},
"univerify": {
"appid": "",
"apiKey": "",
"apiSecret": ""
}
}
}