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

feat: 兼容uni-app-x的客户端平台

上级 55090d7f
......@@ -111,6 +111,8 @@ module.exports = {
switch (clientPlatform) {
case 'app':
case 'app-plus':
case 'app-android':
case 'app-ios':
clientPlatform = 'app'
break
case 'web':
......
......@@ -18,7 +18,7 @@ const uniIdConfig = createConfig({
})
class ConfigUtils {
constructor ({
constructor({
context
} = {}) {
this.context = context
......@@ -31,6 +31,8 @@ class ConfigUtils {
switch (uniPlatform) {
case 'app':
case 'app-plus':
case 'app-android':
case 'app-ios':
this.platform = 'app'
break
case 'web':
......@@ -43,7 +45,7 @@ class ConfigUtils {
}
}
getConfigArray () {
getConfigArray() {
let configContent
try {
configContent = require('uni-config-center/uni-id/config.json')
......@@ -57,12 +59,12 @@ class ConfigUtils {
return [configContent]
}
getAppConfig () {
getAppConfig() {
const configArray = this.getConfigArray()
return configArray.find(item => item.dcloudAppid === this.appId) || configArray.find(item => item.isDefaultConfig)
}
getPlatformConfig () {
getPlatformConfig() {
const appConfig = this.getAppConfig()
if (!appConfig) {
throw new Error(
......@@ -87,7 +89,7 @@ class ConfigUtils {
return Object.assign(defaultConfig, appConfig, appConfig[platform])
}
getOauthProvider ({
getOauthProvider({
provider
} = {}) {
const clientPlatform = this.platform
......@@ -101,7 +103,7 @@ class ConfigUtils {
return oatuhProivder
}
getOauthConfig ({
getOauthConfig({
provider
} = {}) {
const config = this.getPlatformConfig()
......@@ -122,7 +124,7 @@ class ConfigUtils {
return oauthConfig
}
getHooks () {
getHooks() {
if (uniIdConfig.hasFile('hooks/index.js')) {
return require(
uniIdConfig.resolve('hooks/index.js')
......
......@@ -10,6 +10,8 @@ function getQQPlatform () {
switch (platform) {
case 'app':
case 'app-plus':
case 'app-android':
case 'app-ios':
return 'app'
case 'mp-qq':
return 'mp'
......
......@@ -43,6 +43,8 @@ function getWeixinPlatform () {
switch (platform) {
case 'app':
case 'app-plus':
case 'app-android':
case 'app-ios':
return 'app'
case 'mp-weixin':
return 'mp'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册