引入mqtt

This commit is contained in:
仲么了
2023-01-13 13:23:25 +08:00
parent fd9b3df761
commit 36bcbab647
4 changed files with 62 additions and 100 deletions

View File

@@ -1,25 +1,32 @@
const debug = false // true 是连地服务端本地false 是连接线上
const development = {
domain: 'http://192.168.1.60:8094',
STATIC: '',
tenantId: 'rocanOA',
DOMAIN: 'http://192.168.1.60:8094',
MQTT_OPTIONS: {
clientId: '',
connectTimeout: 15000,
username: 'admin',
password: 'admin',
}
}
const production = {
domain: 'http://192.168.1.60:8094',
STATIC: 'http://192.168.1.60:8094',
tenantId: 'rocanOA',
DOMAIN: 'http://192.168.1.60:8094',
MQTT_OPTIONS: {
clientId: '',
connectTimeout: 15000,
username: 'admin',
password: 'admin',
}
}
const config = debug ? development : production
// #ifdef H5
if (process.env.NODE_ENV === 'development') {
config.domain = '/api'
config.DOMAIN = '/api'
} else {
config.domain = window.location.origin
config.DOMAIN = window.location.origin
}
// #endif

View File

@@ -196,54 +196,6 @@ const loadConfig = (call, need_fresh = false) => {
})
}
// 获取表单信息
const getInstanceData = (params) => {
return new Promise((resolve, reject) => {
request({
url: '/bpm/instance/getInstanceData',
data: params,
method: 'POST',
}).then(rs => {
resolve(rs.data)
}).catch(err => {
reject(err)
})
})
}
// 获取表单信息
const getNextIdByAlias = (alias, call) => {
return new Promise((resolve, reject) => {
request({
url: '/sys/serialNo/getNextIdByAlias',
data: {
alias: alias,
},
method: 'POST',
}).then(rs => {
resolve(rs.data)
}).catch(err => {
reject(err)
})
})
}
// 获取流程信息
const getFlowImageInfo = (params) => {
return new Promise((resolve, reject) => {
request({
url: '/bpm/instance/getFlowImageInfo',
data: params,
method: 'POST',
}).then(rs => {
resolve(rs.data)
}).catch(err => {
reject(err)
})
})
}
export default {
validatePhoneNumber,
toast,
@@ -252,7 +204,4 @@ export default {
h5Helper,
getUserLocation,
loadConfig,
getNextIdByAlias,
getInstanceData,
getFlowImageInfo
}

5
package.json Normal file
View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"mqtt": "^3.0.0"
}
}

View File

@@ -8,6 +8,7 @@
</template>
<script>
const mqtt = require('mqtt')
export default {
data () {
return {
@@ -15,7 +16,7 @@
}
},
onLoad () {
console.log(mqtt);
},
methods: {