完善页面

This commit is contained in:
zmj 2023-10-27 19:26:03 +08:00
parent 999a85f35b
commit b0825d0862
9 changed files with 1638 additions and 1602 deletions

View File

@ -2,10 +2,17 @@
import { import {
userInfoStore userInfoStore
} from '@/store/userInfo' } from '@/store/userInfo'
import {
userInfoAPI
} from "@/api/plant.js"
export default { export default {
onLaunch: function() { onLaunch: function() {
const userInfo = userInfoStore() const userInfo = userInfoStore()
userInfo.saveUserInfo(307) userInfoAPI({
user_id: 307
}).then(res => {
userInfo.saveUserInfo(res.data)
})
uni.setStorageSync("SY_TOKEN", "dfdf4564557445df4df") uni.setStorageSync("SY_TOKEN", "dfdf4564557445df4df")
}, },

View File

@ -44,21 +44,25 @@
reactive, reactive,
watch watch
} from "vue"; } from "vue";
// import {
// userInfoAPI
// } from "@/api/plant.js"
import { import {
userInfoAPI userInfoStore
} from "@/api/plant.js" } from '@/store/userInfo'
const userInfoStores = userInfoStore()
const userInfo = reactive({}) const userInfo = reactive({})
const objFn = (res, data) => { const objFn = (res, data) => {
for (let key in res) { for (let key in res) {
data[key] = res[key] data[key] = res[key]
} }
} }
userInfoAPI({ // userInfoAPI({
user_id: 307 // user_id: 307
}).then(res => { // }).then(res => {
objFn(res.data, userInfo) // objFn(res.data, userInfo)
}) // })
objFn(userInfoStores.userInfo, userInfo)
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -19,16 +19,21 @@
reactive reactive
} from 'vue' } from 'vue'
import uplodeFn from "@/utils/uplodeImg.js" import uplodeFn from "@/utils/uplodeImg.js"
// import {
// userInfoAPI
// } from "@/api/plant.js"
import { import {
userInfoAPI userInfoStore
} from "@/api/plant.js" } from '@/store/userInfo'
const userInfoStores = userInfoStore()
const address = ref("") const address = ref("")
userInfoAPI({ // userInfoAPI({
user_id: 307 // user_id: 307
}).then(res => { // }).then(res => {
let userInfo = res.data
address.value = userInfo.area_name + userInfo.street_name + userInfo.village_name + userInfo.brigade_name // })
}) let userInfo = userInfoStores.userInfo
address.value = userInfo.area_name + userInfo.street_name + userInfo.village_name + userInfo.brigade_name
const props = defineProps({ const props = defineProps({
imgUrl: String, imgUrl: String,
text: String text: String

View File

@ -45,21 +45,25 @@
reactive, reactive,
watch watch
} from "vue"; } from "vue";
// import {
// userInfoAPI
// } from "@/api/plant.js"
import { import {
userInfoAPI userInfoStore
} from "@/api/plant.js" } from '@/store/userInfo'
const userInfoStores = userInfoStore()
const userInfo = reactive({}) const userInfo = reactive({})
const objFn = (res, data) => { const objFn = (res, data) => {
for (let key in res) { for (let key in res) {
data[key] = res[key] data[key] = res[key]
} }
} }
userInfoAPI({ // userInfoAPI({
user_id: 307 // user_id: 307
}).then(res => { // }).then(res => {
objFn(res.data, userInfo) // objFn(res.data, userInfo)
}) // })
objFn(userInfoStores.userInfo, userInfo)
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,8 +1,6 @@
<template> <template>
<view class="content"> <view class="content">
<imgCard :imgUrl='landDeatil.pic' text='地址'></imgCard> <imgCard :imgUrl='landDeatil.pic' text='地址'></imgCard>
<view class="bad-info"> <view class="bad-info">
<view class="" style="display: flex;align-items: center;"> <view class="" style="display: flex;align-items: center;">
<u--image :src="urlFn('sj')" style="margin: 0 5rpx;" width="28.04rpx" height="28.04rpx"></u--image> <u--image :src="urlFn('sj')" style="margin: 0 5rpx;" width="28.04rpx" height="28.04rpx"></u--image>
@ -22,7 +20,7 @@
<landInfo :land_id='landDeatil.land_id'></landInfo> <landInfo :land_id='landDeatil.land_id'></landInfo>
<!-- 生长记录 --> <!-- 生长记录 -->
<view class="grow-record-tit"> <!-- <view class="grow-record-tit">
<view class=""> <view class="">
生长记录操作 生长记录操作
</view> </view>
@ -31,20 +29,25 @@
</view> </view>
</view> </view>
<myTable tit='查看历史记录' :dataList="tableDate" :route='`/pages/records/index?land_id=${landDeatil.land_id}`'> <myTable tit='查看历史记录' :dataList="tableDate" :route='`/pages/records/index?land_id=${landDeatil.land_id}`'>
</myTable> </myTable> -->
<!-- dsfdsf
<!-- <view class="circumstance" v-for="(item,index) in tableDate" :key="index"> {{tableDate}} -->
<view class="circumstance" v-for="(item,index) in tableDate" :key="index">
<!-- {{index}} -->
<!-- {{tableDate}}
dsfdsf -->
<view class="card-tit"> <view class="card-tit">
<view class=""> <view class="">
{{index}} {{index}}
</view> </view>
<view class="updata-btn" @click="navgo('/pages/growRecord/index')"> <view class="updata-btn" @click="navgo('/pages/growRecord/index?type=1')">
更新{{index.slice(0,-2)}} 更新{{index.slice(0,-2)}}
</view> </view>
</view> </view>
<myTable :tit='`查看${index.slice(0,-2)}`' :dataList="item.action_record" route='/pages/feedIng/allRecording'> <myTable :tit='`查看${index.slice(0,-2)}`' :dataList="item.action_record"
:route='`/pages/records/index?land_id=${landDeatil.land_id}`'>
</myTable> </myTable>
</view> --> </view>
<view class="data"> <view class="data">
<view class="tit"> <view class="tit">
@ -182,7 +185,7 @@
} from "@dcloudio/uni-app" } from "@dcloudio/uni-app"
const crop_yield = ref("") const crop_yield = ref("")
const showPop = ref(false) const showPop = ref(false)
const tableDate = reactive([]) const tableDate = reactive({})
const landDeatil = reactive({}) const landDeatil = reactive({})
const data = reactive([{ const data = reactive([{
tit: "土壤温度", tit: "土壤温度",
@ -223,8 +226,11 @@
land_id: options.land_id land_id: options.land_id
}) })
objFn(res.data, landDeatil) objFn(res.data, landDeatil)
let res2 = await landCropRecordListAPI({ // let res2 = await landCropRecordListAPI({
crop_id: landDeatil.crop_id // crop_id: landDeatil.crop_id
// })
let res2 = await actionsAPI({
type: 1
}) })
objFn(res2.data, tableDate) objFn(res2.data, tableDate)
let res3 = await landEnvDataCurrAPI({ let res3 = await landEnvDataCurrAPI({

View File

@ -28,7 +28,6 @@
<up-input placeholder="请输入品种" border="surround" v-model="value" @change="change"></up-input> <up-input placeholder="请输入品种" border="surround" v-model="value" @change="change"></up-input>
</view> </view>
</view> </view>
<view class="card-li"> <view class="card-li">
<view class="card-li-tit"> <view class="card-li-tit">
疫苗条形码 疫苗条形码

View File

@ -40,6 +40,7 @@
import { import {
userInfoAPI userInfoAPI
} from "@/api/plant.js" } from "@/api/plant.js"
import { import {
reactive, reactive,
ref ref
@ -53,48 +54,50 @@
import planting from "@/components/index/planting.vue" import planting from "@/components/index/planting.vue"
import fishing from "@/components/index/fishing.vue" import fishing from "@/components/index/fishing.vue"
import chick from "@/components/index/chick.vue" import chick from "@/components/index/chick.vue"
import {
userInfoStore
} from '@/store/userInfo'
const userInfoStores = userInfoStore()
const flag = ref(1) const flag = ref(1)
const scollChangeFn = (index) => { const scollChangeFn = (index) => {
flag.value = index flag.value = index
} }
const list = reactive([]) const list = reactive([])
const userInfo = reactive({ const userInfo = reactive({})
})
const initUserinfoFn = () => { const initUserinfoFn = () => {
userInfoAPI({ for (const key in userInfoStores.userInfo) {
user_id: 307 userInfo[key] = (userInfoStores.userInfo)[key]
}).then(res => { if (key == 'land_detail') {
for (const key in res.data) { list.push({
userInfo[key] = (res.data)[key] tit: "土地种植管理",
if (key == 'land_detail') { id: 1,
list.push({ }, )
tit: "土地种植管理", } else if (key == 'animal_detail') {
id: 1, list.push({
}, ) tit: "家畜养殖管理",
} else if (key == 'animal_detail') { id: 2,
list.push({ }, )
tit: "家畜养殖管理", } else if (key == 'poultry_detail') {
id: 2, list.push({
}, ) tit: "家禽养殖管理",
} else if (key == 'poultry_detail') { id: 3,
list.push({ }, )
tit: "家禽养殖管理", } else if (key == 'pond_detail') {
id: 3, list.push({
}, ) tit: "水产养殖管理",
} else if (key == 'pond_detail') { id: 4,
list.push({ }, )
tit: "水产养殖管理",
id: 4,
}, )
}
} }
list.sort(function(a, b) {
return a.id - b.id; }
}) list.sort(function(a, b) {
return a.id - b.id;
}) })
// userInfoAPI({
// user_id: 307
// }).then(res => {
// })
} }
initUserinfoFn() initUserinfoFn()

View File

@ -4,12 +4,12 @@ import {
export const userInfoStore = defineStore('counter', { export const userInfoStore = defineStore('counter', {
state: () => ({ state: () => ({
user_id: "" userInfo: {}
}), }),
getters: {}, getters: {},
actions: { actions: {
saveUserInfo(userInfo) { saveUserInfo(userInfo) {
this.user_id = userInfo this.userInfo = userInfo
} }
} }
}) })

File diff suppressed because it is too large Load Diff