This commit is contained in:
3321822538@qq.com 2024-06-05 09:24:17 +08:00
parent ee33abc2c8
commit d7d1ef08f1
5 changed files with 321 additions and 197 deletions

View File

@ -23,20 +23,20 @@
fengchangNumber: 0,
fengxiangNumber: 0,
listData: [],
latitude: '27.105794',
longitude: '120.256882',
latitude: '',
longitude: '',
isMap: false,
zoomSize: 15,
fclist: [],
markers: [
// {
// latitude:27.105794,
// longitude:120.256882,
// width: 20,
// height: 30,
// id: 0,
// iconPath: '../../static/dwicon.png',
// }
{
// latitude:27.105794,
// longitude:120.256882,
// width: 20,
// height: 30,
// id: 0,
// iconPath: '../../static/aa1.png',
}
],
}
},
@ -62,11 +62,30 @@
width: 25,
height: 25,
id: item.id,
iconPath: '../../static/蜂场.png ',
iconPath: '../../static/蜂场.png',
label: {
content: item.name,
textAlign:'center',
fontSize:14
fontSize:14,
anchorX: (() => {
if (item.name.length <= 2) {
return -12
} else if (item.name.length <= 3) {
return -20
} else if (item.name.length <= 4) {
return -25
} else if (item.name.length <= 5) {
return -30
} else if (item.name.length <= 6) {
return -35
} else if (item.name.length <= 8) {
return -40
} else if (item.name.length <=
10) {
return -45
} else {
return -item.name.length * 5
}
})(),
},
})
})
@ -91,7 +110,26 @@
iconPath: '../../static/a11.png',
label: {
content: item.name,
textAlign:'center'
anchorX: (() => {
if (item.name.length <= 2) {
return -12
} else if (item.name.length <= 3) {
return -20
} else if (item.name.length <= 4) {
return -25
} else if (item.name.length <= 5) {
return -30
} else if (item.name.length <= 6) {
return -35
} else if (item.name.length <= 8) {
return -40
} else if (item.name.length <=
10) {
return -45
} else {
return -item.name.length * 5
}
})(),
}
})
} else {
@ -104,7 +142,26 @@
iconPath: '../../static/a22.png',
label: {
content: item.name,
textAlign:'center'
anchorX: (() => {
if (item.name.length <= 2) {
return -12
} else if (item.name.length <= 3) {
return -20
} else if (item.name.length <= 4) {
return -25
} else if (item.name.length <= 5) {
return -30
} else if (item.name.length <= 6) {
return -35
} else if (item.name.length <= 8) {
return -40
} else if (item.name.length <=
10) {
return -45
} else {
return -item.name.length * 5
}
})(),
}
})
}
@ -125,12 +182,32 @@
this.markers.push({
latitude,
longitude,
width: 20,
height: 30,
width: 1,
height: 1,
id: 0,
iconPath:'',
customCallout: {
anchorY: -5,
anchorX: 5,
// anchorY: -5,
anchorX: (() => {
if (item.name.length <= 2) {
return -12
} else if (item.name.length <= 3) {
return -20
} else if (item.name.length <= 4) {
return -25
} else if (item.name.length <= 5) {
return -30
} else if (item.name.length <= 6) {
return -35
} else if (item.name.length <= 8) {
return -40
} else if (item.name.length <=
10) {
return -45
} else {
return -item.name.length * 5
}
})(),
display: 'BYCLICK'
}
})

View File

@ -40,24 +40,24 @@
<view class="group_7 bianhao-top-yi">
<view class="bianhao-zuo">
<text class="font_2">{{item.name}}</text>
<text class="font_2" @click="detilsq(item)">{{item.name}}</text>
<view class=" text-wrapper"
:id="item.status_text == '在线' ? 'text-wrapper-bgc1' : 'text-wrapper-bgc2'">
<text class="font_33">{{item.status_text}}</text>
<text class="font_33" @click="detilsq(item)">{{item.status_text}}</text>
<!-- <text class="font_3">在线</text> -->
</view>
<image v-if="item.warning_battery_low" class=" image_7 image_8"
<image v-if="item.warning_battery_low" @click="addyujings(item)" class=" image_7 image_8"
src="../../static/蜂箱-电量预警.png" />
<image v-if="item.warning_shake" class=" image_7 image_9"
<image v-if="item.warning_shake" @click="addyujings(item)" class=" image_7 image_9"
src="../../static/蜂箱-震动预警.png" />
<image v-if="item.warning_temperature" class=" image_7 image_10"
<image v-if="item.warning_temperature" @click="addyujings(item)" class=" image_7 image_10"
src="../../static/蜂箱-温度预警.png" />
<image v-if="item.warning_humidity" class=" image_7 image_11"
<image v-if="item.warning_humidity" @click="addyujings(item)" class=" image_7 image_11"
src="../../static/蜂箱-湿度预警.png" />
<image v-if="item.warning_weight" class=" image_7 image_12"
<image v-if="item.warning_weight" @click="addyujings(item)" class=" image_7 image_12"
src="../../static/蜂箱-重量预警.png" />
<image class=" image_7 image_13" src="../../static/蜂箱-蜂场预警.png"
<image class=" image_7 image_13" @click="addyujings(item)" src="../../static/蜂箱-蜂场预警.png"
v-if="item.warning_attendance" />
</view>
@ -145,12 +145,12 @@
<view class="flex-taxt">
<image class=" image_16" src="../../static/蜂箱-温度.png" />
<text class="font_5 text_9 text-l">箱内</text>
<text class=" font_5 text_13">{{item.temperature_in_box}}</text>
<text class=" font_5 text_13">{{item.temperature_in_box.substring(0, 3) < -40 || item.temperature_in_box.substring(0, 3) > 100 ? '--' : item.temperature_in_box}}</text>
</view>
<view class="flex-taxt">
<image class=" image_17" src="../../static/蜂箱-湿度.png" />
<text class="font_5 text_9 text-l">箱内</text>
<text class=" font_5 text_13">{{item.humidity_in_box}}</text>
<text class=" font_5 text_13">{{item.temperature_in_box.substring(0, 3) < -40 || item.temperature_in_box.substring(0, 3) > 100? '--' : item.humidity_in_box}}</text>
</view>
</view>
<!-- 箱内温度 -->
@ -166,12 +166,12 @@
<view class="flex-taxt">
<image class=" image_16" src="../../static/蜂箱-温度.png" />
<text class="font_5 text_9 text-l">箱外</text>
<text class=" font_5 text_13">{{item.temperature_out_box}}</text>
<text class=" font_5 text_13">{{item.temperature_out_box.substring(0, 3) < -40 || item.temperature_out_box.substring(0, 3) > 100 ? '--' : item.temperature_in_box}}</text>
</view>
<view class="flex-taxt">
<image class=" image_17" src="../../static/蜂箱-湿度.png" />
<text class="font_5 text_9 text-l">箱外</text>
<text class=" font_5 text_13">{{item.humidity_out_box}}</text>
<text class=" font_5 text_13">{{item.temperature_out_box.substring(0, 3) < -40 || item.temperature_out_box.substring(0, 3) > 100 ? '--' :item.humidity_out_box}}</text>
</view>
@ -187,9 +187,9 @@
<view class="group_8 space-x-6 flex-taxt2" @click="warmbuts(item)">
<image class=" image_19" src="../../static/加热.png" />
<text class="font_5">加热</text>
<switch @change="warmbut(item)" disabled="disabledflag"
<switch @change="warmbut(item)" disabled="disabledflag"
:checked="item.heat == 1 ? true : false" class=" image_201"
:color="'#3a942b'" style="transform:scale(0.5)" />
:color="'#3a942b'" style="transform:scale(0.5)"/>
</view>
<view class="group_9 flex-taxt3" @click="fenlampbuts(item)">
<image class=" image_21" src="../../static/蜂箱-风扇.png" />
@ -760,6 +760,13 @@
},
//
detilsq(item) {
console.log(item);
// this.HiddenClick(item)
uni.navigateTo({
url: `/pagesFengXiang/pages/fengxiangDetail/index?id=${item.id}`
})
},
detils(item) {
console.log(item);
this.HiddenClick(item)
@ -767,9 +774,14 @@
url: `/pagesFengXiang/pages/fengxiangDetail/index?id=${item.id}`
})
},
addyujings(item) {
// this.HiddenClick(item)
uni.navigateTo({
url: '/pagesFengXiang/pages/index?id=' + item.id + '&qrcode=' + item.qrcode
})
},
addyujing(item) {
this.HiddenClick(item)
console.log(item);
uni.navigateTo({
url: '/pagesFengXiang/pages/index?id=' + item.id + '&qrcode=' + item.qrcode
})
@ -801,7 +813,7 @@
/deep/ .u-popup__content {
width: 750rpx;
}
.shuaxin {
width: 32rpx;
height: 32rpx;
@ -1052,11 +1064,11 @@
}
.flex-taxt2 {
margin-top: 10rpx;
margin-top: 20rpx;
}
.flex-taxt3 {
margin-top: 14rpx;
margin-top: 20rpx;
}
.padding-box {
@ -1099,14 +1111,14 @@
}
.page {
height: 100%;
width: 100%;
// height: 100%;
// width: 100%;
// position: absolute;
background-color: #f7f7f7;
width: 100%;
overflow-y: auto;
overflow-x: hidden;
height: 100%;
overflow-x: hidden;
height: 100vh;
}
.font_2 {
@ -1265,18 +1277,27 @@
}
.image_15 {
width: 31rpx;
width: 28rpx;
height: 32rpx;
vertical-align: middle;
padding-bottom: 6rpx;
box-sizing: border-box;
}
.image_16 {
width: 22rpx;
width: 20rpx;
height: 32rpx;
vertical-align: middle;
padding-bottom: 5rpx;
box-sizing: border-box;
}
.image_17 {
width: 23rpx;
width: 21rpx;
height: 32rpx;
vertical-align: middle;
padding-bottom: 6rpx;
box-sizing: border-box;
}
.font_5 {
@ -1329,8 +1350,11 @@
}
.image_19 {
width: 24rpx;
width: 22rpx;
height: 32rpx;
vertical-align: middle;
padding-bottom: 6rpx;
box-sizing: border-box;
}
.image_20 {
@ -1343,6 +1367,7 @@
border-radius: 16rpx;
width: 65rpx;
height: 35rpx;
vertical-align: top;
}
.view_5 {
@ -1356,8 +1381,9 @@
}
.image_21 {
width: 28rpx;
height: 28rpx;
width: 26rpx;
height: 26rpx;
vertical-align: middle;
}
.text_15 {

View File

@ -1,171 +1,192 @@
<template>
<view class="page">
<view class="page-box">
<!-- 扫描二维码 -->
<view>
<view class="text-box">扫描二维码</view>
<view class="scan-boxview">
<u--input
class="input-b"
shape="circle"
placeholder="请扫描蜂箱上的二维码"
border="surround"
v-model="form.qrcode"
>
</u--input>
<image @click="gotomap" class="scan-img" src="/static/16994973961877418353.png" />
</view>
</view>
<!-- 自定义蜂箱 -->
<view>
<view class="text-box">自定义蜂箱</view>
<view>
<u--input
class="input-b"
shape="circle"
placeholder="请输入蜂箱的自定义名称"
border="surround"
v-model="form.name"
></u--input>
</view>
</view>
<!-- 所属蜂场 -->
<view>
<view class="text-box">所属蜂场</view>
<view @click="showfengzhong = true">
<u--input style="background-color: #f7f7f7;" disabled shape="circle" placeholder="请选择蜂场" border="surround" v-model="form.apiary_id_text" ></u--input>
<view class="page">
<view class="page-box">
<!-- 扫描二维码 -->
<view>
<view class="text-box">扫描二维码</view>
<view class="scan-boxview">
<u--input class="input-b" shape="circle" placeholder="请扫描蜂箱上的二维码" border="surround"
v-model="form.qrcode">
</u--input>
<image @click="gotomap" class="scan-img" src="/static/16994973961877418353.png" />
</view>
</view>
<view class="mag-box">
<u-button @click="xinzeng" size="large" shape="circle" text="保 存" color="#23693f"></u-button>
</view>
</view>
</view>
<!-- 自定义蜂箱 -->
<view>
<view class="text-box">自定义蜂箱</view>
<view>
<u--input class="input-b" shape="circle" placeholder="请输入蜂箱的自定义名称" border="surround"
v-model="form.name"></u--input>
</view>
</view>
<!-- 所属蜂场 -->
<view>
<view class="text-box">所属蜂场</view>
<view @click="showfengzhong = true">
<u--input style="background-color: #f7f7f7;" disabled shape="circle" placeholder="请选择蜂场"
border="surround" v-model="form.apiary_id_text"></u--input>
</view>
</view>
<view class="mag-box">
<u-button @click="xinzeng" size="large" shape="circle" :text="text" :color="computedColor" ></u-button>
</view>
</view>
<u-picker @cancel="showfengzhong=false" @confirm="confirmfengzhong" :show="showfengzhong" :columns="fengzhongcolumns"></u-picker>
<u-picker @cancel="showfengzhong=false" @confirm="confirmfengzhong" :show="showfengzhong"
:columns="fengzhongcolumns"></u-picker>
</view>
</view>
</template>
<script>
import request from '../../../utils/request';
export default {
name: 'FxIndex',
onLoad(){
this.listData()
},
data() {
return {
page:1,
form:{
name:'', //
qrcode:'', //
apiary_id_text:'', // text
apiary_id:'' // id
},
showfengzhong: false,
fengzhongcolumns: [
import request from '../../../utils/request';
export default {
name: 'FxIndex',
onLoad() {
this.listData()
},
data() {
return {
page: 1,
form: {
name: '', //
qrcode: '', //
apiary_id_text: '', // text
apiary_id: '' // id
},
showfengzhong: false,
fengzhongcolumns: [
// '','',''
[]
[]
],
};
},
text:'保 存',
};
},
computed: {
computedColor() {
if (this.text === '保 存') {
return '#23693f';
} else {
return '#ccc';
}
}
},
mounted() {
mounted() {
},
},
methods: {
async xinzeng(){ //!
//
const res = await request.post('/api/beehive/add',this.form)
if(res.data.code === 0){
uni.showToast({
title:res.data.msg,
icon:'none',
duration:2000
})
this.form = {
name:'', //
qrcode:'', //
apiary_id_text:'', // text
apiary_id:'' // id
}
}else{
uni.showToast({
title:res.data.msg,
icon:'none',
duration:2000
})
}
},
gotomap(){
wx.scanCode({
onlyFromCamera: false, // false
scanType: ['qrCode', 'barCode'], //
success: res => { //
console.log(res.result , '成功结果') //
this.form.qrcode = res.result
},
fail: res => { //
console.log(res , '失败结果') //
}
})
},
confirmfengzhong(e){
methods: {
async xinzeng() {
if(this.text == '保 存'){
this.text = '保存中'
const res = await request.post('/api/beehive/add', this.form)
if (res.data.code === 0) {
this.text = '保 存'
uni.showToast({
title: res.data.msg,
icon: 'none',
duration: 2000
})
this.form = {
name: '', //
qrcode: '', //
apiary_id_text: '', // text
apiary_id: '' // id
}
} else {
uni.showToast({
title: res.data.msg,
icon: 'none',
duration: 2000
})
setTimeout(()=>{
this.text = '保 存'
},1000)
}
}else{
uni.showToast({
title: '保存中',
icon: 'none',
duration: 1000
})
}
},
gotomap() {
wx.scanCode({
onlyFromCamera: false, // false
scanType: ['qrCode', 'barCode'], //
success: res => { //
console.log(res.result, '成功结果') //
this.form.qrcode = res.result
},
fail: res => { //
console.log(res, '失败结果') //
}
})
},
confirmfengzhong(e) {
console.log(e);
this.form.apiary_id = e.value[0].id
this.form.apiary_id_text = e.value[0].text
this.showfengzhong=false
this.showfengzhong = false
},
listData() {
request.get('/api/apiary/index', {
page: this.page
}).then(res => {
res.data.data.forEach(item => {
this.fengzhongcolumns[0].push({
text:item.name,
id:item.id
})
})
console.log(res)
console.log(res.data.data[0].id)
console.log(res.data.data[0].name)
console.log(this.fengzhongcolumns , '数组')
})
// console.log(res.data.data)
listData() {
request.get('/api/apiary/index', {
page: this.page
}).then(res => {
res.data.data.forEach(item => {
this.fengzhongcolumns[0].push({
text: item.name,
id: item.id
})
})
console.log(res)
console.log(res.data.data[0].id)
console.log(res.data.data[0].name)
console.log(this.fengzhongcolumns, '数组')
})
// console.log(res.data.data)
}
},
};
}
},
};
</script>
<style lang="scss" scoped>
.scan-boxview{
display: flex;
align-items: center;
}
.scan-img{
width: 50rpx;
height: 50rpx;
}
.input-b{
background-color: #f7f7f7;
}
.text-box{
margin: 30rpx 0 20rpx 15rpx;
}
.page-box{
padding: 20rpx 50rpx;
}
.mag-box{
margin: 50rpx 0;
}
.scan-boxview {
display: flex;
align-items: center;
}
.scan-img {
width: 50rpx;
height: 50rpx;
}
.input-b {
background-color: #f7f7f7;
}
.text-box {
margin: 30rpx 0 20rpx 15rpx;
}
.page-box {
padding: 20rpx 50rpx;
}
.mag-box {
margin: 50rpx 0;
}
.page {
height: 100%;
height: 100%;
width: 100%;
position: absolute;
background-color: #ffff;
color: #8888;
}
color: #8888;
}
</style>

View File

@ -66,9 +66,9 @@
</view>
</view>
</view>
<view class="" v-if="fromList.length == 0" style="width: 100%;text-align: center;margin-top: 200rpx;color: #ccc;font-size: 36rpx;">
<!-- <view class="" v-if="fromList.length == 0" style="width: 100%;text-align: center;margin-top: 200rpx;color: #ccc;font-size: 36rpx;">
<text v-if="!flagmask">暂时没有预警记录...</text>
</view>
</view> -->
</view>
</view>

View File

@ -11,7 +11,7 @@
<view class="bianhao-zuo">
<view class="font_2">{{listdata.name}}</view>
<view class=" justify-start self-start text-wrapper"
:id="listdata.status_text == '在线' ? 'text-wrapper-bgc1' : 'text-wrapper-bgc2'">
:id="listdata.status_text == '在线' ? 'text-wrapper-bgc1' : '<strong></strong>text-wrapper-bgc2'">
<view class="font_33">{{listdata.status_text}}</view>
</view>
@ -35,7 +35,7 @@
</view>
<view class="d-baseline group_7 view_2">
<text class="font_4">{{listdata.qrcode}}</text>
<text class="font_4 text_6"> {{listdata.create_time}}更新</text>
<text class="font_4 text_6"> {{listdata.update_time}}更新</text>
<text class="font_4 text_7"></text>
<text class="font_4 text_8">{{listdata.address}}</text>
</view>