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

View File

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

View File

@ -38,13 +38,13 @@
src="../../static/wode-youjianto.png"
/>
</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>
<image
class="image_6"
src="../../static/wode-youjianto.png"
/>
</view>
</view> -->
<view @click="shezhi" class="button-box flex-row justify-between items-center group_8">
<text class="font text_6">设置</text>
<image

View File

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