TraceabilityAPP/pages/aquatic/addAquatic.vue

207 lines
4.3 KiB
Vue
Raw Normal View History

2023-10-23 17:57:19 +08:00
<template>
<view class="content" @click.capture="off">
<view class="card">
<view class="" style="margin-bottom: 20rpx;">
养殖品种: 白鲢
</view>
<view class="" style="margin-bottom: 20rpx;">
养殖数量: 白鲢
</view>
<view class="" style="margin-bottom: 20rpx;">
鱼苗购入点: 白鲢
</view>
<view class="" style="margin-bottom: 20rpx;">
购入凭证
</view>
<view class="code-img">
<view class="carime-icon">
</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">
<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-tit">
购入凭证
</view>
<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>
</view>
</view>
<view class="next-btn">
下一个
</view>
<view class="ripe-btn" @click="navgo('/pages/index/index')">
完成添加
</view>
</view>
</template>
<script setup>
import {
reactive,
ref
} from "vue"
const navgo = (url) => {
uni.navigateTo({
url
})
}
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)
}
})
}
</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);
}
.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;
}
}
</style>