This commit is contained in:
weipengfei 2024-03-06 17:40:26 +08:00
parent 90cb3619f5
commit 60f72cf533
8 changed files with 53 additions and 41 deletions

View File

@ -2,8 +2,8 @@
"name" : "养殖溯源", "name" : "养殖溯源",
"appid" : "__UNI__C509A32", "appid" : "__UNI__C509A32",
"description" : "", "description" : "",
"versionName" : "1.0.3", "versionName" : "1.0.4",
"versionCode" : 103, "versionCode" : 104,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {

View File

@ -221,7 +221,9 @@
if (res.code == 1) { if (res.code == 1) {
datalist.splice(0, datalist.length, ...res.data) res.data.forEach(item=>{
datalist.push(item)
})
res.data.detai res.data.detai
// console.log(res.data) // console.log(res.data)
} }

View File

@ -213,10 +213,10 @@
}).then((res) => { }).then((res) => {
if (res.code == 1) { if (res.code == 1) {
dataList.splice(0, dataList.length, ...res.data); res.data.forEach(item=>{
dataList.forEach(item => { item.showCode = false
item.showCode = false dataList.push(item)
}) })
console.log(dataList) console.log(dataList)
} }
}); });

View File

@ -298,7 +298,9 @@
item.pic = JSON.parse(item.pic||'[]'); item.pic = JSON.parse(item.pic||'[]');
return item return item
}) })
dataList.splice(0, dataList.length, ...res.data.lists); res.data.lists.forEach(item=>{
dataList.push(item)
})
// console.log(dataList) // console.log(dataList)
} }
}); });

View File

@ -8,10 +8,13 @@
<view class="left"> <view class="left">
<u--image @click="perviewFn(item.pic[0])" radius='10' :src="item.pic[0]" width="250rpx" <u--image @click="perviewFn(item.pic[0])" radius='10' :src="item.pic[0]" width="250rpx"
height="250rpx"></u--image> height="250rpx"></u--image>
<u---image class="qr-code" @click="showBarCode(item)" src="/static/main/house/su_yuan_ma_btn.png" width="60rpx" height="60rpx"></u---image> <u---image class="qr-code" @click="showBarCode(item)" src="/static/main/house/su_yuan_ma_btn.png"
width="60rpx" height="60rpx"></u---image>
</view> </view>
<u--image src="/static/main/house/xia_yi_ji_btn.png" class="next" width="38rpx" height="38rpx" @click="navTo(`/pages/plantAdmin/breedDetail?id=${item.id}&house_id=${item.fence_house_id}`)"></u--image> <u--image src="/static/main/house/xia_yi_ji_btn.png" class="next" width="38rpx" height="38rpx"
<view class="right" style="color: #7B7B7B;" @click="navTo(`/pages/plantAdmin/breedDetail?id=${item.id}&house_id=${item.fence_house_id}`)"> @click="navTo(`/pages/plantAdmin/breedDetail?id=${item.id}&house_id=${item.fence_house_id}`)"></u--image>
<view class="right" style="color: #7B7B7B;"
@click="navTo(`/pages/plantAdmin/breedDetail?id=${item.id}&house_id=${item.fence_house_id}`)">
<view class="name">{{item.sn}}</view> <view class="name">{{item.sn}}</view>
<view class="r-item"> <view class="r-item">
<view class="item-title">品类:</view> <view class="item-title">品类:</view>
@ -47,7 +50,7 @@
</view> </view>
</view> </view>
</view> </view>
<uni-popup ref="codeRef"> <uni-popup ref="codeRef">
<view class="bar-code"> <view class="bar-code">
<view class="title">{{options.code.split('d_')[1]}}</view> <view class="title">{{options.code.split('d_')[1]}}</view>
@ -60,7 +63,6 @@
</template> </template>
<script setup> <script setup>
import { import {
ref, ref,
reactive reactive
@ -76,9 +78,9 @@
import { import {
animalTypeLists animalTypeLists
} from "@/api/dict.js" } from "@/api/dict.js"
const dataList = reactive([]) const dataList = reactive([])
const typeID = ref('') const typeID = ref('')
// //
@ -87,14 +89,14 @@
url url
}) })
} }
const options = ref({ const options = ref({
code: '',// code: '', //
size: 460,// 460460rpx size: 460, // 460460rpx
}) })
const qrCode = ref(''); const qrCode = ref('');
const saveCode = async ()=>{// const saveCode = async () => { //
const img = await qrCode.value.GetCodeImg() const img = await qrCode.value.GetCodeImg()
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
filePath: img.tempFilePath, filePath: img.tempFilePath,
@ -115,7 +117,7 @@
}); });
} }
const codeRef = ref(null); const codeRef = ref(null);
const showBarCode = (e)=>{ const showBarCode = (e) => {
options.value.code = 'd_' + e.sn; options.value.code = 'd_' + e.sn;
codeRef.value.open(); codeRef.value.open();
} }
@ -143,7 +145,7 @@
dataList[i].showCode = !dataList[i].showCode dataList[i].showCode = !dataList[i].showCode
console.log(dataList[i].showCode) console.log(dataList[i].showCode)
} }
const where = ref({ const where = ref({
page_no: 1, page_no: 1,
page_size: 10 page_size: 10
@ -157,31 +159,33 @@
if (res.code == 1) { if (res.code == 1) {
res.data.lists = res.data.lists.map(item => { res.data.lists = res.data.lists.map(item => {
item.showCode = false; item.showCode = false;
item.pic = JSON.parse(item.pic||'[]'); item.pic = JSON.parse(item.pic || '[]');
return item return item
}) })
dataList.splice(0, dataList, ...res.data.lists); res.data.lists.forEach(item => {
dataList.push(item)
})
// console.log(dataList) // console.log(dataList)
} }
}); });
}; };
const animal_type_lists = ref([]); const animal_type_lists = ref([]);
const initAnimalTypeLists = ()=>{ const initAnimalTypeLists = () => {
animalTypeLists().then(res=>{ animalTypeLists().then(res => {
animal_type_lists.value = res.data; animal_type_lists.value = res.data;
}) })
} }
initAnimalTypeLists(); initAnimalTypeLists();
const getAnimalType = (value)=>{ const getAnimalType = (value) => {
return animal_type_lists.value.find(item=>item.value==value)?.name || '' return animal_type_lists.value.find(item => item.value == value)?.name || ''
} }
onLoad((option) => { onLoad((option) => {
typeID.value = option.id; typeID.value = option.id;
getlist(); getlist();
}); });
onReachBottom(()=>{ onReachBottom(() => {
where.value.page_no++; where.value.page_no++;
getlist(); getlist();
}) })
@ -289,7 +293,8 @@
.left { .left {
flex-shrink: 0; flex-shrink: 0;
position: relative; position: relative;
.qr-code{
.qr-code {
position: absolute; position: absolute;
right: 10rpx; right: 10rpx;
bottom: 10rpx; bottom: 10rpx;
@ -373,8 +378,8 @@
.actBtn { .actBtn {
background: linear-gradient(to right, #FEFFFF 0%, #E8FAF2 100%); background: linear-gradient(to right, #FEFFFF 0%, #E8FAF2 100%);
} }
.bar-code{ .bar-code {
padding: 28rpx; padding: 28rpx;
background-color: #fff; background-color: #fff;
border-radius: 24rpx; border-radius: 24rpx;
@ -382,12 +387,14 @@
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
.title{
.title {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
margin-bottom: 15rpx; margin-bottom: 15rpx;
} }
.btn{
.btn {
background-color: rgba(#999, 0.2); background-color: rgba(#999, 0.2);
font-size: 24rpx; font-size: 24rpx;
padding: 5rpx 20rpx; padding: 5rpx 20rpx;

View File

@ -210,8 +210,9 @@
item.pic = JSON.parse(item.pic||'[]'); item.pic = JSON.parse(item.pic||'[]');
return item return item
}) })
dataList.splice(0, dataList, ...res.data.lists); res.data.lists.forEach(item=>{
// console.log(dataList) dataList.push(item)
})
} }
}); });
}; };

File diff suppressed because one or more lines are too long

View File

@ -7,8 +7,8 @@
"id": "__UNI__C509A32", "id": "__UNI__C509A32",
"name": "养殖溯源", "name": "养殖溯源",
"version": { "version": {
"name": "1.0.3", "name": "1.0.4",
"code": 103 "code": 104
}, },
"description": "", "description": "",
"developer": { "developer": {