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

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