TraceabilityAPP/pages/index/index.vue

131 lines
2.7 KiB
Vue
Raw Normal View History

2023-10-17 11:00:41 +08:00
<template>
2023-10-17 16:02:55 +08:00
<view class="">
2023-10-20 18:45:15 +08:00
<view class="tabbar">
<view class="" style="padding-top:var(--status-bar-height) ;">
</view>
2023-10-17 16:02:55 +08:00
2023-10-20 18:45:15 +08:00
<view class="" style="display: flex;">
<u--image src="/static/img/FH.png" width="50.82rpx" height="50.82rpx" alt=""></u--image>
<view class="scoll-list">
2023-10-23 17:57:19 +08:00
<view v-for="(item,index) in list" :key="index" class="scoll-list-li"
:style="{color:flag==item.id?'white':''}" @tap="scollChangeFn(item.id)">
2023-10-20 18:45:15 +08:00
{{item.tit}}
</view>
</view>
</view>
</view>
<view style="background-color: #34D190;">
<view class="" style="padding-top:var(--status-bar-height) ;">
</view>
<view class="" style="height: 100rpx;">
</view>
</view>
2023-10-21 18:02:06 +08:00
2023-10-20 18:45:15 +08:00
<!-- 种植户首页 -->
2023-10-25 19:55:18 +08:00
<planting v-if='flag==1' :userInfo='userInfo'></planting>
2023-10-21 18:02:06 +08:00
<!-- 养猪的 -->
2023-10-25 19:55:18 +08:00
<cultivation v-if="flag==2" :userInfo='userInfo'></cultivation>
2023-10-23 17:57:19 +08:00
<!-- 养鸡的 -->
2023-10-25 19:55:18 +08:00
<chick v-if="flag==3" :userInfo='userInfo'> </chick>
2023-10-23 17:57:19 +08:00
<!-- 卖鱼的首页 -->
2023-10-25 19:55:18 +08:00
<fishing v-if='flag==4' :userInfo='userInfo'></fishing>
2023-10-23 17:57:19 +08:00
2023-10-17 11:00:41 +08:00
</view>
</template>
2023-10-17 16:02:55 +08:00
<script setup>
2023-10-25 19:55:18 +08:00
import {
userInfoAPI
} from "@/api/plant.js"
2023-10-17 16:02:55 +08:00
import {
2023-10-20 18:45:15 +08:00
reactive,
2023-10-17 16:02:55 +08:00
ref
} from 'vue';
2023-10-25 19:55:18 +08:00
2023-10-17 16:02:55 +08:00
import {
onLoad
} from "@dcloudio/uni-app"
2023-10-21 18:02:06 +08:00
import cultivation from "@/components/index/cultivation.vue"
2023-10-20 18:45:15 +08:00
import planting from "@/components/index/planting.vue"
import fishing from "@/components/index/fishing.vue"
2023-10-23 17:57:19 +08:00
import chick from "@/components/index/chick.vue"
const flag = ref(1)
const scollChangeFn = (index) => {
flag.value = index
}
2023-10-25 19:55:18 +08:00
const list = reactive([])
const userInfo = reactive({
})
const initUserinfoFn = () => {
userInfoAPI({
user_id: 307
}).then(res => {
for (const key in res.data) {
userInfo[key] = (res.data)[key]
if (key == 'land_detail') {
list.push({
tit: "土地种植管理",
id: 1,
}, )
} else if (key == 'animal_detail') {
list.push({
tit: "家畜养殖管理",
id: 2,
}, )
} else if (key == 'poultry_detail') {
list.push({
tit: "家禽养殖管理",
id: 3,
}, )
} else if (key == 'pond_detail') {
list.push({
tit: "水产养殖管理",
id: 4,
}, )
}
}
list.sort(function(a, b) {
return a.id - b.id;
})
})
}
initUserinfoFn()
2023-10-20 18:45:15 +08:00
</script>
<style lang="scss">
.tabbar {
z-index: 999;
background-color: #34D190;
position: fixed;
padding: 20rpx 0;
2023-10-17 16:02:55 +08:00
2023-10-20 18:45:15 +08:00
.scoll-list {
white-space: nowrap;
overflow-x: scroll;
overflow-y: hidden;
2023-10-25 19:55:18 +08:00
min-width: 95vw;
2023-10-20 18:45:15 +08:00
.scoll-list-li {
display: inline-block;
margin-right: 20px;
white-space: normal;
font-size: 33.29rpx;
transform: skewX(-10deg);
}
}
2023-10-17 11:00:41 +08:00
}
2023-10-21 18:02:06 +08:00
.act {
color: white;
}
2023-10-20 18:45:15 +08:00
</style>