diff --git a/App.vue b/App.vue
index ce98a4e..bf52ac9 100644
--- a/App.vue
+++ b/App.vue
@@ -3,6 +3,7 @@ import { queryDictDataCache } from './common/api/dictionary.js'
import encrypt from './common/js/aes.js'
export default {
onLaunch: function () {
+ console.log(window);
// this.connect()
console.log('App Launch')
let devCode = uni.getStorageSync('devCode')
@@ -13,13 +14,12 @@ export default {
},
})
}
-
- queryDictDataCache().then((res) => {
- uni.setStorageSync(this.$cacheKey.dictData, res.data)
- })
},
onShow: function () {
console.log('App Show')
+ queryDictDataCache().then((res) => {
+ uni.setStorageSync(this.$cacheKey.dictData, res.data)
+ })
},
onHide: function () {
console.log('App Hide')
diff --git a/common/api/device.js b/common/api/device.js
index a73d9d4..b4e13fa 100644
--- a/common/api/device.js
+++ b/common/api/device.js
@@ -30,12 +30,11 @@ export function getModel(nDid) {
url: '/access-boot/device/model',
method: 'post',
data: {
- nDid
+ nDid,
},
})
}
-
// 直连设备接入
export function addDevice(params) {
return request({
@@ -54,7 +53,37 @@ export function registerDevice(nDid) {
url: '/access-boot/device/register',
method: 'post',
data: {
- nDid
+ nDid,
},
})
-}
\ No newline at end of file
+}
+
+// 查询拓扑图模板
+export const getTopoTemplate = () => {
+ return request({
+ url: '/cs-device-boot/topologyTemplate/queryImage',
+ method: 'POST',
+ })
+}
+
+// 查询拓扑图模板监测点
+export const queryByTopoId = (id) => {
+ return request({
+ url: '/cs-device-boot/lineTemplate/queryByTopoId',
+ method: 'POST',
+ data: {
+ topoId:id,
+ },
+ })
+}
+// 查询装置拓扑图
+export const queryTopologyDiagram = (devId) => {
+ return request({
+ url: '/cs-device-boot/lineTopologyDiagram/queryTopologyDiagram',
+ method: 'POST',
+ data: {
+ devId,
+ },
+ })
+}
+
diff --git a/common/api/user.js b/common/api/user.js
index d716bb2..c822122 100644
--- a/common/api/user.js
+++ b/common/api/user.js
@@ -168,6 +168,7 @@ export function apiPwdLogin(params) {
//登录获取公钥
export function gongkey(data) {
+ console.log(data);
return request({
url: '/user-boot/user/generateSm2Key',
method: 'get',
diff --git a/common/css/base.scss b/common/css/base.scss
index a55d842..8616a78 100644
--- a/common/css/base.scss
+++ b/common/css/base.scss
@@ -97,6 +97,7 @@ page {
.grid-card-content-4,
.grid-card-content-2,
+ .grid-card-content-1,
.grid-card-content-3,
.grid-card-content-5,
.grid-card-content-6 {
@@ -114,15 +115,19 @@ page {
text-align: center;
border-bottom: 2rpx solid #ccc;
border-right: 2rpx solid #ccc;
- min-height: 100rpx;
+ padding: 4rpx;
background: $uni-theme-white;
}
.item-title {
background: unset;
+ padding: 8rpx 4rpx;
}
}
+ .grid-card-content-1 {
+ grid-template-columns: 1fr;
+ }
.grid-card-content-2 {
grid-template-columns: 1fr 2fr;
}
@@ -253,4 +258,25 @@ page {
border-radius: 50%;
background: red;
overflow: hidden;
+}
+
+
+.popup-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 0 20rpx;
+ height: 80rpx;
+ background: #fff;
+ border-radius: 20rpx 20rpx 0 0;
+ overflow: hidden;
+ border-bottom: 1px solid #eee;
+ .popup-header-title {
+ font-size: 32rpx;
+ color: #333;
+ }
+ .popup-header-close {
+ font-size: 32rpx;
+ color: #666;
+ }
}
\ No newline at end of file
diff --git a/common/js/config.js b/common/js/config.js
index 67e9d47..6ddf744 100644
--- a/common/js/config.js
+++ b/common/js/config.js
@@ -1,13 +1,13 @@
const debug = true // true 是连地服务端本地,false 是连接线上
const development = {
- domain: 'http://192.168.1.114:10210',
+ domain: 'http://192.168.1.139:10215',
devCode: "2aaecd0b124df819eda75e639a1f91fd",
key: "f81804778c89c779"
}
const production = {
- domain: 'http://192.168.1.60:8094',
+ domain: 'http://192.168.1.13:10215',
}
const config = debug ? development : production
diff --git a/common/js/drawMixin.js b/common/js/drawMixin.js
new file mode 100644
index 0000000..b255460
--- /dev/null
+++ b/common/js/drawMixin.js
@@ -0,0 +1,71 @@
+// 屏幕适配 mixin 函数
+
+// * 默认缩放值
+const scale = {
+ width: '1',
+ height: '1',
+};
+
+// * 设计稿尺寸(px)
+const baseWidth = 375;
+const baseHeight = 667;
+
+// * 需保持的比例(默认1.77778)
+const baseProportion = parseFloat((baseWidth / baseHeight).toFixed(5));
+
+export default {
+ data() {
+ return {
+ // * 定时函数
+ drawTiming: null,
+ };
+ },
+ mounted() {
+ this.calcRate();
+ window.addEventListener('resize', this.resize);
+ },
+ beforeDestroy() {
+ window.removeEventListener('resize', this.resize);
+ },
+ methods: {
+ calcRate() {
+ const appRef = this.$refs['appRef'];
+ const fatherRef = this.$refs['fatherRef'];
+ if (!appRef) return;
+ // 当前宽高比
+ const currentRate = parseFloat(
+ (fatherRef.offsetWidth / fatherRef.offsetHeight).toFixed(5)
+ );
+ if (appRef) {
+ if (currentRate > baseProportion) {
+ // 表示更宽
+ scale.width = (
+ (fatherRef.offsetHeight * baseProportion) /
+ baseWidth
+ ).toFixed(5);
+ scale.height = (
+ fatherRef.offsetHeight / baseHeight
+ ).toFixed(5);
+ appRef.style.transform = `scale(${scale.width}, ${scale.height}) translate(-50%, -50%)`;
+ } else {
+ // 表示更高
+ scale.height = (
+ fatherRef.offsetWidth /
+ baseProportion /
+ baseHeight
+ ).toFixed(5);
+ scale.width = (fatherRef.offsetWidth / baseWidth).toFixed(
+ 5
+ );
+ appRef.style.transform = `scale(${scale.width}, ${scale.height}) translate(-50%, -50%)`;
+ }
+ }
+ },
+ resize() {
+ clearTimeout(this.drawTiming);
+ this.drawTiming = setTimeout(() => {
+ this.calcRate();
+ }, 200);
+ },
+ },
+};
diff --git a/common/js/mqtt.js b/common/js/mqtt.js
index 6b89b62..8b4b5e8 100644
--- a/common/js/mqtt.js
+++ b/common/js/mqtt.js
@@ -1,6 +1,6 @@
-export const MQTT_IP = '60.204.148.71:9001'//mqtt地址端口, 使用emqx时一定要加mqtt
-const MQTT_USERNAME = 'test'//mqtt用户名
-const MQTT_PASSWORD = 'test'//密码
+export const MQTT_IP = '192.168.1.18:8083/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt
+const MQTT_USERNAME = 't_user'//mqtt用户名
+const MQTT_PASSWORD = 'njcnpqs'//密码
export const MQTT_OPTIONS = {
connectTimeout: 5000,
diff --git a/common/js/sm2.js b/common/js/sm2.js
index bbb516a..fb11399 100644
--- a/common/js/sm2.js
+++ b/common/js/sm2.js
@@ -1,4 +1,10 @@
import CryptoJS from 'crypto-js'
+if(typeof navigator === 'undefined') {
+ var navigator = {
+ appName: 'Netscape',
+ };
+ var window = {};
+}
function SM2Cipher(a) {
this.ct = 1;
this.sm3c3 = this.sm3keybase = this.p2 = null;
diff --git a/common/js/util.js b/common/js/util.js
index 7b5fc2f..9e24fbc 100644
--- a/common/js/util.js
+++ b/common/js/util.js
@@ -1,5 +1,7 @@
import request from './request'
import cache from './cacheKey.js'
+import { queryDictDataCache } from '../api/dictionary.js'
+import cacheKey from './cacheKey.js'
const toast = (title, duration = 1500, call, mask = false, icon = 'none') => {
if (Boolean(title) === false) {
return
@@ -198,14 +200,23 @@ const prePage = () => {
}
const loginSuccess = (data) => {
+ 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,获取载体
- var userInfo = JSON.parse(decodeURIComponent(escape(window.atob(strings[1].replace(/-/g, '+').replace(/_/g, '/')))))
+ console.log(escape,atob);
+ var userInfo = JSON.parse(decodeURIComponent(escape(atob(strings[1].replace(/-/g, '+').replace(/_/g, '/')))))
userInfo.authorities = userInfo.authorities[0]
uni.setStorageSync('userInfo', userInfo)
- uni.reLaunch({
- url: '/pages/index/index',
+ console.log('reLaunch');
+ queryDictDataCache().then((res) => {
+ uni.setStorageSync(cacheKey.dictData, res.data)
+ uni.reLaunch({
+ url: '/pages/index/index',
+ fail: (err) => {
+ console.log(err);
+ }
+ })
})
}
diff --git a/components/Cn-htmlToImg/Cn-htmlToImg.vue b/components/Cn-htmlToImg/Cn-htmlToImg.vue
index fb29024..2458c58 100644
--- a/components/Cn-htmlToImg/Cn-htmlToImg.vue
+++ b/components/Cn-htmlToImg/Cn-htmlToImg.vue
@@ -29,13 +29,15 @@ export default {
methods: {
// 生成图片需要调用的方法
generateImage(domId) {
- console.log(123);
// 获取设备dpi
setTimeout(() => {
let dom = document.getElementById(domId);
+ console.log(dom.offsetWidth, dom.offsetHeight);
html2canvas(dom, {
scale: 8,
useCORS: true,
+ width: dom.offsetWidth,
+ height: dom.offsetHeight,
}).then((canvas) => {
// this.$refs.header.appendChild(canvas);
const posterImg = canvas.toDataURL()
@@ -45,7 +47,7 @@ export default {
}).catch((err) => {
console.log(err)
})
- }, 300);
+ }, 200);
}
}
}
diff --git a/main.js b/main.js
index d660026..8d4c685 100644
--- a/main.js
+++ b/main.js
@@ -6,6 +6,7 @@ import config from './common/js/config'
import cacheKey from './common/js/cacheKey'
import Vue from 'vue'
import share from "@/common/js/share.js";
+
Vue.config.productionTip = false
Vue.prototype.$request = request
Vue.prototype.$util = util
diff --git a/manifest.json b/manifest.json
index 38f4496..a7fe63a 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,8 +2,8 @@
"name" : "灿能物联",
"appid" : "__UNI__88BC25B",
"description" : "",
- "versionName" : "1.0.2",
- "versionCode" : 101,
+ "versionName" : "1.0.3",
+ "versionCode" : 102,
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
@@ -132,7 +132,7 @@
"/api" : {
"https" : true,
// "target" : "https://china.indpecker.com",
- "target" : "http://192.168.1.139:10215",
+ "target" : "http://192.168.1.115:10215",
"changOrigin" : true,
"pathRewrite" : {
"/api" : ""
diff --git a/package.json b/package.json
index 2ec6bce..194ebd9 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,8 @@
"html2canvas": "^1.4.1",
"mqtt": "3.0.0",
"pinyin-pro": "^3.13.2",
- "qs": "^6.11.2"
+ "qs": "^6.11.2",
+ "vconsole": "^3.15.1"
},
"devDependencies": {
"@types/html5plus": "^1.0.2",
diff --git a/pages.json b/pages.json
index fce8a80..231c05f 100644
--- a/pages.json
+++ b/pages.json
@@ -306,7 +306,8 @@
{
"path": "pages/engineering/list",
"style": {
- "navigationBarTitleText": "工程列表"
+ "navigationBarTitleText": "工程列表",
+ "navigationStyle": "custom"
}
},
{
@@ -437,11 +438,7 @@
//模式配置,仅开发期间生效
"current": 0, //当前激活的模式(list 的索引项)
"list": [
- {
- "name": "login", //模式名称
- "path": "pages/project/new", //启动页面,必选
- "query": "" //启动参数,在页面的onLoad函数里面得到。
- }
+
]
}
}
\ No newline at end of file
diff --git a/pages/device/APF/comp/basic.vue b/pages/device/APF/comp/basic.vue
index 75582cb..1163783 100644
--- a/pages/device/APF/comp/basic.vue
+++ b/pages/device/APF/comp/basic.vue
@@ -1,5 +1,5 @@
-
+
电网电流
-
+
名称
有效值(A)
- cosp
THDI(%)
- L1
- 226.8
- 50.0
- 4.6
- L2
- 226.8
- 50.0
- 4.6
- L3
- 226.8
- 50.0
- 4.6
- N
- 3.9
-
-
+
+ {{ item.phase }}
+ {{ item['A(A)'] }}
+ {{ item['ThdPhI(%)'] }}
+
@@ -58,74 +46,112 @@
电压(V)
频率(Hz)
THDU(%)
- L1
- 226.8
- 50.0
- 4.6
- L2
- 226.8
- 50.0
- 4.6
- L3
- 226.8
- 50.0
- 4.6
+
+ {{ item.phase }}
+ {{ item['PhV(V)'] }}
+ {{ item['Hz(Hz)'] }}
+ {{ item['ThdPhV(%)'] }}
+
负载电流
-
+
名称
有效值(A)
- cosp
THDI(%)
- L1
- 226.8
- 50.0
- 4.6
- L2
- 226.8
- 50.0
- 4.6
- L3
- 226.8
- 50.0
- 4.6
+
+ {{ item.phase }}
+ {{ item['A(A)'] }}
+ {{ item['ThdPhI(%)'] }}
+
补偿电流
-
+
名称
有效值(A)
负载率(%)
-
- L1
- 226.8
- 50.0
-
- L2
- 226.8
- 50.0
-
- L3
- 226.8
- 50.0
-
+
+ {{ item.phase }}
+ {{ item['A(A)'] }}
+
+
-
\ No newline at end of file
+
diff --git a/pages/device/APF/comp/power.vue b/pages/device/APF/comp/power.vue
index c28fe73..b916f6a 100644
--- a/pages/device/APF/comp/power.vue
+++ b/pages/device/APF/comp/power.vue
@@ -1,5 +1,5 @@
-
+
电网侧
@@ -8,21 +8,13 @@
无功功率(kVar)
视在功率(kVA)
功率因数
- L1
- 226.8
- 50.0
- 4.6
- 4.6
- L2
- 226.8
- 50.0
- 50.0
- 4.6
- L3
- 226.8
- 50.0
- 4.6
- 4.6
+
+ {{ item.phase }}
+ {{ item['W(W)'] }}
+ {{ item['VAr(var)'] }}
+ {{ item['VA(VA)'] }}
+ {{ item['ThdPhI(%)'] }}
+
@@ -33,35 +25,87 @@
无功功率(kVar)
视在功率(kVA)
功率因数
- L1
- 226.8
- 50.0
- 4.6
- 4.6
- L2
- 226.8
- 50.0
- 50.0
- 4.6
- L3
- 226.8
- 50.0
- 4.6
- 4.6
+
+ {{ item.phase }}
+ {{ item['W(W)'] }}
+ {{ item['VAr(var)'] }}
+ {{ item['VA(VA)'] }}
+ {{ item['ThdPhI(%)'] }}
+
-
\ No newline at end of file
+
diff --git a/pages/device/APF/detail.vue b/pages/device/APF/detail.vue
index dfb4203..c256657 100644
--- a/pages/device/APF/detail.vue
+++ b/pages/device/APF/detail.vue
@@ -1,44 +1,22 @@
-
-
-
+
+
+
-
\ No newline at end of file
+
diff --git a/pages/device/list.vue b/pages/device/list.vue
index f844e27..8794528 100644
--- a/pages/device/list.vue
+++ b/pages/device/list.vue
@@ -32,7 +32,7 @@ export default {
},
jump () {
uni.navigateTo({
- url: '/pages/device/APF/detail'
+ url: '/pages/device/APF/detail?id=' + item.id
})
},
trigger (e) {
diff --git a/pages/device/new.vue b/pages/device/new.vue
index ad7cd4c..02664ad 100644
--- a/pages/device/new.vue
+++ b/pages/device/new.vue
@@ -56,12 +56,9 @@
-
+
+
+
选择拓扑图
-
+
提交
@@ -113,7 +102,8 @@
:key="key"
/>
- 确定
+ 取消
+ 确定
@@ -161,7 +151,7 @@
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 7084bd3..448ac96 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -8,6 +8,7 @@ specifiers:
mqtt: 3.0.0
pinyin-pro: ^3.13.2
qs: ^6.11.2
+ vconsole: ^3.15.1
dependencies:
crypto-js: 4.1.1
@@ -15,6 +16,7 @@ dependencies:
mqtt: 3.0.0
pinyin-pro: 3.13.2
qs: 6.11.2
+ vconsole: 3.15.1
devDependencies:
'@types/html5plus': 1.0.2
@@ -40,6 +42,13 @@ packages:
'@babel/types': 7.22.5
dev: true
+ /@babel/runtime/7.22.6:
+ resolution: {integrity: sha512-wDb5pWm4WDdF6LFUde3Jl8WzPA+3ZbxYqkC6xAXuD3irdEHN1k0NfTRrJD8ZD378SJ61miMLCqIOXYhd8x+AJQ==}
+ engines: {node: '>=6.9.0'}
+ dependencies:
+ regenerator-runtime: 0.13.11
+ dev: false
+
/@babel/types/7.22.5:
resolution: {integrity: sha512-zo3MIHGOkPOfoRXitsgHLjEXmlDaD/5KU1Uzuc9GNiZPhSqVxVRtxuPaSBZDsYZ9qV88AjtMtWW7ww98loJ9KA==}
engines: {node: '>=6.9.0'}
@@ -145,6 +154,16 @@ packages:
typedarray: 0.0.6
dev: false
+ /copy-text-to-clipboard/3.2.0:
+ resolution: {integrity: sha512-RnJFp1XR/LOBDckxTib5Qjr/PMfkatD0MUCQgdpqS8MdKiNUzBjAQBEN6oUy+jW7LI93BBG3DtMB2KOOKpGs2Q==}
+ engines: {node: '>=12'}
+ dev: false
+
+ /core-js/3.31.1:
+ resolution: {integrity: sha512-2sKLtfq1eFST7l7v62zaqXacPc7uG8ZAya8ogijLhTtaKNcpzpB4TMoTw2Si+8GYKRwFPMMtUT0263QFWFfqyQ==}
+ requiresBuild: true
+ dev: false
+
/core-util-is/1.0.3:
resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}
dev: false
@@ -479,6 +498,10 @@ packages:
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
dev: false
+ /mutation-observer/1.0.3:
+ resolution: {integrity: sha512-M/O/4rF2h776hV7qGMZUH3utZLO/jK7p8rnNgGkjKUw8zCGjRQPxB8z6+5l8+VjRUQ3dNYu4vjqXYLr+U8ZVNA==}
+ dev: false
+
/nanoid/3.3.6:
resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
@@ -585,6 +608,10 @@ packages:
util-deprecate: 1.0.2
dev: false
+ /regenerator-runtime/0.13.11:
+ resolution: {integrity: sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==}
+ dev: false
+
/reinterval/1.1.0:
resolution: {integrity: sha512-QIRet3SYrGp0HUHO88jVskiG6seqUGC5iAG7AwI/BV4ypGcuqk9Du6YQBUOUqm9c8pw1eyLoIaONifRua1lsEQ==}
dev: false
@@ -712,6 +739,15 @@ packages:
base64-arraybuffer: 1.0.2
dev: false
+ /vconsole/3.15.1:
+ resolution: {integrity: sha512-KH8XLdrq9T5YHJO/ixrjivHfmF2PC2CdVoK6RWZB4yftMykYIaXY1mxZYAic70vADM54kpMQF+dYmvl5NRNy1g==}
+ dependencies:
+ '@babel/runtime': 7.22.6
+ copy-text-to-clipboard: 3.2.0
+ core-js: 3.31.1
+ mutation-observer: 1.0.3
+ dev: false
+
/vue/2.7.14:
resolution: {integrity: sha512-b2qkFyOM0kwqWFuQmgd4o+uHGU7T+2z3T+WQp8UBjADfEv2n4FEMffzBmCKNP0IGzOEEfYjvtcC62xaSKeQDrQ==}
dependencies:
diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue b/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue
index 51ace0b..0c1abe8 100644
--- a/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue
+++ b/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue
@@ -1,7 +1,7 @@
-
-
-
+
+
+
@@ -37,10 +37,10 @@
default () {
return []
}
- },
- disabled:{
- type: Boolean,
- default: false
+ },
+ disabled:{
+ type: Boolean,
+ default: false
},
disablePreview: {
type: Boolean,
@@ -63,10 +63,10 @@
delIcon: {
type: Boolean,
default: true
- },
- readonly:{
- type:Boolean,
- default:false
+ },
+ readonly:{
+ type:Boolean,
+ default:false
}
},
computed: {
@@ -104,20 +104,20 @@
}
} else {
obj.width = this.value2px(width)
- }
-
- let classles = ''
- for(let i in obj){
- classles+= `${i}:${obj[i]};`
- }
+ }
+
+ let classles = ''
+ for(let i in obj){
+ classles+= `${i}:${obj[i]};`
+ }
return classles
},
borderStyle() {
let {
border
} = this.styles
- let obj = {}
- const widthDefaultValue = 1
+ let obj = {}
+ const widthDefaultValue = 1
const radiusDefaultValue = 3
if (typeof border === 'boolean') {
obj.border = border ? '1px #eee solid' : 'none'
@@ -132,10 +132,10 @@
'border-color': (border && border.color) || '#eee',
'border-radius': radius
}
- }
- let classles = ''
- for(let i in obj){
- classles+= `${i}:${obj[i]};`
+ }
+ let classles = ''
+ for(let i in obj){
+ classles+= `${i}:${obj[i]};`
}
return classles
}
@@ -151,11 +151,11 @@
this.$emit('delFile', index)
},
prviewImage(img, index) {
- let urls = []
- if(Number(this.limit) === 1&&this.disablePreview&&!this.disabled){
- this.$emit("choose")
+ let urls = []
+ if(Number(this.limit) === 1&&this.disablePreview&&!this.disabled){
+ this.$emit("choose")
}
- if(this.disablePreview) return
+ if(this.disablePreview) return
this.filesList.forEach(i => {
urls.push(i.url)
})
@@ -180,10 +180,10 @@
+