1
0
forked from dyf/APP

Compare commits

..

3 Commits

8 changed files with 63 additions and 26 deletions

View File

@ -20,7 +20,7 @@
// uni.removeStorageSync("clientID"); // uni.removeStorageSync("clientID");
// } // }
// } // }
// else if(val=="token" || val=="clientID"){ // else if(val=="token" || val=="clientID" || val=='phone'){
// console.log("忽略登陆信息"); // console.log("忽略登陆信息");
// }else{ // }else{
// uni.removeStorageSync(val); // uni.removeStorageSync(val);

View File

@ -12,11 +12,11 @@ const config = {
}, },
// 生产环境 // 生产环境
production: { production: {
BASE_URL: 'https://fuyuanshen.com/backend', BASE_URL: 'https://www.cnxhyc.com/jingquan',
API_PREFIX: '', API_PREFIX: '',
// MQTT 配置 // MQTT 配置
MQTT_HOST: 'www.cnxhyc.com', MQTT_HOST: 'www.cnxhyc.com',
MQTT_PORT: 8083, MQTT_PORT: 9084,
MQTT_USERNAME: 'admin', MQTT_USERNAME: 'admin',
MQTT_PASSWORD: '#YtvpSfCNG' MQTT_PASSWORD: '#YtvpSfCNG'
} }

View File

@ -2,7 +2,7 @@
"name" : "星汉物联", "name" : "星汉物联",
"appid" : "__UNI__A21EF43", "appid" : "__UNI__A21EF43",
"description" : "设备管控", "description" : "设备管控",
"versionName" : "1.0.1", "versionName" : "1.0.2",
"versionCode" : "100", "versionCode" : "100",
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
@ -62,7 +62,7 @@
"privacyDescription" : { "privacyDescription" : {
"NSLocationWhenInUseUsageDescription" : "App需要您的同意,访问位置,用于判定装备位置是否异常", "NSLocationWhenInUseUsageDescription" : "App需要您的同意,访问位置,用于判定装备位置是否异常",
"NSLocationAlwaysUsageDescription" : "App需要您的同意,访问位置,用于判定装备位置是否异常", "NSLocationAlwaysUsageDescription" : "App需要您的同意,访问位置,用于判定装备位置是否异常",
"NSLocationAlwaysAndWhenInUseUsageDescription" : "App需要您的同意,才能始终访问位置", "NSLocationAlwaysAndWhenInUseUsageDescription" : "App需要您的同意,访问位置,用于判定装备位置是否异常",
"NSBluetoothPeripheralUsageDescription" : "App需要您的同意访问蓝牙访问权限用于设备通信与反向控制", "NSBluetoothPeripheralUsageDescription" : "App需要您的同意访问蓝牙访问权限用于设备通信与反向控制",
"NSBluetoothAlwaysUsageDescription" : "App需要您的同意访问蓝牙访问权限用于设备通信与反向控制", "NSBluetoothAlwaysUsageDescription" : "App需要您的同意访问蓝牙访问权限用于设备通信与反向控制",
"NSPhotoLibraryUsageDescription" : "App需要您的同意访问相册,用于上传头像,设备开机画面", "NSPhotoLibraryUsageDescription" : "App需要您的同意访问相册,用于上传头像,设备开机画面",

View File

@ -984,7 +984,7 @@
uni.uploadFile({ uni.uploadFile({
// url: 'http://114.55.111.217/video/upload', // url: 'http://114.55.111.217/video/upload',
url: baseURL+"app/video/upload", url: baseURL + "app/video/upload",
filePath: videoPath, filePath: videoPath,
name: 'file', name: 'file',
header: { header: {
@ -1262,7 +1262,9 @@
let arr = gbk.encode(text) let arr = gbk.encode(text)
let gbkData = gbk.arr2hex(arr); let gbkData = gbk.arr2hex(arr);
let s = (text.length * 2).toString(16);
let len = String(s).padStart(4, '0')
len = len.match(/.{1,2}/g);
// 构建数据包 // 构建数据包
const bufferSize = 5 + gbkData.length / 2; // 头部4字节 + 数据部分 const bufferSize = 5 + gbkData.length / 2; // 头部4字节 + 数据部分
const buffer = new ArrayBuffer(bufferSize); const buffer = new ArrayBuffer(bufferSize);
@ -1272,7 +1274,8 @@
dataView.setUint8(0, 0x55); // 帧头 dataView.setUint8(0, 0x55); // 帧头
dataView.setUint8(1, 0x03); // 帧类型:文字 dataView.setUint8(1, 0x03); // 帧类型:文字
dataView.setUint8(2, currentPacket.toString(16)); // 包序号 dataView.setUint8(2, currentPacket.toString(16)); // 包序号
dataView.setUint16(3, (text.length * 2).toString(16)); // 数据长度 dataView.setUint8(3, parseInt('0x' + len[0], 16)); // 数据长度
dataView.setUint8(4, parseInt('0x' + len[1], 16)); // 数据长度
// 填充数据 // 填充数据
let index = 0; let index = 0;

View File

@ -590,9 +590,9 @@
that.formData.job = personnelInfo.position; that.formData.job = personnelInfo.position;
that.formData.usrid = personnelInfo.code that.formData.usrid = personnelInfo.code
} }
that.formData.imei=res.deviceImei; that.formData.imei = res.deviceImei;
these.device.deviceImei=res.deviceImei; these.device.deviceImei = res.deviceImei;
if(that.formData.imei){ if (that.formData.imei) {
that.initMQ(); that.initMQ();
} }
let dic = { let dic = {
@ -2218,11 +2218,18 @@
const buffer = new ArrayBuffer(bufferSize); const buffer = new ArrayBuffer(bufferSize);
const dataView = new DataView(buffer); const dataView = new DataView(buffer);
let s = (text.length * 2).toString(16);
let len = String(s).padStart(4, '0')
len = len.match(/.{1,2}/g);
// 填充头部 // 填充头部
dataView.setUint8(0, 0x55); // 帧头 dataView.setUint8(0, 0x55); // 帧头
dataView.setUint8(1, 0x03); // 帧类型:文字 dataView.setUint8(1, 0x03); // 帧类型:文字
dataView.setUint8(2, currentPacket.toString(16)); // 包序号 dataView.setUint8(2, currentPacket.toString(16)); // 包序号
dataView.setUint16(3, (text.length * 2).toString(16)); // 数据长度 dataView.setUint8(3, parseInt('0x' + len[0], 16)); // 数据长度
dataView.setUint8(4, parseInt('0x' + len[1], 16)); // 数据长度
// 填充数据 // 填充数据
let index = 0; let index = 0;

View File

@ -163,7 +163,7 @@
} }
}); });
//已连接过但没绑定过的设备 //已连接过但没绑定过的设备
let noDev=ble.data.LinkedList.filter(v=>{ let noDev = ble.data.LinkedList.filter(v => {
return !(v.device && v.device.id); return !(v.device && v.device.id);
}).map(v => { }).map(v => {
return { return {
@ -173,7 +173,7 @@
"localName": v.name, "localName": v.name,
} }
}); });
delArr=delArr.concat(noDev); delArr = delArr.concat(noDev);
console.log("可能搜不到的设备=", delArr); console.log("可能搜不到的设备=", delArr);
this.EquipMents = delArr; this.EquipMents = delArr;
@ -289,7 +289,7 @@
ble.subScribe(deviceId, false); //取消订阅消息 ble.subScribe(deviceId, false); //取消订阅消息
ble.DropDevice(deviceId); //从缓存中删除该设备 ble.DropDevice(deviceId); //从缓存中删除该设备
ble.disconnectDevice(deviceId); //断开与该设备的连接 ble.disconnectDevice(deviceId); //断开与该设备的连接
these.device.deviceMac=""; these.device.deviceMac = "";
let index = this.PairEquip.findIndex(function(v) { let index = this.PairEquip.findIndex(function(v) {
return v.deviceId == deviceId; return v.deviceId == deviceId;
}); });
@ -539,7 +539,10 @@
position: absolute; position: absolute;
border-radius: 50%; border-radius: 50%;
background-color: #bbe60033; background-color: #bbe60033;
animation: expand 3s infinite ease-out; animation: expand 4s infinite ease-out;
display: inline-block;
transform: translate(-50%, -50%);
} }
.circle:nth-child(2) { .circle:nth-child(2) {
@ -555,14 +558,16 @@
width: 0; width: 0;
height: 0; height: 0;
opacity: 0.8; opacity: 0.8;
transform: translate(-50%, -50%);
} }
100% { 100% {
width: 18.75rem; width: 18.75rem;
height: 18.75rem; height: 18.75rem;
opacity: 0; opacity: 0.2;
transform: translate(-50%, -50%);
} }
} }

View File

@ -101,9 +101,11 @@
uni.removeStorageSync("token") uni.removeStorageSync("token")
uni.removeStorageSync("clientID") uni.removeStorageSync("clientID")
uni.removeStorageSync("tokenTime") uni.removeStorageSync("tokenTime")
this.phone= uni.getStorageInfoSync('phone');
} }
} }
}, },
methods: { methods: {
// 验证码密码切换 // 验证码密码切换
@ -237,6 +239,7 @@
uni.setStorageSync('token', res.data.access_token) // 缓存token uni.setStorageSync('token', res.data.access_token) // 缓存token
uni.setStorageSync('clientID', res.data.client_id) // 缓存token uni.setStorageSync('clientID', res.data.client_id) // 缓存token
uni.setStorageSync('tokenTime', new Date().getTime() + 86400000); //过期时间 uni.setStorageSync('tokenTime', new Date().getTime() + 86400000); //过期时间
uni.setStorageSync('phone',this.phone);
uni.showToast({ uni.showToast({
title: '登录成功', title: '登录成功',
icon: 'success' icon: 'success'

View File

@ -7,7 +7,7 @@
</view> </view>
<view class="user-right"> <view class="user-right">
<view class="user-title">武汉星汉</view> <view class="user-title">武汉星汉</view>
<view class="ID">ID:123456</view> <view class="ID">ID:{{phone?phone:'123456'}}</view>
</view> </view>
</view> </view>
<view class="content"> <view class="content">
@ -24,7 +24,7 @@
</view> </view>
<view class="menu-item" @click="aboutUs"> <view class="menu-item" @click="aboutUs">
<image src="/static/images/common/wm.png" class="icon"></image> <image src="/static/images/common/wm.png" class="icon"></image>
<text class="title">关于我们</text> <text class="title">关于我们 ({{appVersion}})</text>
<uni-icons type="right" size="25" color="rgba(255, 255, 255, 0.4)" class="uniIcon"></uni-icons> <uni-icons type="right" size="25" color="rgba(255, 255, 255, 0.4)" class="uniIcon"></uni-icons>
</view> </view>
<view class="menu-item" @click="account"> <view class="menu-item" @click="account">
@ -65,8 +65,27 @@
export default { export default {
data() { data() {
return { return {
showAgreement: false // 控制弹窗显示 showAgreement: false, // 控制弹窗显示
appVersion:'',
phone:''
} }
},
onLoad() {
var these=this;
uni.getSystemInfo({
success(res) {
if(res.uniPlatform=='app'){
plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => {
const currentVersion = widgetInfo.version;
these.appVersion=currentVersion;
});
}
}
});
this.phone= uni.getStorageSync('phone')
}, },
methods: { methods: {
// 取消 // 取消