接口对接修改
This commit is contained in:
@@ -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,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 查询拓扑图模板
|
||||
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,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -168,6 +168,7 @@ export function apiPwdLogin(params) {
|
||||
|
||||
//登录获取公钥
|
||||
export function gongkey(data) {
|
||||
console.log(data);
|
||||
return request({
|
||||
url: '/user-boot/user/generateSm2Key',
|
||||
method: 'get',
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
71
common/js/drawMixin.js
Normal file
71
common/js/drawMixin.js
Normal file
@@ -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);
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user