数据切换到正式环境
This commit is contained in:
7
App.vue
7
App.vue
@@ -27,13 +27,6 @@ export default {
|
||||
uni.setStorageSync(this.$cacheKey.dictData, res.data)
|
||||
})
|
||||
|
||||
// 更新用户头像
|
||||
if (userInfo.headSculpture) {
|
||||
getImageUrl(userInfo.headSculpture).then((res) => {
|
||||
userInfo.avatar = res.data
|
||||
uni.setStorageSync(this.$cacheKey.userInfo, userInfo)
|
||||
})
|
||||
}
|
||||
},
|
||||
onHide: function () {
|
||||
console.log('App Hide')
|
||||
|
||||
@@ -5,7 +5,7 @@ const development = {
|
||||
}
|
||||
|
||||
const production = {
|
||||
domain: 'http://192.168.1.13:10215',
|
||||
domain: 'https://pqmcn.com:8092/api',
|
||||
}
|
||||
|
||||
const config = debug ? development : production
|
||||
@@ -18,4 +18,7 @@ if (process.env.NODE_ENV === 'development') {
|
||||
}
|
||||
// #endif
|
||||
|
||||
config.static = config.domain + '/system-boot/image/toStream?bgImage='
|
||||
|
||||
|
||||
export default config
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
export const MQTT_IP = '192.168.1.18:8083/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt
|
||||
// export const MQTT_IP = '192.168.1.18:8083/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt
|
||||
export const MQTT_IP = 'pqmcn.com:8085/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt
|
||||
|
||||
const MQTT_USERNAME = 't_user'//mqtt用户名
|
||||
const MQTT_PASSWORD = 'njcnpqs'//密码
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ import {getImageUrl} from '@/common/api/basic'
|
||||
import {apiUpdatePush} from '@/common/api/user'
|
||||
import {queryDictDataCache} from '../api/dictionary.js'
|
||||
import cacheKey from './cacheKey.js'
|
||||
import config from "@/common/js/config";
|
||||
import jsrsasign from 'jsrsasign'
|
||||
|
||||
const toast = (title, duration = 1500, call, mask = false, icon = 'none') => {
|
||||
if (Boolean(title) === false) {
|
||||
@@ -209,28 +211,24 @@ const loginSuccess = (data, jump = true) => {
|
||||
console.log(data)
|
||||
uni.setStorageSync('access_token', data.token_type + ' ' + data.access_token)
|
||||
uni.setStorageSync('refresh_token', data.refresh_token)
|
||||
let strings = data.access_token.split('.') //截取token,获取载体
|
||||
console.log(escape, atob)
|
||||
var userInfo = JSON.parse(decodeURIComponent(escape(atob(strings[1].replace(/-/g, '+').replace(/_/g, '/')))))
|
||||
let userInfo = decodeToken(data.access_token)
|
||||
console.log(userInfo)
|
||||
// let strings = data.access_token.split('.') //截取token,获取载体
|
||||
// console.log(escape, atob)
|
||||
// var userInfo = JSON.parse(decodeURIComponent(escape(atob(strings[1].replace(/-/g, '+').replace(/_/g, '/')))))
|
||||
userInfo.authorities = userInfo.authorities[0]
|
||||
uni.setStorageSync(cache.userInfo, userInfo)
|
||||
if (userInfo.headSculpture) {
|
||||
getImageUrl(userInfo.headSculpture).then((res) => {
|
||||
userInfo.avatar = res.data
|
||||
uni.setStorageSync(cache.userInfo, userInfo)
|
||||
apiUpdatePush()
|
||||
resolve(userInfo)
|
||||
})
|
||||
} else {
|
||||
uni.setStorageSync(cache.userInfo, userInfo)
|
||||
apiUpdatePush()
|
||||
resolve(userInfo)
|
||||
userInfo.avatar = config.static + userInfo.headSculpture
|
||||
}
|
||||
console.log('reLaunch')
|
||||
console.log(userInfo)
|
||||
uni.setStorageSync(cache.userInfo, userInfo)
|
||||
apiUpdatePush()
|
||||
resolve(userInfo)
|
||||
if (jump) {
|
||||
queryDictDataCache().then((res) => {
|
||||
uni.setStorageSync(cacheKey.dictData, res.data)
|
||||
})
|
||||
console.log('reLaunch')
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
fail: (err) => {
|
||||
@@ -258,6 +256,17 @@ const refreshPrePage = (number = 1, time = 1500) => {
|
||||
}
|
||||
}
|
||||
|
||||
const decodeToken = (token) => {
|
||||
let obj = null
|
||||
if (token !== '') {
|
||||
const payload = jsrsasign.KJUR.jws.JWS.parse(token)
|
||||
if (payload.hasOwnProperty('payloadObj')) {
|
||||
obj = payload.payloadObj
|
||||
}
|
||||
}
|
||||
return obj
|
||||
}
|
||||
|
||||
export default {
|
||||
validatePhoneNumber,
|
||||
toast,
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
"name" : "灿能物联",
|
||||
"appid" : "__UNI__88BC25B",
|
||||
"description" : "",
|
||||
"versionName" : "1.1.8",
|
||||
"versionCode" : 118,
|
||||
"versionName" : "1.2.2",
|
||||
"versionCode" : 122,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
@@ -131,7 +131,6 @@
|
||||
"proxy" : {
|
||||
"/api" : {
|
||||
"https" : true,
|
||||
// "target" : "https://china.indpecker.com",
|
||||
"target" : "http://192.168.1.115:10215",
|
||||
"changOrigin" : true,
|
||||
"pathRewrite" : {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"crypto-js": "^4.1.1",
|
||||
"html2canvas": "^1.4.1",
|
||||
"image-tools": "^1.4.0",
|
||||
"jsrsasign": "^10.8.6",
|
||||
"mqtt": "3.0.0",
|
||||
"pinyin-pro": "^3.13.2",
|
||||
"qs": "^6.11.2",
|
||||
|
||||
@@ -13,19 +13,19 @@
|
||||
<view class="item">20.0</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="grid-card">
|
||||
<view class="grid-card-title">干接点</view>
|
||||
<view class="grid-card-content-4">
|
||||
<view class="item item-title">干接点1</view>
|
||||
<view class="item item-title">干接点2</view>
|
||||
<view class="item item-title"></view>
|
||||
<view class="item item-title"></view>
|
||||
<view class="item">正常</view>
|
||||
<view class="item">正常</view>
|
||||
<view class="item"></view>
|
||||
<view class="item"></view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="grid-card">-->
|
||||
<!-- <view class="grid-card-title">干接点</view>-->
|
||||
<!-- <view class="grid-card-content-4">-->
|
||||
<!-- <view class="item item-title">干接点1</view>-->
|
||||
<!-- <view class="item item-title">干接点2</view>-->
|
||||
<!-- <view class="item item-title"></view>-->
|
||||
<!-- <view class="item item-title"></view>-->
|
||||
<!-- <view class="item">正常</view>-->
|
||||
<!-- <view class="item">正常</view>-->
|
||||
<!-- <view class="item"></view>-->
|
||||
<!-- <view class="item"></view>-->
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
@@ -29,18 +29,15 @@
|
||||
<view class="module">
|
||||
<view class="grid-card">
|
||||
<view class="grid-card-content-2">
|
||||
<view class="item">模块一</view>
|
||||
<view class="item">
|
||||
<view class="status-point-success mr10"></view>
|
||||
<view style="width: 30rpx"> 15</view>
|
||||
<view> °C</view>
|
||||
</view>
|
||||
<view class="item">模块二</view>
|
||||
<view class="item">
|
||||
<view class="status-point-error mr10"></view>
|
||||
<view style="width: 30rpx"> 0</view>
|
||||
<view> °C</view>
|
||||
</view>
|
||||
<template v-for="(item,index) in IOData">
|
||||
<view class="item">{{ item.clDid }}</view>
|
||||
<view class="item">
|
||||
<!-- <view class="status-point-success mr10"></view>-->
|
||||
<view style="width: 30rpx"> {{ item.value }}</view>
|
||||
<view> °C</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -185,7 +182,8 @@ export default {
|
||||
value: [],
|
||||
},
|
||||
],
|
||||
basicData: []
|
||||
basicData: [],
|
||||
IOData: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -255,6 +253,7 @@ export default {
|
||||
this.loading = true
|
||||
this.domLoading = true
|
||||
queryTopologyDiagram(this.devId).then((res) => {
|
||||
res.data.filePath = this.$config.static + res.data.filePath
|
||||
this.deviceInfo = res.data
|
||||
uni.setNavigationBarTitle({title: this.deviceInfo.devName || '设备详情'})
|
||||
this.topolodyData.filter((item) => {
|
||||
@@ -312,13 +311,22 @@ export default {
|
||||
this.client
|
||||
.on('connect', () => {
|
||||
console.log('连接成功')
|
||||
this.client.subscribe(`/zl/TemperData/${this.devId}`, (err) => {
|
||||
if (!err) {
|
||||
console.log(`订阅成功:/zl/TemperData/${this.devId}`)
|
||||
}
|
||||
})
|
||||
this.client.subscribe(`/zl/devData/${this.devId}`, (err) => {
|
||||
if (!err) {
|
||||
console.log(`订阅成功:/zl/devData/${this.devId}`)
|
||||
|
||||
// 默认推送
|
||||
this.client.publish(`/zl/askDevData/${this.devId}`)
|
||||
this.client.publish(`/zl/askTemperData/${this.devId}`)
|
||||
this.timer = setInterval(() => {
|
||||
console.log('askDevData')
|
||||
this.client.publish(`/zl/askDevData/${this.devId}`)
|
||||
this.client.publish(`/zl/askTemperData/${this.devId}`)
|
||||
}, 1000 * 60)
|
||||
}
|
||||
})
|
||||
@@ -335,14 +343,20 @@ export default {
|
||||
})
|
||||
.on('message', (topic, message) => {
|
||||
console.log('接收推送信息:', message.toString(), topic)
|
||||
if (topic !== `/zl/devData/${this.devId}`) return
|
||||
if ((!message.toString() || message.toString().length < 10) && this.loading) {
|
||||
this.$util.toast('该设备暂无数据')
|
||||
if (topic === `/zl/devData/${this.devId}`) {
|
||||
if ((!message.toString() || message.toString().length < 10) && this.loading) {
|
||||
this.$util.toast('该设备暂无数据')
|
||||
}
|
||||
this.loading = false
|
||||
this.handlerData(JSON.parse(message.toString()))
|
||||
} else if (topic === `/zl/TemperData/${this.devId}`) {
|
||||
// this.basicData.forEach((item) => {
|
||||
// if (item.statisticalName === '温度' && item.phase === 'avg') {
|
||||
// item.statisticalData = message.toString()
|
||||
// }
|
||||
// })
|
||||
this.IOData = JSON.parse(message.toString())
|
||||
}
|
||||
this.loading = false
|
||||
this.handlerData(JSON.parse(message.toString()))
|
||||
|
||||
this.$forceUpdate()
|
||||
})
|
||||
},
|
||||
handlerData(data) {
|
||||
|
||||
@@ -236,7 +236,12 @@ export default {
|
||||
queryTopologyDiagramPage({
|
||||
projectId: this.formData.projectId,
|
||||
}).then((res) => {
|
||||
this.imageList = res.data.records
|
||||
this.imageList = res.data.records.map(item=>{
|
||||
return {
|
||||
...item,
|
||||
filePath: this.$config.static + item.filePath
|
||||
}
|
||||
})
|
||||
this.activeGplot = this.imageList.findIndex(item => {
|
||||
return item.id === this.deviceInfo.id
|
||||
})
|
||||
|
||||
@@ -271,7 +271,12 @@ export default {
|
||||
queryTopologyDiagramPage({
|
||||
projectId: this.formData.projectId,
|
||||
}).then((res) => {
|
||||
this.imageList = res.data.records
|
||||
this.imageList = res.data.records.map(item=>{
|
||||
return {
|
||||
...item,
|
||||
filePath: this.$config.static + item.filePath
|
||||
}
|
||||
})
|
||||
this.activeGplot = 0
|
||||
if (this.imageList.length) {
|
||||
this.confirmGplot()
|
||||
|
||||
@@ -87,7 +87,7 @@ export default {
|
||||
return {
|
||||
"name": item,
|
||||
"extname": item.split('.')[1],
|
||||
"url": item,
|
||||
"url": this.$config.static + item,
|
||||
}
|
||||
})
|
||||
this.loading = false
|
||||
|
||||
@@ -249,7 +249,7 @@ export default {
|
||||
return {
|
||||
name: item.name,
|
||||
extname: 'img',
|
||||
url: item.filePath,
|
||||
url: this.$config.static + item.filePath,
|
||||
...item,
|
||||
}
|
||||
})
|
||||
@@ -297,6 +297,9 @@ export default {
|
||||
}, 1000)
|
||||
console.log(option.project)
|
||||
this.project = JSON.parse(decodeURIComponent(option.project))
|
||||
this.project.topologyDiagramPaths.forEach(item=>{
|
||||
item.filePath = this.$config.static + item.filePath
|
||||
})
|
||||
this.init()
|
||||
// uni.setNavigationBarTitle({ title: this.project })
|
||||
},
|
||||
|
||||
@@ -164,14 +164,19 @@ export default {
|
||||
})
|
||||
getTopoTemplate().then((res) => {
|
||||
console.log(res)
|
||||
this.tempList = res.data
|
||||
this.tempList = res.data.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
filePath:this.$config.static + item.filePath
|
||||
}
|
||||
})
|
||||
if (this.project) {
|
||||
this.project.topologyDiagramPaths.forEach((item) => {
|
||||
if (this.tempList.some((item2) => item2.id === item.topoId)) {
|
||||
this.formData.tempFiles.push(item)
|
||||
} else {
|
||||
this.formData.files.push({
|
||||
url: item.filePath,
|
||||
url: this.$config.static + item.filePath,
|
||||
extname: item.name.split('.')[1],
|
||||
name: item.name,
|
||||
...item,
|
||||
|
||||
@@ -38,14 +38,10 @@ export default {
|
||||
headSculpture: result.data.minFileUrl,
|
||||
}).then((res) => {
|
||||
console.log(res)
|
||||
getImageUrl(result.data.minFileUrl).then((url) => {
|
||||
console.log(url.data)
|
||||
this.userInfo.headSculpture = result.data.minFileUrl
|
||||
this.userInfo.avatar = url.data
|
||||
console.warn(this.userInfo)
|
||||
uni.setStorageSync(this.$cacheKey.userInfo, this.userInfo)
|
||||
this.$forceUpdate()
|
||||
})
|
||||
this.userInfo.headSculpture = result.data.minFileUrl
|
||||
this.userInfo.avatar = this.$config.static + result.data.minFileUrl
|
||||
uni.setStorageSync(this.$cacheKey.userInfo, this.userInfo)
|
||||
this.$forceUpdate()
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
@@ -97,7 +97,7 @@ export default {
|
||||
return {
|
||||
checkbox: false,
|
||||
loading: false,
|
||||
loginType: 'yzm',
|
||||
loginType: 'pwd',
|
||||
phone: '',
|
||||
pwdForm: {
|
||||
pwd: '',
|
||||
|
||||
6
pnpm-lock.yaml
generated
6
pnpm-lock.yaml
generated
@@ -6,6 +6,7 @@ specifiers:
|
||||
crypto-js: ^4.1.1
|
||||
html2canvas: ^1.4.1
|
||||
image-tools: ^1.4.0
|
||||
jsrsasign: ^10.8.6
|
||||
mqtt: 3.0.0
|
||||
pinyin-pro: ^3.13.2
|
||||
qs: ^6.11.2
|
||||
@@ -15,6 +16,7 @@ dependencies:
|
||||
crypto-js: 4.1.1
|
||||
html2canvas: 1.4.1
|
||||
image-tools: 1.4.0
|
||||
jsrsasign: 10.8.6
|
||||
mqtt: 3.0.0
|
||||
pinyin-pro: 3.13.2
|
||||
qs: 6.11.2
|
||||
@@ -448,6 +450,10 @@ packages:
|
||||
resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==}
|
||||
dev: false
|
||||
|
||||
/jsrsasign/10.8.6:
|
||||
resolution: {integrity: sha512-bQmbVtsfbgaKBTWCKiDCPlUPbdlRIK/FzSwT3BzIgZl/cU6TqXu6pZJsCI/dJVrZ9Gir5GC4woqw9shH/v7MBw==}
|
||||
dev: false
|
||||
|
||||
/leven/2.1.0:
|
||||
resolution: {integrity: sha512-nvVPLpIHUxCUoRLrFqTgSxXJ614d8AgQoWl7zPe/2VadE8+1dpU3LBhowRuBAcuwruWtOdD8oYC9jDNJjXDPyA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
Reference in New Issue
Block a user