增加local模式自定义服务器url
This commit is contained in:
parent
20838db718
commit
f2c5ec5fed
11
common.js
11
common.js
@ -979,7 +979,16 @@ export async function parsingCharacteristicValue(binaryData) {
|
|||||||
|
|
||||||
// 获取配置
|
// 获取配置
|
||||||
export function getConfig() {
|
export function getConfig() {
|
||||||
let config = configs[this.env]
|
let config = {}
|
||||||
|
if (this.env === "LOCAL"){
|
||||||
|
config = {
|
||||||
|
name: 'LOCAL',
|
||||||
|
baseUrl: this.url
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
config = configs[this.env]
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...config,
|
...config,
|
||||||
version,
|
version,
|
||||||
|
|||||||
@ -80,6 +80,8 @@ class StarCloud {
|
|||||||
constructor() {
|
constructor() {
|
||||||
// 环境
|
// 环境
|
||||||
this.env = null
|
this.env = null
|
||||||
|
//sdk服务器地址
|
||||||
|
this.url = ''
|
||||||
// 客户端Id
|
// 客户端Id
|
||||||
this.clientId = null
|
this.clientId = null
|
||||||
// 客户端密码
|
// 客户端密码
|
||||||
@ -137,7 +139,7 @@ class StarCloud {
|
|||||||
init(params) {
|
init(params) {
|
||||||
Object.assign(StarCloud.prototype, device, lock, other, password, record, user, common)
|
Object.assign(StarCloud.prototype, device, lock, other, password, record, user, common)
|
||||||
|
|
||||||
const { clientId, clientSecret, env, platform, accounts } = params
|
const { clientId, clientSecret, env, platform, accounts,url } = params
|
||||||
this.envVersion = 'release'
|
this.envVersion = 'release'
|
||||||
if (platform !== 2) {
|
if (platform !== 2) {
|
||||||
const appInfo = uni.getAccountInfoSync()
|
const appInfo = uni.getAccountInfoSync()
|
||||||
@ -147,6 +149,7 @@ class StarCloud {
|
|||||||
onBLECharacteristicValueChange(this.listenCharacteristicValue.bind(this))
|
onBLECharacteristicValueChange(this.listenCharacteristicValue.bind(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.url = url
|
||||||
this.isReportLog = params.isReportLog
|
this.isReportLog = params.isReportLog
|
||||||
|
|
||||||
this.env = env || 'XHJ'
|
this.env = env || 'XHJ'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user