数据切换到正式环境

This commit is contained in:
仲么了
2023-08-30 18:52:58 +08:00
parent d61a1614f9
commit 05b28a17e7
16 changed files with 116 additions and 75 deletions

View File

@@ -27,13 +27,6 @@ export default {
uni.setStorageSync(this.$cacheKey.dictData, res.data) 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 () { onHide: function () {
console.log('App Hide') console.log('App Hide')

View File

@@ -5,7 +5,7 @@ const development = {
} }
const production = { const production = {
domain: 'http://192.168.1.13:10215', domain: 'https://pqmcn.com:8092/api',
} }
const config = debug ? development : production const config = debug ? development : production
@@ -18,4 +18,7 @@ if (process.env.NODE_ENV === 'development') {
} }
// #endif // #endif
config.static = config.domain + '/system-boot/image/toStream?bgImage='
export default config export default config

View File

@@ -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_USERNAME = 't_user'//mqtt用户名
const MQTT_PASSWORD = 'njcnpqs'//密码 const MQTT_PASSWORD = 'njcnpqs'//密码

View File

@@ -4,6 +4,8 @@ import {getImageUrl} from '@/common/api/basic'
import {apiUpdatePush} from '@/common/api/user' import {apiUpdatePush} from '@/common/api/user'
import {queryDictDataCache} from '../api/dictionary.js' import {queryDictDataCache} from '../api/dictionary.js'
import cacheKey from './cacheKey.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') => { const toast = (title, duration = 1500, call, mask = false, icon = 'none') => {
if (Boolean(title) === false) { if (Boolean(title) === false) {
@@ -209,28 +211,24 @@ const loginSuccess = (data, jump = true) => {
console.log(data) console.log(data)
uni.setStorageSync('access_token', data.token_type + ' ' + data.access_token) uni.setStorageSync('access_token', data.token_type + ' ' + data.access_token)
uni.setStorageSync('refresh_token', data.refresh_token) uni.setStorageSync('refresh_token', data.refresh_token)
let strings = data.access_token.split('.') //截取token获取载体 let userInfo = decodeToken(data.access_token)
console.log(escape, atob) console.log(userInfo)
var userInfo = JSON.parse(decodeURIComponent(escape(atob(strings[1].replace(/-/g, '+').replace(/_/g, '/'))))) // 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] userInfo.authorities = userInfo.authorities[0]
uni.setStorageSync(cache.userInfo, userInfo)
if (userInfo.headSculpture) { if (userInfo.headSculpture) {
getImageUrl(userInfo.headSculpture).then((res) => { userInfo.avatar = config.static + userInfo.headSculpture
userInfo.avatar = res.data
uni.setStorageSync(cache.userInfo, userInfo)
apiUpdatePush()
resolve(userInfo)
})
} else {
uni.setStorageSync(cache.userInfo, userInfo)
apiUpdatePush()
resolve(userInfo)
} }
console.log('reLaunch') console.log(userInfo)
uni.setStorageSync(cache.userInfo, userInfo)
apiUpdatePush()
resolve(userInfo)
if (jump) { if (jump) {
queryDictDataCache().then((res) => { queryDictDataCache().then((res) => {
uni.setStorageSync(cacheKey.dictData, res.data) uni.setStorageSync(cacheKey.dictData, res.data)
}) })
console.log('reLaunch')
uni.reLaunch({ uni.reLaunch({
url: '/pages/index/index', url: '/pages/index/index',
fail: (err) => { 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 { export default {
validatePhoneNumber, validatePhoneNumber,
toast, toast,

View File

@@ -2,8 +2,8 @@
"name" : "灿能物联", "name" : "灿能物联",
"appid" : "__UNI__88BC25B", "appid" : "__UNI__88BC25B",
"description" : "", "description" : "",
"versionName" : "1.1.8", "versionName" : "1.2.2",
"versionCode" : 118, "versionCode" : 122,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {
@@ -131,7 +131,6 @@
"proxy" : { "proxy" : {
"/api" : { "/api" : {
"https" : true, "https" : true,
// "target" : "https://china.indpecker.com",
"target" : "http://192.168.1.115:10215", "target" : "http://192.168.1.115:10215",
"changOrigin" : true, "changOrigin" : true,
"pathRewrite" : { "pathRewrite" : {

View File

@@ -3,6 +3,7 @@
"crypto-js": "^4.1.1", "crypto-js": "^4.1.1",
"html2canvas": "^1.4.1", "html2canvas": "^1.4.1",
"image-tools": "^1.4.0", "image-tools": "^1.4.0",
"jsrsasign": "^10.8.6",
"mqtt": "3.0.0", "mqtt": "3.0.0",
"pinyin-pro": "^3.13.2", "pinyin-pro": "^3.13.2",
"qs": "^6.11.2", "qs": "^6.11.2",

View File

@@ -13,19 +13,19 @@
<view class="item">20.0</view> <view class="item">20.0</view>
</view> </view>
</view> </view>
<view class="grid-card"> <!-- <view class="grid-card">-->
<view class="grid-card-title">干接点</view> <!-- <view class="grid-card-title">干接点</view>-->
<view class="grid-card-content-4"> <!-- <view class="grid-card-content-4">-->
<view class="item item-title">干接点1</view> <!-- <view class="item item-title">干接点1</view>-->
<view class="item item-title">干接点2</view> <!-- <view class="item item-title">干接点2</view>-->
<view class="item item-title"></view> <!-- <view class="item item-title"></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 class="item"></view> <!-- <view class="item"></view>-->
<view class="item"></view> <!-- <view class="item"></view>-->
</view> <!-- </view>-->
</view> <!-- </view>-->
</view> </view>
</template> </template>
<script> <script>

View File

@@ -29,18 +29,15 @@
<view class="module"> <view class="module">
<view class="grid-card"> <view class="grid-card">
<view class="grid-card-content-2"> <view class="grid-card-content-2">
<view class="item">模块一</view> <template v-for="(item,index) in IOData">
<view class="item">{{ item.clDid }}</view>
<view class="item"> <view class="item">
<view class="status-point-success mr10"></view> <!-- <view class="status-point-success mr10"></view>-->
<view style="width: 30rpx"> 15</view> <view style="width: 30rpx"> {{ item.value }}</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> °C</view>
</view> </view>
</template>
</view> </view>
</view> </view>
</view> </view>
@@ -185,7 +182,8 @@ export default {
value: [], value: [],
}, },
], ],
basicData: [] basicData: [],
IOData: [],
} }
}, },
methods: { methods: {
@@ -255,6 +253,7 @@ export default {
this.loading = true this.loading = true
this.domLoading = true this.domLoading = true
queryTopologyDiagram(this.devId).then((res) => { queryTopologyDiagram(this.devId).then((res) => {
res.data.filePath = this.$config.static + res.data.filePath
this.deviceInfo = res.data this.deviceInfo = res.data
uni.setNavigationBarTitle({title: this.deviceInfo.devName || '设备详情'}) uni.setNavigationBarTitle({title: this.deviceInfo.devName || '设备详情'})
this.topolodyData.filter((item) => { this.topolodyData.filter((item) => {
@@ -312,13 +311,22 @@ export default {
this.client this.client
.on('connect', () => { .on('connect', () => {
console.log('连接成功') 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) => { this.client.subscribe(`/zl/devData/${this.devId}`, (err) => {
if (!err) { if (!err) {
console.log(`订阅成功:/zl/devData/${this.devId}`) console.log(`订阅成功:/zl/devData/${this.devId}`)
// 默认推送
this.client.publish(`/zl/askDevData/${this.devId}`) this.client.publish(`/zl/askDevData/${this.devId}`)
this.client.publish(`/zl/askTemperData/${this.devId}`)
this.timer = setInterval(() => { this.timer = setInterval(() => {
console.log('askDevData') console.log('askDevData')
this.client.publish(`/zl/askDevData/${this.devId}`) this.client.publish(`/zl/askDevData/${this.devId}`)
this.client.publish(`/zl/askTemperData/${this.devId}`)
}, 1000 * 60) }, 1000 * 60)
} }
}) })
@@ -335,14 +343,20 @@ export default {
}) })
.on('message', (topic, message) => { .on('message', (topic, message) => {
console.log('接收推送信息:', message.toString(), topic) console.log('接收推送信息:', message.toString(), topic)
if (topic !== `/zl/devData/${this.devId}`) return if (topic === `/zl/devData/${this.devId}`) {
if ((!message.toString() || message.toString().length < 10) && this.loading) { if ((!message.toString() || message.toString().length < 10) && this.loading) {
this.$util.toast('该设备暂无数据') this.$util.toast('该设备暂无数据')
} }
this.loading = false this.loading = false
this.handlerData(JSON.parse(message.toString())) this.handlerData(JSON.parse(message.toString()))
} else if (topic === `/zl/TemperData/${this.devId}`) {
this.$forceUpdate() // this.basicData.forEach((item) => {
// if (item.statisticalName === '温度' && item.phase === 'avg') {
// item.statisticalData = message.toString()
// }
// })
this.IOData = JSON.parse(message.toString())
}
}) })
}, },
handlerData(data) { handlerData(data) {

View File

@@ -236,7 +236,12 @@ export default {
queryTopologyDiagramPage({ queryTopologyDiagramPage({
projectId: this.formData.projectId, projectId: this.formData.projectId,
}).then((res) => { }).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 => { this.activeGplot = this.imageList.findIndex(item => {
return item.id === this.deviceInfo.id return item.id === this.deviceInfo.id
}) })

View File

@@ -271,7 +271,12 @@ export default {
queryTopologyDiagramPage({ queryTopologyDiagramPage({
projectId: this.formData.projectId, projectId: this.formData.projectId,
}).then((res) => { }).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 this.activeGplot = 0
if (this.imageList.length) { if (this.imageList.length) {
this.confirmGplot() this.confirmGplot()

View File

@@ -87,7 +87,7 @@ export default {
return { return {
"name": item, "name": item,
"extname": item.split('.')[1], "extname": item.split('.')[1],
"url": item, "url": this.$config.static + item,
} }
}) })
this.loading = false this.loading = false

View File

@@ -249,7 +249,7 @@ export default {
return { return {
name: item.name, name: item.name,
extname: 'img', extname: 'img',
url: item.filePath, url: this.$config.static + item.filePath,
...item, ...item,
} }
}) })
@@ -297,6 +297,9 @@ export default {
}, 1000) }, 1000)
console.log(option.project) console.log(option.project)
this.project = JSON.parse(decodeURIComponent(option.project)) this.project = JSON.parse(decodeURIComponent(option.project))
this.project.topologyDiagramPaths.forEach(item=>{
item.filePath = this.$config.static + item.filePath
})
this.init() this.init()
// uni.setNavigationBarTitle({ title: this.project }) // uni.setNavigationBarTitle({ title: this.project })
}, },

View File

@@ -164,14 +164,19 @@ export default {
}) })
getTopoTemplate().then((res) => { getTopoTemplate().then((res) => {
console.log(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) { if (this.project) {
this.project.topologyDiagramPaths.forEach((item) => { this.project.topologyDiagramPaths.forEach((item) => {
if (this.tempList.some((item2) => item2.id === item.topoId)) { if (this.tempList.some((item2) => item2.id === item.topoId)) {
this.formData.tempFiles.push(item) this.formData.tempFiles.push(item)
} else { } else {
this.formData.files.push({ this.formData.files.push({
url: item.filePath, url: this.$config.static + item.filePath,
extname: item.name.split('.')[1], extname: item.name.split('.')[1],
name: item.name, name: item.name,
...item, ...item,

View File

@@ -38,16 +38,12 @@ export default {
headSculpture: result.data.minFileUrl, headSculpture: result.data.minFileUrl,
}).then((res) => { }).then((res) => {
console.log(res) console.log(res)
getImageUrl(result.data.minFileUrl).then((url) => {
console.log(url.data)
this.userInfo.headSculpture = result.data.minFileUrl this.userInfo.headSculpture = result.data.minFileUrl
this.userInfo.avatar = url.data this.userInfo.avatar = this.$config.static + result.data.minFileUrl
console.warn(this.userInfo)
uni.setStorageSync(this.$cacheKey.userInfo, this.userInfo) uni.setStorageSync(this.$cacheKey.userInfo, this.userInfo)
this.$forceUpdate() this.$forceUpdate()
}) })
}) })
})
}, },
}) })
}, },

View File

@@ -97,7 +97,7 @@ export default {
return { return {
checkbox: false, checkbox: false,
loading: false, loading: false,
loginType: 'yzm', loginType: 'pwd',
phone: '', phone: '',
pwdForm: { pwdForm: {
pwd: '', pwd: '',

6
pnpm-lock.yaml generated
View File

@@ -6,6 +6,7 @@ specifiers:
crypto-js: ^4.1.1 crypto-js: ^4.1.1
html2canvas: ^1.4.1 html2canvas: ^1.4.1
image-tools: ^1.4.0 image-tools: ^1.4.0
jsrsasign: ^10.8.6
mqtt: 3.0.0 mqtt: 3.0.0
pinyin-pro: ^3.13.2 pinyin-pro: ^3.13.2
qs: ^6.11.2 qs: ^6.11.2
@@ -15,6 +16,7 @@ dependencies:
crypto-js: 4.1.1 crypto-js: 4.1.1
html2canvas: 1.4.1 html2canvas: 1.4.1
image-tools: 1.4.0 image-tools: 1.4.0
jsrsasign: 10.8.6
mqtt: 3.0.0 mqtt: 3.0.0
pinyin-pro: 3.13.2 pinyin-pro: 3.13.2
qs: 6.11.2 qs: 6.11.2
@@ -448,6 +450,10 @@ packages:
resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==}
dev: false dev: false
/jsrsasign/10.8.6:
resolution: {integrity: sha512-bQmbVtsfbgaKBTWCKiDCPlUPbdlRIK/FzSwT3BzIgZl/cU6TqXu6pZJsCI/dJVrZ9Gir5GC4woqw9shH/v7MBw==}
dev: false
/leven/2.1.0: /leven/2.1.0:
resolution: {integrity: sha512-nvVPLpIHUxCUoRLrFqTgSxXJ614d8AgQoWl7zPe/2VadE8+1dpU3LBhowRuBAcuwruWtOdD8oYC9jDNJjXDPyA==} resolution: {integrity: sha512-nvVPLpIHUxCUoRLrFqTgSxXJ614d8AgQoWl7zPe/2VadE8+1dpU3LBhowRuBAcuwruWtOdD8oYC9jDNJjXDPyA==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}