sss
This commit is contained in:
parent
758102723d
commit
71496d4116
38
page_user/about.vue
Normal file
38
page_user/about.vue
Normal file
|
@ -0,0 +1,38 @@
|
|||
<template>
|
||||
<view class="page">
|
||||
<u-navbar is-back="false" :title="title" :border-bottom="false" :background="bgc" title-color='#000'
|
||||
title-size='36' :title-bold='true' height='45' id="navbar">
|
||||
</u-navbar>
|
||||
<view class="">
|
||||
{{title}}
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
bgc: {
|
||||
backgroundColor: " #F4FAF8",
|
||||
},
|
||||
title: "",
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.title = option.tit
|
||||
},
|
||||
onShow() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #FAFDFD;
|
||||
}
|
||||
</style>
|
|
@ -333,32 +333,24 @@
|
|||
let earthRadiusKm = 6371; // 地球平均半径,单位:千米
|
||||
let radius = radiusInKm / earthRadiusKm; // 半径转换为弧度
|
||||
let points = [];
|
||||
|
||||
for (let i = 0; i < numPoints; i++) {
|
||||
let angle = (i / (numPoints - 1)) * 2 * Math.PI; // 角度从0到2π
|
||||
let latRad = lat * Math.PI / 180; // 中心纬度转换为弧度
|
||||
let lonRad = lon * Math.PI / 180; // 中心经度转换为弧度
|
||||
|
||||
// 使用球面三角学计算新点的经纬度
|
||||
let newLatRad = Math.asin(Math.sin(latRad) * Math.cos(radius) +
|
||||
Math.cos(latRad) * Math.sin(radius) * Math.cos(angle));
|
||||
let newLonRad = lonRad + Math.atan2(
|
||||
Math.sin(angle) * Math.sin(radius) * Math.cos(latRad),
|
||||
Math.cos(radius) - Math.sin(latRad) * Math.sin(newLatRad)
|
||||
);
|
||||
|
||||
// 将弧度转换回度
|
||||
let newLat = newLatRad * 180 / Math.PI;
|
||||
let newLon = (newLonRad + 3 * Math.PI) % (2 * Math.PI) - Math.PI; // 转换到-180到180的范围
|
||||
newLon = newLon * 180 / Math.PI;
|
||||
|
||||
// 添加到点数组
|
||||
points.push({
|
||||
latitude: newLat,
|
||||
longitude: newLon
|
||||
longitude: newLon
|
||||
});
|
||||
}
|
||||
|
||||
return points;
|
||||
},
|
||||
getmy() {
|
||||
|
|
468
pages/Apiary/Apiary_edit/Apiary_edit.vue
Normal file
468
pages/Apiary/Apiary_edit/Apiary_edit.vue
Normal file
|
@ -0,0 +1,468 @@
|
|||
<template>
|
||||
<view class="page">
|
||||
<u-navbar title="修改蜂场" :border-bottom="false" :background="bgc" title-color='#3D3D3D ' :title-bold='true'
|
||||
title-size='36' height='45' id="navbar">
|
||||
</u-navbar>
|
||||
<view class="tit">
|
||||
蜂场名称
|
||||
</view>
|
||||
<view class="iptbox">
|
||||
<input type="text" class="ips" v-model="code" placeholder="请输入蜂场名称(5个字以内)"
|
||||
placeholder-class="my-placeholder" />
|
||||
|
||||
</view>
|
||||
|
||||
<view class="tit">
|
||||
具体位置
|
||||
</view>
|
||||
<view class="iptbox" @click="chooseAddress()">
|
||||
<input type="text" class="ips" v-model="form.address" placeholder="请选择蜂场具体位置"
|
||||
placeholder-class="my-placeholder" disabled />
|
||||
<image src="https://api.ccttiot.com/smartmeter/img/static/ugAdKZm5ZHZ4to1cDsNI" mode=""></image>
|
||||
</view>
|
||||
<view class="tit">
|
||||
养殖蜂种
|
||||
</view>
|
||||
<view class="iptbox" @click="showfengzhong = true">
|
||||
<input type="text" class="ips" v-model="fengzhong" placeholder="请选择养殖蜂种" placeholder-class="my-placeholder"
|
||||
disabled />
|
||||
<image src="https://api.ccttiot.com/smartmeter/img/static/ugAdKZm5ZHZ4to1cDsNI" mode=""></image>
|
||||
</view>
|
||||
<view class="tit">
|
||||
采集蜜源
|
||||
</view>
|
||||
<view class="iptbox" @click="showmiyuan = true">
|
||||
<input type="text" class="ips" v-model="miyuan" placeholder="请选择采集蜜源" placeholder-class="my-placeholder"
|
||||
disabled />
|
||||
<image src="https://api.ccttiot.com/smartmeter/img/static/ugAdKZm5ZHZ4to1cDsNI" mode=""></image>
|
||||
</view>
|
||||
<view class="tit">
|
||||
照片
|
||||
</view>
|
||||
<view class="imgbox" @click="btn" v-if="userImgs==''">
|
||||
<view class="">
|
||||
|
||||
</view>
|
||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uLpiGDDDvBwk7hOhOtVp" mode="" v-if=""></image>
|
||||
|
||||
</view>
|
||||
<view class="imgbox" @click="btn" v-else>
|
||||
<image :src="userImgs" mode="" v-if=""></image>
|
||||
|
||||
</view>
|
||||
<u-select v-model="showfengzhong" :list="fengzhongcolumns" title='选择蜂种' @confirm="confirmfz"></u-select>
|
||||
<u-select v-model="showmiyuan" :list="miyuancolumns" title='选择蜜源' @confirm="confirmmy"></u-select>
|
||||
<view class="btn" @click="btnadd">
|
||||
确认修改
|
||||
</view>
|
||||
<view class="btns" @click="btndel">
|
||||
删除蜂场
|
||||
</view>
|
||||
<!-- <u-picker @cancel="showmiyuan=false" @confirm="confirmmiyuan" :show="showmiyuan"
|
||||
:columns="miyuancolumns"></u-picker> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
bgc: {
|
||||
backgroundColor: " #FAFDFD",
|
||||
},
|
||||
code: '',
|
||||
fengzhong: '',
|
||||
miyuan: '',
|
||||
fengzhongcolumns: [
|
||||
|
||||
],
|
||||
miyuancolumns: [
|
||||
|
||||
|
||||
],
|
||||
showfengzhong: false,
|
||||
showmiyuan: false,
|
||||
form: {
|
||||
lat: 0,
|
||||
lng: 0,
|
||||
address: '',
|
||||
province: '',
|
||||
city: '',
|
||||
county: '',
|
||||
beeType: '',
|
||||
honeyType: ''
|
||||
},
|
||||
|
||||
userImgs: '',
|
||||
token: '',
|
||||
sn: '',
|
||||
upurl: 'https://api.ccttiot.com/',
|
||||
apiaryId: ''
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.apiaryId = option.apiaryId
|
||||
this.getfc()
|
||||
},
|
||||
onShow() {
|
||||
this.getQiniuToken()
|
||||
this.getfengzhongcolumns()
|
||||
this.getmiyuancolumns()
|
||||
},
|
||||
methods: {
|
||||
confirmfz(e) {
|
||||
this.form.beeType = e[0].value
|
||||
this.fengzhong = e[0].label
|
||||
},
|
||||
confirmmy(e) {
|
||||
this.form.honeyType = e[0].value
|
||||
this.miyuan = e[0].label
|
||||
},
|
||||
btndel() {
|
||||
let that = this;
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: '确定要删除此蜂场?请谨慎操作',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
that.$u.delete(`/farm/apiary/${that.apiaryId}`).then(res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
title: '删除蜂场成功',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({
|
||||
delta:2
|
||||
});
|
||||
}, 1500);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('删除蜂场失败:', error);
|
||||
uni.showToast({
|
||||
title: '删除蜂场失败,请稍后再试',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
btnadd() {
|
||||
let data = {
|
||||
apiaryId: this.apiaryId,
|
||||
name: this.code,
|
||||
picture: this.userImgs,
|
||||
address: this.form.address,
|
||||
province: this.form.province,
|
||||
city: this.form.city,
|
||||
county: this.form.county,
|
||||
lng: this.form.lng,
|
||||
lat: this.form.lat,
|
||||
beeType: this.form.beeType,
|
||||
honeyType: this.form.honeyType
|
||||
}
|
||||
this.$u.put("/farm/apiary", data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
title: '修改蜂场成功',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
getfc() {
|
||||
this.$u.get(`/farm/apiary/${this.apiaryId}`).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.code = res.data.name
|
||||
this.userImgs = res.data.picture
|
||||
this.form.address = res.data.address
|
||||
this.form.province = res.data.province
|
||||
this.form.city = res.data.city
|
||||
this.form.county = res.data.county
|
||||
this.form.lng = res.data.lng
|
||||
this.form.lat = res.data.lat
|
||||
this.form.beeType = res.data.beeType
|
||||
this.form.honeyType = res.data.honeyType
|
||||
this.miyuancolumns.forEach(item => {
|
||||
if (res.data.honeyType.includes(item.value)) {
|
||||
this.miyuan = item.label
|
||||
}
|
||||
})
|
||||
this.fengzhongcolumns.forEach(item => {
|
||||
if (res.data.beeType.includes(item.value)) {
|
||||
this.fengzhong = item.label
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
getQiniuToken() {
|
||||
this.$u.get("/common/qiniu/uploadInfo").then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.token = res.token
|
||||
|
||||
}
|
||||
});
|
||||
// this.$u.get('https://v2.ielts.langsi.online/file/getToken').then(res => {
|
||||
// console.log(res.data);
|
||||
// this.token = res.data.token
|
||||
// }).catch(err => {
|
||||
// console.log(err)
|
||||
// })
|
||||
|
||||
},
|
||||
getfengzhongcolumns() {
|
||||
let data = {
|
||||
dictType: 'apiary_bee_type'
|
||||
}
|
||||
this.$u.get("/common/getDictByType?", data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.fengzhongcolumns = res.data.map(item => ({
|
||||
value: item.dictValue,
|
||||
label: item.dictLabel
|
||||
}));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
getmiyuancolumns() {
|
||||
let data = {
|
||||
dictType: 'apiary_honey_type'
|
||||
}
|
||||
this.$u.get("/common/getDictByType?", data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.miyuancolumns = res.data.map(item => ({
|
||||
value: item.dictValue,
|
||||
label: item.dictLabel
|
||||
}));
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
addApiary() {
|
||||
let data = {
|
||||
|
||||
}
|
||||
this.$u.get('/farm/apiary', data).then((res) => {
|
||||
|
||||
if (res.code === 200) {
|
||||
uni.navigateBack({
|
||||
delta: 1 // delta值为1时表示返回的页面层数
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
btn() {
|
||||
let _this = this
|
||||
let math = 'static/' + _this.$u.guid(20)
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
type: 'all',
|
||||
success(res) {
|
||||
// tempFilePath可以作为img标签的src属性显示图片
|
||||
const tempFilePaths = res.tempFiles
|
||||
// let tempFilePaths = chooseImageRes.tempFilePaths;
|
||||
// console.log(tempFilePaths)
|
||||
// tempFilePaths.forEach(item=>{
|
||||
// // 上传图片到七牛云
|
||||
|
||||
// })
|
||||
wx.uploadFile({
|
||||
url: 'https://up-z2.qiniup.com',
|
||||
name: 'file',
|
||||
filePath: tempFilePaths[0].path,
|
||||
formData: {
|
||||
token: _this.token, //后端返回的token
|
||||
key: 'smartmeter/img/' + math
|
||||
},
|
||||
success: function(res) {
|
||||
console.log(res, 'resres');
|
||||
let str = JSON.parse(res.data)
|
||||
console.log(str.key)
|
||||
_this.userImgs = _this.upurl + '/' + str.key
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
confirmfengzhong(e) {
|
||||
console.log(e);
|
||||
this.form.bee_type = e.value[0].id
|
||||
this.form.bee_type_text = e.value[0].text
|
||||
|
||||
this.showfengzhong = false
|
||||
},
|
||||
confirmmiyuan(e) {
|
||||
this.form.honey_source = e.value[0].id
|
||||
this.form.honey_source_text = e.value[0].text
|
||||
this.showmiyuan = false
|
||||
},
|
||||
sourcelist() {
|
||||
request.put("/api/apiary/info", {}).then(res => {
|
||||
this.fengzhongcolumns[0] = this.setfor(res.data.data.bee_type)
|
||||
this.miyuancolumns[0] = this.setfor(res.data.data.honey_source)
|
||||
})
|
||||
},
|
||||
chooseAddress() {
|
||||
uni.chooseLocation({
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
let address = res.address;
|
||||
let regex =
|
||||
/^([\u4e00-\u9fa5]+省)([\u4e00-\u9fa5]+市)([\u4e00-\u9fa5]+市|[\u4e00-\u9fa5]+区)(.*)/;
|
||||
let match = address.match(regex);
|
||||
if (match && match.length > 3) {
|
||||
let province = match[1];
|
||||
let city = match[2];
|
||||
let district = match[3];
|
||||
this.form.province = province
|
||||
this.form.city = city
|
||||
this.form.county = district
|
||||
} else {
|
||||
console.log('地址格式不匹配或无法提取省市区信息');
|
||||
}
|
||||
this.form.lng = res.longitude
|
||||
this.form.lat = res.latitude
|
||||
this.form.address = res.address
|
||||
},
|
||||
fail: function(err) {
|
||||
// 检查错误消息,看是否是用户取消了位置选择
|
||||
if (err.errMsg && err.errMsg.indexOf('chooseLocation:cancel') === 0) {
|
||||
uni.showToast({
|
||||
title: '您取消了位置选择',
|
||||
icon: 'none'
|
||||
});
|
||||
} else {
|
||||
console.log('选择位置失败', err);
|
||||
// 处理其他失败情况
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #FAFDFD;
|
||||
}
|
||||
|
||||
.page {
|
||||
padding-bottom: 200rpx;
|
||||
// position: relative;
|
||||
width: 750rpx;
|
||||
|
||||
.btn {
|
||||
position: fixed;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
bottom: 150rpx;
|
||||
left: 46rpx;
|
||||
width: 658rpx;
|
||||
height: 88rpx;
|
||||
background: #FFCC25;
|
||||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.btns {
|
||||
position: fixed;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
bottom: 50rpx;
|
||||
left: 46rpx;
|
||||
width: 658rpx;
|
||||
height: 88rpx;
|
||||
background: #D8D8D8;
|
||||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #808080;
|
||||
}
|
||||
|
||||
.tit {
|
||||
margin-top: 40rpx;
|
||||
margin-left: 50rpx;
|
||||
font-weight: 600;
|
||||
font-size: 32rpx;
|
||||
color: #3D3D3D;
|
||||
}
|
||||
|
||||
.imgbox {
|
||||
margin-top: 28rpx;
|
||||
margin-left: 46rpx;
|
||||
|
||||
image {
|
||||
width: 412rpx;
|
||||
height: 222rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.iptbox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
padding: 22rpx;
|
||||
margin: 28rpx auto 0;
|
||||
width: 658rpx;
|
||||
height: 88rpx;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
|
||||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||||
|
||||
.ips {
|
||||
width: 630rpx;
|
||||
|
||||
}
|
||||
|
||||
image {
|
||||
width: 18rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
.my-placeholder {
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
color: #808080;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
709
pages/Apiary/addrizhi.vue
Normal file
709
pages/Apiary/addrizhi.vue
Normal file
|
@ -0,0 +1,709 @@
|
|||
<template>
|
||||
<view class="page">
|
||||
<u-navbar :title="title" :border-bottom="false" :background="bgc" title-color='#000' title-size='36'
|
||||
:title-bold='true' height='45' id="navbar">
|
||||
</u-navbar>
|
||||
<view class="top">
|
||||
<view class="top_left">
|
||||
{{apiaryName}}
|
||||
</view>
|
||||
<view class="top_right" @click="showmiyuan = true">
|
||||
其他蜂箱 <view class="iconfont icon-xiangyou1" style="font-size: 40rpx;">
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="set_log_box">
|
||||
<view class="tit">
|
||||
选择操作类型
|
||||
</view>
|
||||
<view class="set_type_box">
|
||||
<view class="type_li" v-for="(item,index) in tabs" :key="index" @click="btntab(index,item.type)"
|
||||
:class='indexs==index?"act1":""'>
|
||||
{{item.title}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="tit" style="margin-top: 48rpx;">
|
||||
上传操作图片
|
||||
</view>
|
||||
<view class="icon">
|
||||
<view class="imgbox" v-if="imglist != ''" v-for="(item,index) in imglist " :key="index">
|
||||
<view v-if="title == '编辑操作日志'" class="xx" @click="imgdel(index)">×</view>
|
||||
<image :src="item" mode=""></image>
|
||||
</view>
|
||||
<view class="imgbox" @click="btn">
|
||||
<image src="https://api.ccttiot.com/smartmeter/img/static/ulkCEWjWYqwijg7yhdY9" mode=""></image>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="tit" style="margin-top: 48rpx;">
|
||||
操作说明描述
|
||||
</view>
|
||||
<view class="input-container">
|
||||
<view class="placeholder" v-if="!textValue">在此输入文字描述(选填)</view>
|
||||
<textarea class="custom-textarea" v-model="textValue" @focus="hidePlaceholder" style="border: none;"
|
||||
@input="updateWordCount" @blur="showPlaceholder"></textarea>
|
||||
<text class="word-count">{{ currentCount }}/140</text>
|
||||
</view>
|
||||
<view class="xy">
|
||||
<u-checkbox-group>
|
||||
<u-checkbox v-model="checked" shape="circle" active-color="#FFCC25"
|
||||
@change="checkboxChange">该蜂场的所有蜂箱进行此日志,并且记录</u-checkbox>
|
||||
</u-checkbox-group>
|
||||
<view class="txt">
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn" v-if="title == '添加操作日志'" @click="btnadd">
|
||||
确认添加
|
||||
</view>
|
||||
<view class="btn" v-else @click="btnedit">
|
||||
确认修改
|
||||
</view>
|
||||
</view>
|
||||
<u-select v-model="showmiyuan" :list="fclist" title='选择蜂场' @confirm="confirmmy"></u-select>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
bgc: {
|
||||
backgroundColor: " #F4FAF8",
|
||||
},
|
||||
showmiyuan: false,
|
||||
title: "添加操作日志",
|
||||
currentIndex: 0,
|
||||
wuflag: false,
|
||||
tabs: [{
|
||||
title: '换脾',
|
||||
type: 1
|
||||
},
|
||||
{
|
||||
title: '饲喂',
|
||||
type: 2
|
||||
},
|
||||
{
|
||||
title: '取蜜',
|
||||
type: 3
|
||||
},
|
||||
{
|
||||
title: '加牌',
|
||||
type: 4
|
||||
},
|
||||
{
|
||||
title: '除螨',
|
||||
type: 5
|
||||
},
|
||||
{
|
||||
title: '换王',
|
||||
type: 6
|
||||
},
|
||||
{
|
||||
title: '换位置',
|
||||
type: 7
|
||||
},
|
||||
|
||||
],
|
||||
textValue: '',
|
||||
currentCount: 0,
|
||||
showxy: false,
|
||||
apiaryId: '',
|
||||
beehiveId: '',
|
||||
fclist: [],
|
||||
apiaryName: '',
|
||||
type: null,
|
||||
indexs: -1,
|
||||
imglist: [],
|
||||
token: '',
|
||||
checked: false,
|
||||
id: '',
|
||||
arrimg:[]
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
if (option.id) {
|
||||
this.id = option.id
|
||||
this.title = '编辑操作日志'
|
||||
this.getxq()
|
||||
}
|
||||
this.getQiniuToken()
|
||||
this.getfc()
|
||||
},
|
||||
onShow() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
// 编辑
|
||||
getxq() {
|
||||
this.$u.get(`/farm/beehive/log/${this.id}`).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.type = res.data.type
|
||||
this.apiaryId = res.data.beehiveId
|
||||
this.indexs = res.data.type - 1
|
||||
this.apiaryName = res.data.beehiveName
|
||||
this.textValue = res.data.content
|
||||
this.checked = res.data.apiaryLog
|
||||
if(res.data.picture.length > 0){
|
||||
this.imglist = res.data.picture.split(',')
|
||||
}else{
|
||||
this.imglist = []
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
imgdel(indexToRemove){
|
||||
this.imglist = this.imglist.filter((item, index) => index !== indexToRemove)
|
||||
},
|
||||
btnedit(){
|
||||
if (this.imglist) {
|
||||
let validUrls = this.imglist.filter(item => typeof item === 'string')
|
||||
this.arrimg = validUrls.join(',')
|
||||
}
|
||||
let data = {
|
||||
id:this.id,
|
||||
beehiveId: this.apiaryId,
|
||||
type: this.type,
|
||||
content: this.textValue,
|
||||
picture: this.arrimg,
|
||||
apiaryLog: this.checked
|
||||
}
|
||||
this.$u.put(`/farm/beehive/log`,data).then(res => {
|
||||
if(res.code == 200){
|
||||
uni.showToast({
|
||||
title: '编辑成功',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
|
||||
checkboxChange(e) {
|
||||
this.checked = e
|
||||
},
|
||||
btnadd() {
|
||||
if (this.imglist) {
|
||||
let validUrls = this.imglist.filter(item => typeof item === 'string')
|
||||
this.imglist = validUrls.join(',')
|
||||
}
|
||||
let data = {
|
||||
beehiveId: this.apiaryId,
|
||||
type: this.type,
|
||||
content: this.textValue,
|
||||
picture: this.imglist,
|
||||
apiaryLog: this.checked
|
||||
}
|
||||
this.$u.post(`/farm/beehive/log`, data).then(res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
title: '创建成功',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
confirmmy(e) {
|
||||
this.apiaryId = e[0].value
|
||||
this.apiaryName = e[0].label
|
||||
},
|
||||
// 请求蜂箱
|
||||
getfc() {
|
||||
this.$u.get(`/farm/beehive/listAll`).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.fclist = res.data.map(item => ({
|
||||
value: item.beehiveId,
|
||||
label: item.name
|
||||
}))
|
||||
}
|
||||
})
|
||||
},
|
||||
btntab(index, type) {
|
||||
this.type = type
|
||||
this.indexs = index
|
||||
},
|
||||
hidePlaceholder() {
|
||||
this.placeholderVisible = false;
|
||||
},
|
||||
showPlaceholder() {
|
||||
if (!this.textValue) {
|
||||
this.placeholderVisible = true;
|
||||
}
|
||||
},
|
||||
updateWordCount() {
|
||||
this.currentCount = this.textValue.trim().replace(/\s+/g, '').length;
|
||||
},
|
||||
getQiniuToken() {
|
||||
this.$u.get("/common/qiniu/uploadInfo").then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.token = res.token
|
||||
}
|
||||
});
|
||||
},
|
||||
btn() {
|
||||
let _this = this
|
||||
let math = 'static/' + _this.$u.guid(20)
|
||||
uni.chooseImage({
|
||||
count: 9,
|
||||
type: 'all',
|
||||
success(res) {
|
||||
const tempFilePaths = res.tempFiles
|
||||
wx.uploadFile({
|
||||
url: 'https://up-z2.qiniup.com',
|
||||
name: 'file',
|
||||
filePath: tempFilePaths[0].path,
|
||||
formData: {
|
||||
token: _this.token, //后端返回的token
|
||||
key: 'smartmeter/img/' + math
|
||||
},
|
||||
success: function(res) {
|
||||
let str = JSON.parse(res.data)
|
||||
_this.userImgs = 'https://api.ccttiot.com/' + str.key
|
||||
_this.imglist.push(_this.userImgs)
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
changeTag(idx, type) {
|
||||
this.type = type
|
||||
this.currentIndex = idx
|
||||
this.getfxrz()
|
||||
},
|
||||
ClickImage(PhotoAddress) {
|
||||
uni.previewImage({
|
||||
urls: [PhotoAddress], //需要预览的图片http链接列表,多张的时候,url直接写在后面就行了
|
||||
current: '', // 当前显示图片的http链接,默认是第一个
|
||||
success: function(res) {},
|
||||
fail: function(res) {},
|
||||
complete: function(res) {},
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #F4FAF8;
|
||||
}
|
||||
|
||||
.addtj {
|
||||
width: 300rpx;
|
||||
height: 90rpx;
|
||||
background-color: #FFCC25;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
line-height: 90rpx;
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
bottom: 150rpx;
|
||||
border-radius: 10rpx;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
|
||||
.page {
|
||||
// position: relative;
|
||||
width: 750rpx;
|
||||
padding-bottom: 300rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.no_cont {
|
||||
margin: 152rpx auto 0;
|
||||
width: 432rpx;
|
||||
|
||||
.img {
|
||||
image {
|
||||
width: 432rpx;
|
||||
height: 432rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.txt {
|
||||
margin-top: 50rpx;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #808080;
|
||||
}
|
||||
}
|
||||
|
||||
.set_log_box {
|
||||
padding: 50rpx 56rpx;
|
||||
|
||||
.btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: fixed;
|
||||
left: 58rpx;
|
||||
bottom: 68rpx;
|
||||
width: 638rpx;
|
||||
height: 88rpx;
|
||||
background: #FFCC25;
|
||||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.xy {
|
||||
margin-top: 46rpx;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.yuans {
|
||||
margin-top: 2rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
border-radius: 50%;
|
||||
border: #808080 solid 2rpx;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.txt {
|
||||
margin-left: 10rpx;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #808080;
|
||||
|
||||
span {
|
||||
color: #3D3D3D;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.input-container {
|
||||
position: relative;
|
||||
width: 612rpx;
|
||||
height: 172rpx;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42, 130, 228, 0.1);
|
||||
border-radius: 20rpx;
|
||||
margin-top: 40rpx;
|
||||
overflow: hidden;
|
||||
padding-right: 38rpx;
|
||||
box-sizing: border-box;
|
||||
border: 2rpx solid #C7C7C7;
|
||||
}
|
||||
|
||||
.placeholder {
|
||||
position: absolute;
|
||||
top: 18rpx;
|
||||
left: 38rpx;
|
||||
color: #999;
|
||||
/* placeholder颜色 */
|
||||
pointer-events: none;
|
||||
/* 确保点击事件可以穿透到textarea上 */
|
||||
}
|
||||
|
||||
.custom-textarea {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
/* 设置一个合适高度 */
|
||||
padding-top: 18rpx;
|
||||
/* 为placeholder留出空间 */
|
||||
padding-left: 38rpx;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.word-count {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
bottom: 10px;
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.icon {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
margin-top: 40rpx;
|
||||
|
||||
.imgbox {
|
||||
width: 33%;
|
||||
padding-right: 10rpx;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
.xx{
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
background-color: red;
|
||||
text-align: center;
|
||||
line-height: 40rpx;
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
position: absolute;
|
||||
top: -8rpx;
|
||||
right: 0;
|
||||
}
|
||||
image {
|
||||
height: 212rpx;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.tit {
|
||||
font-weight: 600;
|
||||
font-size: 36rpx;
|
||||
color: #3D3D3D;
|
||||
}
|
||||
|
||||
.set_type_box {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
// margin-top: 26rpx;
|
||||
.type_li {
|
||||
margin-top: 26rpx;
|
||||
margin-right: 18rpx;
|
||||
padding: 12rpx 50rpx;
|
||||
background: #FFF5D6;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
border: 2rpx solid #FFC107;
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #3D3D3D;
|
||||
}
|
||||
|
||||
.act1 {
|
||||
background: #FFC107;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
border: 2rpx solid #FFC107;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 22rpx;
|
||||
margin: 0 auto;
|
||||
width: 658rpx;
|
||||
height: 106rpx;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
|
||||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||||
|
||||
.top_left {
|
||||
font-weight: 600;
|
||||
font-size: 36rpx;
|
||||
color: #3D3D3D;
|
||||
}
|
||||
|
||||
.top_right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
font-weight: 500;
|
||||
font-size: 36rpx;
|
||||
color: #808080;
|
||||
}
|
||||
}
|
||||
|
||||
.cont_box {
|
||||
margin-top: 26rpx;
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
|
||||
.left {
|
||||
margin-left: 48rpx;
|
||||
width: 216rpx;
|
||||
|
||||
.left_cont_box {
|
||||
width: 216rpx;
|
||||
height: 100rpx;
|
||||
background: #fff;
|
||||
|
||||
.left_cont {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 216rpx;
|
||||
height: 100rpx;
|
||||
font-weight: 600;
|
||||
font-size: 36rpx;
|
||||
color: #3D3D3D;
|
||||
background-color: #F4FAF8;
|
||||
|
||||
// border-radius: 0rpx 40rpx 40rpx 0rpx;
|
||||
// border: 1rpx solid #fff;
|
||||
|
||||
}
|
||||
|
||||
.act1 {
|
||||
background: #fff;
|
||||
border-radius: 40rpx 0 0 40rpx;
|
||||
// box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.act2 {
|
||||
border-radius: 0rpx 0rpx 40rpx 0rpx;
|
||||
}
|
||||
|
||||
.act3 {
|
||||
border-radius: 0rpx 40rpx 0rpx 0rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.act4 {
|
||||
background-color: #F4FAF8;
|
||||
border-radius: 40rpx 0 0 40rpx;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.right {
|
||||
padding: 16rpx;
|
||||
margin-left: -10rpx;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
background: #fff;
|
||||
|
||||
.right_cont {
|
||||
padding: 20rpx 26rpx;
|
||||
border: 2rpx solid #D8D8D8;
|
||||
border-radius: 20rpx;
|
||||
margin-top: 20rpx;
|
||||
|
||||
.log_work {
|
||||
margin-top: 16rpx;
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
|
||||
.work_cont {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
|
||||
image {
|
||||
width: 29rpx;
|
||||
height: 29rpx;
|
||||
}
|
||||
|
||||
.cont_xtx {
|
||||
margin-left: 6rpx;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #3D3D3D;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.log_info {
|
||||
margin-top: 16rpx;
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.txt {
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #3D3D3D;
|
||||
}
|
||||
}
|
||||
|
||||
.imgcont {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 16rpx;
|
||||
|
||||
.img_box {
|
||||
margin-top: 16rpx;
|
||||
margin-right: 14rpx;
|
||||
height: 124rpx;
|
||||
width: 124rpx;
|
||||
|
||||
image {
|
||||
background: #D8D8D8;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
height: 124rpx;
|
||||
width: 124rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||||
.cont {
|
||||
margin-top: 16rpx;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #3D3D3D;
|
||||
}
|
||||
|
||||
.right_cont_top {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.cont_left {
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #808080;
|
||||
}
|
||||
|
||||
.cont_right {
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
color: #FFC107;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// border-radius: 40rpx 0 0 40rpx;
|
||||
// box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user