提交 2fa5d79b 编写于 作者: 雪洛's avatar 雪洛

docs: update uniCloud

上级 775447a6
......@@ -195,7 +195,7 @@ exports.main = async (event, context) => {
```js
exports.main = async (event, context) => {
context.PLATFORM = 'app-plus'
context.PLATFORM = 'app'
}
```
......
......@@ -163,7 +163,7 @@ uni.request({
```js
exports.main = async (event, context) => {
context.PLATFORM = 'app-plus'
context.PLATFORM = 'app'
}
```
......@@ -242,11 +242,13 @@ content-length: 13
}
```
**headers内可以返回传统服务器的所有响应头,包括Set-Cookie、Content-Type等**
##### 使用集成响应返回 HTML
`content-type`设置为`text/html`,即可在`body`中返回 HTML,会被浏览器自动解析:
**阿里云默认域名无法返回html并在浏览器中展示,只可以触发下载。绑定自定义域名无此限制**
**阿里云默认域名无法返回html并在浏览器中展示,只可以触发下载(无法修改Content-Disposition)。绑定自定义域名无此限制**
```js
exports.main = function() {
......
......@@ -250,13 +250,13 @@ const hour = getOffsetDate(8).getHours()
"clientInfo":{
// HBuilderX 3.5.1之前的版本需要传全大写的参数才可以在context内使用context.OS、context.LOCALE等
"OS": "ios" // 系统类型 ios、android
"PLATFORM": "web", // 客户端类型 app-plus、h5、mp-weixin、mp-alipay等
"PLATFORM": "web", // 客户端类型 app、web、mp-weixin、mp-alipay等
"DEVICEID": "", // 设备id
"APPID": "", // 应用DCloud AppId
"LOCALE: "", // 客户端语言
// HBuilderX 3.5.1及更高版本无需传入大写参数,以上参数对应写法如下
"osName": "ios", // 系统类型 ios、android
"uniPlatform": "web", // 客户端类型 app-plus、h5、mp-weixin、mp-alipay等
"uniPlatform": "web", // 客户端类型 app、web、mp-weixin、mp-alipay等
"deviceId": "", // 设备id
"appId": "", // 应用DCloud AppId
"locale": "", // 客户端语言
......
......@@ -1368,11 +1368,11 @@ await uniIdCo.setAuthorizedApp({
- 微信 appid 申请步骤:[https://ask.dcloud.net.cn/article/208](https://ask.dcloud.net.cn/article/208)
- iOS平台微信SDK配置通用链接:[https://uniapp.dcloud.io/api/plugins/universal-links.html](https://uniapp.dcloud.io/api/plugins/universal-links.html)
- 模块配置:`manifest.json` --> `App模块配置` --> `OAuth(登录鉴权)` --> `勾选微信登录` --> 填写`appid``appsecret``ios平台通用链接`
- uni-id配置:`uni-id配置文件` --> `app-plus` --> `oauth` --> `weixin`,填写`appid``appsecret`
- uni-id配置:`uni-id配置文件` --> `app` --> `oauth` --> `weixin`,填写`appid``appsecret`
## 苹果登录集成指南
- 模块配置:`manifest.json` --> `App模块配置` --> OAuth(登录鉴权)勾选`苹果登录`[IOS苹果授权登录参考文档](https://ask.dcloud.net.cn/article/36651)。如不发布到Appstore,不需要配置此项
- uni-id配置:`uni-id配置文件` --> `app-plus` --> `oauth` --> `apple` 填写`bundleId`
- uni-id配置:`uni-id配置文件` --> `app` --> `oauth` --> `apple` 填写`bundleId`
- 关联域配置:`manifest.json` --> `App常用其他设置` --> `iOS设置` --> `关联域(Associated Domains)` 填写配置 [参考教程](https://ask.dcloud.net.cn/article/36393)。如不发布到Appstore,不需要配置此项
## 短信验证码
......
......@@ -124,7 +124,7 @@ uni-id的云端配置文件在`uniCloud/cloudfunctions/common/uni-config-center/
```js
exports.main = async (event, context) => {
context.PLATFORM = 'app-plus'
context.PLATFORM = 'app'
}
```
......@@ -555,7 +555,7 @@ module.exports = {
**为什么需要自行创建uni-id实例**
默认情况下uni-id某些接口会自动从全局context内获取客户端的PLATFORM(平台,如:app-plus、h5、mp-weixin)信息。
默认情况下uni-id某些接口会自动从全局context内获取客户端的PLATFORM(平台,如:app、web、mp-weixin)信息。
在单实例多并发的场景下可能无法正确获取(全局对象会被后面的请求覆盖,可能会导致前面一次请求使用了后面一次请求的PLATFORM信息)。因此推荐在开启云函数单实例多并发后,自行为uni-id传入context。
......@@ -1887,7 +1887,7 @@ exports.main = async function(event,context) {
1. 在manifest.json内配置微信登录用appid
2. **打包****使用**自定义基座(注意一定要在manifest.json填写微信appid后再制作自定义基座),[自定义基座使用说明](https://ask.dcloud.net.cn/article/35115)
3. 在uni-id的config.json内app-plus对应的微信登录信息内配置appid和appsecret
3. 在uni-id的config.json内app对应的微信登录信息内配置appid和appsecret
**LoginByWexinParams参数说明**
......@@ -2186,7 +2186,7 @@ exports.main = async function(event,context) {
1. 在manifest.json内配置QQ登录用appid
2. **打包****使用**自定义基座(注意一定要在manifest.json填写QQ appid后再制作自定义基座),[自定义基座使用说明](https://ask.dcloud.net.cn/article/35115)
3. 在uni-id的config.json内app-plus对应的QQ登录信息内配置appid和appsecret
3. 在uni-id的config.json内app对应的QQ登录信息内配置appid和appsecret
**参数说明**
......@@ -2502,7 +2502,7 @@ exports.main = async function(event,context) {
**注意**
- 需要在config.json内的 app-plus > oauth > apple 下配置 bundleId
- 需要在config.json内的 app > oauth > apple 下配置 bundleId
- 登录成功之后会返回token、tokenExpired,在获取token之后应进行持久化存储,详情参考:[保存token及其有效期](uniCloud/uni-id.md?id=save-token)
**LoginByAppleParams参数说明**
......@@ -3691,10 +3691,10 @@ exports.main = async function(event, context){
"dcloudAppid": "__UNI__xxxx1", // 务必替换为对应项目manifest.json内的DCloud Appid
"isDefaultConfig": true, // 默认配置标记,未匹配到dcloudAppid的情况下使用默认配置
"passwordSecret": "passwordSecret-demo",
"tokenSecret": "tokenSecret-demo",
"tokenExpiresIn": 7200,
"tokenExpiresThreshold": 600,
"app-plus": {
"tokenSecret": "tokenSecret-demo",
"tokenExpiresIn": 7200,
"tokenExpiresThreshold": 600,
"app": {
"tokenExpiresIn": 2592000,
"oauth": {
"weixin": {
......@@ -3706,9 +3706,9 @@ exports.main = async function(event, context){
}, {
"dcloudAppid": "__UNI__xxxx2", // 务必替换为对应项目manifest.json内的DCloud Appid
"passwordSecret": "passwordSecret-demo",
"tokenSecret": "tokenSecret-demo",
"tokenExpiresIn": 7200,
"tokenExpiresThreshold": 600,
"tokenSecret": "tokenSecret-demo",
"tokenExpiresIn": 7200,
"tokenExpiresThreshold": 600,
"app-plus": {
"tokenExpiresIn": 2592000,
"oauth": {
......
......@@ -215,13 +215,13 @@ uniCloud.callFunction({
name: 'getOrderInfo',
success(res) {
uni.requestPayment({
// #ifdef APP-PLUS
// #ifdef APP
provider: selectedProvider, // App端此参数必填,可以通过uni.getProvider获取
// #endif
// #ifdef MP-WEIXIN
...res.result.orderInfo,
// #endif
// #ifdef APP-PLUS || MP-ALIPAY
// #ifdef APP || MP-ALIPAY
orderInfo: res.result.orderInfo,
// #endif
...res.result.orderInfo
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册