Browse Source

首页 基地管理 联调接口

master
邓宏 2 years ago
parent
commit
8170d4aa48
  1. 4
      common/request.js
  2. 15
      pages.js
  3. 29
      pages/demo.nvue
  4. 50
      pages/home/index.vue
  5. 21
      pages/massif/mapEditor.vue
  6. 11
      router/massif.js
  7. 11
      uni_modules/d-form/components/d-form/d-form.vue

4
common/request.js

@ -2,8 +2,8 @@ import store from "@/store"
export function host(host='default',suffix='/plant_manage'){
var url=process.env.NODE_ENV === 'development'?{
default:`http://wmyrzw.natappfree.cc` //陈
// default:`http://uq5pak.natappfree.cc` //马
// default:`http://wmyrzw.natappfree.cc` //陈
default:`http://b9uckg.natappfree.cc` //马
}:{
default:`http://qv6mj8.natappfree.cc`
}

15
pages.js

@ -9,19 +9,6 @@ module.exports = hot((pagesJson)=>{
...require("./router/massif.js"),
...require('./router/purchase.js'),
...require('./router/stock.js'),
// {
// "path":"pages/demo",
// "style":{
// "navigationBarTitleText":"测试地图",
// "navigationBarBackgroundColor":"#10C176",
// "navigationBarTextStyle":"white",
// "app-plus":{
// "titleNView":true,
// "nvueCompiler":"uni-app",
// "nvueStyleCompiler":"uni-app"
// }
// }
// },
],
tabBar:{
color:"#999",
@ -38,7 +25,7 @@ module.exports = hot((pagesJson)=>{
list: [
// {name:"测试页面",path:"pages/demo"},
// {name: "地块管理",path: "pages/massif/mana/index","query": ""},
{name: "地块基本信息",path: "pages/massif/info","query": ""},
// {name: "地块基本信息",path: "pages/massif/info","query": ""},
{name: "登录",path: "pages/home/login","query": ""},
{name: "首页",path: "pages/home/index","query": ""},
{name: "仓库管理",path: "pages/warehouse/mana","query": ""},

29
pages/demo.nvue

@ -1,29 +0,0 @@
<style lang="scss">
.content{
width:750rpx;
height:1050rpx;
background:red;
map{
width:750rpx;
height:1050rpx;
}
}
</style>
<template>
<view class="content">
<map enable-satellite style="width:750rpx;height:1050rpx;"/>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>

50
pages/home/index.vue

@ -201,6 +201,9 @@
margin-right:12rpx;
text-shadow: 6rpx -6rpx rgba(var(--c),0.3);
}
&.active{
color:rgba(var(--c),1);
}
}
}
.item{
@ -209,6 +212,7 @@
margin-top:40rpx;
&:before{
content:" ";
flex-shrink: 0;
width:20rpx;
height:20rpx;
margin-right:16rpx;
@ -217,8 +221,11 @@
}
text{
&:first-child{
flex-shrink: 0;
min-width:140rpx;
color:#333333;
font-size:28rpx;
margin-right:20rpx;
}
&:nth-child(2){
color:#999999;
@ -313,19 +320,21 @@
基地管理 <text class="plant-jiantou_zuoyouqiehuan" v-if="isAdmin" @click="show=true">切换基地</text>
</view>
<view class="matter">
<text class="plant-jilu" style="--c:16, 193, 118;margin-right:40px;">农事记录</text>
<text class="plant-tourupin" style="--c:255, 195, 83;">投入品</text>
<text class="plant-jilu" :class="{active:baseIndex=='record'}" style="--c:16, 193, 118;margin-right:40px;" @click="baseIndex=='record'?baseIndex='':baseIndex='record'">农事记录</text>
<text class="plant-tourupin" :class="{active:baseIndex=='input'}" style="--c:255, 195, 83;" @click="baseIndex=='input'?baseIndex='':baseIndex='input'">投入品</text>
</view>
<view class="item" style="--c:16, 193, 118;">
<text>农事</text> <text>[示例]今日完成了草莓园浇水任务</text>
<template v-if="!baseIndex || baseIndex=='record'">
<view v-for="(v,k) in baseInfo.farmWork||[]" :key="`${k}_work`" class="item" style="--c:16, 193, 118;">
<text>农事</text> <text class="over">{{new Date(v.time).format('yyyy-MM-dd')}}{{v.userName}}{{v.plotName}}{{v.farmWorkName}}</text>
</view>
<view class="item" style="--c:255, 195, 83;">
<text>投入品</text> <text>[示例]今日完成了草莓园浇水任务</text>
</view>
<view class="item" style="--c:255, 195, 83;">
<text>投入品</text> <text>[示例]今日完成了草莓园浇水任务</text>
</template>
<template v-if="!baseIndex || baseIndex=='input'">
<view v-for="(v,k) in baseInfo.farmingInput||[]" :key="`${k}_input`" class="item" style="--c:255, 195, 83;">
<text>投入品</text> <text class="over">{{new Date(v.time).format('yyyy-MM-dd')}}{{v.userName}}{{v.plotName}}{{v.farmWorkName}}</text>
</view>
</template>
<u-empty v-if="isEmpty" width="70%" icon="/static/noData.png"/>
</view>
<u-picker v-if="isAdmin" :show="show" :columns="plantBase" keyName="baseName" closeOnClickOverlay @close="show=false" @confirm="$store.commit('setBaseId', $event.value[0].id);show=false" @cancel="show=false"/>
@ -341,16 +350,24 @@ import request from '@/common/request.js'
show:false,
plantBase:[[]],
massif:{},
baseInfo:{},
baseIndex:"",
}
},
computed:{
isAdmin(){
return this.$store.getters.userInfo.roleCode=='companyAdmin'
},
isEmpty(){
if(!baseIndex)return (this.baseInfo.farmWork||[]).length+(baseInfo.farmingInput||[]).length<=0
else if(baseIndex=='record')return (this.baseInfo.farmWork||[]).length<=0
else return (baseInfo.farmingInput||[]).length<=0
},
},
watch:{
"$store.state.plantBaseInfoId"(n){
this.getMassif(n)
this.getBaseInfo(n)
}
},
onLoad() {
@ -392,6 +409,21 @@ import request from '@/common/request.js'
})
}
},
async getBaseInfo(plantBaseId){
console.log('-------------getBaseInfo-----------------')
var res=await request("/api/plantIndex/queryFarmWorkAndInput",{
params:{plantBaseId}
})
if(res.statu){
this.baseInfo=res.data
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取基地管理信息失败!",
showCancel:false,
})
}
},
}
}
</script>

21
pages/massif/mapEditor.vue

@ -0,0 +1,21 @@
<style lang="scss"> </style>
<template>
<web-view
:webview-styles="{ progress: { color: '#31C888' } }"
:update-title="false"
src="http://v4b5ta9gepbj.ngrok.xiaomiqiu123.top/amap.html">
</web-view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>

11
router/massif.js

@ -90,4 +90,15 @@ module.exports=[
}
}
},
{
path:"pages/massif/mapEditor",
style:{
navigationBarTitleText:"地图编辑",
navigationBarBackgroundColor:"#10C176",
navigationBarTextStyle:"white",
"app-plus":{
titleNView:true,
}
}
},
]

11
uni_modules/d-form/components/d-form/d-form.vue

@ -425,14 +425,12 @@ import {dataType} from 'black-knight/lib/config/tools'
}
},
openMap(){
// uni.navigateTo({url:"/pages/massif/mapEditor"})
/* #ifdef APP-PLUS */
this.showMap=true
if(!this.maps){
var amap=uni.createMapContext("amap",this)
for(var i in plus.maps.MapStyles){
console.log(i,'-plus.maps.MapStyles-------')
}
this.maps=amap.$getAppMap()
this.maps.setMapType(plus.maps.MapType.MAPTYPE_SATELLITE)
@ -442,7 +440,7 @@ for(var i in plus.maps.MapStyles){
this.maps.addOverlay(polyline)
this.maps.onclick=(e)=>{
if(this.value.length<=0 && this.markerList.length<=2){
if(this.value.length<=0){
var marker=new plus.maps.Marker(new plus.maps.Point(e.longitude, e.latitude));
marker.setIcon("/static/map_point_1.png");
marker.bringToTop()
@ -450,6 +448,11 @@ for(var i in plus.maps.MapStyles){
marker.onDrag= e=>{
console.log("-----Drag:",JSON.stringify(e.getPoint()))
}
if(this.markerList.length<=0){
marker.onclick= e=>{
console.log('-------------asdf--------------------')
}
}
this.markerList.push(marker)
this.maps.addOverlay(marker);

Loading…
Cancel
Save