cultivationApp/pages/feedIng/addPoultry.vue

313 lines
7.1 KiB
Vue
Raw Normal View History

2023-10-21 18:02:06 +08:00
<template>
2023-10-23 17:57:19 +08:00
<view class="content" @click.capture="off">
2023-10-21 18:02:06 +08:00
<view class="card">
<view class="card-tit">
<view class="">
编号: 13254
</view>
<view class="" style="color: green;">
健康
</view>
</view>
<view class="card-cont">
<view class="card-l">
<view class="">
养殖品种: 黑山🐖
</view>
<view class="">
养殖类型: 黑山🐖
</view>
<view class="">
年龄: 黑山🐖
</view>
<view class="">
体重: 黑山🐖
</view>
</view>
<view class="card-r">
<u--image src="/static/img/GJ.jpg" width="353.97rpx" height="210.28rpx" alt=""></u--image>
</view>
</view>
</view>
<view class="card">
<view class="card-li">
<view class="card-li-tit">
养殖品种
</view>
<view class="">
<up-input placeholder="请输入品种" border="surround" v-model="value" @change="change"></up-input>
</view>
</view>
<view class="card-li">
<view class="card-li-tit">
年龄
</view>
<view class="">
<up-input placeholder="请输入品种" border="surround" v-model="value" @change="change"></up-input>
</view>
</view>
<view class="card-li">
2023-10-23 17:57:19 +08:00
<view class="select">
养殖类型: <up-input readonly placeholder="请选择" style="margin-top: 20rpx;" border="surround"
@click.capture="selectFoucsFn" @blur="selectAct=false" v-model="value">
</up-input>
<view class="JT" :class="{actJT:selectAct}">
<u--image src="/static/img/XLJT.png" width="24.53rpx" height="24.53rpx"></u--image>
</view>
<view class="selectvalue" v-show="selectAct">
<view class="select-li" v-for="(item,index) in selectList" :key="index"
@click="changSelectfn(index)" :style="{color:indexs==index?'black':'#B3B3B3'}">
{{item}}
<view class="" v-show='indexs==index'>
<u--image src="/static/img/XLZZ.png" width="24.53rpx" height="24.53rpx"></u--image>
</view>
</view>
</view>
2023-10-21 18:02:06 +08:00
</view>
2023-10-23 17:57:19 +08:00
2023-10-21 18:02:06 +08:00
</view>
<view class="card-li">
2023-10-23 17:57:19 +08:00
<view class="select">
状态: <up-input readonly placeholder="请选择" style="margin-top: 20rpx;" border="surround"
@click.capture="selectFoucsFn1" @blur="selectAct1=false" v-model="value">
</up-input>
<view class="JT" :class="{actJT:selectAct1}">
<u--image src="/static/img/XLJT.png" width="24.53rpx" height="24.53rpx"></u--image>
</view>
<view class="selectvalue" v-show="selectAct1" style="bottom:-250rpx">
<view class="select-li" v-for="(item,index) in selectList1" :key="index"
@click="changSelectfn(index)" :style="{color:indexs==index?'black':'#B3B3B3'}">
{{item}}
<view class="" v-show='indexs==index'>
<u--image src="/static/img/XLZZ.png" width="24.53rpx" height="24.53rpx"></u--image>
</view>
</view>
</view>
2023-10-21 18:02:06 +08:00
</view>
</view>
<view class="card-li">
<view class="card-li-tit">
体重
</view>
<view class="">
<up-input placeholder="请输入品种" border="surround" v-model="value" @change="change"></up-input>
</view>
</view>
2023-10-23 17:57:19 +08:00
<view class="code-img">
<view class="carime-icon" @click="updateImgFn">
<u--image src="/static/img/DJSC.png" width="91.12rpx" height="91.12rpx"></u--image>
<view class="">
点击上传图片
</view>
</view>
2023-10-21 18:02:06 +08:00
</view>
</view>
<view class="next-btn">
下一个
</view>
<view class="ripe-btn">
完成添加
</view>
</view>
</template>
2023-10-23 17:57:19 +08:00
<script setup>
import {
reactive,
ref
} from "vue"
const off = () => {
selectAct.value = false
selectAct1.value = false
}
const selectList = reactive([
"幼崽", "公猪", "母猪"
])
const selectList1 = reactive([
"健康", "怀孕中", "生病隔离中", "可出栏"
])
const value = ref("")
const selectAct = ref(false)
const selectAct1 = ref(false)
const selectFoucsFn = (e) => {
selectAct.value = true
}
const selectFoucsFn1 = (e) => {
selectAct1.value = true
}
const indexs = ref(0)
const changSelectfn = (index) => {
indexs.value = index
value.value = selectList[index]
}
const updateImgFn = () => {
uni.chooseImage({
count: 1,
sizeType: ['compressed'],
sourceType: ['album'],
success: (res) => {
console.log('chooseImage success, temp path is', res.tempFilePaths[0])
var imageSrc = res.tempFilePaths[0]
uni.showLoading({
title: '上传中'
})
this.task = uni.uploadFile({
url: 'https://unidemo.dcloud.net.cn/upload', //仅为示例,非真实的接口地址
filePath: imageSrc,
name: 'file',
formData: {
'user': 'test'
},
success: (res) => {
if (this.pageVisible) {
console.log('uploadImage success, res is:', res)
uni.hideLoading();
uni.showToast({
title: '上传成功',
icon: 'success',
duration: 1000
})
this.imageSrc = imageSrc
}
},
fail: (err) => {
if (this.pageVisible) {
console.log('uploadImage fail', err);
uni.hideLoading();
uni.showModal({
content: err.errMsg,
showCancel: false
});
}
},
});
},
fail: (err) => {
console.log('chooseImage fail', err)
}
})
}
2023-10-21 18:02:06 +08:00
</script>
<style lang="scss">
.card-tit {
display: flex;
justify-content: space-between;
border-bottom: 1px solid #F4F4F4;
padding-bottom: 20rpx;
margin-bottom: 20rpx;
}
.card-cont {
display: flex;
justify-content: space-between;
.card-l {
display: flex;
flex-direction: column;
justify-content: space-between;
}
.card-r {
overflow: hidden;
border-radius: 21.03rpx 21.03rpx 21.03rpx 21.03rpx;
width: 353.97rpx;
height: 210.28rpx;
}
}
.card-li-tit {
margin-bottom: 20rpx;
}
.uplode {
height: 350.47rpx;
background-color: red;
}
.next-btn {
width: 196.26rpx;
height: 66.59rpx;
border: 1px solid #00A15E;
color: #00A15E;
border-radius: 42.06rpx 42.06rpx 42.06rpx 42.06rpx;
margin: 0 auto;
text-align: center;
line-height: 66rpx;
}
.ripe-btn {
width: 588.79rpx;
height: 84.11rpx;
background-color: #00A15E;
color: white;
display: flex;
justify-content: center;
align-items: center;
margin: 85rpx auto;
border-radius: 42.06rpx 42.06rpx 42.06rpx 42.06rpx;
background: linear-gradient(to right, #00A15E, #4CC593);
}
2023-10-23 17:57:19 +08:00
.select {
position: relative;
.JT {
position: absolute;
right: 20rpx;
top: 60%;
z-index: 9999;
transition: .2s;
}
.actJT {
transition: .2s;
transform: rotate(180deg);
}
.selectvalue {
position: absolute;
width: 608.53rpx;
background-color: white;
z-index: 99;
font-size: 26.29rpx;
left: 0rpx;
bottom: -200rpx;
border-radius: 21.03rpx 21.03rpx 21.03rpx 21.03rpx;
padding: 0 20rpx;
border: 1px solid #F4F4F4;
.select-li {
margin: 20rpx 0;
display: flex;
justify-content: space-between;
align-items: center;
}
}
}
.code-img {
background-color: #F4F4F4;
height: 196.26rpx;
position: relative;
.carime-icon {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
}
}
2023-10-21 18:02:06 +08:00
</style>