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
pages
ditu
fengxiang
pagesFengXiang/pages
addfengxiang
fengxiang-yujin
fengxiangDetail

View File

@ -23,20 +23,20 @@
fengchangNumber: 0, fengchangNumber: 0,
fengxiangNumber: 0, fengxiangNumber: 0,
listData: [], listData: [],
latitude: '27.105794', latitude: '',
longitude: '120.256882', longitude: '',
isMap: false, isMap: false,
zoomSize: 15, zoomSize: 15,
fclist: [], fclist: [],
markers: [ markers: [
// { {
// latitude:27.105794, // latitude:27.105794,
// longitude:120.256882, // longitude:120.256882,
// width: 20, // width: 20,
// height: 30, // height: 30,
// id: 0, // id: 0,
// iconPath: '../../static/dwicon.png', // iconPath: '../../static/aa1.png',
// } }
], ],
} }
}, },
@ -62,11 +62,30 @@
width: 25, width: 25,
height: 25, height: 25,
id: item.id, id: item.id,
iconPath: '../../static/蜂场.png ', iconPath: '../../static/蜂场.png',
label: { label: {
content: item.name, 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', iconPath: '../../static/a11.png',
label: { label: {
content: item.name, 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 { } else {
@ -104,7 +142,26 @@
iconPath: '../../static/a22.png', iconPath: '../../static/a22.png',
label: { label: {
content: item.name, 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({ this.markers.push({
latitude, latitude,
longitude, longitude,
width: 20, width: 1,
height: 30, height: 1,
id: 0, id: 0,
iconPath:'',
customCallout: { customCallout: {
anchorY: -5, // anchorY: -5,
anchorX: 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' display: 'BYCLICK'
} }
}) })

View File

@ -40,24 +40,24 @@
<view class="group_7 bianhao-top-yi"> <view class="group_7 bianhao-top-yi">
<view class="bianhao-zuo"> <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" <view class=" text-wrapper"
:id="item.status_text == '在线' ? 'text-wrapper-bgc1' : 'text-wrapper-bgc2'"> :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> --> <!-- <text class="font_3">在线</text> -->
</view> </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" /> 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" /> 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" /> 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" /> 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" /> 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" /> v-if="item.warning_attendance" />
</view> </view>
@ -145,12 +145,12 @@
<view class="flex-taxt"> <view class="flex-taxt">
<image class=" image_16" src="../../static/蜂箱-温度.png" /> <image class=" image_16" src="../../static/蜂箱-温度.png" />
<text class="font_5 text_9 text-l">箱内</text> <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>
<view class="flex-taxt"> <view class="flex-taxt">
<image class=" image_17" src="../../static/蜂箱-湿度.png" /> <image class=" image_17" src="../../static/蜂箱-湿度.png" />
<text class="font_5 text_9 text-l">箱内</text> <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>
</view> </view>
<!-- 箱内温度 --> <!-- 箱内温度 -->
@ -166,12 +166,12 @@
<view class="flex-taxt"> <view class="flex-taxt">
<image class=" image_16" src="../../static/蜂箱-温度.png" /> <image class=" image_16" src="../../static/蜂箱-温度.png" />
<text class="font_5 text_9 text-l">箱外</text> <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>
<view class="flex-taxt"> <view class="flex-taxt">
<image class=" image_17" src="../../static/蜂箱-湿度.png" /> <image class=" image_17" src="../../static/蜂箱-湿度.png" />
<text class="font_5 text_9 text-l">箱外</text> <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> </view>
@ -187,9 +187,9 @@
<view class="group_8 space-x-6 flex-taxt2" @click="warmbuts(item)"> <view class="group_8 space-x-6 flex-taxt2" @click="warmbuts(item)">
<image class=" image_19" src="../../static/加热.png" /> <image class=" image_19" src="../../static/加热.png" />
<text class="font_5">加热</text> <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" :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>
<view class="group_9 flex-taxt3" @click="fenlampbuts(item)"> <view class="group_9 flex-taxt3" @click="fenlampbuts(item)">
<image class=" image_21" src="../../static/蜂箱-风扇.png" /> <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) { detils(item) {
console.log(item); console.log(item);
this.HiddenClick(item) this.HiddenClick(item)
@ -767,9 +774,14 @@
url: `/pagesFengXiang/pages/fengxiangDetail/index?id=${item.id}` 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) { addyujing(item) {
this.HiddenClick(item) this.HiddenClick(item)
console.log(item);
uni.navigateTo({ uni.navigateTo({
url: '/pagesFengXiang/pages/index?id=' + item.id + '&qrcode=' + item.qrcode url: '/pagesFengXiang/pages/index?id=' + item.id + '&qrcode=' + item.qrcode
}) })
@ -801,7 +813,7 @@
/deep/ .u-popup__content { /deep/ .u-popup__content {
width: 750rpx; width: 750rpx;
} }
.shuaxin { .shuaxin {
width: 32rpx; width: 32rpx;
height: 32rpx; height: 32rpx;
@ -1052,11 +1064,11 @@
} }
.flex-taxt2 { .flex-taxt2 {
margin-top: 10rpx; margin-top: 20rpx;
} }
.flex-taxt3 { .flex-taxt3 {
margin-top: 14rpx; margin-top: 20rpx;
} }
.padding-box { .padding-box {
@ -1099,14 +1111,14 @@
} }
.page { .page {
height: 100%; // height: 100%;
width: 100%; // width: 100%;
// position: absolute; // position: absolute;
background-color: #f7f7f7; background-color: #f7f7f7;
width: 100%; width: 100%;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
height: 100%; height: 100vh;
} }
.font_2 { .font_2 {
@ -1265,18 +1277,27 @@
} }
.image_15 { .image_15 {
width: 31rpx; width: 28rpx;
height: 32rpx; height: 32rpx;
vertical-align: middle;
padding-bottom: 6rpx;
box-sizing: border-box;
} }
.image_16 { .image_16 {
width: 22rpx; width: 20rpx;
height: 32rpx; height: 32rpx;
vertical-align: middle;
padding-bottom: 5rpx;
box-sizing: border-box;
} }
.image_17 { .image_17 {
width: 23rpx; width: 21rpx;
height: 32rpx; height: 32rpx;
vertical-align: middle;
padding-bottom: 6rpx;
box-sizing: border-box;
} }
.font_5 { .font_5 {
@ -1329,8 +1350,11 @@
} }
.image_19 { .image_19 {
width: 24rpx; width: 22rpx;
height: 32rpx; height: 32rpx;
vertical-align: middle;
padding-bottom: 6rpx;
box-sizing: border-box;
} }
.image_20 { .image_20 {
@ -1343,6 +1367,7 @@
border-radius: 16rpx; border-radius: 16rpx;
width: 65rpx; width: 65rpx;
height: 35rpx; height: 35rpx;
vertical-align: top;
} }
.view_5 { .view_5 {
@ -1356,8 +1381,9 @@
} }
.image_21 { .image_21 {
width: 28rpx; width: 26rpx;
height: 28rpx; height: 26rpx;
vertical-align: middle;
} }
.text_15 { .text_15 {

View File

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

View File

@ -66,9 +66,9 @@
</view> </view>
</view> </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> <text v-if="!flagmask">暂时没有预警记录...</text>
</view> </view> -->
</view> </view>
</view> </view>

View File

@ -11,7 +11,7 @@
<view class="bianhao-zuo"> <view class="bianhao-zuo">
<view class="font_2">{{listdata.name}}</view> <view class="font_2">{{listdata.name}}</view>
<view class=" justify-start self-start text-wrapper" <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 class="font_33">{{listdata.status_text}}</view>
</view> </view>
@ -35,7 +35,7 @@
</view> </view>
<view class="d-baseline group_7 view_2"> <view class="d-baseline group_7 view_2">
<text class="font_4">{{listdata.qrcode}}</text> <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_7"></text>
<text class="font_4 text_8">{{listdata.address}}</text> <text class="font_4 text_8">{{listdata.address}}</text>
</view> </view>