引入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

@@ -1,52 +1,53 @@
<template> <template>
<view class="content"> <view class="content">
<image class="logo" src="/static/logo.png"></image> <image class="logo" src="/static/logo.png"></image>
<view class="text-area"> <view class="text-area">
<text class="title">{{title}}</text> <text class="title">{{ title }}</text>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default { const mqtt = require('mqtt')
data() { export default {
return { data () {
title: '灿能' return {
} title: '灿能'
}, }
onLoad() { },
onLoad () {
console.log(mqtt);
},
methods: {
}, }
methods: { }
}
}
</script> </script>
<style> <style>
.content { .content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.logo { .logo {
height: 200rpx; height: 200rpx;
width: 200rpx; width: 200rpx;
margin-top: 200rpx; margin-top: 200rpx;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
margin-bottom: 50rpx; margin-bottom: 50rpx;
} }
.text-area { .text-area {
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.title { .title {
font-size: 36rpx; font-size: 36rpx;
color: #8f8f94; color: #8f8f94;
} }
</style> </style>