代码更新

This commit is contained in:
jia 2023-11-25 16:18:54 +08:00
parent f0f7c6987a
commit 89b5a5777d
113 changed files with 3843 additions and 762 deletions

View File

@ -48,6 +48,10 @@
display: flex;
align-items: center;
}
.u-action-sheet__item-wrap {
overflow: auto;
max-height: 30vh !important;
}
/*每个页面公共css */
</style>

View File

@ -1,25 +1,60 @@
import syhttp from "@/utils/syhttp.js";
import http from "@/utils/http.js";
/**
* 我的公司
*/
export const uplodeImgAPI = (data) => syhttp.post('/user/imageUpload', data)
//登录
export const login = (data) => syhttp.post('/login/account', data)
//验证码
export const xinregister = (data) => syhttp.post('/index/code', data)
//用户注册
export const logregister = (data) => syhttp.post('/login/register', data)
//修改密码
export const changePassword = (data) => syhttp.post('/user/changePassword', data)
//退出登录
export const logout = (data) => syhttp.get('/login/logout', data)
//土地列表
export const landlist = (data) => syhttp.get('/land/list', data)
//土地详情
export const landdetail = (data) => syhttp.get('/land/detail', data)
//新增土地
export const addland = (data) => syhttp.post('/land/add', data)
//种植列表
export const plantlist = (data) => syhttp.get('/plant/list', data)
//新增种植
export const addplant = (data) => syhttp.post('/plant/add', data)
//操作列表
export const actionlist = (data) => syhttp.get('/action/list', data)
//添加操作
export const addaction = (data) => syhttp.post('/action/add', data)
//添加操作
export const binddevice = (data) => syhttp.post('/device/bind', data)
//首页
export const lindexist = (data) => syhttp.get('/index/index', data)
//省
export const province = (data) => http.get('/common/geo/province', data)
//市
export const city = (data) => http.get('/common/geo/city', data)
//区县
export const county = (data) => http.get('/common/geo/county', data)
//镇街
export const towns = (data) => http.get('/common/geo/towns', data)
//乡村
export const villages = (data) => http.get('/common/geo/villages', data)
//小组
export const groups = (data) => http.get('/common/geo/groups', data)
export const logout = (data) => syhttp.get('/login/logout', data)

68
api/upload.js Normal file
View File

@ -0,0 +1,68 @@
// import base from "@/config/baseUrl";
// let baseUrl = 'https://ceshi.excellentkk.cn/api';
// import store from '../store';
import { config } from '@/config/app';
let header = {};
console.log(config)
if (uni.getStorageSync('SY_TOKEN')){
header.token = uni.getStorageSync('SY_TOKEN');
}
function uploads(src, type) {
return new Promise((resolve, reject) => {
// //console.log('上传', type === 'img' ? '图片' : '视频', '', src)
let a = uni.uploadFile({
// url: base.baseUrl + '/upload?token=',
url: HTTP_REQUEST_URL_TWO + '/api' + '/upload?token=',
filePath: src,
name: 'file',
success: (res) => {
let data = JSON.parse(res.data)
if (data.code != 1) {
uni.$u.toast(data.msg)
return false
} else {
resolve(data.data.url) // 返回线上地址
}
},
fail: (err) => {
reject(err)
//console.log('upload-上传失败', err)
}
});
})
}
function Uploads(src, type) {
return new Promise((resolve, reject) => {
// //console.log('上传', type === 'img' ? '图片' : '视频', '', src)
let a = uni.uploadFile({
url:config.HTTP_REQUEST_URL + '/api/upload/image',
filePath: src,
name: 'file',
header: header,
success: (res) => {
let data = JSON.parse(res.data)
if (data.code == 1) {
resolve(data) // 返回线上地址
} else {
uni.$u.toast(data.msg)
return false
}
},
fail: (err) => {
reject(err)
//console.log('upload-上传失败', err)
}
});
})
}
export {
uploads,
Uploads
}

View File

@ -2,31 +2,32 @@
<view class="card">
<view class="tit">
<view class="">
{{land.crop_id}}号土地
{{info.title}}
号土地
</view>
<view class="">
溯源码: {{land.source_code}}
溯源码: {{}}
</view>
</view>
<view class="card-li">
<view class="">
当前种植: {{land.crop_name}}
</view>
<view class="">
种植品牌: {{land.crop_brand}}
当前种植: {{info.residual_area}}
</view>
<!-- <view class="">
种植品牌: {{}}
</view> -->
</view>
<view class="card-li">
<view class="">
土地面积: {{land.land_area}}
</view>
<view class="">
种子品牌: {{land.crop_variety}}
土地面积: {{info.total_area}}
</view>
<!-- <view class="">
种子品牌: {{}}
</view> -->
</view>
<view class="card-li" v-if="land.crop_yield">
<view class="card-li">
<view class="">
预计产量: {{land.crop_yield}}
<!-- 预计产量: {{}} -->
</view>
<!-- <view class="">
已出售: ???
@ -35,7 +36,7 @@
<view class="card-li">
<view class="">
播种时间: {{land.seed_time}}
播种时间: {{info.create_time}}
</view>
</view>
@ -45,43 +46,14 @@
</template>
<script setup>
import {
landInfoAPI,
} from "@/api/plant.js"
import {
reactive,
watch,
defineEmits
watch
} from "vue";
const props = defineProps({
land_id: String,
is_cropped: Boolean,
})
const emit = defineEmits(['child-click'])
const land = reactive({})
const objFn = (res, data) => {
for (let key in res) {
data[key] = res[key]
}
info: Object,
}
watch(props, (newValue, oldVlaue) => {
// console.log(newValue, oldVlaue)
if (props?.land_id) {
landInfoAPI({
land_id: props.land_id,
user_id: 307
}).then(res => {
objFn(res.data, land)
emit('getcropid', {
cropid: res.data.crop_id
})
})
}
}, {
immediate: true
})
</script>

5
node_modules/uview-plus/index.scss generated vendored
View File

@ -8,7 +8,10 @@
@import "./libs/css/vue.scss";
/* #endif */
// nvue的特有样式
/* #ifdef APP-NVUE */
@import "./libs/css/nvue.scss";
/* #endif */
// 小程序特有的样式
/* #ifdef MP */

199
package-lock.json generated Normal file
View File

@ -0,0 +1,199 @@
{
"name": "TraceabilityAPP",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"dependencies": {
"pinia": "^2.0.14",
"uview-plus": "^3.1.38"
}
},
"node_modules/@vue/devtools-api": {
"version": "6.5.1",
"resolved": "https://registry.npmmirror.com/@vue/devtools-api/-/devtools-api-6.5.1.tgz",
"integrity": "sha512-+KpckaAQyfbvshdDW5xQylLni1asvNSGme1JFs8I1+/H5pHEhqUKMEQD/qn3Nx5+/nycBq11qAEi8lk+LXI2dA=="
},
"node_modules/clipboard": {
"version": "2.0.11",
"resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.11.tgz",
"integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==",
"license": "MIT",
"dependencies": {
"good-listener": "^1.2.2",
"select": "^1.1.2",
"tiny-emitter": "^2.0.0"
}
},
"node_modules/dayjs": {
"version": "1.11.10",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz",
"integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==",
"license": "MIT"
},
"node_modules/delegate": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==",
"license": "MIT"
},
"node_modules/good-listener": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz",
"integrity": "sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw==",
"license": "MIT",
"dependencies": {
"delegate": "^3.1.2"
}
},
"node_modules/pinia": {
"version": "2.0.14",
"resolved": "https://registry.npmmirror.com/pinia/-/pinia-2.0.14.tgz",
"integrity": "sha512-0nPuZR4TetT/WcLN+feMSjWJku3SQU7dBbXC6uw+R6FLQJCsg+/0pzXyD82T1FmAYe0lsx+jnEDQ1BLgkRKlxA==",
"dependencies": {
"@vue/devtools-api": "^6.1.4",
"vue-demi": "*"
},
"peerDependencies": {
"@vue/composition-api": "^1.4.0",
"typescript": ">=4.4.4",
"vue": "^2.6.14 || ^3.2.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
},
"typescript": {
"optional": true
}
}
},
"node_modules/select": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
"integrity": "sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA==",
"license": "MIT"
},
"node_modules/tiny-emitter": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==",
"license": "MIT"
},
"node_modules/uview-plus": {
"version": "3.1.38",
"resolved": "https://registry.npmjs.org/uview-plus/-/uview-plus-3.1.38.tgz",
"integrity": "sha512-sdEkDBdqhBuzJVDXR4ApzchtdZjaen2jK23h0Mp5VSLngWEPiOmWDwSBu66ZHbnM9n4xTzfip6t6cGRFhvIGRA==",
"dependencies": {
"clipboard": "^2.0.11",
"dayjs": "^1.11.3"
},
"engines": {
"HBuilderX": "^3.1.0"
}
},
"node_modules/vue": {
"version": "2.6.14",
"resolved": "https://registry.npmmirror.com/vue/-/vue-2.6.14.tgz",
"integrity": "sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ==",
"peer": true
},
"node_modules/vue-demi": {
"version": "0.14.6",
"resolved": "https://registry.npmmirror.com/vue-demi/-/vue-demi-0.14.6.tgz",
"integrity": "sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w==",
"hasInstallScript": true,
"bin": {
"vue-demi-fix": "bin/vue-demi-fix.js",
"vue-demi-switch": "bin/vue-demi-switch.js"
},
"engines": {
"node": ">=12"
},
"peerDependencies": {
"@vue/composition-api": "^1.0.0-rc.1",
"vue": "^3.0.0-0 || ^2.6.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
}
},
"dependencies": {
"@vue/devtools-api": {
"version": "6.5.1",
"resolved": "https://registry.npmmirror.com/@vue/devtools-api/-/devtools-api-6.5.1.tgz",
"integrity": "sha512-+KpckaAQyfbvshdDW5xQylLni1asvNSGme1JFs8I1+/H5pHEhqUKMEQD/qn3Nx5+/nycBq11qAEi8lk+LXI2dA=="
},
"clipboard": {
"version": "2.0.11",
"resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.11.tgz",
"integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==",
"requires": {
"good-listener": "^1.2.2",
"select": "^1.1.2",
"tiny-emitter": "^2.0.0"
}
},
"dayjs": {
"version": "1.11.10",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz",
"integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ=="
},
"delegate": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
},
"good-listener": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz",
"integrity": "sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw==",
"requires": {
"delegate": "^3.1.2"
}
},
"pinia": {
"version": "2.0.14",
"resolved": "https://registry.npmmirror.com/pinia/-/pinia-2.0.14.tgz",
"integrity": "sha512-0nPuZR4TetT/WcLN+feMSjWJku3SQU7dBbXC6uw+R6FLQJCsg+/0pzXyD82T1FmAYe0lsx+jnEDQ1BLgkRKlxA==",
"requires": {
"@vue/devtools-api": "^6.1.4",
"vue-demi": "*"
}
},
"select": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
"integrity": "sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA=="
},
"tiny-emitter": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
},
"uview-plus": {
"version": "3.1.38",
"resolved": "https://registry.npmjs.org/uview-plus/-/uview-plus-3.1.38.tgz",
"integrity": "sha512-sdEkDBdqhBuzJVDXR4ApzchtdZjaen2jK23h0Mp5VSLngWEPiOmWDwSBu66ZHbnM9n4xTzfip6t6cGRFhvIGRA==",
"requires": {
"clipboard": "^2.0.11",
"dayjs": "^1.11.3"
}
},
"vue": {
"version": "2.6.14",
"resolved": "https://registry.npmmirror.com/vue/-/vue-2.6.14.tgz",
"integrity": "sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ==",
"peer": true
},
"vue-demi": {
"version": "0.14.6",
"resolved": "https://registry.npmmirror.com/vue-demi/-/vue-demi-0.14.6.tgz",
"integrity": "sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w==",
"requires": {}
}
}
}

View File

@ -11,7 +11,8 @@
{
"path": "pages/index/index",
"style": {
"navigationStyle": "custom"
"navigationStyle": "custom",
"enablePullDownRefresh": true
}
},
// live harvest
@ -24,6 +25,15 @@
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/landDetail/tudi",
"style": {
"navigationBarTitleText": "种植详情",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#F4F4F4",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/husbandryForm/harvest",
"style": {
@ -109,6 +119,7 @@
"path": "pages/index/massif",
"style": {
"navigationBarTitleText": "地块",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#F4F4F4",
"navigationBarTextStyle": "black"
@ -148,17 +159,23 @@
"borderStyle": "white",
"backgroundColor": "#EBF1EF",
"list": [{
"pagePath": "pages/index/index",
"pagePath": "pages/index/massif",
"text": "首页",
"iconPath": "static/tabs-icon/home.png",
"selectedIconPath": "static/img/DK.png"
"iconPath": "static/tabber/a.png",
"selectedIconPath": "static/tabber/a-a.png"
},
{
"pagePath": "pages/index/index",
"text": "地块",
"iconPath": "static/tabber/b.png",
"selectedIconPath": "static/tabber/b-b.png"
},
{
"pagePath": "pages/index/personal",
"text": "我的",
"iconPath": "static/img/WD.png",
"selectedIconPath": "static/img/WD.png"
"iconPath": "static/tabber/c.png",
"selectedIconPath": "static/tabber/c-c.png"
}
]

View File

@ -88,18 +88,19 @@
// ios
const checkUserAgent = () => {
uni.getSystemInfo({
success: function(res) {
const platform = res.platform.toLowerCase();
if (platform === 'android') {
formData.terminal = 6
} else if (platform === 'ios') {
formData.terminal = 5
} else {
console.log('当前设备不是 Android 也不是 iOS');
}
}
success: function(res) {
const platform = res.platform.toLowerCase();
if (platform === 'android') {
formData.terminal = 6
} else if (platform === 'ios') {
formData.terminal = 5
} else {
formData.terminal = 6
console.log('当前设备不是 Android 也不是 iOS');
}
}
});
};
//
const startCountDown = () => {
@ -138,18 +139,19 @@
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(formData.account)) return uni.$u.toast(
'请输入正确的手机号码'
);
console.log(formData)
// console.log(formData)
if (!formData.code && formData.scene == 2) return uni.$u.toast('验证码不能为空');
login(formData).then((res) => {
if (res.code == 1) {
const userInfo = userInfoStore()
userInfo.saveUserInfo(res.data)
uni.setStorageSync("SY_TOKEN", res.data.token)
uni.setStorageSync("SY_USER", res.data)
const userInfo = userInfoStore()
userInfo.saveUserInfo(res.data)
uni.$u.toast(res.msg);
uni.reLaunch({
url: '/pages/index/index'
url: '/pages/index/massif'
})
}

173
pages/Login/resgier.vue Normal file
View File

@ -0,0 +1,173 @@
<template>
<view class="box">
<view class="content">
<view class="tit">
欢迎进入吟龙土壤墒情监测溯系统!
</view>
<view class="input-card">
<view class="login-type">
账号注册
<view class="line" />
</view>
<view class="" style="margin: 30rpx 0;">
<u-input placeholder="请输入账号"
customStyle="background:#F5F5F5;height:80rpx;padding-left:40rpx;border:none" shape='circle'
border="surround" v-model="formData.mobile"></u-input>
</view>
<view class="" style="margin: 30rpx 0;">
<u-input type="password" shape='circle'
customStyle="background:#F5F5F5;height:80rpx;;padding-left:40rpx;border:none"
placeholder="请输入密码" border="surround" v-model="formData.password"></u-input>
</view>
<view class="">
<u-input type="password" shape='circle'
customStyle="background:#F5F5F5;height:80rpx;;padding-left:40rpx;border:none"
placeholder="请确认密码" border="surround" v-model="formData.password_confirm"></u-input>
</view>
<view class="sub-btn">
<u-button @click="submitFn" type="primary" customStyle="border:none;height:90rpx" color="#34D190"
text="注册登录"></u-button>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
logregister
} from '@/api/file.js';
import {
reactive,
ref
} from 'vue';
const formData = reactive({
mobile: "",
password: "",
password_confirm: "",
})
const submitFn = () => {
if (!formData.mobile) return uni.$u.toast('账号不能为空');
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(formData.mobile)) return uni.$u.toast(
'请输入正确的手机号码'
);
if (!formData.password)
return uni.$u.toast('密码不能为空')
if (formData.password !== formData.password_confirm) return uni.$u.toast('密码与确认密码不一致');
logregister(formData).then((res) => {
if (res.code == 1) {
uni.navigateBack({
delta: formData
})
}
})
}
</script>
<style lang="scss" scoped>
.box {
width: 100vw;
height: 100vh;
background-color: $theme-main-color;
position: relative;
}
.content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 700rpx;
.tit {
color: white;
font-size: 45rpx;
margin-bottom: 30rpx;
}
.input-card {
width: 620rpx;
background-color: #fff;
height: auto;
padding: 40rpx;
border-radius: 30rpx;
.login-type {
display: flex;
margin-right: 50rpx;
flex-direction: column;
// align-items: center;
justify-content: flex-start;
.line {
border-top: 3px solid #34D190;
margin-left: 30rpx;
margin-top: 10rpx;
width: 60rpx;
}
}
.yanzm {
display: flex;
justify-content: space-between;
.u-input {
margin-right: 60rpx;
}
}
.code {
width: 120rpx;
height: 80rpx;
background-color: #34D190;
line-height: 80rpx;
text-align: center;
border-radius: 20rpx 20rpx;
font-size: 20rpx;
padding: 0rpx 20rpx;
color: #fff;
}
.sub-btn {
margin-top: 30rpx;
}
.resgiter {
font-size: 20rpx;
margin-top: 40rpx;
}
}
}
</style>

View File

@ -2,130 +2,473 @@
<view class="content">
<view class="card">
<u-form labelPosition="top" labelWidth='100' :model="data.formData" ref="form1">
<!-- <u-form-item label="姓名" prop="name"><u-input v-model="data.formData.name" /></u-form-item>
<u-form-item label="简介" prop="intro"><u-input v-model="data.formData.intro" /></u-form-item> -->
<u--form labelPosition="top" labelWidth='100' :model="formData" :rules="rules" ref="form">
<u-form-item label="土地名称" prop="formData.breed" borderBottom ref='item1' required>
<up-input placeholder="请输入土地名称" border="surround" v-model="formData.breed"></up-input>
<u-form-item label="土地名称" prop="title" borderBottom ref='item1' required>
<up-input placeholder="请输入土地名称" border="surround" v-model="data.formData.title"></up-input>
</u-form-item>
<u-form-item label="土地面积" prop="formData.breed" borderBottom required>
<up-input placeholder="请输入土地面积" border="surround" v-model="formData.breed"></up-input>
<u-form-item label="土地面积" prop="area" borderBottom required>
<up-input placeholder="请输入土地面积" border="surround" v-model="data.formData.area"></up-input>
</u-form-item>
<u-form-item label="土地地址" prop="formData.breed" borderBottom required>
<up-input placeholder="请选择土地地址" border="surround" v-model="formData.breed"></up-input>
<u-form-item label="所在省份" prop="province_code" borderBottom required>
<up-input placeholder="请选择所在省份" border="surround" v-model="province_name" disabled="true"
@click="isshow1"></up-input>
</u-form-item>
<u-form-item label="土地负责人" prop="formData.breed" borderBottom required>
<up-input placeholder="请输入土地负责人" border="surround" v-model="formData.breed"></up-input>
<u-form-item label="所在城市" prop="city_code" borderBottom required>
<up-input placeholder="请选择所在城市" border="surround" v-model="city_name" @click="isshow2"
disabled="true"></up-input>
</u-form-item>
<u-form-item label="负责人电话" prop="formData.breed" borderBottom required>
<u-form-item label="所在区县" prop="county_code" borderBottom required>
<up-input placeholder="请选择所在区县" border="surround" v-model="county_name" @click="isshow3"
disabled="true"></up-input>
</u-form-item>
<u-form-item label="所在镇街" prop="town_code" borderBottom required>
<up-input placeholder="请选择所在镇街" border="surround" v-model="town_name" @click="isshow4"
disabled="true"></up-input>
</u-form-item>
<u-form-item label="所在乡村" prop="village_code" borderBottom required>
<up-input placeholder="请选择所在乡村" border="surround" v-model="village_name" @click="isshow5"
disabled="true"></up-input>
</u-form-item>
<u-form-item label="所在小队" prop="group_code" borderBottom required>
<up-input placeholder="请选择所在小队" border="surround" v-model="group_name" @click="isshow6"
disabled="true"></up-input>
</u-form-item>
<u-form-item label="土地负责人" prop="master_name" borderBottom required>
<up-input placeholder="请输入土地负责人" border="surround" v-model="data.formData.master_name"></up-input>
</u-form-item>
<u-form-item label="负责人电话" prop="master_phone" borderBottom required>
<up-input placeholder="请输入负责人电话" type="number" border="surround"
v-model="formData.breed"></up-input>
v-model="data.formData.master_phone"></up-input>
</u-form-item>
<view class="card-li">
<view class="card-li-tit">
土地图片
</view>
<view class="code-img1">
<view class="" v-if="pic.length>0"
style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;">
<view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;">
<u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image>
</view>
</view>
</view>
<view class="code-img">
<view class="" @click="updateImgFn">
<view class="" v-if="formData.buy_cert">
<u--image :src="formData.buy_cert" width="637.85rpx" height="350.47rpx"></u--image>
</view>
<view class="carime-icon" v-else>
<u--image src="/static/img/DJSC.png" width="91.12rpx" height="91.12rpx"></u--image>
<view class="carime-icon">
<u-image src="/static/img/DJSC.png" width="91.12rpx" height="91.12rpx"></u-image>
<view class="">
点击上传图片
</view>
</view>
</view>
</view>
</view>
</u-form>
<u-action-sheet :show="show" keyName="name" closeOnClickOverlay :actions="columns" title="请选择"
@close="show = false" @select="leavaType1">
</u--form>
</u-action-sheet>
<u-action-sheet :show="show1" keyName="name" :actions="columns1" title="请选择" @close="show1 = false"
@select="leavaType2">
</u-action-sheet>
<u-action-sheet :show="show2" keyName="name" :actions="columns2" title="请选择" @close="show2 = false"
@select="leavaType3">
</u-action-sheet>
<u-action-sheet :show="show3" keyName="name" :actions="columns3" title="请选择" @close="show3 = false"
@select="leavaType4">
</u-action-sheet>
<u-action-sheet :show="show4" keyName="name" :actions="columns4" title="请选择" @close="show4 = false"
@select="leavaType5">
</u-action-sheet>
<u-action-sheet :show="show5" keyName="name" :actions="columns5" title="请选择" @close="show5 = false"
@select="leavaType6">
</u-action-sheet>
<u-button @click="submit">提交</u-button>
</view>
<!-- <view class="up-img confim-btn">
+上传播种图片
</view> -->
<view class="confirm">
<view class="confirm-btn" style="color: white;background-color: #0AA565;" @click="addFn">
完成添加
</view>
</view>
<!-- <view class="today-btn confim-btn" @tap="sowFn">
今日播种
</view> -->
</view>
</template>
<script setup>
import uplodeImg from "@/utils/uplodeImg.js"
import {
ref,
reactive,
ref
} from "vue";
onMounted,
unref,
computed,
watch
} from 'vue';
import {
onLoad
} from "@dcloudio/uni-app"
onLoad,
onReady
} from '@dcloudio/uni-app';
import {
Uploads
} from "@/api/upload.js"
import {
addland,
province,
city,
county,
towns,
villages,
groups
} from '@/api/file.js'
const form = ref(null)
// console.log()
const formData = reactive({
breed: ""
})
const rules = {
'formData.breed': {
type: 'string',
required: true,
message: '请填写姓名',
trigger: ['blur', 'change']
const form1 = ref(null);
const data = reactive({
formData: {
title: '',
area: '',
province_code: '',
city_code: '',
county_code: '',
town_code: '',
village_code: '',
group_code: '',
master_name: '',
master_phone: '',
pic: ['https://img0.baidu.com/it/u=1717510975,3258230326&fm=253&fmt=auto?w=120&h=80',
'https://img0.baidu.com/it/u=1717510975,3258230326&fm=253&fmt=auto?w=120&h=80'
]
},
}
const navgo = (url) => {
uni.navigateTo({
url
})
}
const addFn = () => {
form.value.validate().then(res => {
console.log(6)
}).catch(errors => {
uni.$u.toast('校验失败')
})
console.log()
return
this.$refs.uForm.validate().then(res => {
uni.$u.toast('校验通过')
}).catch(errors => {
uni.$u.toast('校验失败')
})
navgo('/pages/index/index')
rules: {
// name: [{
// required: true,
// message: '',
// //
// trigger: ['change', 'blur'],
// }],
// intro: [{
// min: 5,
// message: '5',
// trigger: 'change'
// }],
title: [{
type: 'string',
required: true,
message: '请填写土地名称',
trigger: ['blur', 'change']
}],
area: [{
type: 'string',
required: true,
message: '请填写土地面积',
trigger: ['blur', 'change']
}],
province_code: [{
type: 'string',
required: true,
message: '请请选择所在省份',
trigger: 'change'
}],
city_code: [{
type: 'string',
required: true,
message: '请选择所在城市',
trigger: 'change'
}],
county_code: [{
type: 'string',
required: true,
message: '请选择所在区县',
trigger: 'change'
}],
town_code: [{
type: 'string',
required: true,
message: '请选择所在镇街',
trigger: 'change'
}],
village_code: [{
type: 'string',
required: true,
message: '请选择所在乡村',
trigger: 'change'
}],
group_code: [{
type: 'string',
required: true,
message: '请选择小队',
trigger: 'change'
}],
master_name: [{
type: 'string',
required: true,
message: '请天下负责人',
trigger: ['blur', 'change']
}],
master_phone: [{
required: true,
message: '请输入手机号',
trigger: ['change', 'blur'],
},
{
validator: (rule, value, callback) => {
// truefalse
// uni.$u.test.mobile()truefalse
return uni.$u.test.mobile(value);
},
message: '手机号码不正确',
// blurchange
trigger: ['change', 'blur'],
}
],
}
});
const pic = reactive([]);
const province_name = ref(null)
const city_name = ref(null)
const county_name = ref(null)
const town_name = ref(null)
const village_name = ref(null)
const group_name = ref(null)
const show = ref(false)
const show1 = ref(false)
const show2 = ref(false)
const show3 = ref(false)
const show4 = ref(false)
const show5 = ref(false)
const columns = reactive([])
const columns1 = reactive([])
const columns2 = reactive([])
const columns3 = reactive([])
const columns4 = reactive([])
const columns5 = reactive([])
const provincen = () => {
province().then((res) => {
columns.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.province_name,
id: step.province_code,
};
}));
});
}
const updateImgFn = async () => {
let res = await uplodeImg()
formData.buy_cert = res.data.image
const cityn = (id) => {
console.log(id)
city({
province_code: id
}).then((res) => {
columns1.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.city_name,
id: step.city_code,
};
}));
});
}
const countyn = (id) => {
county({
city_code: id
}).then((res) => {
columns2.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.county_name,
id: step.county_code,
};
}));
});
}
const townsn = (id) => {
towns({
county_code: id
}).then((res) => {
columns3.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.town_name,
id: step.town_code,
};
}));
});
}
//
const updateImgFn = async () => {
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
Uploads(res.tempFilePaths[0], 'img').then(res => {
console.log(res)
if (res.code == 1) {
pic.push(res.data.url)
console.log(data.formData)
uni.$u.toast('上传成功')
}
}).catch(err => {
//console.log('err', err);
// uni.$u.toast('')
})
},
fail: function(err) {
//console.log('choose');
uni.$u.toast('添加失败')
}
});
// let res = await Uploads()
// data.formData.pic = res.data.image
}
const villagesn = (id) => {
villages({
town_code: id
}).then((res) => {
columns4.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.village_name,
id: step.village_code,
};
}));
});
}
const groupsn = () => {
groups().then((res) => {
columns5.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.group_name,
id: step.group_code,
};
}));
});
}
//
const isshow1 = () => {
show.value = true
}
const isshow2 = () => {
show1.value = true
}
const isshow3 = () => {
show2.value = true
}
const isshow4 = () => {
show3.value = true
}
const isshow5 = () => {
show4.value = true
}
const isshow6 = () => {
show5.value = true
}
const leavaType1 = (e) => {
console.log('Received value:', e)
province_name.value = e.name
data.formData.province_code = e.id
cityn(e.id)
}
const leavaType2 = (e) => {
city_name.value = e.name
data.formData.city_code = e.id
countyn(e.id)
}
const leavaType3 = (e) => {
county_name.value = e.name
data.formData.county_code = e.id
townsn(e.id)
}
const leavaType4 = (e) => {
town_name.value = e.name
data.formData.town_code = e.id
villagesn(e.id)
}
const leavaType5 = (e) => {
village_name.value = e.name
data.formData.village_code = e.id
}
const leavaType6 = (e) => {
console.log(e)
group_name.value = e.name
data.formData.group_code = e.id.toString()
}
onReady(() => {
form1.value.setRules(data.rules);
});
const submit = async () => {
try {
const valid = await form1.value.validate();
if (valid) {
console.log('表单通过');
data.formData.pic = JSON.stringify(pic)
if (data.formData.pic.length == 0) {
uni.$u.toast('请上传图片')
return
}
//
addland(data.formData).then((res) => {
console.log(res)
if (res.code == 1) {
uni.navigateBack({
delta: 1
})
uni.$u.toast(res.msg)
// console.log('');
}
})
} else {
//
console.log('表单验证未通过');
}
} catch (error) {
//
console.error(error);
}
}
onLoad((options) => {
provincen()
groupsn()
})
</script>
<style lang='scss' scoped>
.tit {
display: flex;
justify-content: space-between;
}
<style lang="scss">
.card-li-tit {
margin-bottom: 20rpx;
}
@ -177,22 +520,4 @@
}
}
.confirm {
position: fixed;
height: 84.11rpx;
display: flex;
bottom: 30rpx;
width: 750rpx;
.confirm-btn {
width: 315.42rpx;
height: 84.11rpx;
border: #00A15E 1px solid;
margin: 0 auto;
border-radius: 80rpx;
text-align: center;
line-height: 84rpx;
}
}
</style>

504
pages/addLand/addLand1.vue Normal file
View File

@ -0,0 +1,504 @@
<template>
<view class="content">
<view class="card">
<u--form labelPosition="top" labelWidth='100' :model="formData" :rules="rules" ref="form">
<u-form-item label="土地名称" prop="formData.title" borderBottom ref='item1' required>
<up-input placeholder="请输入土地名称" border="surround" v-model="formData.title"></up-input>
</u-form-item>
<u-form-item label="土地面积" prop="formData.area" borderBottom required>
<up-input placeholder="请输入土地面积" border="surround" v-model="formData.area"></up-input>
</u-form-item>
<u-form-item label="所在省份" prop="formData.province_code" borderBottom required>
<up-input placeholder="请选择所在省份" border="surround" v-model="province_name" disabled="true"
@click="isshow1"></up-input>
</u-form-item>
<u-form-item label="所在城市" prop="formData.city_code" borderBottom required>
<up-input placeholder="请选择所在城市" border="surround" v-model="city_name" @click="isshow2"
disabled="true"></up-input>
</u-form-item>
<u-form-item label="所在区县" prop="formData.county_code" borderBottom required>
<up-input placeholder="请选择所在区县" border="surround" v-model="county_name" @click="isshow3"
disabled="true"></up-input>
</u-form-item>
<u-form-item label="所在镇街" prop="formData.town_code" borderBottom required>
<up-input placeholder="请选择所在镇街" border="surround" v-model="town_name" @click="isshow4"
disabled="true"></up-input>
</u-form-item>
<u-form-item label="所在乡村" prop="formData.village_code" borderBottom required>
<up-input placeholder="请选择所在乡村" border="surround" v-model="village_name" @click="isshow5"
disabled="true"></up-input>
</u-form-item>
<u-form-item label="所在小队" prop="formData.group_code" borderBottom required>
<up-input placeholder="请选择所在小队" border="surround" v-model="group_name" @click="isshow6"
disabled="true"></up-input>
</u-form-item>
<u-form-item label="土地负责人" prop="formData.master_name" borderBottom required>
<up-input placeholder="请输入土地负责人" border="surround" v-model="formData.master_name"></up-input>
</u-form-item>
<u-form-item label="负责人电话" prop="formData.master_phone" borderBottom required>
<up-input placeholder="请输入负责人电话" type="number" border="surround"
v-model="formData.master_phone"></up-input>
</u-form-item>
<view class="card-li">
<view class="card-li-tit">
土地图片
</view>
<view class="code-img">
<view class="" @click="updateImgFn">
<view class="" v-if="formData.pic">
<u-image :src="formData.buy_cert" width="637.85rpx" height="350.47rpx"></u-image>
</view>
<view class="carime-icon" v-else>
<u-image src="/static/img/DJSC.png" width="91.12rpx" height="91.12rpx"></u-image>
<view class="">
点击上传图片
</view>
</view>
</view>
</view>
</view>
</u--form>
</view>
<u-action-sheet :show="show" keyName="name" closeOnClickOverlay :actions="columns" title="请选择"
@close="show = false" @select="leavaType1">
</u-action-sheet>
<u-action-sheet :show="show1" keyName="name" :actions="columns1" title="请选择" @close="show1 = false"
@select="leavaType2">
</u-action-sheet>
<u-action-sheet :show="show2" keyName="name" :actions="columns2" title="请选择" @close="show2 = false"
@select="leavaType3">
</u-action-sheet>
<u-action-sheet :show="show3" keyName="name" :actions="columns3" title="请选择" @close="show3 = false"
@select="leavaType4">
</u-action-sheet>
<u-action-sheet :show="show4" keyName="name" :actions="columns4" title="请选择" @close="show4 = false"
@select="leavaType5">
</u-action-sheet>
<u-action-sheet :show="show5" keyName="name" :actions="columns5" title="请选择" @close="show5 = false"
@select="leavaType6">
</u-action-sheet>
<!-- <view class="up-img confim-btn">
+上传播种图片
</view> -->
<view class="confirm">
<view class="confirm-btn" style="color: white;background-color: #0AA565;" @click="addFn">
完成添加
</view>
</view>
<!-- <view class="today-btn confim-btn" @tap="sowFn">
今日播种
</view> -->
</view>
</template>
<script setup>
import uplodeImg from "@/utils/uplodeImg.js"
import {
reactive,
ref
} from "vue";
import {
onLoad,
onReady
} from "@dcloudio/uni-app"
import {
addland,
province,
city,
county,
towns,
villages,
groups
} from '@/api/file.js'
const form = ref(null);
const formData = ref({
title: '',
area: '',
province_code: '',
city_code: '',
county_code: '',
code: '',
village_code: '',
group_code: '',
master_name: '',
master_phone: ''
})
const rules = reactive({
title: {
type: 'string',
required: true,
message: '请填写土地名称',
trigger: ['blur']
},
area: {
type: 'string',
required: true,
message: '请填写土地面积',
trigger: ['blur', 'change']
},
province_code: {
type: 'string',
required: true,
message: '请请选择所在省份',
trigger: ['blur', 'change']
},
city_code: {
type: 'string',
required: true,
message: '请选择所在城市',
trigger: ['blur', 'change']
},
county_code: {
type: 'string',
required: true,
message: '请选择所在区县',
trigger: ['blur', 'change']
},
town_code: {
type: 'string',
required: true,
message: '请选择所在镇街',
trigger: ['blur', 'change']
},
village_code: {
type: 'string',
required: true,
message: '请选择所在乡村',
trigger: ['blur', 'change']
},
group_code: {
type: 'string',
required: true,
message: '请选择小队',
trigger: ['blur', 'change']
},
master_name: {
type: 'string',
required: true,
message: '请天下负责人',
trigger: ['blur', 'change']
},
master_phone: [{
required: true,
message: '请输入手机号',
trigger: ['change', 'blur'],
},
{
//
validator: (rule, value, callback) => {
// truefalse
// this.$u.test.mobile()truefalse
// return this.$u.test.mobile(value);
},
message: '手机号码不正确',
// blurchange
trigger: ['change', 'blur'],
}
],
})
const province_name = ref(null)
const city_name = ref(null)
const county_name = ref(null)
const town_name = ref(null)
const village_name = ref(null)
const group_name = ref(null)
const show = ref(false)
const show1 = ref(false)
const show2 = ref(false)
const show3 = ref(false)
const show4 = ref(false)
const show5 = ref(false)
const columns = reactive([])
const columns1 = reactive([])
const columns2 = reactive([])
const columns3 = reactive([])
const columns4 = reactive([])
const columns5 = reactive([])
const provincen = () => {
province().then((res) => {
columns.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.province_name,
id: step.province_code,
};
}));
});
}
const cityn = (id) => {
console.log(id)
city({
province_code: id
}).then((res) => {
columns1.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.city_name,
id: step.city_code,
};
}));
});
}
const countyn = (id) => {
county({
city_code: id
}).then((res) => {
columns2.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.county_name,
id: step.county_code,
};
}));
});
}
const townsn = (id) => {
towns({
county_code: id
}).then((res) => {
columns3.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.town_name,
id: step.town_code,
};
}));
});
}
const villagesn = (id) => {
villages({
town_code: id
}).then((res) => {
columns4.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.village_name,
id: step.village_code,
};
}));
});
}
const groupsn = () => {
groups().then((res) => {
columns5.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.group_name,
id: step.group_code,
};
}));
});
}
//
const isshow1 = () => {
show.value = true
}
const isshow2 = () => {
show1.value = true
}
const isshow3 = () => {
show2.value = true
}
const isshow4 = () => {
show3.value = true
}
const isshow5 = () => {
show4.value = true
}
const isshow6 = () => {
show5.value = true
}
const leavaType1 = (e) => {
console.log('Received value:', e)
province_name.value = e.name
formData.province_code = e.id
cityn(e.id)
}
const leavaType2 = (e) => {
city_name.value = e.name
formData.city_code = e.id
countyn(e.id)
}
const leavaType3 = (e) => {
county_name.value = e.name
formData.county_code = e.id
townsn(e.id)
}
const leavaType4 = (e) => {
town_name.value = e.name
formData.town_code = e.id
villagesn(e.id)
}
const leavaType5 = (e) => {
village_name.value = e.name
formData.village_code = e.id
groupsn()
}
const leavaType6 = (e) => {
group_name.value = e.name
formData.group_code = e.id
}
const navgo = (url) => {
uni.navigateTo({
url
})
}
const addFn = () => {
console.log('11111');
form.value.validate((valid) => {
console.log(valid);
if (valid) {
uni.showToast({
icon: "none",
title: "表单验证通过"
})
addland(this.formData).then((res) => {
console.log(res)
})
} else {
uni.$u.toast('校验失败')
}
})
// form.value.validate().then(res => {
// console.log(6)
// }).catch(errors => {
// uni.$u.toast('')
// })
// console.log()
// return
// this.$refs.form.validate(valid).then(res => {
// console.log(valid)
// uni.$u.toast('')
// }).catch(errors => {
// uni.$u.toast('')
// })
// navgo('/pages/index/index')
}
const updateImgFn = async () => {
let res = await uplodeImg()
formData.buy_cert = res.data.image
}
onLoad((options) => {
provincen()
})
</script>
<style lang='scss' scoped>
.tit {
display: flex;
justify-content: space-between;
}
.card-li-tit {
margin-bottom: 20rpx;
}
.confim-btn {
margin: 0 auto;
width: 196.26rpx;
height: 66.59rpx;
/* border: ; */
border: #00A15E 1px solid;
color: #00A15E;
display: flex;
align-items: center;
justify-content: center;
border-radius: 42.06rpx 42.06rpx 42.06rpx 42.06rpx;
}
.up-img {
width: 341.71rpx
}
.today-btn {
width: 588.79rpx;
background-color: #00A15E;
color: white;
position: fixed;
bottom: 40rpx;
/* transform: ; */
left: 50%;
transform: translateX(-50%);
background: linear-gradient(to right, #00A15E, #4CC593);
/* margin: 0 auto; */
}
.code-img {
background-color: #F4F4F4;
height: 350.47rpx;
position: relative;
margin-bottom: 100rpx;
.carime-icon {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
}
}
.confirm {
position: fixed;
height: 84.11rpx;
display: flex;
bottom: 30rpx;
width: 750rpx;
.confirm-btn {
width: 315.42rpx;
height: 84.11rpx;
border: #00A15E 1px solid;
margin: 0 auto;
border-radius: 80rpx;
text-align: center;
line-height: 84rpx;
}
}
</style>

403
pages/addLand/addLand2.vue Normal file
View File

@ -0,0 +1,403 @@
<template>
<view class="content">
<view class="card">
<u-form labelPosition="top" labelWidth='100' :model="data.formData" ref="form1">
<!-- <u-form-item label="姓名" prop="name"><u-input v-model="data.formData.name" /></u-form-item>
<u-form-item label="简介" prop="intro"><u-input v-model="data.formData.intro" /></u-form-item> -->
<u-form-item label="土地名称" prop="title" borderBottom ref='item1' required>
<up-input placeholder="请输入土地名称" border="surround" v-model="data.formData.title"></up-input>
</u-form-item>
<u-form-item label="土地面积" prop="area" borderBottom required>
<up-input placeholder="请输入土地面积" border="surround" v-model="data.formData.area"></up-input>
</u-form-item>
<u-form-item label="所在省份" prop="province_code" borderBottom required>
<up-input placeholder="请选择所在省份" border="surround" v-model="province_name" disabled="true"
@click="isshow1"></up-input>
</u-form-item>
<u-form-item label="所在城市" prop="city_code" borderBottom required>
<up-input placeholder="请选择所在城市" border="surround" v-model="city_name" @click="isshow2"
disabled="true"></up-input>
</u-form-item>
<u-form-item label="所在区县" prop="county_code" borderBottom required>
<up-input placeholder="请选择所在区县" border="surround" v-model="county_name" @click="isshow3"
disabled="true"></up-input>
</u-form-item>
<u-form-item label="所在镇街" prop="town_code" borderBottom required>
<up-input placeholder="请选择所在镇街" border="surround" v-model="town_name" @click="isshow4"
disabled="true"></up-input>
</u-form-item>
<u-form-item label="所在乡村" prop="village_code" borderBottom required>
<up-input placeholder="请选择所在乡村" border="surround" v-model="village_name" @click="isshow5"
disabled="true"></up-input>
</u-form-item>
<u-form-item label="所在小队" prop="group_code" borderBottom required>
<up-input placeholder="请选择所在小队" border="surround" v-model="group_name" @click="isshow6"
disabled="true"></up-input>
</u-form-item>
<u-form-item label="土地负责人" prop="master_name" borderBottom required>
<up-input placeholder="请输入土地负责人" border="surround" v-model="data.formData.master_name"></up-input>
</u-form-item>
<u-form-item label="负责人电话" prop="master_phone" borderBottom required>
<up-input placeholder="请输入负责人电话" type="number" border="surround"
v-model="data.formData.master_phone"></up-input>
</u-form-item>
<view class="card-li">
<view class="card-li-tit">
土地图片
</view>
<view class="code-img">
<view class="" @click="updateImgFn">
<view class="" v-if="data.formData.pic">
<u-image :src="data.formData.pic" width="637.85rpx" height="350.47rpx"></u-image>
</view>
<view class="carime-icon" v-else>
<u-image src="/static/img/DJSC.png" width="91.12rpx" height="91.12rpx"></u-image>
<view class="">
点击上传图片
</view>
</view>
</view>
</view>
</view>
</u-form>
<u-action-sheet :show="show" keyName="name" closeOnClickOverlay :actions="columns" title="请选择"
@close="show = false" @select="leavaType1">
</u-action-sheet>
<u-action-sheet :show="show1" keyName="name" :actions="columns1" title="请选择" @close="show1 = false"
@select="leavaType2">
</u-action-sheet>
<u-action-sheet :show="show2" keyName="name" :actions="columns2" title="请选择" @close="show2 = false"
@select="leavaType3">
</u-action-sheet>
<u-action-sheet :show="show3" keyName="name" :actions="columns3" title="请选择" @close="show3 = false"
@select="leavaType4">
</u-action-sheet>
<u-action-sheet :show="show4" keyName="name" :actions="columns4" title="请选择" @close="show4 = false"
@select="leavaType5">
</u-action-sheet>
<u-action-sheet :show="show5" keyName="name" :actions="columns5" title="请选择" @close="show5 = false"
@select="leavaType6">
</u-action-sheet>
<u-button @click="submit">提交</u-button>
</view>
</template>
<script setup>
import {
ref,
reactive,
onMounted,
unref,
computed,
watch
} from 'vue';
import {
onLoad,
onReady
} from '@dcloudio/uni-app';
import {
addland,
province,
city,
county,
towns,
villages,
groups
} from '@/api/file.js'
const form1 = ref();
const data = reactive({
formData: {
title: '',
area: '',
province_code: '',
city_code: '',
county_code: '',
town_code: '',
village_code: '',
group_code: '',
master_name: '',
master_phone: ''
},
rules: {
// name: [{
// required: true,
// message: '',
// //
// trigger: ['change', 'blur'],
// }],
// intro: [{
// min: 5,
// message: '5',
// trigger: 'change'
// }],
title: [{
type: 'string',
required: true,
message: '请填写土地名称',
trigger: ['blur', 'change']
}],
area: [{
type: 'string',
required: true,
message: '请填写土地面积',
trigger: ['blur', 'change']
}],
province_code: [{
type: 'string',
required: true,
message: '请请选择所在省份',
trigger: 'change'
}],
city_code: [{
type: 'string',
required: true,
message: '请选择所在城市',
trigger: 'change'
}],
county_code: [{
type: 'string',
required: true,
message: '请选择所在区县',
trigger: 'change'
}],
town_code: [{
type: 'string',
required: true,
message: '请选择所在镇街',
trigger: 'change'
}],
village_code: [{
type: 'string',
required: true,
message: '请选择所在乡村',
trigger: 'change'
}],
group_code: [{
type: 'string',
required: true,
message: '请选择小队',
trigger: 'change'
}],
master_name: [{
type: 'string',
required: true,
message: '请天下负责人',
trigger: ['blur', 'change']
}],
master_phone: [{
required: true,
message: '请输入手机号',
trigger: ['change', 'blur'],
},
{
//
validator: (rule, value, callback) => {
// truefalse
// this.$u.test.mobile()truefalse
// return this.$u.test.mobile(value);
},
message: '手机号码不正确',
// blurchange
trigger: ['change', 'blur'],
}
],
}
});
const province_name = ref(null)
const city_name = ref(null)
const county_name = ref(null)
const town_name = ref(null)
const village_name = ref(null)
const group_name = ref(null)
const show = ref(false)
const show1 = ref(false)
const show2 = ref(false)
const show3 = ref(false)
const show4 = ref(false)
const show5 = ref(false)
const columns = reactive([])
const columns1 = reactive([])
const columns2 = reactive([])
const columns3 = reactive([])
const columns4 = reactive([])
const columns5 = reactive([])
const provincen = () => {
province().then((res) => {
columns.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.province_name,
id: step.province_code,
};
}));
});
}
const cityn = (id) => {
console.log(id)
city({
province_code: id
}).then((res) => {
columns1.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.city_name,
id: step.city_code,
};
}));
});
}
const countyn = (id) => {
county({
city_code: id
}).then((res) => {
columns2.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.county_name,
id: step.county_code,
};
}));
});
}
const townsn = (id) => {
towns({
county_code: id
}).then((res) => {
columns3.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.town_name,
id: step.town_code,
};
}));
});
}
const villagesn = (id) => {
villages({
town_code: id
}).then((res) => {
columns4.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.village_name,
id: step.village_code,
};
}));
});
}
const groupsn = () => {
groups().then((res) => {
columns5.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.group_name,
id: step.group_code,
};
}));
});
}
//
const isshow1 = () => {
show.value = true
}
const isshow2 = () => {
show1.value = true
}
const isshow3 = () => {
show2.value = true
}
const isshow4 = () => {
show3.value = true
}
const isshow5 = () => {
show4.value = true
}
const isshow6 = () => {
show5.value = true
}
const leavaType1 = (e) => {
console.log('Received value:', e)
province_name.value = e.name
data.formData.province_code = e.id
cityn(e.id)
}
const leavaType2 = (e) => {
city_name.value = e.name
data.formData.city_code = e.id
countyn(e.id)
}
const leavaType3 = (e) => {
county_name.value = e.name
data.formData.county_code = e.id
townsn(e.id)
}
const leavaType4 = (e) => {
town_name.value = e.name
data.formData.town_code = e.id
villagesn(e.id)
}
const leavaType5 = (e) => {
village_name.value = e.name
data.formData.village_code = e.id
}
const leavaType6 = (e) => {
console.log(e)
group_name.value = e.name
data.formData.group_code = e.id.toString()
}
onReady(() => {
form1.value.setRules(data.rules);
});
const submit = (e) => {
form1.value.validate(valid => {
console.log(valid)
if (valid) {
uni.showToast({
title: "验证通过",
icon: 'none'
});
console.log('验证通过');
} else {
console.log('验证失败');
}
});
}
onLoad((options) => {
provincen()
groupsn()
})
</script>

View File

@ -3,69 +3,85 @@
<view class="content">
<view class="card">
<u--form labelPosition="top" labelWidth='100' :model="formData" :rules="rules" ref="form">
<u-form-item label="药剂种类" prop="formData.breed" borderBottom ref='item1' required>
<up-input placeholder="请输入药剂种类" :disabled="mode=='detail'" border="surround"
<u-form-item label="杀虫剂种类" prop="kind" borderBottom ref='item1' required>
<up-input placeholder="请输入杀虫剂种类" :disabled="mode=='detail'" border="surround"
v-model="formData.kind"></up-input>
</u-form-item>
<u-form-item label="杀虫剂品牌" prop="breed" borderBottom required>
<up-input placeholder="请输入杀虫剂品牌" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="药剂品牌" prop="formData.breed" borderBottom required>
<up-input placeholder="请输入药剂品牌" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
<u-form-item label="杀虫剂用量" prop="dosage" borderBottom required>
<up-input placeholder="请输入杀虫剂用量" border="surround" :disabled="mode=='detail'"
v-model="formData.dosage"></up-input>
</u-form-item>
<u-form-item label="药剂用量" prop="formData.breed" borderBottom required>
<up-input placeholder="请输入药剂用量" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
<view class="" v-if="mode=='add'">
<u-form-item label="开始日期" @click="openDate" prop="start_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.start_date"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="end_date" @click="openDate1" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.end_date"></up-input>
</u-form-item>
</view>
<view class="" v-else>
<u-form-item label="开始日期" prop="start_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.start_date"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="end_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.end_date"></up-input>
</u-form-item>
</view>
<u-form-item label="作业面积" prop="area" borderBottom required>
<up-input placeholder="请输入作业面积" :disabled="mode=='detail'" type="number" border="surround"
v-model="formData.area"></up-input>
</u-form-item>
<u-form-item label="开始日期" prop="formData.breed" borderBottom required>
<up-input placeholder="请选择日期" border="surround" @blur="openDate" :disabled="mode=='detail'"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="formData.breed" borderBottom required>
<up-input placeholder="请选择日期" border="surround" @blur="openDate" :disabled="mode=='detail'"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="作业地块" prop="formData.breed" borderBottom required>
<up-input placeholder="请输入作业地块" border="surround" :disabled="mode=='detail'"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="作业面积" prop="formData.breed" borderBottom required>
<up-input placeholder="请输入作业面积" type="number" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="参与人" prop="formData.breed" borderBottom required>
<up-input placeholder="请输入参与人" type="number" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
<u-form-item label="参与人" prop="user" borderBottom required>
<up-input placeholder="请输入参与人" :disabled="mode=='detail'" type="txt" border="surround"
v-model="formData.user"></up-input>
</u-form-item>
<view class="card-li">
<view class="card-li-tit">
防治图片
杀虫图片
</view>
<view class="code-img">
<view class="" @click="updateImgFn">
<view class="" v-if="formData.buy_cert">
<u--image :src="formData.buy_cert" width="637.85rpx" height="350.47rpx"></u--image>
<view class="code-img1">
<view class="" v-if="pic.length>0"
style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;">
<view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;">
<u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image>
</view>
<view class="carime-icon" v-else>
<u--image src="/static/img/DJSC.png" width="91.12rpx" height="91.12rpx"></u--image>
</view>
</view>
<view class="code-img" v-if="mode=='add'">
<view class="" @click="updateImgFn">
<view class="carime-icon">
<u-image src="/static/img/DJSC.png" width="91.12rpx" height="91.12rpx"></u-image>
<view class="">
点击上传图片
</view>
</view>
</view>
</view>
</view>
<u-form-item label="备注" prop="formData.breed" borderBottom required>
<u--textarea v-model="formData.breed" :disabled="mode=='detail'" placeholder="请输入内容"></u--textarea>
<u-form-item label="备注" prop="remark" borderBottom required>
<u--textarea v-model="formData.remark" :disabled="mode=='detail'" placeholder="请输入内容"></u--textarea>
</u-form-item>
</u--form>
<view>
<uni-calendar ref="calendar" :showMonth="true" :lunar="true" :insert="false" @confirm="dateConfirmfn" />
<uni-calendar ref="calendar1" :showMonth="true" :lunar="true" :insert="false"
@confirm="dateConfirmfn1" />
</view>
</view>
<view class="confirm" v-if="mode=='add'">
<view class="confirm-btn" style="color: white;background-color: #0AA565;" @click="addFn">
完成添加
@ -80,69 +96,211 @@
</template>
<script setup>
import uplodeImg from "@/utils/uplodeImg.js"
import {
Uploads
} from "@/api/upload.js"
import {
reactive,
ref
} from "vue";
import {
onLoad
} from "@dcloudio/uni-app"
onLoad,
onReady
} from '@dcloudio/uni-app';
import {
addaction
} from '@/api/file.js'
const pic = reactive([]);
const calendar = ref(null)
const calendar1 = ref(null)
const form = ref(null)
const task_id = ref('');
const openDate = () => {
calendar.value.open()
}
const openDate1 = () => {
calendar1.value.open()
}
// console.log()
const formData = reactive({
breed: ""
kind: "",
breed: "",
dosage: "",
start_date: "",
dosage: "",
end_date: "",
})
const dateConfirmfn = (e) => {
console.log(e)
formData.start_date = e.fulldate
}
const rules = {
'formData.breed': {
const dateConfirmfn1 = (e) => {
console.log(e)
formData.end_date = e.fulldate
}
const rules = ref({
'kind': {
type: 'string',
required: true,
message: '请填写姓名',
message: '请填写杀虫剂种类',
trigger: ['blur', 'change']
},
'breed': {
type: 'string',
required: true,
message: '请填写杀虫剂品牌',
trigger: ['blur', 'change']
},
'dosage': {
type: 'string',
required: true,
message: '请填写杀虫剂用量',
trigger: ['blur', 'change']
},
'start_date': {
type: 'string',
required: true,
message: '请填写开始日期',
trigger: ['blur', 'change']
},
'end_date': {
type: 'string',
required: true,
message: '请填写结束日期',
trigger: ['blur', 'change']
},
'area': {
type: 'string',
required: true,
message: '请填写土地面积',
trigger: ['blur', 'change']
},
'user': {
type: 'string',
required: true,
message: '请填写参与人',
trigger: ['blur', 'change']
},
'remark': {
type: 'string',
required: true,
message: '请填写备注',
trigger: ['blur', 'change']
},
})
onReady(() => {
form.value.setRules(rules);
});
//
const updateImgFn = async () => {
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
Uploads(res.tempFilePaths[0], 'img').then(res => {
console.log(res)
if (res.code == 1) {
pic.push(res.data.url)
console.log(data.formData)
uni.$u.toast('上传成功')
}
}).catch(err => {
//console.log('err', err);
// uni.$u.toast('')
})
},
fail: function(err) {
//console.log('choose');
uni.$u.toast('添加失败')
}
});
// let res = await Uploads()
// data.formData.pic = res.data.image
}
const navgo = (url) => {
uni.navigateTo({
url
})
}
const addFn = () => {
form.value.validate().then(res => {
console.log(6)
}).catch(errors => {
uni.$u.toast('校验失败')
console.log(res)
if (res) {
formData.pic = pic
let data1 = {
plant_id: task_id.value,
type: 4,
detail: JSON.stringify(formData)
};
if (formData.pic.length == 0) {
uni.$u.toast('请上传图片')
return
}
console.log('表单通过');
//
addaction(data1).then((res) => {
console.log(res)
if (res.code == 1) {
uni.$u.toast(res.msg)
uni.navigateBack({
delta: 1
})
}
})
// uni.$u.toast('')
}
})
console.log()
return
this.$refs.uForm.validate().then(res => {
uni.$u.toast('校验通过')
}).catch(errors => {
uni.$u.toast('校验失败')
})
navgo('/pages/index/index')
}
const updateImgFn = async () => {
if (mode.value == 'detail') return
let res = await uplodeImg()
formData.buy_cert = res.data.image
}
const mode = ref('add')
onLoad((options) => {
if (options.task_id) {
mode.value = "detail"
if (options.task) {
let data = options.task ? JSON.parse(decodeURIComponent(options.task)) : null;
console.log(data, data.detail)
Object.assign(formData, data.detail);
pic.splice(0, pic.length, data.detail.pic);
mode.value = 'detail'
uni.setNavigationBarTitle({
title: '虫害防治信息详情'
})
// formData=data.detail
} else {
task_id.value = options.id
}
})
</script>

View File

@ -3,72 +3,90 @@
<view class="content">
<view class="card">
<u--form labelPosition="top" labelWidth='100' :model="formData" :rules="rules" ref="form">
<u-form-item label="肥料种类" prop="formData.breed" borderBottom ref='item1' required>
<u-form-item label="肥料种类" prop="kind" borderBottom ref='item1' required>
<up-input placeholder="请输入肥料种类" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
v-model="formData.kind"></up-input>
</u-form-item>
<u-form-item label="肥料品牌" prop="formData.breed" borderBottom required>
<u-form-item label="肥料品牌" prop="breed" borderBottom required>
<up-input placeholder="请输入肥料品牌" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="肥料用量" prop="formData.breed" borderBottom required>
<u-form-item label="肥料用量" prop="dosage" borderBottom required>
<up-input placeholder="请输入肥料用量" border="surround" :disabled="mode=='detail'"
v-model="formData.breed"></up-input>
v-model="formData.dosage"></up-input>
</u-form-item>
<u-form-item label="开始日期" @click="openDate" prop="formData.breed" borderBottom required>
<up-input placeholder="请选择日期" @blur="openDate" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="formData.breed" borderBottom required>
<up-input placeholder="请选择日期" @blur="openDate" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="作业地块" prop="formData.breed" borderBottom required>
<up-input placeholder="请输入作业地块" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="作业面积" prop="formData.breed" borderBottom required>
<view class="" v-if="mode=='add'">
<u-form-item label="开始日期" @click="openDate" prop="start_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.start_date"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="end_date" @click="openDate1" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.end_date"></up-input>
</u-form-item>
</view>
<view class="" v-else>
<u-form-item label="开始日期" prop="start_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.start_date"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="end_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.end_date"></up-input>
</u-form-item>
</view>
<u-form-item label="作业面积" prop="area" borderBottom required>
<up-input placeholder="请输入作业面积" :disabled="mode=='detail'" type="number" border="surround"
v-model="formData.breed"></up-input>
v-model="formData.area"></up-input>
</u-form-item>
<u-form-item label="参与人" prop="formData.breed" borderBottom required>
<up-input placeholder="请输入参与人" :disabled="mode=='detail'" type="number" border="surround"
v-model="formData.breed"></up-input>
<u-form-item label="参与人" prop="user" borderBottom required>
<up-input placeholder="请输入参与人" :disabled="mode=='detail'" type="txt" border="surround"
v-model="formData.user"></up-input>
</u-form-item>
<view class="card-li">
<view class="card-li-tit">
施肥图片
</view>
<view class="code-img">
<view class="" @click="updateImgFn">
<view class="" v-if="formData.buy_cert">
<u--image :src="formData.buy_cert" width="637.85rpx" height="350.47rpx"></u--image>
<view class="code-img1">
<view class="" v-if="pic.length>0"
style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;">
<view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;">
<u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image>
</view>
<view class="carime-icon" v-else>
<u--image src="/static/img/DJSC.png" width="91.12rpx" height="91.12rpx"></u--image>
<view class="">
</view>
</view>
<view class="code-img" v-if="mode=='add'">
<view class="" @click="updateImgFn">
<view class="carime-icon">
<u-image src="/static/img/DJSC.png" width="91.12rpx" height="91.12rpx"></u-image>
<view class="">
点击上传图片
</view>
</view>
</view>
</view>
</view>
<u-form-item label="备注" prop="formData.breed" borderBottom required>
<u--textarea v-model="formData.breed" :disabled="mode=='detail'" placeholder="请输入内容"></u--textarea>
<u-form-item label="备注" prop="remark" borderBottom required>
<u--textarea v-model="formData.remark" :disabled="mode=='detail'" placeholder="请输入内容"></u--textarea>
</u-form-item>
</u--form>
<view>
<uni-calendar ref="calendar" :showMonth="true" :lunar="true" :insert="false" @confirm="dateConfirmfn" />
<uni-calendar ref="calendar1" :showMonth="true" :lunar="true" :insert="false"
@confirm="dateConfirmfn1" />
</view>
</view>
<view class="confirm" v-if="mode=='add'">
<view class="confirm-btn" style="color: white;background-color: #0AA565;" @click="addFn">
完成添加
</view>
</view>dateConfirmfn1
</view>
@ -79,69 +97,215 @@
</template>
<script setup>
import uplodeImg from "@/utils/uplodeImg.js"
import {
Uploads
} from "@/api/upload.js"
import {
reactive,
ref
} from "vue";
import {
onLoad
} from "@dcloudio/uni-app"
onLoad,
onReady
} from '@dcloudio/uni-app';
import {
addaction
} from '@/api/file.js'
const pic = reactive([]);
const calendar = ref(null)
const calendar1 = ref(null)
const form = ref(null)
const task_id = ref('');
const openDate = () => {
calendar.value.open()
}
const openDate1 = () => {
calendar1.value.open()
}
// console.log()
const formData = reactive({
breed: ""
kind: "",
breed: "",
dosage: "",
start_date: "",
dosage: "",
end_date: "",
})
const dateConfirmfn = (e) => {
console.log(e)
formData.start_date = e.fulldate
}
const rules = {
'formData.breed': {
const dateConfirmfn1 = (e) => {
formData.end_date = e.fulldate
}
const rules = ref({
'kind': {
type: 'string',
required: true,
message: '请填写姓名',
message: '请填写肥料种类',
trigger: ['blur', 'change']
},
'breed': {
type: 'string',
required: true,
message: '请填写肥料品牌',
trigger: ['blur', 'change']
},
'dosage': {
type: 'string',
required: true,
message: '请填写肥料用量',
trigger: ['blur', 'change']
},
'start_date': {
type: 'string',
required: true,
message: '请填写开始日期',
trigger: ['blur', 'change']
},
'end_date': {
type: 'string',
required: true,
message: '请填写结束日期',
trigger: ['blur', 'change']
},
'area': {
type: 'string',
required: true,
message: '请填写土地面积',
trigger: ['blur', 'change']
},
'user': {
type: 'string',
required: true,
message: '请填写参与人',
trigger: ['blur', 'change']
},
'remark': {
type: 'string',
required: true,
message: '请填写备注',
trigger: ['blur', 'change']
},
})
onReady(() => {
form.value.setRules(rules);
});
//
const updateImgFn = async () => {
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
Uploads(res.tempFilePaths[0], 'img').then(res => {
console.log(res)
if (res.code == 1) {
pic.push(res.data.url)
console.log(pic)
uni.$u.toast('上传成功')
}
}).catch(err => {
//console.log('err', err);
// uni.$u.toast('')
})
},
fail: function(err) {
//console.log('choose');
uni.$u.toast('添加失败')
}
});
// let res = await Uploads()
// data.formData.pic = res.data.image
}
const navgo = (url) => {
uni.navigateTo({
url
})
}
const addFn = () => {
form.value.validate().then(res => {
console.log(6)
}).catch(errors => {
uni.$u.toast('校验失败')
console.log(res)
if (res) {
formData.pic = pic
let data1 = {
plant_id: task_id.value,
type: 1,
detail: JSON.stringify(formData)
};
if (formData.pic.length == 0) {
uni.$u.toast('请上传图片')
return
}
console.log('表单通过');
//
addaction(data1).then((res) => {
console.log(res)
if (res.code == 1) {
uni.$u.toast(res.msg)
uni.navigateBack({
delta: 1
})
}
})
// uni.$u.toast('')
}
})
console.log()
return
this.$refs.uForm.validate().then(res => {
uni.$u.toast('校验通过')
}).catch(errors => {
uni.$u.toast('校验失败')
})
navgo('/pages/index/index')
}
const updateImgFn = async () => {
if (mode.value == 'detail') return
let res = await uplodeImg()
formData.buy_cert = res.data.image
}
const mode = ref('add')
onLoad((options) => {
if (options.task_id) {
mode.value = "detail"
if (options.task) {
let data = options.task ? JSON.parse(decodeURIComponent(options.task)) : null;
console.log(data, data.detail)
Object.assign(formData, data.detail);
pic.splice(0, pic.length, data.detail.pic);
mode.value = 'detail'
uni.setNavigationBarTitle({
title: '施肥详情'
})
// formData=data.detail
} else {
task_id.value = options.id
}
})
</script>

View File

@ -4,41 +4,49 @@
<view class="card">
<u--form labelPosition="top" labelWidth='100' :model="formData" :rules="rules" ref="form">
<u-form-item label="作业地块" prop="formData.breed" borderBottom required>
<!-- <u-form-item label="作业地块" prop="formData.breed" borderBottom required>
<up-input placeholder="请输入作业地块" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="作业面积" prop="formData.breed" borderBottom required>
<up-input placeholder="请输入作业面积" :disabled="mode=='detail'" type="number" border="surround"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="参与人" prop="formData.breed" borderBottom required>
<up-input placeholder="请输入参与人" :disabled="mode=='detail'" type="number" border="surround"
v-model="formData.breed"></up-input>
</u-form-item> -->
<u-form-item label="参与人" prop="user" borderBottom required>
<up-input placeholder="请输入参与人" :disabled="mode=='detail'" type="txt" border="surround"
v-model="formData.user"></up-input>
</u-form-item>
<view class="card-li">
<view class="card-li-tit">
收获图片
</view>
<view class="code-img">
<view class="" @click="updateImgFn">
<view class="" v-if="formData.buy_cert">
<u--image :src="formData.buy_cert" width="637.85rpx" height="350.47rpx"></u--image>
<view class="code-img1">
<view class="" v-if="pic.length>0"
style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;">
<view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;">
<u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image>
</view>
<view class="carime-icon" v-else>
<u--image src="/static/img/DJSC.png" width="91.12rpx" height="91.12rpx"></u--image>
</view>
</view>
<view class="code-img" v-if="mode=='add'">
<view class="" @click="updateImgFn">
<view class="carime-icon">
<u-image src="/static/img/DJSC.png" width="91.12rpx" height="91.12rpx"></u-image>
<view class="">
点击上传图片
</view>
</view>
</view>
</view>
</view>
<u-form-item label="备注" prop="formData.breed" borderBottom required>
<u--textarea :disabled="mode=='detail'" v-model="formData.breed" placeholder="请输入内容"></u--textarea>
<u-form-item label="备注" prop="remark" borderBottom required>
<u--textarea v-model="formData.remark" :disabled="mode=='detail'" placeholder="请输入内容"></u--textarea>
</u-form-item>
</u--form>
</view>
@ -57,31 +65,49 @@
</template>
<script setup>
import uplodeImg from "@/utils/uplodeImg.js"
import {
Uploads
} from "@/api/upload.js"
import {
reactive,
ref
} from "vue";
import {
onLoad
onLoad,
onReady
} from "@dcloudio/uni-app"
import {
addaction
} from '@/api/file.js'
const form = ref(null)
const pic = reactive([]);
const formData = reactive({
breed: ""
user: "",
remark: "",
pic: []
})
const dateConfirmfn = (e) => {
console.log(e)
}
const rules = {
'formData.breed': {
'user': {
type: 'string',
required: true,
message: '请填写姓名',
message: '请填写参与人',
trigger: ['blur', 'change']
},
'remark': {
type: 'string',
required: true,
message: '请填写备注',
trigger: ['blur', 'change']
},
}
onReady(() => {
form.value.setRules(rules);
});
const navgo = (url) => {
uni.navigateTo({
url
@ -89,23 +115,77 @@
}
const addFn = () => {
form.value.validate().then(res => {
console.log(6)
}).catch(errors => {
uni.$u.toast('校验失败')
console.log(res)
if (res) {
formData.pic = pic
let data1 = {
plant_id: task_id.value,
type: 5,
detail: JSON.stringify(formData)
};
if (formData.pic.length == 0) {
uni.$u.toast('请上传图片')
return
}
console.log('表单通过');
//
addaction(data1).then((res) => {
console.log(res)
if (res.code == 1) {
uni.$u.toast(res.msg)
uni.navigateBack({
delta: 1
})
}
})
// uni.$u.toast('')
}
})
console.log()
return
this.$refs.uForm.validate().then(res => {
uni.$u.toast('校验通过')
}).catch(errors => {
uni.$u.toast('校验失败')
})
navgo('/pages/index/index')
}
//
const updateImgFn = async () => {
if (mode.value == 'detail') return
let res = await uplodeImg()
formData.buy_cert = res.data.image
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
Uploads(res.tempFilePaths[0], 'img').then(res => {
console.log(res)
if (res.code == 1) {
pic.push(res.data.url)
console.log(data.formData)
uni.$u.toast('上传成功')
}
}).catch(err => {
//console.log('err', err);
// uni.$u.toast('')
})
},
fail: function(err) {
//console.log('choose');
uni.$u.toast('添加失败')
}
});
// let res = await Uploads()
// data.formData.pic = res.data.image
}
const mode = ref('add')
onLoad((options) => {

View File

@ -3,58 +3,85 @@
<view class="content">
<view class="card">
<u--form labelPosition="top" labelWidth='100' :model="formData" :rules="rules" ref="form">
<u-form-item label="灌溉方式" prop="formData.breed" borderBottom ref='item1' required>
<uni-data-select v-model="formData.breed" :disabled="mode=='detail'"
:localdata="range"></uni-data-select>
<u-form-item label="灌溉方式" prop="type" borderBottom required @click="showggai">
<!-- <uni-data-select v-model="formData.type" :disabled="mode=='detail'"
:localdata="range"></uni-data-select> -->
<up-input placeholder="请选择灌溉方式" :disabled="true" border="surround"
v-model="formDatatype"></up-input>
</u-form-item>
<u-form-item label="开始日期" prop="formData.breed" borderBottom required>
<up-input placeholder="请选择日期" @blur="openDate" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="formData.breed" borderBottom required>
<up-input placeholder="请选择日期" @blur="openDate" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="作业地块" prop="formData.breed" borderBottom required>
<up-input placeholder="请输入作业地块" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="作业面积" prop="formData.breed" borderBottom required>
<view class="" v-if="mode=='add'">
<u-form-item label="开始日期" @click="openDate" prop="start_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.start_date"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="end_date" @click="openDate1" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.end_date"></up-input>
</u-form-item>
</view>
<view class="" v-else>
<u-form-item label="开始日期" prop="start_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.start_date"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="end_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.end_date"></up-input>
</u-form-item>
</view>
<u-form-item label="灌溉面积" prop="area" borderBottom required>
<up-input placeholder="请输入作业面积" :disabled="mode=='detail'" type="number" border="surround"
v-model="formData.breed"></up-input>
v-model="formData.area"></up-input>
</u-form-item>
<u-form-item label="参与人" prop="formData.breed" borderBottom required>
<up-input placeholder="请输入参与人" type="number" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
<u-form-item label="参与人" prop="user" borderBottom required>
<up-input placeholder="请输入参与人" :disabled="mode=='detail'" type="txt" border="surround"
v-model="formData.user"></up-input>
</u-form-item>
<view class="card-li">
<view class="card-li-tit">
灌溉图片
</view>
<view class="code-img">
<view class="" @click="updateImgFn">
<view class="" v-if="formData.buy_cert">
<u--image :src="formData.buy_cert" width="637.85rpx" height="350.47rpx"></u--image>
<view class="code-img1">
<view class="" v-if="pic.length>0"
style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;">
<view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;">
<u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image>
</view>
<view class="carime-icon" v-else>
<u--image src="/static/img/DJSC.png" width="91.12rpx" height="91.12rpx"></u--image>
</view>
</view>
<view class="code-img" v-if="mode=='add'">
<view class="" @click="updateImgFn">
<view class="carime-icon">
<u-image src="/static/img/DJSC.png" width="91.12rpx" height="91.12rpx"></u-image>
<view class="">
点击上传图片
</view>
</view>
</view>
</view>
</view>
<u-form-item label="备注" prop="formData.breed" borderBottom required>
<u--textarea v-model="formData.breed" :disabled="mode=='detail'" placeholder="请输入内容"></u--textarea>
<u-form-item label="备注" prop="remark" borderBottom required>
<u--textarea v-model="formData.remark" :disabled="mode=='detail'" placeholder="请输入内容"></u--textarea>
</u-form-item>
</u--form>
<view>
<uni-calendar ref="calendar" :showMonth="true" :lunar="true" :insert="false" @confirm="dateConfirmfn" />
<uni-calendar ref="calendar1" :showMonth="true" :lunar="true" :insert="false"
@confirm="dateConfirmfn1" />
<u-action-sheet
:show="showgg"
:actions="range"
title="请选择灌溉方式"
@close="showgg = false"
@select="ggSelect"
>
</u-action-sheet>
</view>
</view>
@ -73,49 +100,111 @@
</template>
<script setup>
import uplodeImg from "@/utils/uplodeImg.js"
import {
Uploads
} from "@/api/upload.js"
import {
reactive,
ref
} from "vue";
import {
onLoad
onLoad,
onReady
} from "@dcloudio/uni-app"
const range = reactive([{
value: 0,
text: "喷灌"
name: "喷灌"
},
{
value: 1,
text: "滴灌"
name: "滴灌"
},
{
value: 2,
text: "沟灌"
name: "沟灌"
},
])
const pic = reactive([]);
const calendar = ref(null)
const calendar1 = ref(null)
const formDatatype = ref('')
const showgg= ref(false)
const form = ref(null)
const openDate = () => {
calendar.value.open()
}
const openDate1 = () => {
calendar1.value.open()
}
// console.log()
const formData = reactive({
breed: ""
type: "",
})
//
const ggSelect = (e) => {
formDatatype.value=e.name
formData.type = e.value
}
//
const showggai = () => {
showgg.value=true
}
//
const dateConfirmfn = (e) => {
console.log(e)
formData.start_date = e.fulldate
}
const dateConfirmfn1 = (e) => {
formData.end_date = e.fulldate
}
const rules = {
'formData.breed': {
'type': {
type: 'string',
required: true,
message: '请填写姓名',
message: '请选择灌溉方式',
trigger: ['change']
},
'start_date': {
type: 'string',
required: true,
message: '请填写开始日期',
trigger: ['blur', 'change']
},
'end_date': {
type: 'string',
required: true,
message: '请填写结束日期',
trigger: ['blur', 'change']
},
'area': {
type: 'string',
required: true,
message: '请填写土地面积',
trigger: ['blur', 'change']
},
'user': {
type: 'string',
required: true,
message: '请填写参与人',
trigger: ['blur', 'change']
},
'remark': {
type: 'string',
required: true,
message: '请填写备注',
trigger: ['blur', 'change']
},
}
onReady(() => {
form.value.setRules(rules);
});
const navgo = (url) => {
uni.navigateTo({
url
@ -123,31 +212,96 @@
}
const addFn = () => {
form.value.validate().then(res => {
console.log(6)
}).catch(errors => {
uni.$u.toast('校验失败')
console.log(res)
if (res) {
formData.pic = pic
let data1 = {
plant_id: task_id.value,
type: 3,
detail: JSON.stringify(formData)
};
if (formData.pic.length == 0) {
uni.$u.toast('请上传图片')
return
}
console.log('表单通过');
//
addaction(data1).then((res) => {
console.log(res)
if (res.code == 1) {
uni.$u.toast(res.msg)
uni.navigateBack({
delta: 1
})
}
})
// uni.$u.toast('')
}
})
console.log()
return
this.$refs.uForm.validate().then(res => {
uni.$u.toast('校验通过')
}).catch(errors => {
uni.$u.toast('校验失败')
})
navgo('/pages/index/index')
}
//
const updateImgFn = async () => {
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
Uploads(res.tempFilePaths[0], 'img').then(res => {
console.log(res)
if (res.code == 1) {
pic.push(res.data.url)
console.log(data.formData)
uni.$u.toast('上传成功')
}
}).catch(err => {
//console.log('err', err);
// uni.$u.toast('')
})
},
fail: function(err) {
//console.log('choose');
uni.$u.toast('添加失败')
}
});
// let res = await Uploads()
// data.formData.pic = res.data.image
}
const updateImgFn = async () => {
if (mode.value == 'detail') return
let res = await uplodeImg()
formData.buy_cert = res.data.image
}
const mode = ref('add')
onLoad((options) => {
if (options.task_id) {
mode.value = "detail"
if (options.task) {
let data = options.task ? JSON.parse(decodeURIComponent(options.task)) : null;
console.log(data, data.detail)
Object.assign(formData, data.detail);
pic.splice(0, pic.length, data.detail.pic);
mode.value = 'detail'
uni.setNavigationBarTitle({
title: '施肥详情'
})
// formData=data.detail
} else {
task_id.value = options.id
}
})
</script>

View File

@ -2,55 +2,60 @@
<!-- 播种 -->
<view class="content">
<view class="card">
<u--form labelPosition="top" labelWidth='100' :model="formData" :rules="rules" ref="form">
<u-form-item label="种植种类" prop="formData.breed" borderBottom ref='item1' required>
<u-form labelPosition="top" labelWidth='100' :model="data.formData" ref="form1">
<u-form-item label="种植种类" prop="kind" borderBottom ref='item1' required>
<up-input placeholder="请输入种植种类" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
v-model="data.formData.kind"></up-input>
</u-form-item>
<u-form-item label="种植品种" prop="formData.breed" borderBottom required>
<u-form-item label="种植品种" prop="breed" borderBottom required>
<up-input placeholder="请输入品种" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
v-model="data.formData.breed"></up-input>
</u-form-item>
<u-form-item label="开始日期" prop="formData.breed" borderBottom required>
<up-input placeholder="请选择日期" @blur="openDate" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
<u-form-item label="开始日期" prop="date" borderBottom required>
<up-input placeholder="请选择日期" @click="openDate" :disabled="true" border="surround"
v-model="data.formData.date"></up-input>
</u-form-item>
<u-form-item label="作业地块" prop="formData.breed" borderBottom required>
<up-input placeholder="请输入作业地块" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="种植面积" prop="formData.breed" borderBottom required>
<u-form-item label="种植面积" prop="area" borderBottom required>
<up-input placeholder="请输入种植面积" :disabled="mode=='detail'" type="number" border="surround"
v-model="formData.breed"></up-input>
v-model="data.formData.area"></up-input>
</u-form-item>
<u-form-item label="参与人" prop="formData.breed" borderBottom required>
<up-input placeholder="请输入参与人" :disabled="mode=='detail'" type="number" border="surround"
v-model="formData.breed"></up-input>
<u-form-item label="参与人" prop="user" borderBottom required>
<up-input placeholder="请输入参与人" :disabled="mode=='detail'" type="txt" border="surround"
v-model="data.formData.user"></up-input>
</u-form-item>
<view class="card-li">
<view class="card-li-tit">
种植图片
土地图片
</view>
<view class="code-img1">
<view class="" v-if="pic.length>0"
style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;">
<view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;">
<u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image>
</view>
</view>
</view>
<view class="code-img">
<view class="" @click="updateImgFn">
<view class="" v-if="formData.buy_cert">
<u--image :src="formData.buy_cert" width="637.85rpx" height="350.47rpx"></u--image>
</view>
<view class="carime-icon" v-else>
<u--image src="/static/img/DJSC.png" width="91.12rpx" height="91.12rpx"></u--image>
<view class="carime-icon">
<u-image src="/static/img/DJSC.png" width="91.12rpx" height="91.12rpx"></u-image>
<view class="">
点击上传图片
</view>
</view>
</view>
</view>
</view>
<u-form-item label="备注" prop="formData.breed" borderBottom required>
<u--textarea v-model="formData.breed" :disabled="mode=='detail'" placeholder="请输入内容"></u--textarea>
<u-form-item label="备注" prop="remark" borderBottom required>
<u--textarea v-model="data.formData.remark" :disabled="mode=='detail'"
placeholder="请输入内容"></u--textarea>
</u-form-item>
</u--form>
</u-form>
<view>
<uni-calendar ref="calendar" :showMonth="true" :lunar="true" :insert="false" @confirm="dateConfirmfn" />
@ -72,68 +77,190 @@
</template>
<script setup>
import uplodeImg from "@/utils/uplodeImg.js"
import {
Uploads
} from "@/api/upload.js"
import {
reactive,
ref
} from "vue";
import {
onLoad
onLoad,
onReady
} from "@dcloudio/uni-app"
import {
addplant
} from '@/api/file.js'
const calendar = ref(null)
const form = ref(null)
const form1 = ref(null);
const task_id = ref('');
const pic = reactive([]);
const data = reactive({
formData: {
kind: '',
breed: '',
area: '',
user: '',
date: '',
remark: '',
pic: []
},
rules: {
kind: [{
type: 'string',
required: true,
message: '请填写种植种类',
trigger: ['blur', 'change']
}],
breed: [{
type: 'string',
required: true,
message: '请填写种植品种',
trigger: ['blur', 'change']
}],
area: [{
type: 'string',
required: true,
message: '请填写种植面积',
trigger: ['blur', 'change']
}],
user: [{
type: 'string',
required: true,
message: '请填写参与人员',
trigger: ['blur', 'change']
}],
date: [{
type: 'string',
required: true,
message: '请填写开始日期',
trigger: ['blur', 'change']
}],
remark: [{
type: 'string',
required: true,
message: '请填写备注信息',
trigger: ['blur', 'change']
}]
}
})
onReady(() => {
form1.value.setRules(data.rules);
});
const openDate = () => {
calendar.value.open()
}
// console.log()
const formData = reactive({
breed: ""
})
const dateConfirmfn = (e) => {
console.log(e)
}
const rules = {
'formData.breed': {
type: 'string',
required: true,
message: '请填写姓名',
trigger: ['blur', 'change']
},
data.formData.date = e.fulldate
}
const navgo = (url) => {
uni.navigateTo({
url
})
}
const addFn = () => {
form.value.validate().then(res => {
console.log(6)
}).catch(errors => {
uni.$u.toast('校验失败')
})
console.log()
return
this.$refs.uForm.validate().then(res => {
uni.$u.toast('校验通过')
}).catch(errors => {
uni.$u.toast('校验失败')
})
navgo('/pages/index/index')
const addFn = async () => {
console.log(form1.value)
try {
const valid = await form1.value.validate();
if (valid) {
data.formData.land_id = task_id.value
console.log('表单通过');
data.formData.pic = JSON.stringify(pic)
if (data.formData.pic.length == 0) {
uni.$u.toast('请上传图片')
return
}
//
addplant(data.formData).then((res) => {
console.log(res)
if (res.code == 1) {
uni.$u.toast(res.msg)
uni.navigateBack({
delta:1
})
}
})
} else {
//
console.log('表单验证未通过');
}
} catch (error) {
//
console.error(error);
}
// form.value.validate().then(res => {
// console.log(6)
// }).catch(errors => {
// uni.$u.toast('')
// })
// console.log()
}
//
const updateImgFn = async () => {
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
Uploads(res.tempFilePaths[0], 'img').then(res => {
console.log(res)
if (res.code == 1) {
pic.push(res.data.url)
console.log(pic)
uni.$u.toast('上传成功')
}
}).catch(err => {
//console.log('err', err);
// uni.$u.toast('')
})
},
fail: function(err) {
//console.log('choose');
uni.$u.toast('添加失败')
}
});
// let res = await Uploads()
// data.formData.pic = res.data.image
}
const updateImgFn = async () => {
if (mode.value == 'detail') return
let res = await uplodeImg()
formData.buy_cert = res.data.image
}
const mode = ref('add')
onLoad((options) => {
if (options.task_id) {
mode.value = "detail"
}
task_id.value = options.id
// if (options.task_id) {
// mode.value = "detail"
// }
})
</script>

View File

@ -3,69 +3,85 @@
<view class="content">
<view class="card">
<u--form labelPosition="top" labelWidth='100' :model="formData" :rules="rules" ref="form">
<u-form-item label="除草剂种类" prop="formData.breed" borderBottom ref='item1' required>
<u-form-item label="除草剂种类" prop="kind" borderBottom ref='item1' required>
<up-input placeholder="请输入除草剂种类" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
v-model="formData.kind"></up-input>
</u-form-item>
<u-form-item label="除草剂品牌" prop="formData.breed" borderBottom required>
<u-form-item label="除草剂品牌" prop="breed" borderBottom required>
<up-input placeholder="请输入除草剂品牌" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="除草剂用量" prop="formData.breed" borderBottom required>
<up-input placeholder="请输入除草剂用量" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
<u-form-item label="除草剂用量" prop="dosage" borderBottom required>
<up-input placeholder="请输入除草剂用量" border="surround" :disabled="mode=='detail'"
v-model="formData.dosage"></up-input>
</u-form-item>
<u-form-item label="开始日期" prop="formData.breed" borderBottom required>
<up-input placeholder="请选择日期" @blur="openDate" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="formData.breed" borderBottom required>
<up-input placeholder="请选择日期" @blur="openDate" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="作业地块" prop="formData.breed" borderBottom required>
<up-input placeholder="请输入作业地块" :disabled="mode=='detail'" border="surround"
v-model="formData.breed"></up-input>
</u-form-item>
<u-form-item label="作业面积" prop="formData.breed" borderBottom required>
<view class="" v-if="mode=='add'">
<u-form-item label="开始日期" @click="openDate" prop="start_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.start_date"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="end_date" @click="openDate1" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.end_date"></up-input>
</u-form-item>
</view>
<view class="" v-else>
<u-form-item label="开始日期" prop="start_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.start_date"></up-input>
</u-form-item>
<u-form-item label="结束日期" prop="end_date" borderBottom required>
<up-input placeholder="请选择日期" :disabled="true" border="surround"
v-model="formData.end_date"></up-input>
</u-form-item>
</view>
<u-form-item label="作业面积" prop="area" borderBottom required>
<up-input placeholder="请输入作业面积" :disabled="mode=='detail'" type="number" border="surround"
v-model="formData.breed"></up-input>
v-model="formData.area"></up-input>
</u-form-item>
<u-form-item label="参与人" prop="formData.breed" borderBottom required>
<up-input placeholder="请输入参与人" :disabled="mode=='detail'" type="number" border="surround"
v-model="formData.breed"></up-input>
<u-form-item label="参与人" prop="user" borderBottom required>
<up-input placeholder="请输入参与人" :disabled="mode=='detail'" type="txt" border="surround"
v-model="formData.user"></up-input>
</u-form-item>
<view class="card-li">
<view class="card-li-tit">
除草图片
土地图片
</view>
<view class="code-img">
<view class="" @click="updateImgFn">
<view class="" v-if="formData.buy_cert">
<u--image :src="formData.buy_cert" width="637.85rpx" height="350.47rpx"></u--image>
<view class="code-img1">
<view class="" v-if="pic.length>0"
style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;">
<view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;">
<u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image>
</view>
<view class="carime-icon" v-else>
<u--image src="/static/img/DJSC.png" width="91.12rpx" height="91.12rpx"></u--image>
</view>
</view>
<view class="code-img" v-if="mode=='add'">
<view class="" @click="updateImgFn">
<view class="carime-icon">
<u-image src="/static/img/DJSC.png" width="91.12rpx" height="91.12rpx"></u-image>
<view class="">
点击上传图片
</view>
</view>
</view>
</view>
</view>
<u-form-item label="备注" prop="formData.breed" borderBottom required>
<u--textarea v-model="formData.breed" :disabled="mode=='detail'" placeholder="请输入内容"></u--textarea>
<u-form-item label="备注" prop="remark" borderBottom required>
<u--textarea v-model="formData.remark" :disabled="mode=='detail'" placeholder="请输入内容"></u--textarea>
</u-form-item>
</u--form>
<view>
<uni-calendar ref="calendar" :showMonth="true" :lunar="true" :insert="false" @confirm="dateConfirmfn" />
<uni-calendar ref="calendar1" :showMonth="true" :lunar="true" :insert="false"
@confirm="dateConfirmfn1" />
</view>
</view>
<view class="confirm" v-if="mode=='add'">
<view class="confirm-btn" style="color: white;background-color: #0AA565;" @click="addFn">
完成添加
@ -74,75 +90,217 @@
</view>
</view>
</template>
<script setup>
import uplodeImg from "@/utils/uplodeImg.js"
import {
Uploads
} from "@/api/upload.js"
import {
reactive,
ref
} from "vue";
import {
onLoad
} from "@dcloudio/uni-app"
onLoad,
onReady
} from '@dcloudio/uni-app';
import {
addaction
} from '@/api/file.js'
const pic = reactive([]);
const calendar = ref(null)
const calendar1 = ref(null)
const form = ref(null)
const task_id = ref('');
const openDate = () => {
calendar.value.open()
}
const openDate1 = () => {
calendar1.value.open()
}
// console.log()
const formData = reactive({
breed: ""
kind: "",
breed: "",
dosage: "",
start_date: "",
dosage: "",
end_date: "",
})
const dateConfirmfn = (e) => {
console.log(e)
formData.start_date = e.fulldate
}
const rules = {
'formData.breed': {
const dateConfirmfn1 = (e) => {
console.log(e)
formData.end_date = e.fulldate
}
const rules = ref({
'kind': {
type: 'string',
required: true,
message: '请填写姓名',
message: '请填写除草剂种类',
trigger: ['blur', 'change']
},
'breed': {
type: 'string',
required: true,
message: '请填写除草剂品牌',
trigger: ['blur', 'change']
},
'dosage': {
type: 'string',
required: true,
message: '请填写除草剂用量',
trigger: ['blur', 'change']
},
'start_date': {
type: 'string',
required: true,
message: '请填写开始日期',
trigger: ['blur', 'change']
},
'end_date': {
type: 'string',
required: true,
message: '请填写结束日期',
trigger: ['blur', 'change']
},
'area': {
type: 'string',
required: true,
message: '请填写土地面积',
trigger: ['blur', 'change']
},
'user': {
type: 'string',
required: true,
message: '请填写参与人',
trigger: ['blur', 'change']
},
'remark': {
type: 'string',
required: true,
message: '请填写备注',
trigger: ['blur', 'change']
},
})
onReady(() => {
form.value.setRules(rules);
});
//
const updateImgFn = async () => {
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
Uploads(res.tempFilePaths[0], 'img').then(res => {
console.log(res)
if (res.code == 1) {
pic.push(res.data.url)
console.log(data.formData)
uni.$u.toast('上传成功')
}
}).catch(err => {
//console.log('err', err);
// uni.$u.toast('')
})
},
fail: function(err) {
//console.log('choose');
uni.$u.toast('添加失败')
}
});
// let res = await Uploads()
// data.formData.pic = res.data.image
}
const navgo = (url) => {
uni.navigateTo({
url
})
}
const addFn = () => {
form.value.validate().then(res => {
console.log(6)
}).catch(errors => {
uni.$u.toast('校验失败')
console.log(res)
if (res) {
formData.pic = pic
let data1 = {
plant_id: task_id.value,
type: 2,
detail: JSON.stringify(formData)
};
if (formData.pic.length == 0) {
uni.$u.toast('请上传图片')
return
}
console.log('表单通过');
//
addaction(data1).then((res) => {
console.log(res)
if (res.code == 1) {
uni.$u.toast(res.msg)
uni.navigateBack({
delta: 1
})
}
})
// uni.$u.toast('')
}
})
console.log()
return
this.$refs.uForm.validate().then(res => {
uni.$u.toast('校验通过')
}).catch(errors => {
uni.$u.toast('校验失败')
})
navgo('/pages/index/index')
}
const updateImgFn = async () => {
if (mode.value == 'detail') return
let res = await uplodeImg()
console.log(res,'1111111')
formData.buy_cert = res.data.image
}
const mode = ref('add')
onLoad((options) => {
if (options.task_id) {
mode.value = "detail"
if (options.task) {
let data = options.task ? JSON.parse(decodeURIComponent(options.task)) : null;
console.log(data, data.detail)
Object.assign(formData, data.detail);
pic.splice(0, pic.length, data.detail.pic);
mode.value = 'detail'
uni.setNavigationBarTitle({
title: '除草详情'
})
// formData=data.detail
} else {
task_id.value = options.id
}
})
</script>

View File

@ -3,35 +3,43 @@
<view class="content">
<view class="serch">
<u-search bgColor="white" :show-action="false" placeholder="搜索你的土地信息" v-model="keyword"
shape="round"></u-search>
<u-search bgColor="white" :show-action="false" margin='0 30rpx' placeholder="搜索你的土地信息"
v-model="fomData.keyword" shape="round"></u-search>
<u-button class="custom-style" @click="search">搜索</u-button>
</view>
<view class="card" v-for="(item,index) in [1,1,1]" :key="index" @click="navgo('/pages/landDetail/index')">
<view class="card" v-for="(item,index) in datalist" :key="index" @click="navgo(item)">
<view class="tit card-li">
<view class="">
土地名称
{{item.title}}
</view>
<view class="" style="color: #00A15E;">
<view class="" style="color: #00A15E;" v-if="item.residual_area!=item.total_area">
已种植
</view>
<view class="" style="color: #00A15E;">
<view class="" style="color: #00A15E;" v-if="item.residual_area==item.total_area">
未种植
</view>
</view>
<view class="card-li">
<view class="card-li" v-if="item.residual_area!=item.total_area">
<view class="">
面积: 20
种植面积:{{item.total_area-item.residual_area}}
</view>
</view>
<view class="card-li" v-if="item.residual_area==item.total_area">
<view class="">
未种植面积:{{item.total_area}}
</view>
</view>
<view class="card-li tit">
<view class="" style="font-weight: normal;">
农作物: 洋芋
地址: {{item.town_name}}{{item.village_name}}{{item.group_name}}
</view>
</view>
</view>
<view style="height: 170rpx;">
</view>
<!-- <view class="land" @click="navgo('/pages/addLand/addLand')">
土地
</view> -->
</view>
@ -39,18 +47,40 @@
</template>
<script setup>
import {
onLoad,
onShow,
onReachBottom,
onPullDownRefresh
} from "@dcloudio/uni-app"
import {
ref,
reactive,
onMounted
} from "vue"
const keyword = ref();
const props = defineProps({
userInfo: Object
import {
landlist
} from '@/api/file.js'
onShow(() => {
console.log(11)
list()
})
onPullDownRefresh(() => {
console.log(11)
uni.stopPullDownRefresh()
})
onReachBottom(() => {
console.log(11)
getlist()
})
const datalist = reactive([])
const fomData = reactive({
page_no: 1,
page_size: 15,
keyword: ''
})
//
const getPositionFn = () => {
uni.getLocation({
@ -67,30 +97,61 @@
}
});
}
const list = () => {
fomData.page_no = 1
getlist()
}
const getlist = () => {
landlist(fomData).then((res) => {
if (res.code == 1) {
datalist.splice(0, datalist.length, ...res.data);
fomData.page_no += fomData.page_no
const userInfo = reactive(props.userInfo)
}
})
const navgo = (url) => {
}
const search = () => {
console.log('111111')
}
const navgo = (item) => {
uni.navigateTo({
url
url: '/pages/landDetail/index?id=' + item.id
})
}
onMounted(() => {
console.log('22222222')
// console.log('22222222')
})
</script>
<style lang="scss">
.content {
min-height: 100vh;
position: relative;
background-color: #EAF2EF;
padding-top: 180rpx;
.land {
width: 100rpx;
height: 100rpx;
line-height: 100rpx;
text-align: center;
background-color: #fff;
border-radius: 50%;
position: absolute;
right: 60rpx;
bottom: 130rpx;
position: fixed;
}
.serch {
@ -99,9 +160,18 @@
background-color: #EAF2EF;
position: absolute;
position: fixed;
top:0;
display: flex;
top: 0;
padding-top: 70rpx;
padding-right: 20rpx;
.custom-style {
color: #606266;
width: 120rpx;
border-radius: 30rpx;
margin-top: 10rpx;
margin-right: 20rpx;
}
z-index: 8888 !important;
@ -137,4 +207,4 @@
}
}
}
</style>
</style>

View File

@ -1,5 +1,3 @@
<template>
<view class="" style="position: relative;">
<view class="top">
@ -29,15 +27,18 @@
<!-- 土地信息 -->
<view class="">
<view class="card">
<view class="">
<view class="" @click="navgo">
<view class="">
土地名称: 土地信息1
土地名称: {{dataobj.title}}
</view>
<view class="" style="margin: 10rpx 0;">
<!-- <view class="" style="margin: 10rpx 0;">
农作物: 洋芋
</view> -->
<view class="">
面积: {{dataobj.total_area}}
</view>
<view class="">
面积: 20
面积: {{dataobj.total_area}}
</view>
</view>
<view class="changeLand" @click="show=true">
@ -125,10 +126,11 @@
<!-- 组件 -->
<u-loading-page :loading="showLoading"></u-loading-page>
<u-picker :show="show" :columns="columns" @cancel="show=false" @confirm="confirm"></u-picker>
<u-action-sheet :show="show" keyName="name" closeOnClickOverlay :actions="columns" title="请选择"
@close="show = false" @select="confirm">
</u-action-sheet>
</view>
<view class="empty" v-else>
<view class="addLand">
@ -165,6 +167,12 @@
import {
onLoad
} from "@dcloudio/uni-app"
import {
binddevice,
lindexist,
landlist
} from '@/api/file.js'
const showModal = ref(false)
@ -215,10 +223,12 @@
},
])
const dataobj = reactive({})
const tdId = ref()
//
const equipmentId = ref("")
const bindFn = () => {
bindevice()
showModal.value = false
}
//
@ -233,9 +243,7 @@
const show = ref(false)
const showLoading = ref(false)
const columns = reactive([
['中国', '美国', '日本']
]);
const columns = reactive([]);
//
const environmentList = reactive([{
icon: "/static/img/sj.png",
@ -288,9 +296,65 @@
},
])
onLoad(() => {
getlist()
getlist1()
})
const getlist = () => {
lindexist({
land_id: ''
}).then((res) => {
console.log(res)
if (res.code == 1) {
Object.assign(dataobj, res.data);
}
})
}
const getlist1 = () => {
landlist({
page_no: 1,
page_size: 99995,
keyword: ''
}).then((res) => {
if (res.code == 1) {
columns.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.title,
id: step.id,
};
}));
}
})
}
const bindevice = () => {
binddevice({
land_id: '2222',
device_code: equipmentId.value
}).then((res) => {
if (res.code == 1) {
uni.$u.toast(res.msg);
// this.dataobj=res.data
}
console.log(res)
})
}
const confirm = (e) => {
console.log(e)
show.value = false
showLoading.value = true
setTimeout(() => {
@ -306,6 +370,12 @@
const currentTime = formattedHour + ':' + formattedMinute;
return currentTime
}
const navgo = () => {
uni.navigateTo({
url: '/pages/landDetail/index?id=' + dataobj.id
})
}
const navto = (url) => {
uni.navigateTo({
url

View File

@ -4,7 +4,8 @@
<u--image @click="previewImageFn" :src="userinfo.avatar" width="130.28rpx" height="130.28rpx"
shape="circle"></u--image>
</view>
<view class="">
<view class="" v-if="userinfo">
<view class="head-li">
姓名: {{userinfo.nickname}}
</view>
@ -15,6 +16,9 @@
公司: 里海弄农业科技有限公司
</view> -->
</view>
<view class="" v-else @click="revto('/pages/Login/login')">
请登录
</view>
</view>
<view class="content">
<view class="card" style="border-radius: 20rpx;">
@ -90,6 +94,13 @@
url
})
}
const revto = (url) => {
uni.redirectTo({
url
})
}
</script>
<style lang="scss" scoped>

View File

@ -1,64 +1,73 @@
<template>
<view class="box">
<view class="content">
<view class="video" @click="navto('/pages/live/live')">
<view class="video" @click="navto('/pages/live/live')" >
<!-- <u--image :src="url" width="100%" height="300rpx"></u--image> -->
<u-swiper :list="list"></u-swiper>
<u-swiper :list="dataobj.pic"></u-swiper>
</view>
<view class="time">
<u-icon name="clock"></u-icon>
<text>刷新时间: {{getNowTimeFn()}} </text>
</view>
<view class="add-thing" @click="showPicker=true">
记农事
<view class="add-thing" @click="addshowPicke">
新增种植
</view>
<landInfo></landInfo>
<landInfo :info='dataobj'></landInfo>
<view class="">
<view class="" >
<view class="tit" style="font-size: 33.29rpx;margin: 20rpx 0;">
历史农事信息
种植信息
</view>
<view class="" v-if="dataList.length>0">
<view class="thing-card" v-for="(item,index) in dataList" :key="index">
<view class="head">
<view class="">
种植
</view>
<view class="" @click="navtoForm(item.type)">
<view class="" @click="navtoForm(item,i)">
农事查看
</view>
</view>
<view class="body">
<view class="card_body">
<view class="left">
<u--image @click="perviewFn(url)" radius='10' :src="url" width="200rpx"
<u--image @click="perviewFn(url)" radius='10' :src="item.pic[0]" width="200rpx"
height="200rpx"></u--image>
</view>
<view class="right">
<view class="">
土地名称: 张伟撒打算撒旦
种植种类:{{item.kind}}
</view>
<view class="">
土地名称: 张伟撒打算撒旦
种植品种: {{item.breed}}
</view>
<view class="">
土地名称: 张伟撒打算撒旦
种植面积: {{item.area}}
</view>
<view class="">
土地名称: 张伟撒打算撒旦
参与人员: {{item.user}}
</view>
<view class="">
开始日期: {{item.create_time}}
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 组件 -->
<view class="">
<u-picker keyName="label" :show="showPicker" @cancel="showPicker=false" @confirm="confirm"
:columns="columns"></u-picker>
</view>
</view>
</template>
@ -70,6 +79,15 @@
reactive
} from "vue"
import {
plantlist,
landdetail
} from '@/api/file.js'
import {
onLoad
} from "@dcloudio/uni-app"
const list = reactive([{
id: 1,
@ -97,88 +115,92 @@
url: 'https://ceshi-worker-task.lihaink.cn//uploads//images//20231121//202311211336582b7920656.jpg',
}
])
const dataList = reactive([{
type: '0'
}, {
type: '1'
}, {
type: '2'
}, {
type: '3'
}, {
type: '4'
}, {
type: '5'
},
])
const showPicker = ref(false);
const dataList = reactive([])
const dataList1 = reactive([])
const dataobj = reactive({})
const typeID = ref('')
const columns = reactive([
[{
label: '种植',
route: "/pages/husbandryForm/sow"
}, {
label: '施肥',
route: "/pages/husbandryForm/fertilize"
}, {
label: '除草',
route: "/pages/husbandryForm/weeding"
}, {
label: '灌溉',
route: "/pages/husbandryForm/irrigate"
}, {
label: '除虫',
route: "/pages/husbandryForm/Pest"
}, {
label: '收获',
route: "/pages/husbandryForm/harvest"
},
]
label: '种植',
route: "/pages/husbandryForm/sow"
}, {
label: '施肥',
route: "/pages/husbandryForm/fertilize"
}, {
label: '除草',
route: "/pages/husbandryForm/weeding"
}, {
label: '灌溉',
route: "/pages/husbandryForm/irrigate"
}, {
label: '除虫',
route: "/pages/husbandryForm/Pest"
}, {
label: '收获',
route: "/pages/husbandryForm/harvest"
}]
]);
onLoad((option) => {
typeID.value = option.id;
getlist();
getlist1();
});
const getlist1 = () => {
landdetail({
land_id: typeID.value
}).then((res) => {
console.log(res);
if (res.code == 1) {
Object.assign(dataobj, res.data);
}
});
};
const getlist = () => {
plantlist({
land_id: typeID.value
}).then((res) => {
if (res.code == 1) {
dataList.splice(0, dataList.length, ...res.data);
}
});
};
//
const addshowPicke = ()=> {
uni.navigateTo({
url:'/pages/husbandryForm/sow?id='+typeID.value
})
}
//
const navto = (url) => {
uni.navigateTo({
url
})
}
const navtoForm = (type) => {
switch (type) {
//
case "0":
navto(`/pages/husbandryForm/sow?task_id=${5}`);
break;
//
case "1":
navto(`/pages/husbandryForm/fertilize?task_id=${5}`);
break;
//
case "2":
navto(`/pages/husbandryForm/weeding?task_id=${5}`);
break;
//
case "3":
navto(`/pages/husbandryForm/irrigate?task_id=${5}`);
break;
//
case "4":
navto(`/pages/husbandryForm/Pest?task_id=${5}`);
break;
//
case "5":
navto(`/pages/husbandryForm/harvest?task_id=${5}`);
break;
}
const navtoForm = (item, type) => {
console.log(item)
uni.navigateTo({
url:'/pages/landDetail/tudi?data='+ encodeURIComponent(JSON.stringify(item))
})
// }
}
const confirm = (e) => {
showPicker.value = false
uni.navigateTo({
url: e.value[0].route
})
}
const url = ref('https://ceshi-worker-task.lihaink.cn//uploads//images//20231121//202311211336582b7920656.jpg')
const getNowTimeFn = () => {
const now = new Date();
const hour = now.getHours();
@ -252,7 +274,7 @@
padding: 0 30rpx;
}
.body {
.card_body {
padding: 20rpx;
display: flex;
// justify-content: space-between;

308
pages/landDetail/tudi.vue Normal file
View File

@ -0,0 +1,308 @@
<template>
<view class="box">
<view class="content">
<view class="video" @click="navto('/pages/live/live')">
<!-- <u--image :src="url" width="100%" height="300rpx"></u--image> -->
<u-swiper :list="dataobj.pic"></u-swiper>
</view>
<view class="time">
<u-icon name="clock"></u-icon>
<text>刷新时间: {{getNowTimeFn()}} </text>
</view>
<view class="add-thing" @click="showPicker=true">
记农事
</view>
<landInfo :info='dataobj'></landInfo>
<view class="">
<view class="tit" style="font-size: 33.29rpx;margin: 20rpx 0;">
操作信息
</view>
<view class="thing-card" v-for="(item,index) in dataList1" :key="index">
<view class="head">
<view class="">
{{item.type_text}}
</view>
<view class="" @click="navtoForm(item,item.type)">
农事查看
</view>
</view>
<view class="card_body">
<view class="left">
<u--image @click="perviewFn(url)" radius='10' :src="item.detail.pic[0]" width="200rpx"
height="200rpx"></u--image>
</view>
<view class="right">
<view class="">
种植种类:{{item.kind}}
</view>
<view class="">
种植品种: {{item.breed}}
</view>
<view class="">
种植面积: {{item.area}}
</view>
<view class="">
参与人员: {{item.user}}
</view>
<view class="">
开始日期: {{item.create_time}}
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 组件 -->
<view class="">
<u-picker keyName="label" :show="showPicker" @cancel="showPicker=false" @confirm="confirm"
:columns="columns"></u-picker>
</view>
</view>
</template>
<script setup>
import landInfo from "@/components/plant/landInfo.vue"
import {
ref,
reactive
} from "vue"
import {
plantlist,
actionlist,
landdetail
} from '@/api/file.js'
import {
onLoad
} from "@dcloudio/uni-app"
const list = reactive([{
id: 1,
url: 'https://ceshi-worker-task.lihaink.cn//uploads//images//20231121//202311211336582b7920656.jpg',
},
{
id: 1,
url: 'https://ceshi-worker-task.lihaink.cn//uploads//images//20231121//202311211336582b7920656.jpg',
},
{
id: 1,
url: 'https://ceshi-worker-task.lihaink.cn//uploads//images//20231121//202311211336582b7920656.jpg',
},
{
id: 1,
url: 'https://ceshi-worker-task.lihaink.cn//uploads//images//20231121//202311211336582b7920656.jpg',
},
])
const dataList1 = reactive([])
const dataobj = reactive({})
const typeID = ref('')
const showPicker = ref(false)
const columns = reactive([
[{
label: '施肥',
route: "/pages/husbandryForm/fertilize"
}, {
label: '除草',
route: "/pages/husbandryForm/weeding"
}, {
label: '灌溉',
route: "/pages/husbandryForm/irrigate"
}, {
label: '除虫',
route: "/pages/husbandryForm/Pest"
}, {
label: '收获',
route: "/pages/husbandryForm/harvest"
}]
]);
onLoad((query) => {
let data = query.data ? JSON.parse(decodeURIComponent(query.data)) : null;
console.log(data); // { name: 'John', age: 25 }
Object.assign(dataobj, data);
typeID.value = data.id;
getlist2();
});
const getlist1 = () => {
landdetail({
land_id: typeID.value
}).then((res) => {
console.log(res);
if (res.code == 1) {
Object.assign(dataobj, res.data);
}
});
};
const getlist2 = () => {
actionlist({
plant_id: typeID.value
}).then((res) => {
if (res.code == 1) {
dataList1.splice(0, dataList1.length, ...res.data);
}
});
};
const navto = (url) => {
uni.navigateTo({
url
})
}
const navtoForm = (item, type) => {
console.log(item, type)
switch (type) {
//
case 1:
uni.navigateTo({
url: '/pages/husbandryForm/fertilize?task=' + encodeURIComponent(JSON.stringify(item))
})
break;
//
case 2:
uni.navigateTo({
url: '/pages/husbandryForm/weeding?task=' + encodeURIComponent(JSON.stringify(item))
})
//
case 3:
uni.navigateTo({
url: '/pages/husbandryForm/irrigate?task=' + encodeURIComponent(JSON.stringify(item))
})
break;
//
case 4:
uni.navigateTo({
url: '/pages/husbandryForm/Pest?task=' + encodeURIComponent(JSON.stringify(item))
})
break;
//
case 5:
uni.navigateTo({
url: '/pages/husbandryForm/harvest?task=' + encodeURIComponent(JSON.stringify(item))
})
break;
}
}
const confirm = (e) => {
showPicker.value = false
console.log(typeID.value)
uni.navigateTo({
url: e.value[0].route + '?id=' + typeID.value
})
}
const getNowTimeFn = () => {
const now = new Date();
const hour = now.getHours();
const minute = now.getMinutes();
const formattedHour = hour < 10 ? '0' + hour : hour;
const formattedMinute = minute < 10 ? '0' + minute : minute;
const currentTime = formattedHour + ':' + formattedMinute;
return currentTime
}
const perviewFn = (url) => {
console.log(url)
uni.previewImage({
urls: [url]
})
}
</script>
<style lang="scss" scoped>
.box {
width: 750rpx;
min-height: 100vh;
background-color: $theme-bg-color;
padding: 0;
.content {
width: 693.93rpx;
margin: auto;
padding-top: 20rpx;
}
// padding: 20rpx;
.time {
display: flex;
font-size: 26.29rpx;
color: #737373;
margin-top: 10rpx;
}
.video {
// margin-top: 10rpx;
}
.add-thing {
width: 266.36rpx;
height: 66.59rpx;
border-radius: 42.06rpx 42.06rpx 42.06rpx 42.06rpx;
border: 1px solid $theme-main-color;
margin: 20rpx auto;
line-height: 66rpx;
text-align: center;
color: $theme-main-color;
}
}
.thing-card {
width: 693.93rpx;
box-sizing: border-box;
background-color: #fff;
border-radius: 20rpx;
overflow: hidden;
margin-bottom: 30rpx;
.head {
height: 90rpx;
border-radius: 20rpx 20rpx 0 0;
background-color: $theme-main-color;
display: flex;
justify-content: space-between;
line-height: 90rpx;
color: white;
padding: 0 30rpx;
}
.card_body {
padding: 20rpx;
display: flex;
// justify-content: space-between;
.right {
display: flex;
justify-content: space-between;
flex-direction: column;
margin-left: 40rpx;
}
}
}
</style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 881 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 355 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 894 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 527 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

BIN
static/tabber/a-a.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 772 B

BIN
static/tabber/a.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 957 B

BIN
static/tabber/b-b.png.lnk Normal file

Binary file not shown.

BIN
static/tabber/b.png.lnk Normal file

Binary file not shown.

BIN
static/tabber/c-a.png.lnk Normal file

Binary file not shown.

BIN
static/tabber/c.png.lnk Normal file

Binary file not shown.

View File

@ -8,10 +8,7 @@ export const userInfoStore = defineStore('counter', {
}),
getters: {},
actions: {
saveUserInfo(userInfo) {
console.log(userInfo,'1111111')
this.userInfo = userInfo
}
}

View File

@ -1,3 +0,0 @@
andrCertfile=D:/soft/HBuilderX/plugins/app-safe-pack/Test.keystore
andrCertAlias=android
andrCertPass=ep/Tdjka4Y7WYqDB6/S7dw==

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More