first commit

This commit is contained in:
2026-02-23 16:31:39 +08:00
commit 8dcee4fadd
269 changed files with 45231 additions and 0 deletions

291
pages/addEquip/addEquip.vue Normal file
View File

@@ -0,0 +1,291 @@
<template>
<view>
<u-form :model="cameara" ref="uForm">
<u-form-item label-width="150" label="设备编号">
<u-input v-model="cameara.number" disabled='true' />
</u-form-item>
<u-form-item label-width="150" label="设备类型">
<u-input v-model="cameara.type" disabled='true' />
</u-form-item>
<u-field v-model="cameara.remarks" label="备注" placeholder="备注" type="textarea">
</u-field>
<view>
<view class="uploadImages">
<view v-for="(item,index) in imgList" class="imgBox">
<image mode="aspectFit" :src="item.url"></image>
<uni-icons type="trash" size="22" @click="removeImage(index)"></uni-icons>
</view>
<uni-icons type="plusempty" size="48" @click="selectBase64Img"></uni-icons>
</view>
</view>
</u-form>
<u-button v-if="cameara.id!=''" class="btn1" type="primary" @click="updateAction(1)">更新</u-button>
<u-button v-if="cameara.id==''" class="btn1" type="primary" @click="updateAction(2)">新增</u-button>
</view>
</template>
<script>
import config from "../../libs/config/config.js"
const _api = config.api + "/upload"
export default {
data() {
return {
cameara: {
id: "",
camera_name: "",
camera_code: "",
longitude: "",
latitude: "",
images: "",
remarks: "",
type: "",
},
radioList: [{
name: '摄像头',
disabled: false
},
{
name: '消防栓',
disabled: false
},
{
name: '消防炮',
disabled: false
},
{
name: '泡沫栓',
disabled: false
},
{
name: '栓炮一体',
disabled: false
},
{
name: '手动报警器',
disabled: false
},
{
name: '消防器材箱',
disabled: false
}
],
radio: '',
switchVal: false,
action: _api,
fileList: [],
uploadList: [],
camearaDetails: null,
imgList: [],
};
},
onLoad(options) {
if (options.cameara) {
this.cameara = JSON.parse(options.cameara)
uni.setNavigationBarTitle({
title: '编辑'
})
this.getById(this.cameara.id)
}
},
onShow() {
this.cameara = this.$store.state.equip.currentData
if(this.$store.state.equip.currentDataDetails){
if(this.$store.state.equip.currentDataDetails.remarks){
this.cameara.remarks=this.$store.state.equip.currentDataDetails.remarks
}
}
},
methods: {
getImgByDocId(docIdList) {
let _this =this;
docIdList.map((item) => {
_this.$u.post(config.api + '/xfhrshInternet/service/selImageBase64', JSON.stringify({
docId: item.docId,
})).then(res => {
console.log(res)
if(res.code==0){
_this.imgList.push({
url: res.data,
docId: item.docId
})
}
});
})
},
removeImage(index) {
this.imgList=this.imgList.splice(index, 1)
console.log(index)
},
selectBase64Img() {
let _this = this
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], //从相册选择
success: function(res) {
const tempFilePath = res.tempFilePaths[0]
_this.imgUrlToBase64(tempFilePath)
}
});
},
uploadImg() {
uni.chooseImage({
count: 1,
success: (res) => {
console.log(res, '返回临时路径');
const tempFilePath = res.tempFilePaths[0]
this.imgUrlToBase64(tempFilePath)
}
})
},
imgUrlToBase64(url) {
let _this = this;
// #ifdef MP-WEIXIN
uni.getFileSystemManager().readFile({
filePath: url, //选择图片返回的相对路径
encoding: 'base64', //编码格式
success: res => { //成功的回调
console.log(res, '返回结果');
let base64 = 'data:image/png;base64,' + res.data //不加上这串字符,在页面无法显示的哦
console.log(base64)
this.$u.post(config.api + '/xfhrshInternet/service/uploadImage', JSON.stringify({
fileName: uni.$u.guid(20) + '.png',
data: base64
})).then(res => {
console.log()
_this.imgList.push({
url: base64,
docId: res.docId
})
//this.camera_list = res;
});
},
fail: (e) => {
console.log("图片转换失败");
}
})
// #endif
// #ifdef H5
uni.request({
url: url,
method: 'GET',
responseType: 'arraybuffer',
success: ress => {
let base64 = uni.arrayBufferToBase64(ress.data); //把arraybuffer转成base64
base64 = 'data:image/png;base64,' + base64;
console.log(base64, '转换结果')
this.imgURL = base64
},
fail: (e) => {
console.log("图片转换失败");
}
})
// #endif
// #ifdef APP-PLUS
plus.io.resolveLocalFileSystemURL(url, (entry) => {
// 可通过entry对象操作test.html文件
entry.file((file) => {
let fileReader = new plus.io.FileReader();
fileReader.onloadend = (evt) => {
const base64 = evt.target.result.substr(22);
this.imgURL = base64
}
fileReader.readAsDataURL(file);
});
}, (e) => {
alert("Resolve file URL failed: " + e.message);
});
// #endif
},
getById(id) {
this.$u.post(config.api + '/xfhrshInternet/service/selPicture', {
subjectId: id
}).then(res => {
console.log(res)
if (res.status = "success") {
if(res.data.length>0){
this.$store.dispatch('setCurrentEquipDtails', {
data: res.data[0]
})
this.getImgByDocId(res.data[0].docIds)
}
}
//this.camera_list = res;
});
},
// 图片自动上传成功的钩子
onSuccess(data) {
console.log("========================onSuccess")
let files = [];
// 通过filter过滤数组筛选出上传进度为100的文件
files = this.$refs.uUpload.lists.filter(val => {
return val.progress == 100;
})
// 如果不需要进行太多的处理,直接如下即可
files = this.$refs.uUpload.lists;
console.log(files);
this.fileList.push({
url: data.url
});
},
clickAction() {
uni.$emit('updateCamera', {
cameara: this.cameara
})
uni.navigateBack()
},
onRemove(index) {
console.log('图片已被移除', index);
this.fileList.splice(index, 1); // arr.splice(i,n) 删除从i(索引值)开始之后的那个元素。返回值是删除的元素
},
updateAction(index) {
console.log(this.$store.state.equip.currentData)
let _data = {
subjectId: this.$store.state.equip.currentData.id,
remarks: this.cameara.remarks,
docId: []
}
this.imgList.map((item) => {
_data.docId.push(item.docId)
})
_data.docId=JSON.stringify(_data.docId)
this.$store.dispatch('updateEquipDetails', {data: _data})
}
}
};
</script>
<style lang="scss">
.uploadImages {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
align-items: center;
}
.imgBox {
width: 200rpx;
height: 200rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
image {
width: 180rpx;
height: 180rpx;
}
}
.u-btn {
margin-top: 40rpx;
}
</style>

639
pages/index/index.vue Normal file
View File

@@ -0,0 +1,639 @@
<template>
<view>
<u-navbar :is-back="isBack" title="经纬度拾取">
</u-navbar>
<map style="width: 100vw; height: 40vh;" id="maps" class="map" :show-location="true"
:enable-satellite="satellite" :theme="theme" :scale="scale" :markers="markers" @regionchange="regionchange"
@tap="tapAction"></map>
<view class="selectPointPosition">
<view>已选位置:</view>
<view>经度{{longitude}}纬度{{latitude}}</view>
</view>
<view class="cameraInfo">
<view class="btnListBox">
<view>操作:</view>
<u-icon name="map-fill" size="56" @click="reGetLocation()" style="margin-right: 20rpx;"></u-icon>
</view>
<u-section title="已选择设备" :sub-title="cameara.number==null?'请选择':cameara.number"
@click="goToSelectCamera()"></u-section>
<view class="cameraItem" v-if="cameara.number!=null">
<view class="editItem">
<view class="editItemBtn" @click="goToEdit()">
<u-icon name="edit-pen" size="36" style="margin-right: 20rpx;"></u-icon>
<text>编辑其它信息</text>
</view>
</view>
<view class="cameraItemLi">
<view>设备编码</view>
<view>{{cameara.number}}</view>
</view>
<view class="cameraItemLi">
<view>设备类型</view>
<view>{{cameara.type}}</view>
</view>
<view class="cameraItemLi">
<view>纬度</view>
<view v-if="cameara.latitude">{{cameara.latitude}}</view>
<view class="unKnow" v-if="!cameara.latitude"></view>
</view>
<view class="cameraItemLi">
<view>经度</view>
<view v-if="cameara.longitude">{{cameara.longitude}}</view>
<view class="unKnow" v-if="!cameara.longitude"></view>
</view>
<view class="btnList">
<u-button size="mini" class="btn" type="info" @click="moveTo(10000)">聚焦历史点位</u-button>
<u-button size="mini" class="btn" type="info" @click="moveTo(100)">聚焦手选位置</u-button>
<u-button size="mini" class="btn" type="info" @click="moveTo(1)">聚焦当前位置</u-button>
</view>
<view class="btnList1">
<u-button size="mini" type="primary" class="btn" @click="updateAction(0)">设置黑色点为当前设备位置</u-button>
<u-button size="mini" type="primary" class="btn" @click="updateAction(1)">设置红色点为当前设备位置</u-button>
</view>
</view>
</view>
<view class="tipsList">
<view></view>
<view>黑色图标为用户当前位置</view>
<view>红色图标为用户手动选中位置点击地图可以收到选择</view>
<view>黄色图标为设备旧位置</view>
</view>
<view v-for="item in logs">
{{item}}
</view>
<u-popup v-model="leftModelShow">
<u-search placeholder="日照香炉生紫烟" v-model="keyword"></u-search>
<view>出淤泥而不染濯清涟而不妖</view>
</u-popup>
<u-action-sheet :list="list" v-model="showActionList"></u-action-sheet>
</view>
</template>
<script>
import dayjs from "dayjs"
import config from "../../libs/config/config.js"
export default {
data() {
return {
theme: 'satellite',
satellite: true,
isBack: false,
leftModelShow: false,
latitude: "", // 默认定在首都
longitude: "",
scale: 16, // 默认16
markers: [],
markerHeight: 30,
timer: null,
logs: [],
keyword: '',
accuracy: '', //位置的精确度
altitude: '', //高度,单位 m
horizontalAccuracy: '', //水平精度,单位 m
cameara: {
id: "",
camera_name: "",
camera_code: "",
longitude: "",
latitude: "",
images: "",
remarks: "",
type: "",
},
showActionList: false,
list: [{
text: '点赞',
color: 'blue',
fontSize: 28,
subText: '感谢您的点赞'
}, {
text: '分享'
}, {
text: '评论'
}],
};
},
onShow() {
const returnedTarget = Object.assign(this.$store.state.equip.currentData, this.$store.state.equip.currentDataDetails);
this.cameara=returnedTarget
this.$store.dispatch('queryCurrentDataDetails', {})
},
onReady() {
this._mapContext = uni.createMapContext("maps", this);
this.timer = setInterval(() => {
//this.getLocationInfo()
}, 2000)
this.getLocationInfo()
//this.bindMapClickAction();
// this.addMarkers();
},
methods: {
tapAction(e) {
console.log(e)
let point = e.detail;
point.iconPath = '../../static/address_2.png';
point.id = 100
this.latitude = point.latitude;
this.longitude = point.longitude;
this._mapContext.moveToLocation({
latitude: point.latitude,
longitude: point.longitude,
})
let list = JSON.parse(JSON.stringify(this.markers));
let isFrist = 0;
list.forEach(function(item) {
if (item.id == 100) {
isFrist = 1;
item.latitude = point.latitude;
item.longitude = point.longitude;
} else {
}
});
if (isFrist == 0) {
this.markers = this.markers.concat(point);
} else {
this.markers = list;
}
},
bindMapClickAction() {
var that = this;
var maps = this._mapContext.$getAppMap();
maps.onclick = function(point) {
console.log(point);
point.iconPath = '../../static/address_2.png';
point.id = 100
that.latitude = point.latitude;
that.longitude = point.longitude;
that._mapContext.moveToLocation({
latitude: point.latitude,
longitude: point.longitude,
})
let list = JSON.parse(JSON.stringify(that.markers));
let isFrist = 0;
list.forEach(function(item) {
if (item.id == 100) {
isFrist = 1;
item.latitude = point.latitude;
item.longitude = point.longitude;
} else {
}
});
if (isFrist == 0) {
that.markers = that.markers.concat(point);
} else {
that.markers = list;
}
//that.markers = list;
console.log(_item)
// if (_item.length > 0) {
// console.log("=============平移:", point.latitude)
// console.log("=============平移:", point.longitude)
// that._mapContext.translateMarker({
// markerId: 100,
// destination: {
// latitude: point.latitude,
// longitude: point.longitude,
// },
// fail(e) {
// console.log(e)
// }
// })
// } else {
// console.log("=============新增")
// that.markers = that.markers.concat(point);
// }
};
},
goToEdit() {
let url = "../addEquip/addEquip?cameara=" + JSON.stringify(this.cameara)
uni.navigateTo({
url: url
});
},
add() {
uni.navigateTo({
url: '../addEquip/addEquip'
});
},
updateAction(index) {
let cameara = JSON.parse(JSON.stringify(this.cameara))
let selfClick = this.markers.filter(item => {
if (item.id == 100) {
return item
}
})
selfClick = selfClick[0];
console.log("=========================selfClick:", JSON.stringify(selfClick))
let selfAuto = this.markers.filter(item => {
if (item.id == 1) {
return item
}
})
selfAuto = selfAuto[0];
console.log("=========================selfAuto:", JSON.stringify(selfAuto))
this.cameara = cameara;
// 用户当前位置
if (index == 0) {
cameara.latitude = selfAuto.latitude;
cameara.longitude = selfAuto.longitude;
} else {
// 用户手选位置
cameara.latitude = selfClick.latitude;
cameara.longitude = selfClick.longitude;
}
this.$store.dispatch('updateEquipDetails', {data: cameara})
},
// 拖拽地图
regionchange(event) {
console.log("========中心点改变1")
if (event.type == 'regionchange') {
//this.getCenterLanLat()
}
},
// 获取当前地图中心的经纬度
getCenterLanLat() {
console.log("========中心点改变2")
let self = this
self._mapContext.getCenterLocation({
altitude:true,
type: 'gcj02',
success: (res) => {
let address = {
latitude: res.latitude,
longitude: res.longitude
}
let list = JSON.parse(JSON.stringify(self.markers));
let isFrist = 0;
list.forEach(function(item) {
if (item.id == 1000) {
isFrist = 1;
item.latitude = res.latitude;
item.longitude = res.longitude;
}
});
if (isFrist == 0) {
console.log("========中心点改变20")
self.markers = self.markers.concat({
id: 1000,
width: 50,
height: 50,
latitude: address.latitude,
longitude: address.longitude,
iconPath: "../../static/address_3.png",
});
} else {
console.log("========中心点改变21")
self.markers = list;
}
},
fail: (err) => {
// console.log('获取当前地图中心的经纬度2', err);
}
})
},
tapMap(e) {
var that = this;
var id = e.currentTarget.id;
var maps = this._mapContext.$getAppMap();
console.log("============maps:", maps)
maps.onclick = function(point) {
console.log(point);
point.iconPath = '../../static/address_2.png';
point.id = 100
that._mapContext.moveToLocation({
latitude: point.latitude,
longitude: point.longitude,
})
let list = JSON.parse(JSON.stringify(that.markers));
let isFrist = 0;
list.forEach(function(item) {
if (item.id == 100) {
isFrist = 1;
item.latitude = point.latitude;
item.longitude = point.longitude;
} else {
}
});
if (isFrist == 0) {
that.markers = that.markers.concat(point);
} else {
that.markers = list;
}
//that.markers = list;
console.log(_item)
// if (_item.length > 0) {
// console.log("=============平移:", point.latitude)
// console.log("=============平移:", point.longitude)
// that._mapContext.translateMarker({
// markerId: 100,
// destination: {
// latitude: point.latitude,
// longitude: point.longitude,
// },
// fail(e) {
// console.log(e)
// }
// })
// } else {
// console.log("=============新增")
// that.markers = that.markers.concat(point);
// }
};
},
goToSelectCamera() {
uni.navigateTo({
url: '../listPage/listPage'
});
console.log("获取周围美食");
},
reGetLocation() {
this.getLocationInfo();
},
// 确认授权后,获取用户位置
getLocationInfo() {
const that = this;
uni.getLocation({
isHighAccuracy: true,
highAccuracyExpireTime: 3500,
accuracy: 'best',
altitude:true,
type: "gcj02",
success: function(res) {
console.log("============================定位结果res:",res);
// 暂时
that.longitude = res.longitude; //118.787575;
that.latitude = res.latitude; //32.05024;
//精确度信息
that.accuracy = res.accuracy;
that.altitude = res.altitude;
that.horizontalAccuracy = res.horizontalAccuracy;
that._mapContext.moveToLocation({
latitude: res.latitude,
longitude: res.longitude,
})
let list = JSON.parse(JSON.stringify(that.markers));
let isFrist = 0;
list.forEach(function(item) {
if (item.id == 1) {
isFrist = 1;
item.latitude = res.latitude;
item.longitude = res.longitude;
} else {
}
});
if (isFrist == 0) {
that.markers.push({
id: 1,
width: 50,
height: 50,
latitude: res.latitude,
longitude: res.longitude,
iconPath: "../../static/address_1.png",
width: that.markerHeight, //宽
height: that.markerHeight, //高
color: '#FFFFFF'
})
} else {
that.markers = list;
}
},
fail(err) {
uni.showToast({
icon: "error",
title: "获取位置出错"
})
console.log(err)
}
});
},
getList() {
console.log("获取周围美食");
console.log(this.markers.length)
},
historyPosition() {
const returnedTarget = Object.assign(this.$store.state.equip.currentData, this.$store.state.equip.currentDataDetails);
let cameara=returnedTarget
if (cameara.longitude) {
console.log("==============更新旧点")
// cameara.longitude = info[0];
// cameara.latitude = info[1];
let point = {};
point.iconPath = '../../static/address_4.png';
point.id = 10000
point.latitude = cameara.latitude;
point.longitude = cameara.longitude;
let list = JSON.parse(JSON.stringify(this.markers));
let isFrist = 0;
list.forEach(function(item) {
if (item.id == 10000) {
isFrist = 1;
item.latitude = cameara.latitude;
item.longitude = cameara.longitude;
}
});
if (isFrist == 0) {
this.markers = this.markers.concat(point);
} else {
this.markers = list;
}
console.log("=====================this.markers:", JSON.stringify(this.markers))
} else {
let list = JSON.parse(JSON.stringify(this.markers));
let _index = 10000;
list.forEach(function(item, index) {
if (item.id == 10000) {
_index = index
}
});
if (_index != 10000) {
list.splice(_index, _index)
}
this.markers = list;
}
},
moveTo(index) {
let point_list = this.markers.filter(item => {
if (item.id == index) {
return item
}
})
let point = point_list[0];
if (point_list.length > 0) {
this._mapContext.moveToLocation({
latitude: point.latitude,
longitude: point.longitude,
})
}
},
getById(id) {
this.$u.post(config.api + '/xfhrshInternet/service/selPicture', {
subjectId: id
}).then(res => {
if(res.code==0){
this.$store.dispatch('setCurrentEquipDtails', {data: res.data[0]})
}
//this.camera_list = res;
});
},
},
onUnload: function() {
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
}
},
onLoad() {
// 监听事件
uni.$on('updateCamera', (cameara) => {
setTimeout(() => {
this.historyPosition()
}, 2500)
})
},
onUnload() {
// 移除监听事件
uni.$off('updateCamera');
},
};
</script>
<style lang="scss">
.u-nav-slot {
padding: 0 20rpx 0 0;
}
.cameraInfo {
margin-top: 20rpx;
margin-bottom: 20rpx;
.btnListBox {
display: flex;
width: 300rpx;
justify-content: space-around;
align-items: center;
margin-bottom: 20rpx;
margin-left: 10rpx;
}
}
.cameraItem {
margin: 0 24rpx;
margin-top: 30rpx !important;
border: 1px solid #A3A8A8;
border-radius: 10rpx;
padding: 10rpx;
.editItem {
display: flex;
flex-direction: row;
justify-content: flex-end;
margin: 20rpx 0;
.editItemBtn {
border: 1rpx solid #A3A8A8;
border-radius: 4rpx;
padding: 4rpx 4rpx;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
}
.cameraItemLi {
display: flex;
flex-direction: row;
justify-content: space-between;
.unKnow {
color: red;
}
}
}
.btn {
margin-top: 10rpx;
}
.btnList {
display: flex;
flex-direction: row;
width: 100%;
justify-content: space-around;
}
.btnList1 {
display: flex;
flex-direction: row;
width: 100%;
justify-content: space-around;
}
.tipsList {
margin: 10rpx;
}
.selectPointPosition {
display: flex;
justify-content: space-between;
}
</style>

View File

@@ -0,0 +1,24 @@
<template>
<div class="test">
<text>12313</text>
</div>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
.test{
background-color: aqua;
}
</style>

242
pages/listPage/listPage.vue Normal file
View File

@@ -0,0 +1,242 @@
<template>
<view>
<u-search placeholder="请输入摄像机名称或者编码" v-model="keyword" @change="change"></u-search>
<view class="tagsList">
<view class="u-page__tag-item" v-for="(item, index) in radios" :key="index">
<u-tag :text="item.type==''?'全部':item.type" :type="item.checked?'success':'info'" :name="index" @click="radioClick(index)">
</u-tag>
</view>
</view>
<z-paging ref="paging" v-model="dataList" @query="queryList" default-page-no="0">
<view v-for="(item,index) in dataList" class="cameraItem">
<u-swipe-action @click="swiperActionClick" :options="options" :index="index"
@content-click="contentClick">
<view>
<view class="cameraItemLi">
<view>设备编号</view>
<view>{{item.number}}</view>
</view>
<view class="cameraItemLi">
<view>设备类型</view>
<view>{{item.type}}</view>
</view>
<view class="cameraItemLi">
<view>经度</view>
<view v-if="item.longitude">{{item.longitude}}</view>
<view class="unKnow" v-if="!item.longitude"></view>
</view>
</view>
</u-swipe-action>
</view>
</z-paging>
</view>
</template>
<script>
import config from "../../libs/config/config.js"
export default {
data() {
return {
radios: [{
checked: true,
type:''
},
{
checked: false,
type:'变焦枪机'
},
{
checked: false,
type:'高清固定摄像机'
},{
checked: false,
type:'标清固定摄像机'
},{
checked: false,
type:'高清云台摄像机'
},{
checked: false,
type:'标清云台摄像机'
},{
checked: false,
type:'消防栓'
},{
checked: false,
type:'消防炮'
},{
checked: false,
type:'泡沫栓'
},{
checked: false,
type:'炮栓一体'
},{
checked: false,
type:'手动报警器'
},{
checked: false,
type:'消防器材箱'
},
],
keyword: '',
dataList: [],
type:'',
options: [{
text: '编辑',
style: {
backgroundColor: '#3c9cff'
}
}, {
text: '删除',
style: {
backgroundColor: '#f56c6c'
}
}],
}
},
onShow() {
//this.$refs.paging.reload();
},
onLoad() {},
methods: {
contentClick(index) {
if (this.dataList[index].isDelete) {
uni.showToast({
icon: "none",
title: "当前设备已被删除"
})
return;
}
this.clickAction(this.dataList[index])
console.log("=====================contentClick", index)
},
swiperActionClick(index, index1) {
if (this.dataList[index].isDelete) {
uni.showToast({
icon: "none",
title: "当前设备已被删除"
})
return;
}
if (index1 == 0) {
console.log("编辑")
let url = "../addEquip/addEquip?cameara=" + JSON.stringify(this.dataList[index])
uni.navigateTo({
url: url
});
}
if (index1 == 1) {
console.log("删除")
console.log(this.dataList[index])
this.delete(index)
}
console.log("=============index:", index)
console.log("=============index1:", index1)
},
delete(index) {
this.$u.post(config.api + '/delete', {
id: this.dataList[index].id
}).then(res => {
if (res.status = "success") {
uni.showToast({
icon: "none",
title: "操作成功"
})
this.dataList[index].isDelete = true;
this.$refs.paging.reload();
}
});
},
queryList(pageNo, pageSize) {
//这里的pageNo和pageSize会自动计算好直接传给服务器即可
//这里的请求只是演示请替换成自己的项目的网络请求并在网络请求回调中通过this.$refs.paging.complete(请求回来的数组)将请求结果传给z-paging
this.$u.post(config.api + '/xfhrshInternet/service/selfireFacilities', {
type: this.type,
number: this.keyword,
page: String(parseFloat(pageNo) + 1),
row: String(pageSize),
}).then(res => {
console.log(typeof res)
console.log(res)
this.$refs.paging.complete(res.data);
});
// this.$request.queryList({
// pageNo,
// pageSize
// }).then(res => {
// //请勿在网络请求回调中给dataList赋值只需要调用complete就可以了
// this.$refs.paging.complete(res.data.list);
// }).catch(res => {
// //如果请求失败写this.$refs.paging.complete(false),会自动展示错误页面
// //注意每次都需要在catch中写这句话很麻烦z-paging提供了方案可以全局统一处理
// //在底层的网络请求抛出异常时写uni.$emit('z-paging-error-emit');即可
// this.$refs.paging.complete(false);
// })
},
clickAction(item) {
this.$store.dispatch('setCurrentEquip', {data: item})
uni.$emit('updateCamera', {
cameara: item
})
uni.navigateBack()
},
change(value) {
this.keyword = value;
this.$refs.paging.reload();
},
getData(key = "") {
this.$u.post(config.api + '/camera_list', {
keyword: this.keyword,
pageNum: 0,
pageSize: 10,
}).then(res => {
this.camera_list = res;
});
},
radioClick(name) {
console.log("==============name:",name)
this.radios.map((item, index) => {
if(index === name){
item.checked = true
this.type = item.type;
this.$refs.paging.reload();
}else{
item.checked = false
}
})
},
}
}
</script>
<style lang="scss">
.tagsList{
display: flex;
flex-wrap: wrap;
}
.z-paging-content {
margin-top: 250rpx;
}
.cameraItem {
margin: 0 24rpx;
margin-top: 30rpx !important;
border: 1px solid #A3A8A8;
border-radius: 10rpx;
padding: 10rpx;
.cameraItemLi {
display: flex;
flex-direction: row;
justify-content: space-between;
.unKnow {
color: red;
}
}
}
</style>