This commit is contained in:
3321822538@qq.com 2024-06-13 17:59:39 +08:00
parent f042c7bf6b
commit d42101a209
4 changed files with 115 additions and 129 deletions

View File

@ -61,13 +61,15 @@
longitude: item.lng, longitude: item.lng,
width: 25, width: 25,
height: 25, height: 25,
id: item.id, id: parseFloat(item.id),
iconPath: '../../static/蜂场.png', iconPath: '../../static/蜂场.png',
label: { label: {
content: item.name, content: item.name,
fontSize:14, fontSize:15,
anchorX: (() => { anchorX: (() => {
if (item.name.length <= 2) { if (item.name.length < 2) {
return -6
}else if(item.name.length <= 2){
return -13 return -13
} else if (item.name.length <= 3) { } else if (item.name.length <= 3) {
return -20 return -20
@ -106,12 +108,14 @@
longitude: item.lng, longitude: item.lng,
width: 15, width: 15,
height: 15, height: 15,
id: item.id, id: parseFloat(item.id),
iconPath: '../../static/a11.png', iconPath: '../../static/a11.png',
label: { label: {
content: item.name, content: item.name,
anchorX: (() => { anchorX: (() => {
if (item.name.length <= 2) { if (item.name.length < 2) {
return -6
}else if(item.name.length <= 2){
return -12 return -12
} else if (item.name.length <= 3) { } else if (item.name.length <= 3) {
return -20 return -20
@ -138,12 +142,14 @@
longitude: item.lng, longitude: item.lng,
width: 15, width: 15,
height: 15, height: 15,
id: item.id, id: parseFloat(item.id),
iconPath: '../../static/a22.png', iconPath: '../../static/a22.png',
label: { label: {
content: item.name, content: item.name,
anchorX: (() => { anchorX: (() => {
if (item.name.length <= 2) { if (item.name.length < 2) {
return -6
}else if(item.name.length <= 2){
return -12 return -12
} else if (item.name.length <= 3) { } else if (item.name.length <= 3) {
return -20 return -20
@ -184,30 +190,11 @@
longitude, longitude,
width: 1, width: 1,
height: 1, height: 1,
id: 0, id: parseFloat(0),
iconPath:'', iconPath:'',
customCallout: { customCallout: {
// anchorY: -5, // anchorY: -5,
anchorX: (() => { anchorX:-5,
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

@ -265,7 +265,7 @@
components: {}, components: {},
data() { data() {
return { return {
listid: '',
maskgun: false, maskgun: false,
curren: '', curren: '',
qrcodevalue: '', // qrcodevalue: '', //
@ -303,7 +303,7 @@
total: 0, total: 0,
showflag: false, showflag: false,
masks: false, masks: false,
quchongid:'' quchongid: ''
}; };
}, },
onShow() { onShow() {
@ -319,7 +319,7 @@
this.loadData() this.loadData()
setTimeout(() => { setTimeout(() => {
uni.hideLoading() uni.hideLoading()
}, 5000) }, 3000)
// this.cheshi() // this.cheshi()
this.tabitems = [{ this.tabitems = [{
name: '全部' name: '全部'
@ -351,7 +351,7 @@
}, },
async loadData() { async loadData() {
// //
// await this.getfengchangList(); await this.getfengchangList();
// targetId // targetId
@ -360,6 +360,7 @@
if (targetId) { if (targetId) {
// this.checkid // this.checkid
this.checkid = targetId; this.checkid = targetId;
this.quchongid = targetId
const index = this.tabitems.findIndex(item => item.id === this.checkid); const index = this.tabitems.findIndex(item => item.id === this.checkid);
// this.currentindex // this.currentindex
this.currentindex = index; this.currentindex = index;
@ -579,12 +580,14 @@
title: res.data.msg, title: res.data.msg,
}) })
this.showfengzhong = false this.showfengzhong = false
this.listData = this.listData.filter(items => items.id !== this.listid)
this.refresh() this.refresh()
}) })
}) })
}, },
// //
migrtionHive(item) { migrtionHive(item) {
console.log(item);
this.HiddenClick(item) this.HiddenClick(item)
this.curren = item.id this.curren = item.id
// //
@ -597,8 +600,9 @@
id: e.id id: e.id
}) })
}) })
console.log(this.fengzhongcolumns); this.listid = item.id
this.showfengzhong = true this.showfengzhong = true
this.quchongid = item.apiary_id
}, },
// //
hiveTare(item) { hiveTare(item) {
@ -656,6 +660,7 @@
}) })
}, },
fenx(item) { fenx(item) {
console.log(item);
this.HiddenClick(item) this.HiddenClick(item)
if (item.detail_qrcode) { if (item.detail_qrcode) {
this.ewmflag = true this.ewmflag = true
@ -682,9 +687,8 @@
title: res.data.msg title: res.data.msg
}) })
}) })
lithis.loadData(); lithis.listData = lithis.listData.filter(items => items.id !== item.id)
// lithis.getfengchangList() // lithis.refresh()
lithis.refresh()
} else if (res.cancel) {} } else if (res.cancel) {}
} }
}) })
@ -695,9 +699,11 @@
}, },
// //
confirmname() { confirmname() {
request.put('/api/beehive/update/' + this.updataname.id, { let itemToChange = this.listData.find(item => item.id === this.listid)
name: this.form.inputvalue if (itemToChange) {
}).then(res => { itemToChange.name = this.form.inputvalue
}
request.put('/api/beehive/update/' + this.updataname.id, {name: this.form.inputvalue}).then(res => {
// this.getfengchangList() // this.getfengchangList()
this.refresh() this.refresh()
this.$nextTick(() => { this.$nextTick(() => {
@ -706,13 +712,13 @@
title: res.data.msg, title: res.data.msg,
}) })
}) })
}) })
this.form.inputvalue = '' this.form.inputvalue = ''
this.flageupdate() this.flageupdate()
}, },
// //
anewname(item) { anewname(item) {
this.listid = item.id
this.backToTop() this.backToTop()
this.HiddenClick(item) this.HiddenClick(item)
this.updataname.name = item.name this.updataname.name = item.name
@ -788,19 +794,18 @@
qrcode qrcode
} }
}).then(res => { }).then(res => {
if(res.statusCode == 200){ if (res.statusCode == 200) {
wx.setStorageSync('user_id', res.data.data[0].user_id); wx.setStorageSync('user_id', res.data.data[0].user_id);
this.total = res.data.total this.total = res.data.total
if(this.total > 0){ if (this.total > 0) {
this.masks = false this.masks = false
}else{ } else {
this.masks = true this.masks = true
} }
if (res.data.data.length > 0) { if (res.data.data.length > 0) {
// //
// this.listData = this.listData.concat(res.data.data)
this.listData.push(...res.data.data) this.listData.push(...res.data.data)
if (this.quchongid === '') { if (this.quchongid == '') {
let filteredData = this.listData let filteredData = this.listData
let uniqueIds = new Set() let uniqueIds = new Set()
let uniqueData = filteredData.filter(item => { let uniqueData = filteredData.filter(item => {
@ -811,34 +816,22 @@
return false return false
}) })
uniqueData.sort((a, b) => { uniqueData.sort((a, b) => {
// status_text
if (a.status_text !== b.status_text) { if (a.status_text !== b.status_text) {
// "线" "线"
return a.status_text === '在线' ? -1 : 1; return a.status_text === '在线' ? -1 : 1;
} }
// status_text name
// name
const numA = Number(a.name); const numA = Number(a.name);
const numB = Number(b.name); const numB = Number(b.name);
// name
if (!isNaN(numA) && !isNaN(numB)) { if (!isNaN(numA) && !isNaN(numB)) {
//
return numA - numB; return numA - numB;
} else if (!isNaN(numA)) { } else if (!isNaN(numA)) {
// a b
return -1; return -1;
} else if (!isNaN(numB)) { } else if (!isNaN(numB)) {
// b a b
return 1; return 1;
} else { } else {
//
return a.name.localeCompare(b.name); return a.name.localeCompare(b.name);
} }
}); });
// this.listData = filteredData; this.listData = uniqueData
this.listData = uniqueData;
} else { } else {
let filteredData = this.listData.filter(item => item.apiary_id === this.quchongid) let filteredData = this.listData.filter(item => item.apiary_id === this.quchongid)
let uniqueIds = new Set() let uniqueIds = new Set()
@ -849,16 +842,19 @@
} }
return false return false
}) })
this.listData = uniqueData; if (uniqueData.length > 0) {
this.listData = uniqueData
} else {
this.listData = []
}
} }
this.page++ this.page++
} }
uni.hideLoading() uni.hideLoading()
// //
wx.stopPullDownRefresh(); wx.stopPullDownRefresh();
// this.$forceUpdate() // this.$forceUpdate()
}else{ } else {
this.masks = true this.masks = true
} }
}).catch(e => {}) }).catch(e => {})
@ -906,12 +902,16 @@
}) })
}, },
clicktabs(event) { clicktabs(event) {
console.log(event); if (event.id) {
if(event.id){
this.quchongid = event.id this.quchongid = event.id
}else{ } else {
this.quchongid = '' this.quchongid = ''
} }
if(event.weight == '0KG'){
this.listData = []
// this.masks = true
console.log(this.listData);
}
uni.showLoading({ uni.showLoading({
title: '加载中', title: '加载中',
mask: true mask: true

View File

@ -38,13 +38,13 @@
src="../../static/wode-youjianto.png" src="../../static/wode-youjianto.png"
/> />
</view> </view>
<view @click="shouhuo" class="button-box flex-row justify-between items-center group_7"> <!-- <view @click="shouhuo" class="button-box flex-row justify-between items-center group_7">
<text class="font">收货地址</text> <text class="font">收货地址</text>
<image <image
class="image_6" class="image_6"
src="../../static/wode-youjianto.png" src="../../static/wode-youjianto.png"
/> />
</view> </view> -->
<view @click="shezhi" class="button-box flex-row justify-between items-center group_8"> <view @click="shezhi" class="button-box flex-row justify-between items-center group_8">
<text class="font text_6">设置</text> <text class="font text_6">设置</text>
<image <image

View File

@ -16,7 +16,7 @@
<view class="text-box">蜂场地区</view> <view class="text-box">蜂场地区</view>
<view> <view>
<u-button @click="show = true" class="input-b" shape="circle" <u-button @click="show = true" class="input-b" shape="circle"
placeholder="请选择蜂场地区">{{form.address}}</u-button> placeholder="请选择蜂场地区">{{form.area}}</u-button>
</view> </view>
</view> </view>
<!-- 具体位置 --> <!-- 具体位置 -->
@ -24,7 +24,7 @@
<view class="text-box">具体位置</view> <view class="text-box">具体位置</view>
<view @click="gotomap"> <view @click="gotomap">
<u--input class="input-b" shape="circle" placeholder="请选择具体位置" border="surround" <u--input class="input-b" shape="circle" placeholder="请选择具体位置" border="surround"
v-model="form.addresss">{{form.addresss}}</u--input> v-model="form.address">{{form.address}}</u--input>
<!-- <view class="input-b">{{form.lng}},{{form.lat}}</view> --> <!-- <view class="input-b">{{form.lng}},{{form.lat}}</view> -->
</view> </view>
</view> </view>
@ -91,7 +91,6 @@
lng: '', lng: '',
lat: '', lat: '',
address: '', address: '',
addresss:'',
bee_type: '', bee_type: '',
honey_source: '', honey_source: '',
remark: '', remark: '',
@ -167,9 +166,9 @@
uni.chooseLocation({ uni.chooseLocation({
success: (res) => { success: (res) => {
console.log(res); console.log(res);
this.form.lng = res.latitude this.form.lng = res.longitude
this.form.lat = res.longitude this.form.lat = res.latitude
this.form.addresss = res.address this.form.address = res.address
}, },
fail: function(err) { fail: function(err) {
// //
@ -359,7 +358,7 @@
confirm(e) { confirm(e) {
console.log('confirm', e) console.log('confirm', e)
this.form.area_id = e.areaId[2] this.form.area_id = e.areaId[2]
this.form.address = e.value.toString() // this.form.address = e.value.toString()
this.form.area = e.value.toString() this.form.area = e.value.toString()
console.log(this.form.area_id, this.form.address) console.log(this.form.area_id, this.form.address)
this.show = false this.show = false