You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
2.8 KiB
118 lines
2.8 KiB
<template>
|
|
<view class="m-bg">
|
|
<view class="m-title">请选择<span class="m-big-green">农事类型</span></view>
|
|
<view class="m-note-box">
|
|
<view class="m-job-item" v-for="item in jobList" @click="handleClick(item)">
|
|
{{item.husbandryName}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { getJob } from '@/api/system/addNoteJob/addNoteJob.js';
|
|
export default {
|
|
data() {
|
|
return {
|
|
jobList: [],
|
|
reviceData:null
|
|
};
|
|
},
|
|
onLoad(options) {
|
|
if (options.params) {
|
|
this.reviceData = JSON.parse(decodeURIComponent(options.params))
|
|
console.log(this.reviceData)
|
|
}else{
|
|
this.reviceData = null
|
|
}
|
|
this.getJob()
|
|
},
|
|
onShow() {
|
|
const datas = uni.getStorageSync('canRefresh');
|
|
if(datas == 'true'){
|
|
this.getJob()
|
|
}
|
|
},
|
|
onUnload() {
|
|
uni.removeStorageSync('canRefresh')
|
|
},
|
|
methods: {
|
|
getJob(){
|
|
getJob().then(res => {
|
|
this.jobList = res.data.filter(item => item.id !== 1);
|
|
const obj = {
|
|
id: 9999,
|
|
husbandryName: '自定义'
|
|
}
|
|
this.jobList.push(obj)
|
|
console.log(this.jobList);
|
|
});
|
|
},
|
|
handleClick(item) {
|
|
if (item.id === 9999) {
|
|
uni.navigateTo({
|
|
url: '/sunPages/jobCustom/jobCustom'
|
|
})
|
|
}else{
|
|
if (this.reviceData == null){
|
|
this.reviceData = {
|
|
husbandryId: item.id,
|
|
husbandryName: item.husbandryName
|
|
}
|
|
console.log(this.reviceData);
|
|
const data = encodeURIComponent(JSON.stringify(this.reviceData))
|
|
uni.navigateTo({
|
|
url:'/sunPages/addNoteJobForm/addNoteJobForm?params='+data
|
|
})
|
|
}
|
|
else{
|
|
this.reviceData.husbandryId=item.id
|
|
this.reviceData.husbandryName=item.husbandryName
|
|
console.log(this.reviceData);
|
|
const data = encodeURIComponent(JSON.stringify(this.reviceData))
|
|
uni.navigateTo({
|
|
url:'/sunPages/addNoteJobForm/addNoteJobForm?params='+data
|
|
})
|
|
}
|
|
}
|
|
console.log(item);
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.m-bg{
|
|
background-color: #fff;
|
|
min-height: 100vh;
|
|
height: fit-content;
|
|
}
|
|
.m-title{
|
|
font-family: Source Han Sans SC;
|
|
font-weight: 500;
|
|
font-size: 40rpx;
|
|
color: #000000;
|
|
text-align: center;
|
|
padding: 50rpx 0;
|
|
|
|
.m-big-green{
|
|
color: #14C171;
|
|
}
|
|
}
|
|
|
|
.m-note-box{
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
padding: 0 40rpx;
|
|
|
|
.m-job-item{
|
|
padding: 10rpx 20rpx;
|
|
margin: 20rpx 20rpx;
|
|
font-weight: 400;
|
|
font-size: 28rpx;
|
|
color: #333333;
|
|
background: #eee;
|
|
border-radius: 15rpx;
|
|
}
|
|
}
|
|
</style>
|
|
|