引入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 debug = false // true 是连地服务端本地false 是连接线上
const development = { const development = {
domain: 'http://192.168.1.60:8094', DOMAIN: 'http://192.168.1.60:8094',
STATIC: '', MQTT_OPTIONS: {
tenantId: 'rocanOA', clientId: '',
connectTimeout: 15000,
username: 'admin',
password: 'admin',
}
} }
const production = { const production = {
domain: 'http://192.168.1.60:8094', DOMAIN: 'http://192.168.1.60:8094',
STATIC: 'http://192.168.1.60:8094', MQTT_OPTIONS: {
tenantId: 'rocanOA', clientId: '',
connectTimeout: 15000,
username: 'admin',
password: 'admin',
}
} }
const config = debug ? development : production const config = debug ? development : production
// #ifdef H5 // #ifdef H5
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
config.domain = '/api' config.DOMAIN = '/api'
} else { } else {
config.domain = window.location.origin config.DOMAIN = window.location.origin
} }
// #endif // #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 { export default {
validatePhoneNumber, validatePhoneNumber,
toast, toast,
@@ -252,7 +204,4 @@ export default {
h5Helper, h5Helper,
getUserLocation, getUserLocation,
loadConfig, 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> </template>
<script> <script>
const mqtt = require('mqtt')
export default { export default {
data () { data () {
return { return {
@@ -15,7 +16,7 @@
} }
}, },
onLoad () { onLoad () {
console.log(mqtt);
}, },
methods: { methods: {