合并版本
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -31,7 +31,7 @@
|
|||||||
<block v-for="(item, index) in deviceList" :key="index" :ref="'swipeItem_' + index">
|
<block v-for="(item, index) in deviceList" :key="index" :ref="'swipeItem_' + index">
|
||||||
<uni-swipe-action-item :right-options="Options"
|
<uni-swipe-action-item :right-options="Options"
|
||||||
@click="handleSwipeClick($event, item, index)" class="device-card"
|
@click="handleSwipeClick($event, item, index)" class="device-card"
|
||||||
:style="{ border: item.communicationMode==0 && item.onlineStatus==0 ? '1px solid rgba(224, 52, 52, 1)' : 'none' }">
|
:style="{ border: item.communicationMode==0 && item.onlineStatus==1 && item.alarmStatus==1 ? '1px solid rgba(224, 52, 52, 1)' : 'none' }">
|
||||||
<view @click.stop="handleFile(item)">
|
<view @click.stop="handleFile(item)">
|
||||||
<view class="device-header">
|
<view class="device-header">
|
||||||
<view class="deviceIMG">
|
<view class="deviceIMG">
|
||||||
@ -54,7 +54,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="device-callpolice"
|
<view class="device-callpolice"
|
||||||
v-if="item.communicationMode==0 && item.onlineStatus==0">报警中</view>
|
v-if="item.communicationMode==0 && item.onlineStatus==1 && item.alarmStatus==1">
|
||||||
|
报警中</view>
|
||||||
<view v-if="item.communicationMode==1">
|
<view v-if="item.communicationMode==1">
|
||||||
<view class="device-status online">已连接</view>
|
<view class="device-status online">已连接</view>
|
||||||
<view class="device-status unline">未连接</view>
|
<view class="device-status unline">未连接</view>
|
||||||
@ -144,6 +145,10 @@
|
|||||||
deviceReName
|
deviceReName
|
||||||
} from '@/api/common/index.js'
|
} from '@/api/common/index.js'
|
||||||
export default {
|
export default {
|
||||||
|
onPullDownRefresh() {
|
||||||
|
// 执行下拉刷新时的操作,比如重新获取数据
|
||||||
|
this.onIntall();
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
navBarHeight: 70 + uni.getSystemInfoSync().statusBarHeight,
|
navBarHeight: 70 + uni.getSystemInfoSync().statusBarHeight,
|
||||||
@ -313,16 +318,18 @@
|
|||||||
this.showTooltip = false; // 关闭弹窗
|
this.showTooltip = false; // 关闭弹窗
|
||||||
switch (item.action) {
|
switch (item.action) {
|
||||||
case 'scan':
|
case 'scan':
|
||||||
// uni.navigateTo({
|
|
||||||
// url: '/pages/common/scan/scan'
|
|
||||||
// });
|
|
||||||
// 扫一扫
|
// 扫一扫
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log('条码内容:' + res.result);
|
console.log('条码内容:', res);
|
||||||
|
// 清除之前的数据
|
||||||
|
this.previousScanResult = null;
|
||||||
|
// 处理新的扫码结果
|
||||||
|
const cleanedResult = res.result.trim();
|
||||||
|
console.log('扫码结果:', cleanedResult);
|
||||||
// 跳转并传递扫描结果
|
// 跳转并传递扫描结果
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(res.result)}`
|
url: `/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(cleanedResult)}`
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
@ -438,7 +445,7 @@
|
|||||||
},
|
},
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
res.eventChannel.emit('devicePolice', {
|
res.eventChannel.emit('devicePolice', {
|
||||||
data: deviceType
|
data: currentTab
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -455,7 +462,8 @@
|
|||||||
},
|
},
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
res.eventChannel.emit('deviceSend', {
|
res.eventChannel.emit('deviceSend', {
|
||||||
data: deviceType
|
//data: deviceType,
|
||||||
|
data: currentTab
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -475,72 +483,33 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 列表跳转
|
||||||
handleFile(item) {
|
handleFile(item) {
|
||||||
// communicationMode 0是4G 1是蓝牙,考虑多个4g设备
|
let url = item.detailPageUrl;
|
||||||
console.log("item=",item);
|
|
||||||
if (item.typeName == 'BJQ6170') {
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/6170/deviceControl/index",
|
url: url,
|
||||||
events: {
|
events: {
|
||||||
ack: function(data) {}
|
ack: function(data) {}
|
||||||
},
|
},
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
// 页面跳转成功后的回调函数
|
// 页面跳转成功后的回调函数
|
||||||
res.eventChannel.emit('deviceControl', {
|
res.eventChannel.emit('detailData', {
|
||||||
data: item,
|
data: item,
|
||||||
apiType: 'listA' // 自定义标识,详情哪里根据这个参数不同信息
|
deviceType: this.tabs[this.activeTab].id || '',
|
||||||
|
apiType: 'listA' //标识,根据这个参数,区分普通详情,分享跳转详情,查不一样的权限信息
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else if (item.typeName == 'HBY210') {
|
|
||||||
const currentTab = this.tabs[this.activeTab];
|
|
||||||
const deviceType = currentTab.id || '';
|
|
||||||
uni.navigateTo({
|
|
||||||
url: "/pages/210/deviceControl/index",
|
|
||||||
events: {
|
|
||||||
ack: function(data) {}
|
|
||||||
},
|
|
||||||
success: (res) => {
|
|
||||||
// 页面跳转成功后的回调函数
|
|
||||||
res.eventChannel.emit('deviceControl', {
|
|
||||||
data: item,
|
|
||||||
deviceType: deviceType,
|
|
||||||
apiType: 'listA' // 自定义标识
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
else if (item.typeName == '6155') {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: "/pages/6155/deviceDetail",
|
|
||||||
events: {
|
|
||||||
ack: function(data) {}
|
|
||||||
},
|
|
||||||
success: (res) => {
|
|
||||||
res.eventChannel.emit('deviceControl', {
|
|
||||||
data: item
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
else if (item.typeName == '650') {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: "/pages/650/HBY650",
|
|
||||||
events: {
|
|
||||||
ack: function(data) {}
|
|
||||||
},
|
|
||||||
success: (res) => {
|
|
||||||
res.eventChannel.emit('deviceControl', {
|
|
||||||
data: item
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onIntall() {
|
onIntall() {
|
||||||
this.page = 1;
|
this.page = 1;
|
||||||
this.finished = false;
|
this.finished = false;
|
||||||
this.getData(this.deviceType); // 重新加载第一页数据
|
const deviceType = this.activeTabInfo?.id === '' ? undefined : this.activeTabInfo?.id;
|
||||||
|
this.getData(deviceType); // 重新加载第一页数据
|
||||||
|
setTimeout(() => {
|
||||||
|
// 停止下拉刷新动画
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
}, 800);
|
||||||
},
|
},
|
||||||
updateDeviceStatus(data) {
|
updateDeviceStatus(data) {
|
||||||
this.deviceList = this.deviceList
|
this.deviceList = this.deviceList
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
const BASE_URL = 'http://192.168.110.169:8000';
|
import config from '../config/index.js';
|
||||||
|
const env = 'development'; //production development //开发of线上 改这里就行
|
||||||
|
const BASE = config[env];
|
||||||
const request = (options) => {
|
const request = (options) => {
|
||||||
console.log("options"+JSON.stringify(options))
|
console.log("options"+JSON.stringify(options),BASE.BASE_URL)
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// 处理GET请求参数
|
// 处理GET请求参数
|
||||||
let url = BASE_URL + options.url;
|
let url = BASE.BASE_URL + options.url;
|
||||||
|
console.log("url"+url)
|
||||||
if (options.method === 'GET' && options.data) {
|
if (options.method === 'GET' && options.data) {
|
||||||
// 使用qs序列化参数
|
// 使用qs序列化参数
|
||||||
const params = Object.keys(options.data)
|
const params = Object.keys(options.data)
|
||||||
@ -19,11 +22,9 @@ const request = (options) => {
|
|||||||
header: options.header || {},
|
header: options.header || {},
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log("请求成功",res);
|
|
||||||
resolve(res.data);
|
resolve(res.data);
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.log("请求失败",err);
|
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -43,7 +44,7 @@ const request = (options) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
// 导出基础URL以便其他地方使用
|
// 导出基础URL以便其他地方使用
|
||||||
export const baseURL = BASE_URL
|
export const baseURL = BASE.BASE_URL
|
||||||
export const getToken = () => uni.getStorageSync('token') // 获取token的方法
|
export const getToken = () => uni.getStorageSync('token') // 获取token的方法
|
||||||
export const clientid =() => uni.getStorageSync('clientID');
|
export const clientid =() => uni.getStorageSync('clientID');
|
||||||
export default request;
|
export default request;
|
Reference in New Issue
Block a user