Browse Source

修改页面样式

master
邓宏 2 years ago
parent
commit
0dfc714c81
  1. 59
      pages/home/index.vue
  2. 234
      pages/massif/myPlant.vue
  3. 11
      router/massif.js
  4. 1
      store/index.js
  5. 2
      uni.scss

59
pages/home/index.vue

@ -65,6 +65,41 @@
} }
} }
.card{ .card{
&.area{
position:relative;
z-index: 20;
table{
width:100%;
border-bottom:2rpx solid rgba(216, 216, 216, 0.2);
tr{
&.title{
font-size:24rpx;
}
&.value{
color:#10C176;
font-size:32rpx;
font-weight: bold;
}
}
}
.article{
display:flex;
align-items: center;
padding-top:20rpx;
text{
&:before{
color:#31C888;
margin-right:14rpx;
}
&.line{
width:5rpx;
height: 52rpx;
background:rgba(216, 216, 216, 0.2);
margin:0 30rpx 0 auto;
}
}
}
}
&.mana{ &.mana{
width:calc(50% - 46rpx); width:calc(50% - 46rpx);
flex-shrink: 0; flex-shrink: 0;
@ -272,7 +307,21 @@
</swiper> </swiper>
<image v-else class="head" src="@/static/banner.png" mode="aspectFit"/> <image v-else class="head" src="@/static/banner.png" mode="aspectFit"/>
<swiper class="data" :display-multiple-items="2" circular> <view class="area card">
<table>
<tr class="title"> <td>地块个数()</td><td>地块面积()</td><td>在种品种()</td><td>在种面积()</td> </tr>
<tr class="value"> <td>{{massif.plotNum}}</td><td>{{massif.totalArea}}</td><td>{{massif.plantArea}}</td><td>{{massif.productCount}}</td> </tr>
</table>
<view class="article">
<text class="plant-bijibenjilutongxunlu" @click="$u.route({url:'pages/massif/myPlant'})"/>
<text class="line"/>
<text class="plant-nongzi" style="margin-right:64rpx;" @click="$u.route({url:'pages/stock/mana'})">库存</text>
<text class="plant-caigou" @click="$u.route({url:'pages/purchase/apply'})">采购</text>
</view>
</view>
<!-- <swiper class="data" :display-multiple-items="2" circular>
<swiper-item> <swiper-item>
<view data-title="地块个数()" style="--c:16, 193, 118;"> <view data-title="地块个数()" style="--c:16, 193, 118;">
<text class="value">{{massif.plotNum}}</text> <text class="value">{{massif.plotNum}}</text>
@ -297,7 +346,7 @@
<text class="plant-zhongzhipinzhong"/> <text class="plant-zhongzhipinzhong"/>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper> -->
<view style="display:flex;"> <view style="display:flex;">
<view class="card mana"> <view class="card mana">
<view class="title"> <view class="title">
@ -318,7 +367,7 @@
<u-empty :show="stockList.length<=0" text=" " width="60%" icon="/static/noData.png"/> <u-empty :show="stockList.length<=0" text=" " width="60%" icon="/static/noData.png"/>
</view> </view>
</view> </view>
<view style="display:flex;"> <!-- <view style="display:flex;">
<view class="card stock" style="margin-right:0px;--c:#10C176;" @click="$u.route({url:'pages/stock/mana'})"> <view class="card stock" style="margin-right:0px;--c:#10C176;" @click="$u.route({url:'pages/stock/mana'})">
<view class="title">库存管理</view> <view class="title">库存管理</view>
@ -331,7 +380,7 @@
<view class="item warehousing">入库管理</view> <view class="item warehousing">入库管理</view>
<view class="item lssue">出库管理</view> <view class="item lssue">出库管理</view>
</view> </view>
</view> </view> -->
<view class="card base"> <view class="card base">
<view class="title"> <view class="title">
{{$store.state.baseInfo.name||'基地管理'}} <text class="plant-jiantou_zuoyouqiehuan" v-if="isAdmin" @click="show=true">切换基地</text> {{$store.state.baseInfo.name||'基地管理'}} <text class="plant-jiantou_zuoyouqiehuan" v-if="isAdmin" @click="show=true">切换基地</text>
@ -362,7 +411,7 @@
</template> </template>
<script> <script>
import request,{host} from '@/common/request.js' import request,{host} from '@/common/request'
export default { export default {
data() { data() {
return { return {

234
pages/massif/myPlant.vue

@ -0,0 +1,234 @@
<style lang="less">
.container{
height:100%;
background:#f6f6f6;
scroll-view{
height:100%;
.items{
padding:30rpx 30rpx 0;
&+.items{
padding-bottom:30rpx;
}
}
.card{
margin:0;
&>.info{
display:flex;
&>.u-transition{
position:relative;
margin-right:20rpx;
&:before{
content:attr(data-type);
position:absolute;
z-index: 30;
top:0;
left:0;
border-radius: 20rpx 20rpx 20rpx 0;
background:rgba(60, 84, 44, 0.5);
color:#fff;
padding:6rpx 2rpx;
min-width:80rpx;
text-align: center;
}
}
&>.detail{
flex-grow: 1;
width:1rpx;
.name{
display:flex;
margin-bottom: 6rpx;
text{
&:first-child{
flex-shrink: 0;
font-size:20rpx;
color:#fff;
background:#10C176;
height:40rpx;
width:80rpx;
line-height: 40rpx;
text-align: center;
border-radius: 6rpx;
margin-right:12rpx;
}
&:nth-child(2){
font-weight: bold;
flex-grow: 1;
}
}
}
.batch,.recovery{
font-size:24rpx;
color:var(--c);
margin-bottom:6rpx;
}
.mu{
display:flex;
align-items: center;
&>text.area{
color:#10C176;
font-size:32rpx;
font-weight: bold;
&:after{
content:"亩";
}
}
&>.farm{
font-size:22rpx;
color:#10C176;
height:40rpx;
line-height: 40rpx;
margin-left:18rpx;
background: rgba(16, 193, 119, 0.1);
padding:0 6rpx;
}
button{
margin:-20rpx 0 -20rpx auto!important;
padding:20rpx;
height: auto;
background: transparent;
}
}
}
}
&>.date{
border-top:2rpx solid rgba(216, 216, 216, 0.5);
margin-top:6rpx;
padding-top:12rpx;
display:flex;
align-items: center;
text{
flex-shrink: 0;
color:#999;
font-size:24rpx;
margin-right:auto;
&.over{
background:#F7F7F7;
border-radius: 8rpx;
height:48rpx;
line-height: 48rpx;
padding:0 20rpx;
margin:0 0 0 auto;
}
}
button{
margin:0 0 0 20rpx;
color:rgba(var(--c),1);
background:rgba(var(--c),0.15);
height:48rpx;
font-size:24rpx;
padding:0 16rpx;
min-width:100rpx;
}
}
}
}
}
</style>
<template>
<view class="container">
<scroll-view scroll-y @scrolltolower="search">
<view class="items" v-for="(v,k) in list" :key="k">
<view class="card">
<view class="info" @click="$u.route({url:'/pages/massif/mana/index',params:{id:v.plotId}})">
<u-image :data-type="v.plantType" radius="20rpx" width="170rpx" height="140rpx" mode="aspectFill" :src="`${host}/${v.images}`">
<text slot="error" style="font-size:45rpx;" class="plant-xiaopangchetupianjiazaishibai"/>
</u-image>
<view class="detail">
<view class="name">
<text>{{v.plantStandard}}</text> <text class="over">{{v.varietyName}}</text> <text class="plant-youbian"/>
</view>
<view class="batch over" style="--c:#999;">种植批次号{{v.plantBatch}}</view>
<view class="recovery" style="--c:#FFC760;">已采收{{v.harvested}}kg</view>
<view class="mu">
<text class="area">{{v.plantArea}}</text>
<text class="farm">农事操作{{v.farmNum||0}}</text>
</view>
</view>
</view>
<view class="date">
<text>预估采收日期{{v.harvestTime}}</text>
<button v-if="v.status==1" class="cu-btn" style="--c:255, 196, 87;" @click.stop="finishPlant(k)">结束种植</button>
<text v-else-if="v.status==2" class="over">已结束</text>
</view>
</view>
</view>
<u-empty v-if="list.length==0" text="为查询到相关信息" width="70%" icon="/static/noData.png"/>
</scroll-view>
</view>
</template>
<script>
import request,{host} from '@/common/request.js'
export default {
data(){
return{
host:host('imgUrl'),
list:[],
total:0,
searchVal:{
pageNo:1,
pageSize:6
},
}
},
onLoad(){
this.search()
},
methods:{
clean(){
this.list=[]
this.total=0
this.searchVal.pageNo=1
},
async search(){
if(this.total==0||this.list.length<this.total){
var res=await request('/api/plantPlan/list',{
params: {
...this.searchVal,
baseId: this.$store.state.baseInfo.id,
}
})
if(res.statu){
this.list=this.list.concat(res.data.records)
this.total=res.data.total
this.searchVal.pageNo++
if(this.list.length==this.total)uni.showToast({title:"加载完成!",icon:"none"})
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取地块列表失败!",
showCancel:false,
})
}
}
},
finishPlant(index){
uni.showModal({
title:"提示",
content:"确定结束种植!",
success: async e=>{
if(e.confirm){
var res=await request("/api/plantPlan/finishPlant",{
params:{plantPlanId:this.list[index].id}
})
if(res.statu){
uni.showToast({title:"结束成功!",duration:1500})
if(this.list.length>this.searchVal.pageSize+2){
this.list.splice(index,1)
}else{
this.clean()
this.search()
}
}else{
uni.showModal({
title:"提示",
content:res.msg||"结束种植失败!",
showCancel:false,
})
}
}
}
})
},
},
}
</script>

11
router/massif.js

@ -143,4 +143,15 @@ module.exports=[
} }
} }
}, },
{
path:"pages/massif/myPlant",
style:{
navigationBarTitleText:"我的种植",
navigationBarBackgroundColor:"#10C176",
navigationBarTextStyle:"white",
"app-plus":{
titleNView:true,
}
}
},
] ]

1
store/index.js

@ -6,7 +6,6 @@ export default new Vuex.Store({
state:{ state:{
userInfo:{}, userInfo:{},
token:"", token:"",
plantBaseInfoId:"",
baseInfo:{ baseInfo:{
id:"", id:"",
name:"", name:"",

2
uni.scss

@ -77,7 +77,7 @@ $uni-font-size-paragraph:15px;
@import '@/common/main.css'; @import '@/common/main.css';
@import 'uview-ui/theme.scss'; @import 'uview-ui/theme.scss';
@import url('https://at.alicdn.com/t/c/font_3852037_8frcz777lb4.css'); @import url('https://at.alicdn.com/t/c/font_3852037_huussxt3ujw.css');
[class*=plant-]{ [class*=plant-]{
font-family: "plantMana" !important; font-family: "plantMana" !important;
font-size: 16px; font-size: 16px;

Loading…
Cancel
Save