mkm
/
yanzhiAPP
Template
2
0
Fork 0

代码更新

This commit is contained in:
jia 2023-11-27 18:23:17 +08:00
parent 22b20e3139
commit b30ab32f44
38 changed files with 847 additions and 373 deletions

View File

@ -24,22 +24,25 @@ export const addland = (data) => syhttp.post('/land/add', data)
export const plantlist = (data) => syhttp.get('/plant/list', data) export const plantlist = (data) => syhttp.get('/plant/list', data)
//新增种植 //新增种植
export const addplant = (data) => syhttp.post('/plant/add', data) export const addplant = (data) => syhttp.post('/plant/add', data)
//种植详情
export const plantdetail = (data) => syhttp.get('/plant/detail', data)
//操作列表 //操作列表
export const actionlist = (data) => syhttp.get('/action/list', data) export const actionlist = (data) => syhttp.get('/action/list', data)
//添加操作 //添加操作
export const addaction = (data) => syhttp.post('/action/add', data) export const addaction = (data) => syhttp.post('/action/add', data)
//添加操作 //添加操作
export const binddevice = (data) => syhttp.post('/device/bind', data) export const binddevice = (data) => syhttp.post('/land/bind', data)
//首页 //首页
export const lindexist = (data) => syhttp.get('/index/index', data) export const lindexist = (data) => syhttp.get('/index/index', data)
//产品列表
export const landproduct = (data) => syhttp.get('/land/product', data)
//绑定产品
export const bindproduct = (data) => syhttp.post('/land/bind', data)

View File

@ -2,11 +2,12 @@
// let baseUrl = 'https://ceshi.excellentkk.cn/api'; // let baseUrl = 'https://ceshi.excellentkk.cn/api';
// import store from '../store'; // import store from '../store';
import { config } from '@/config/app'; import { config } from '@/config/app';
import store from "@/store/index.js"
let header = {}; let header = {};
console.log(config)
if (uni.getStorageSync('SY_TOKEN')){
header.token = uni.getStorageSync('SY_TOKEN'); if (store.state.userInfo){
header.token = store.state.userInfo.token;
} }
function uploads(src, type) { function uploads(src, type) {

View File

@ -5,17 +5,25 @@
{{info.title}} {{info.title}}
号土地 号土地
</view> </view>
<view class=""> <!-- <view class="" style="display:flex;">
溯源码: {{}} <view class="" style="margin-right: 10rpx;">溯源码: </view>
</view>
<u--image @click="perviewFn('http://ceshi-suyuan.lihaink.cn/uploads/images/20231127/2023112716443447deb3539.png')" radius='10' src="http://ceshi-suyuan.lihaink.cn/uploads/images/20231127/2023112716443447deb3539.png" width="30rpx"
height="30rpx" style="margin-top: 10rpx;"></u--image>
</view> -->
</view> </view>
<view class="card-li"> <view class="card-li">
<view class=""> <view class="">
当前种植: {{info.residual_area}} 当前种植: {{info.total_area-info.residual_area}}
</view> </view>
<!-- <view class=""> <!-- <view class="">
种植品牌: {{}} 种植品牌: {{info.kind}}
</view> --> </view> -->
</view><view class="card-li">
<view class="">
种植品种: {{info.kind}}
</view>
</view> </view>
<view class="card-li"> <view class="card-li">
<view class=""> <view class="">
@ -55,6 +63,13 @@
info: Object, info: Object,
}) })
const perviewFn = (url) => {
console.log(url)
uni.previewImage({
urls: [url]
})
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,9 +1,10 @@
let BASE_URL let BASE_URL
import store from "@/store/index.js"
// 环境 // 环境
let env = "dev" let env = "dev"
// let env = "prod" // let env = "prod"
let HTTP_REQUEST_URL let HTTP_REQUEST_URL
let HEADER let HEADER
if (env == 'dev') { if (env == 'dev') {
@ -21,7 +22,7 @@ let config = {
//#ifdef APP-PLUS //#ifdef APP-PLUS
'Form-type': 'app', 'Form-type': 'app',
//#endif //#endif
'TOKEN': uni.getStorageSync("SY_TOKEN") || '' 'TOKEN': ''
} }
} }

17
main.js
View File

@ -1,15 +1,14 @@
import App from './App' import App from './App'
import uviewPlus from 'uview-plus' import uviewPlus from 'uview-plus'
import { import store from './store'
createPinia
} from 'pinia'
// #ifndef VUE3 // #ifndef VUE3
import Vue from 'vue' import Vue from 'vue'
import './uni.promisify.adaptor' import './uni.promisify.adaptor'
Vue.config.productionTip = false Vue.config.productionTip = false
App.mpType = 'app' App.mpType = 'app'
const app = new Vue({ const app = new Vue({
...App ...App,
store
}) })
app.$mount() app.$mount()
// #endif // #endif
@ -18,14 +17,16 @@ app.$mount()
import { import {
createSSRApp createSSRApp
} from 'vue' } from 'vue'
export function createApp() { export function createApp() {
const app = createSSRApp(App) const app = createSSRApp(App)
const pinia = createPinia()
app.use(pinia)
app.use(uviewPlus) app.use(uviewPlus)
app.use(store)
return { return {
app, app
pinia
} }
} }
// #endif // #endif

View File

@ -1,11 +1,11 @@
{ {
"hash": "ecd04c7b", "hash": "ff711c6a",
"browserHash": "62a01527", "browserHash": "fa669d50",
"optimized": { "optimized": {
"uview-plus": { "uview-plus": {
"src": "../../uview-plus/index.js", "src": "../../uview-plus/index.js",
"file": "uview-plus.js", "file": "uview-plus.js",
"fileHash": "87057957", "fileHash": "31730495",
"needsInterop": false "needsInterop": false
} }
}, },

View File

@ -9,6 +9,16 @@
}, },
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages "pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages
{ {
"path": "pages/index/massif",
"style": {
"navigationBarTitleText": "地块",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#F4F4F4",
"navigationBarTextStyle": "black"
}
},{
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
"navigationStyle": "custom", "navigationStyle": "custom",
@ -115,16 +125,7 @@
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black"
} }
}, },
{
"path": "pages/index/massif",
"style": {
"navigationBarTitleText": "地块",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#F4F4F4",
"navigationBarTextStyle": "black"
}
},
{ {
"path": "pages/index/personal", "path": "pages/index/personal",
"style": { "style": {
@ -154,28 +155,28 @@
"backgroundColor": "#F8F8F8" "backgroundColor": "#F8F8F8"
}, },
"tabBar": { "tabBar": {
"color": "#B3B3B3", "color": "#272822",
"selectedColor": "#272822", "selectedColor": "#34D190",
"borderStyle": "white", "borderStyle": "white",
"backgroundColor": "#EBF1EF", "backgroundColor": "#EBF1EF",
"list": [{ "list": [{
"pagePath": "pages/index/massif", "pagePath": "pages/index/massif",
"text": "首页", "text": "首页",
"iconPath": "static/tabber/a.png", "iconPath": "static/tabber/a-a.png",
"selectedIconPath": "static/tabber/a-a.png" "selectedIconPath": "static/tabber/a.png"
}, },
{ {
"pagePath": "pages/index/index", "pagePath": "pages/index/index",
"text": "地块", "text": "地块",
"iconPath": "static/tabber/b.png", "iconPath": "static/tabber/b-b.png",
"selectedIconPath": "static/tabber/b.png"
"selectedIconPath": "static/tabber/b-b.png"
}, },
{ {
"pagePath": "pages/index/personal", "pagePath": "pages/index/personal",
"text": "我的", "text": "我的",
"iconPath": "static/tabber/c.png", "iconPath": "static/tabber/c-a.png",
"selectedIconPath": "static/tabber/c-c.png" "selectedIconPath": "static/tabber/c.png"
} }
] ]

View File

@ -52,15 +52,16 @@
xinregister xinregister
} from '@/api/file.js'; } from '@/api/file.js';
import {
useStore
} from 'vuex'
import { import {
onMounted, onMounted,
reactive, reactive,
ref ref
} from 'vue'; } from 'vue';
import { const store = useStore()
userInfoStore
} from '@/store/userInfo'
const num = ref(0) const num = ref(0)
const isshow = ref(false) const isshow = ref(false)
@ -85,6 +86,7 @@
}, },
] ]
}) })
// ios // ios
const checkUserAgent = () => { const checkUserAgent = () => {
uni.getSystemInfo({ uni.getSystemInfo({
@ -134,6 +136,7 @@
const submitFn = () => { const submitFn = () => {
if (!formData.account) return uni.$u.toast('账号不能为空'); if (!formData.account) return uni.$u.toast('账号不能为空');
if (!formData.password && formData.scene == 1) return uni.$u.toast('密码不能为空'); if (!formData.password && formData.scene == 1) return uni.$u.toast('密码不能为空');
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(formData.account)) return uni.$u.toast( if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(formData.account)) return uni.$u.toast(
@ -144,15 +147,15 @@
login(formData).then((res) => { login(formData).then((res) => {
if (res.code == 1) { if (res.code == 1) {
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);
store.commit('saveUserInfo', res.data)
setTimeout(() => {
uni.reLaunch({ uni.reLaunch({
url: '/pages/index/massif' url: '/pages/index/massif'
}) })
uni.$u.toast('登录成功');
}, 500)
} }
}) })
@ -166,8 +169,6 @@
} }
const aclick = (i) => { const aclick = (i) => {
num.value = i num.value = i
console.log(i)
if (i == 1) { if (i == 1) {
formData.scene = 1 formData.scene = 1
formData.password = '' formData.password = ''
@ -179,7 +180,10 @@
onMounted(() => { onMounted(() => {
checkUserAgent() checkUserAgent()
formData.scene = 2 formData.scene = 2
}) })
</script> </script>
@ -249,6 +253,7 @@
font-size: 20rpx; font-size: 20rpx;
padding: 0rpx 20rpx; padding: 0rpx 20rpx;
color: #fff; color: #fff;
margin-top: 10rpx;
} }

View File

@ -51,9 +51,13 @@
<view class="" v-if="pic.length>0" <view class="" v-if="pic.length>0"
style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;"> style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;">
<view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;"> <view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;">
<view class="">
<u-icon name="close" size="15" style="margin-left:120.85rpx;"
@click="delimg(i)"></u-icon>
<u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image> <u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image>
</view> </view>
</view> </view>
</view>
</view> </view>
<view class="code-img"> <view class="code-img">
@ -254,7 +258,7 @@
} }
const cityn = (id) => { const cityn = (id) => {
console.log(id)
city({ city({
province_code: id province_code: id
}).then((res) => { }).then((res) => {
@ -283,7 +287,10 @@
}); });
} }
//
const delimg = (i) => {
pic.splice(i, 1);
}
const townsn = (id) => { const townsn = (id) => {
towns({ towns({
@ -383,7 +390,7 @@
} }
const leavaType1 = (e) => { const leavaType1 = (e) => {
console.log('Received value:', e)
province_name.value = e.name province_name.value = e.name
data.formData.province_code = e.id data.formData.province_code = e.id
cityn(e.id) cityn(e.id)
@ -411,7 +418,7 @@
} }
const leavaType6 = (e) => { const leavaType6 = (e) => {
console.log(e)
group_name.value = e.name group_name.value = e.name
data.formData.group_code = e.id.toString() data.formData.group_code = e.id.toString()

View File

@ -52,9 +52,13 @@
<view class="" v-if="pic.length>0" <view class="" v-if="pic.length>0"
style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;"> style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;">
<view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;"> <view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;">
<view class="">
<u-icon name="close" size="15" style="margin-left:120.85rpx;"
@click="delimg(i)" v-show="mode=='add'"></u-icon>
<u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image> <u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image>
</view> </view>
</view> </view>
</view>
</view> </view>
<view class="code-img" v-if="mode=='add'"> <view class="code-img" v-if="mode=='add'">
@ -145,7 +149,7 @@
'kind': { 'kind': {
type: 'string', type: 'string',
required: true, required: true,
message: '请填写杀虫剂种类', message: '请填写杀虫剂品牌',
trigger: ['blur', 'change'] trigger: ['blur', 'change']
}, },
'breed': { 'breed': {
@ -195,6 +199,10 @@
form.value.setRules(rules); form.value.setRules(rules);
}); });
//
const delimg = (i) => {
pic.splice(i, 1);
}
// //
const updateImgFn = async () => { const updateImgFn = async () => {

View File

@ -3,8 +3,8 @@
<view class="content"> <view class="content">
<view class="card"> <view class="card">
<u--form labelPosition="top" labelWidth='100' :model="formData" :rules="rules" ref="form"> <u--form labelPosition="top" labelWidth='100' :model="formData" :rules="rules" ref="form">
<u-form-item label="肥料种类" prop="kind" borderBottom ref='item1' required> <u-form-item label="肥料品牌" prop="kind" borderBottom ref='item1' required>
<up-input placeholder="请输入肥料种类" :disabled="mode=='detail'" border="surround" <up-input placeholder="请输入肥料品牌" :disabled="mode=='detail'" border="surround"
v-model="formData.kind"></up-input> v-model="formData.kind"></up-input>
</u-form-item> </u-form-item>
<u-form-item label="肥料品牌" prop="breed" borderBottom required> <u-form-item label="肥料品牌" prop="breed" borderBottom required>
@ -53,9 +53,14 @@
style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;"> style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;">
<view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;"> <view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;">
<view class="">
<u-icon name="close" size="15" style="margin-left:120.85rpx;" @click="delimg(i)"
v-show="mode=='add'"></u-icon>
<u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image> <u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image>
</view> </view>
</view> </view>
</view>
</view> </view>
<view class="code-img" v-if="mode=='add'"> <view class="code-img" v-if="mode=='add'">
@ -86,7 +91,7 @@
<view class="confirm" v-if="mode=='add'"> <view class="confirm" v-if="mode=='add'">
<view class="confirm-btn" style="color: white;background-color: #0AA565;" @click="addFn"> <view class="confirm-btn" style="color: white;background-color: #0AA565;" @click="addFn">
完成添加 完成添加
</view>dateConfirmfn1 </view>
</view> </view>
@ -259,6 +264,17 @@
uni.$u.toast('请上传图片') uni.$u.toast('请上传图片')
return return
} }
let endTime = new Date(formData.end_date)
let startTime = new Date(formData.start_date)
if (endTime < startTime) {
uni.$u.toast("结束时间不能小于开始时间");
return
} else if (startTime > endTime) {
uni.$u.toast("开始时间不能大于结束时间");
return
} else {
console.log("开始时间和结束时间合法");
}
console.log('表单通过'); console.log('表单通过');
@ -280,7 +296,10 @@
} }
//
const delimg = (i) => {
pic.splice(i, 1);
}
const mode = ref('add') const mode = ref('add')

View File

@ -24,9 +24,13 @@
<view class="" v-if="pic.length>0" <view class="" v-if="pic.length>0"
style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;"> style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;">
<view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;"> <view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;">
<view class="">
<u-icon name="close" size="15" style="margin-left:120.85rpx;" @click="delimg(i)"
v-show="mode=='add'"></u-icon>
<u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image> <u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image>
</view> </view>
</view> </view>
</view>
</view> </view>
<view class="code-img" v-if="mode=='add'"> <view class="code-img" v-if="mode=='add'">
@ -81,6 +85,7 @@
} from '@/api/file.js' } from '@/api/file.js'
const form = ref(null) const form = ref(null)
const task_id = ref('');
const pic = reactive([]); const pic = reactive([]);
const formData = reactive({ const formData = reactive({
user: "", user: "",
@ -152,6 +157,10 @@
}) })
}
//
const delimg = (i) => {
pic.splice(i, 1);
} }
// //
const updateImgFn = async () => { const updateImgFn = async () => {
@ -189,10 +198,24 @@
} }
const mode = ref('add') const mode = ref('add')
onLoad((options) => { onLoad((options) => {
if (options.task_id) { if (options.task) {
mode.value = "detail" 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> </script>

View File

@ -46,9 +46,13 @@
<view class="" v-if="pic.length>0" <view class="" v-if="pic.length>0"
style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;"> style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;">
<view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;"> <view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;">
<view class="">
<u-icon name="close" size="15" style="margin-left:120.85rpx;" @click="delimg(i)"
v-show="mode=='add'"></u-icon>
<u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image> <u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image>
</view> </view>
</view> </view>
</view>
</view> </view>
<view class="code-img" v-if="mode=='add'"> <view class="code-img" v-if="mode=='add'">
@ -73,14 +77,8 @@
<uni-calendar ref="calendar" :showMonth="true" :lunar="true" :insert="false" @confirm="dateConfirmfn" /> <uni-calendar ref="calendar" :showMonth="true" :lunar="true" :insert="false" @confirm="dateConfirmfn" />
<uni-calendar ref="calendar1" :showMonth="true" :lunar="true" :insert="false" <uni-calendar ref="calendar1" :showMonth="true" :lunar="true" :insert="false"
@confirm="dateConfirmfn1" /> @confirm="dateConfirmfn1" />
<u-action-sheet <u-action-sheet :show="showgg" :actions="range" title="请选择灌溉方式" @close="showgg = false"
:show="showgg" @select="ggSelect">
:actions="range"
title="请选择灌溉方式"
@close="showgg = false"
@select="ggSelect"
>
</u-action-sheet> </u-action-sheet>
</view> </view>
</view> </view>
@ -109,8 +107,13 @@
} from "vue"; } from "vue";
import { import {
onLoad, onLoad,
onReady onReady,
} from "@dcloudio/uni-app" } from "@dcloudio/uni-app"
import {
addaction
} from '@/api/file.js'
const range = reactive([{ const range = reactive([{
value: 0, value: 0,
name: "喷灌" name: "喷灌"
@ -124,6 +127,7 @@
name: "沟灌" name: "沟灌"
}, },
]) ])
const task_id = ref('');
const pic = reactive([]); const pic = reactive([]);
const calendar = ref(null) const calendar = ref(null)
const calendar1 = ref(null) const calendar1 = ref(null)
@ -165,7 +169,7 @@
} }
const rules = { const rules = {
'type': { 'type': {
type: 'string', type: 'number',
required: true, required: true,
message: '请选择灌溉方式', message: '请选择灌溉方式',
trigger: ['change'] trigger: ['change']
@ -211,10 +215,10 @@
}) })
} }
const addFn = () => { const addFn = () => {
console.log(formData)
form.value.validate().then(res => { form.value.validate().then(res => {
console.log(res)
if (res) {
if (res) {
formData.pic = pic formData.pic = pic
let data1 = { let data1 = {
plant_id: task_id.value, plant_id: task_id.value,
@ -225,8 +229,19 @@
uni.$u.toast('请上传图片') uni.$u.toast('请上传图片')
return return
} }
let endTime = new Date(formData.end_date)
let startTime = new Date(formData.start_date)
if (endTime < startTime) {
uni.$u.toast("结束时间不能小于开始时间");
return
} else if (startTime > endTime) {
uni.$u.toast("开始时间不能大于结束时间");
return
} else {
console.log("开始时间和结束时间合法");
}
console.log('表单通过');
// //
addaction(data1).then((res) => { addaction(data1).then((res) => {
@ -244,6 +259,10 @@
}) })
}
//
const delimg = (i) => {
pic.splice(i, 1);
} }
// //
const updateImgFn = async () => { const updateImgFn = async () => {
@ -287,15 +306,14 @@
console.log(data, data.detail) console.log(data, data.detail)
Object.assign(formData, data.detail); Object.assign(formData, data.detail);
pic.splice(0, pic.length, data.detail.pic); pic.splice(0, pic.length, data.detail.pic);
formDatatype.value = range.find(item => item.value === formData.type).name;
mode.value = 'detail' mode.value = 'detail'
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: '施肥详情' title: '灌溉详情'
}) })
// formData=data.detail // formData=data.detail
} else { } else {
task_id.value = options.id task_id.value = options.id
} }

View File

@ -26,15 +26,19 @@
</u-form-item> </u-form-item>
<view class="card-li"> <view class="card-li">
<view class="card-li-tit"> <view class="card-li-tit">
土地图片 种植图片
</view> </view>
<view class="code-img1"> <view class="code-img1">
<view class="" v-if="pic.length>0" <view class="" v-if="pic.length>0"
style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;"> style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;">
<view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;"> <view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;">
<view class="">
<u-icon name="close" size="15" style="margin-left:120.85rpx;"
@click="delimg(i)" v-show="mode=='add'"></u-icon>
<u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image> <u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image>
</view> </view>
</view> </view>
</view>
</view> </view>
<view class="code-img"> <view class="code-img">
@ -167,7 +171,10 @@
} }
//
const delimg = (i) => {
pic.splice(i, 1);
}
const navgo = (url) => { const navgo = (url) => {
uni.navigateTo({ uni.navigateTo({
@ -192,12 +199,13 @@
} }
// //
addplant(data.formData).then((res) => { addplant(data.formData).then((res) => {
console.log(res)
if (res.code == 1) { if (res.code == 1) {
uni.$u.toast(res.msg)
uni.navigateBack({ uni.navigateBack({
delta:1 delta:1
}) })
uni.$u.toast(res.msg)
} }
}) })
} else { } else {

View File

@ -52,9 +52,13 @@
<view class="" v-if="pic.length>0" <view class="" v-if="pic.length>0"
style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;"> style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;">
<view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;"> <view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;">
<view class="">
<u-icon name="close" size="15" style="margin-left:120.85rpx;" @click="delimg(i)"
v-show="mode=='add'"></u-icon>
<u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image> <u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image>
</view> </view>
</view> </view>
</view>
</view> </view>
<view class="code-img" v-if="mode=='add'"> <view class="code-img" v-if="mode=='add'">
@ -230,11 +234,9 @@
// data.formData.pic = res.data.image // data.formData.pic = res.data.image
} }
//
const navgo = (url) => { const delimg = (i) => {
uni.navigateTo({ pic.splice(i, 1);
url
})
} }
const addFn = () => { const addFn = () => {
@ -256,6 +258,17 @@
uni.$u.toast('请上传图片') uni.$u.toast('请上传图片')
return return
} }
let endTime = new Date(formData.end_date)
let startTime = new Date(formData.start_date)
if (endTime < startTime) {
uni.$u.toast("结束时间不能小于开始时间");
return
} else if (startTime > endTime) {
uni.$u.toast("开始时间不能大于结束时间");
return
} else {
console.log("开始时间和结束时间合法");
}
console.log('表单通过'); console.log('表单通过');
@ -291,10 +304,8 @@
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: '除草详情' title: '除草详情'
}) })
// formData=data.detail // formData=data.detail
} else { } else {
task_id.value = options.id task_id.value = options.id
} }

View File

@ -24,6 +24,9 @@
<view class=""> <view class="">
种植面积:{{item.total_area-item.residual_area}} 种植面积:{{item.total_area-item.residual_area}}
</view> </view>
<view class="">
土地面积:{{item.total_area}}
</view>
</view> </view>
<view class="card-li" v-if="item.residual_area==item.total_area"> <view class="card-li" v-if="item.residual_area==item.total_area">
<view class=""> <view class="">
@ -40,6 +43,16 @@
<!-- <view class="land" @click="navgo('/pages/addLand/addLand')"> <!-- <view class="land" @click="navgo('/pages/addLand/addLand')">
土地 土地
</view> --> </view> -->
<view class="coneng-detail" v-if="datalist.length==0">
<view class="">
<image src="@/static/img/zw.png" mode="aspectFit"></image>
<view class="">
暂无数据
</view>
</view>
</view>
</view> </view>
@ -117,6 +130,9 @@
const search = () => { const search = () => {
console.log('111111') console.log('111111')
getlist()
} }
@ -132,12 +148,15 @@
</script> </script>
<style lang="scss"> <style lang="scss">
page {
background-color: #EAF2EF;
}
.content { .content {
min-height: 100vh;
position: relative; position: relative;
background-color: #EAF2EF;
padding-top: 180rpx; padding-top: 180rpx;
.land { .land {
@ -185,7 +204,30 @@
width: 750rpx; width: 750rpx;
} }
.coneng-detail {
width: 478rpx;
height: 341rpx;
background: #FFFFFF;
border-radius: 6px 6px 6px 6px;
opacity: 1;
font-size: 25rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #737373;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
margin: 70rpx auto;
image {
width: 280rpx;
height: 142rpx;
margin-bottom: 20rpx;
}
}
.card { .card {
position: relative; position: relative;
width: 693.93rpx; width: 693.93rpx;

View File

@ -26,7 +26,7 @@
<view class="content" v-if="true"> <view class="content" v-if="true">
<!-- 土地信息 --> <!-- 土地信息 -->
<view class=""> <view class="">
<view class="card"> <view class="card" v-if="Object.keys(dataobj).length>0">
<view class="" @click="navgo"> <view class="" @click="navgo">
<view class=""> <view class="">
土地名称: {{dataobj.title}} 土地名称: {{dataobj.title}}
@ -35,16 +35,26 @@
农作物: 洋芋 农作物: 洋芋
</view> --> </view> -->
<view class=""> <view class="">
面积: {{dataobj.total_area}} 土地面积: {{dataobj.total_area}}
</view> </view>
<view class=""> <view class="">
面积: {{dataobj.total_area}} 种植面积: {{dataobj.total_area-dataobj.residual_area}}
</view> </view>
</view> </view>
<view class="changeLand" @click="show=true"> <view class="changeLand" @click="show=true">
切换土地 切换土地
</view> </view>
</view>
<view class="card" v-else>
<view class="" @click="navgo">
<view class="">
暂无信息
</view>
</view>
</view> </view>
</view> </view>
<!-- 苗情监测 --> <!-- 苗情监测 -->
@ -61,10 +71,13 @@
</view> </view>
</view> </view>
<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--image :src="url" width="100%" height="300rpx"></u--image> -->
<u-swiper :list="dataobj.pic" width="100%" height="300rpx"></u-swiper>
</view> </view>
</view> </view>
<!-- 土壤监测 --> <!-- 土壤监测 -->
<view class="" v-if="dataobj&&dataobj.monitor&&dataobj.monitor.length>0">
<view class="soil-monitor"> <view class="soil-monitor">
<view class="head"> <view class="head">
<view class="tit"> <view class="tit">
@ -122,7 +135,15 @@
</view> </view>
</view> </view>
</view> </view>
</view>
<view class="coneng-detail" v-else>
<view class="">
<image src="@/static/img/zw.png" mode="aspectFit"></image>
<view class="">
暂无数据
</view>
</view>
</view>
<!-- 组件 --> <!-- 组件 -->
<u-loading-page :loading="showLoading"></u-loading-page> <u-loading-page :loading="showLoading"></u-loading-page>
@ -145,17 +166,27 @@
</view> </view>
<!-- 组件 --> <!-- 组件 -->
<view class=""> <view class="Modal">
<u-modal title="绑定设备" :show="showModal" @confirm='bindFn' @cancel="showModal=false" :showCancelButton='true'
:closeOnClickOverlay="true" @close="showModal=false" :title="title"> <u-popup :show="showModal" mode="center" @close="showModal=false" :round="10">
<view class="slot-content"> <view class="Modal">
<view class="" style="display: flex;align-items: center;"> <text> 产品编号:</text>
设备编号: <up-input style="margin-left: 20rpx;" placeholder="请输入设备编号" border="surround" <uni-data-select v-model="equipmentId" :disabled="mode=='detail'"
v-model="equipmentId"></up-input> style="width: 300rpx;margin-left: 30rpx;" :localdata="range"></uni-data-select>
</view>
<view class="Modal-btn">
<view class="Modal-btna" @click="showModal=false">
取消
</view>
<view class="Modal-btnb" @click="bindFn">
确定
</view> </view>
</view> </view>
</u-modal> </u-popup>
</view> </view>
</view> </view>
</template> </template>
@ -168,67 +199,82 @@
onLoad onLoad
} from "@dcloudio/uni-app" } from "@dcloudio/uni-app"
import { import {
binddevice, bindproduct,
lindexist, lindexist,
landlist landlist,
landproduct
} from '@/api/file.js' } from '@/api/file.js'
const showModal = ref(false) const showModal = ref(false)
const range = reactive([{
value: 0,
text: "喷灌"
},
{
value: 1,
text: "滴灌"
},
{
value: 2,
text: "沟灌"
},
])
// //
const url = ref('https://ceshi-worker-task.lihaink.cn//uploads//images//20231121//202311211336582b7920656.jpg') const url = ref('https://ceshi-worker-task.lihaink.cn//uploads//images//20231121//202311211336582b7920656.jpg')
const soilList = reactive([{ const soilList = reactive([{
icon: "/static/img/sj.png", icon: "/static/img/sj.png",
name: "土壤温度", name: "土壤温度",
num: 20, num: 20,
unit: "%", unit: "",
}, { }, {
icon: "/static/img/sj.png", icon: "/static/img/sj.png",
name: "土壤湿度", name: "土壤湿度",
num: 20, num: 20,
unit: "%", unit: "%RH",
}, { }, {
icon: "/static/img/sj.png", icon: "/static/img/sj.png",
name: "土壤导电率", name: "土壤导电率",
num: 20, num: 20,
unit: "%", unit: "μS/cm",
}, { }, {
icon: "/static/img/sj.png", icon: "/static/img/sj.png",
name: "土壤PH值", name: "土壤PH值",
num: 20, num: 20,
unit: "", unit: "PH",
}, { }, {
icon: "/static/img/sj.png", icon: "/static/img/sj.png",
name: "土壤含氮量", name: "土壤含氮量",
num: 20, num: 20,
unit: "", unit: "mg/kg",
}, { }, {
icon: "/static/img/sj.png", icon: "/static/img/sj.png",
name: "土壤含磷量", name: "土壤含磷量",
num: 20, num: 20,
unit: "", unit: "mg/kg",
}, { }, {
icon: "/static/img/sj.png", icon: "/static/img/sj.png",
name: "土壤含钾量", name: "土壤含钾量",
num: 20, num: 20,
unit: "", unit: "mg/kg",
}, },
]) ])
const dataobj = reactive({}) const dataobj = reactive({})
const tdId = ref() const tdId = ref('')
// //
const equipmentId = ref("") const equipmentId = ref("")
const bindFn = () => { const bindFn = () => {
bindevice() biproduct()
showModal.value = false showModal.value = false
} }
// //
@ -261,37 +307,37 @@
icon: "/static/img/sj.png", icon: "/static/img/sj.png",
name: "温度", name: "温度",
num: 20, num: 20,
unit: "%", unit: "",
}, { }, {
icon: "/static/img/sj.png", icon: "/static/img/sj.png",
name: "湿度", name: "湿度",
num: 20, num: 20,
unit: "", unit: "%RH",
}, { }, {
icon: "/static/img/sj.png", icon: "/static/img/sj.png",
name: "二氧化碳", name: "二氧化碳",
num: 20, num: 20,
unit: "", unit: "ppm",
}, { }, {
icon: "/static/img/sj.png", icon: "/static/img/sj.png",
name: "气压", name: "气压",
num: 20, num: 20,
unit: "", unit: "KPa",
}, { }, {
icon: "/static/img/sj.png", icon: "/static/img/sj.png",
name: "雨量", name: "雨量",
num: 20, num: 20,
unit: "", unit: "mm",
}, { }, {
icon: "/static/img/sj.png", icon: "/static/img/sj.png",
name: "光照量", name: "光照量",
num: 20, num: 20,
unit: "", unit: "Lux",
}, },
@ -302,15 +348,42 @@
getlist() getlist()
getlist1() getlist1()
getlist2()
}) })
//
const getlist = () => { const getlist = () => {
lindexist({ lindexist({
land_id: '' land_id: tdId.value
}).then((res) => { }).then((res) => {
console.log(res)
if (res.code == 1) { if (res.code == 1) {
Object.assign(dataobj, res.data); Object.assign(dataobj, res.data);
if (res.data && res.data.monitor && res.data.monitor.soil_monitor_data) {
soilList[0].num = res.data.monitor.soil_monitor_data.temperature
soilList[1].num = res.data.monitor.soil_monitor_data.moisture
soilList[2].num = res.data.monitor.soil_monitor_data.conductivity
soilList[3].num = res.data.monitor.soil_monitor_data.ph
soilList[4].num = res.data.monitor.soil_monitor_data.n_content
soilList[5].num = res.data.monitor.soil_monitor_data.p_content
soilList[6].num = res.data.monitor.soil_monitor_data.k_content
}
if (res.data && res.data.monitor && res.data.monitor.air_monitor_data) {
environmentList[0].num = res.data.monitor.air_monitor_data.wind_speed
environmentList[1].num = res.data.monitor.air_monitor_data.wind_direction
environmentList[2].num = res.data.monitor.air_monitor_data.temperature
environmentList[3].num = res.data.monitor.air_monitor_data.moisture
environmentList[4].num = res.data.monitor.air_monitor_data.co2_content
environmentList[5].num = res.data.monitor.air_monitor_data.pressure
environmentList[6].num = res.data.monitor.air_monitor_data.rainfall
environmentList[7].num = res.data.monitor.air_monitor_data.light_intensity
}
} }
}) })
@ -324,24 +397,35 @@
}).then((res) => { }).then((res) => {
if (res.code == 1) { if (res.code == 1) {
if (res.data.length > 0) {
columns.splice(0, columns.length, ...res.data.map((step, index) => { columns.splice(0, columns.length, ...res.data.map((step, index) => {
return { return {
name: step.title, name: step.title,
id: step.id, id: step.id,
}; };
})); }));
}
} }
}) })
} }
const getlist2 = () => {
landproduct().then((res) => {
if (res.code == 1) {
const bindevice = () => { console.log(res)
binddevice({ }
})
}
const biproduct = () => {
bindproduct({
land_id: '2222', land_id: '2222',
device_code: equipmentId.value product_id: equipmentId.value
}).then((res) => { }).then((res) => {
if (res.code == 1) { if (res.code == 1) {
uni.$u.toast(res.msg); uni.$u.toast(res.msg);
@ -351,9 +435,10 @@
}) })
} }
const confirm = (e) => { const confirm = (e) => {
console.log(e) // console.log(e)
tdId.value = e.id
getlist()
show.value = false show.value = false
showLoading.value = true showLoading.value = true
@ -384,6 +469,10 @@
getNowTimeFn() getNowTimeFn()
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
page {
background-color: $theme-bg-color;
}
.top { .top {
background-color: #34D190; background-color: #34D190;
position: fixed; position: fixed;
@ -393,6 +482,73 @@
} }
.coneng-detail {
width: 478rpx;
height: 341rpx;
background: #FFFFFF;
border-radius: 6px 6px 6px 6px;
opacity: 1;
font-size: 25rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #737373;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
margin: 70rpx auto;
image {
width: 280rpx;
height: 142rpx;
margin-bottom: 20rpx;
}
}
.Modal {
padding: 60rpx 40rpx;
display: flex;
text {
margin-top: 5rpx;
}
.Modal-btn {
display: flex;
justify-content: space-around;
padding-bottom: 20rpx;
.Modal-btna {
width: 120rpx;
height: 60rpx;
line-height: 60rpx;
font-size: 25rpx;
background-color: #e5e0d8;
text-align: center;
border-radius: 30rpx;
color: #fff;
}
.Modal-btnb {
width: 120rpx;
height: 60rpx;
line-height: 60rpx;
font-size: 25rpx;
background-color: #34D190;
text-align: center;
border-radius: 30rpx;
color: #fff;
}
}
}
.uni-select__selector {
z-index: 9999 !important;
}
.nav { .nav {
height: 70rpx; height: 70rpx;
display: flex; display: flex;
@ -418,8 +574,7 @@
} }
.content { .content {
min-height: 92vh; // min-height: 92vh;
background-color: $theme-bg-color;
padding: 0 30rpx; padding: 0 30rpx;
padding-top: 20rpx; padding-top: 20rpx;
box-sizing: border-box; box-sizing: border-box;

View File

@ -4,7 +4,7 @@
<u--image @click="previewImageFn" :src="userinfo.avatar" width="130.28rpx" height="130.28rpx" <u--image @click="previewImageFn" :src="userinfo.avatar" width="130.28rpx" height="130.28rpx"
shape="circle"></u--image> shape="circle"></u--image>
</view> </view>
<view class="" v-if="userinfo"> <view class="" v-if="Object.keys(userinfo).length>0">
<view class="head-li"> <view class="head-li">
姓名: {{userinfo.nickname}} 姓名: {{userinfo.nickname}}
@ -38,7 +38,9 @@
</view> </view>
<view class="out-btn"> <view class="out-btn">
<up-button @click="loginOutFn" type="primary" customStyle="border:none;height:90rpx" color="#34D190" <up-button @click="loginOutFn" type="primary" customStyle="border:none;height:90rpx" color="#34D190"
text="退出登录"></up-button> text="退出登录" v-if="Object.keys(userinfo).length>0"></up-button>
</view> </view>
</view> </view>
@ -50,11 +52,13 @@
ref ref
} from 'vue'; } from 'vue';
import { logout } from '@/api/file.js' import { logout } from '@/api/file.js'
import store from "@/store/index.js"
const userinfo = uni.getStorageSync("SY_USER") const userinfo = reactive({})
if (store.state.userInfo !=null) {
Object.assign(userinfo,store.state.userInfo)
}
const previewImageFn = () => { const previewImageFn = () => {
uni.previewImage({ uni.previewImage({
@ -65,9 +69,11 @@
} }
const cardLiList = reactive([{
text: "片区经理"
},
const cardLiList = reactive([
{ {
text: "安全设置", text: "安全设置",
nav: "/pages/updatePassword/updatePassword" nav: "/pages/updatePassword/updatePassword"
@ -77,8 +83,8 @@
const loginOutFn = () => { const loginOutFn = () => {
if (store.state.userInfo) {
logout().then((res) => { logout().then((res) => {
if (res.code == 1) { if (res.code == 1) {
uni.$u.toast('退出登录'); uni.$u.toast('退出登录');
uni.navigateTo({ uni.navigateTo({
@ -87,6 +93,12 @@
uni.clearStorageSync() uni.clearStorageSync()
} }
}) })
} else {
uni.navigateTo({
url: "/pages/Login/login"
})
}
} }
const navto = (url) => { const navto = (url) => {
@ -100,7 +112,6 @@
url url
}) })
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -5,7 +5,7 @@
<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--image :src="url" width="100%" height="300rpx"></u--image> -->
<u-swiper :list="dataobj.pic"></u-swiper> <u-swiper :list="dataobj.pic" width="100%" height="300rpx"></u-swiper>
</view> </view>
<view class="time"> <view class="time">
@ -34,7 +34,7 @@
</view> </view>
<view class="card_body"> <view class="card_body">
<view class="left"> <view class="left">
<u--image @click="perviewFn(url)" radius='10' :src="item.pic[0]" width="200rpx" <u--image @click="perviewFn(item.pic[0])" radius='10' :src="item.pic[0]" width="200rpx"
height="200rpx"></u--image> height="200rpx"></u--image>
</view> </view>
<view class="right"> <view class="right">
@ -53,6 +53,13 @@
<view class=""> <view class="">
开始日期: {{item.create_time}} 开始日期: {{item.create_time}}
</view> </view>
<view class="" style="display:flex;" v-if="item.status==2">
<view class="" style="margin-right: 10rpx;">溯源码: </view>
<u--image @click="perviewFn(item.qr_code)" radius='10' :src="item.qr_code" width="200rpx"
height="200rpx" style="margin-top: 10rpx;"></u--image>
</view>
</view> </view>
</view> </view>
</view> </view>
@ -61,6 +68,17 @@
</view> </view>
<view class="coneng-detail" v-else>
<view class="">
<image src="@/static/img/zw.png" mode="aspectFit"></image>
<view class="">
暂无数据
</view>
</view>
</view>
</view> </view>
@ -86,7 +104,8 @@
} from '@/api/file.js' } from '@/api/file.js'
import { import {
onLoad onLoad,
onShow
} from "@dcloudio/uni-app" } from "@dcloudio/uni-app"
const list = reactive([{ const list = reactive([{
@ -150,6 +169,12 @@
getlist1(); getlist1();
}); });
onShow(() => {
getlist();
getlist1();
})
const getlist1 = () => { const getlist1 = () => {
landdetail({ landdetail({
@ -193,7 +218,7 @@
const navtoForm = (item, type) => { const navtoForm = (item, type) => {
console.log(item) console.log(item)
uni.navigateTo({ uni.navigateTo({
url:'/pages/landDetail/tudi?data='+ encodeURIComponent(JSON.stringify(item)) url: '/pages/landDetail/tudi?data=' +item.id
}) })
@ -255,6 +280,31 @@
} }
} }
.coneng-detail {
width: 478rpx;
height: 341rpx;
background: #FFFFFF;
border-radius: 6px 6px 6px 6px;
opacity: 1;
font-size: 25rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #737373;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
margin: 70rpx auto;
image {
width: 280rpx;
height: 142rpx;
margin-bottom: 20rpx;
}
}
.thing-card { .thing-card {
width: 693.93rpx; width: 693.93rpx;
box-sizing: border-box; box-sizing: border-box;

View File

@ -3,8 +3,7 @@
<view class="content"> <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--image :src="url" width="100%" height="300rpx"></u--image> -->
<u-swiper :list="dataobj.pic"></u-swiper> <u-swiper :list="dataobj.datapic" width="100%" height="300rpx"></u-swiper>
</view> </view>
<view class="time"> <view class="time">
<u-icon name="clock"></u-icon> <u-icon name="clock"></u-icon>
@ -20,6 +19,7 @@
<view class="tit" style="font-size: 33.29rpx;margin: 20rpx 0;"> <view class="tit" style="font-size: 33.29rpx;margin: 20rpx 0;">
操作信息 操作信息
</view> </view>
<view class="" v-if="dataList1.length>0">
<view class="thing-card" v-for="(item,index) in dataList1" :key="index"> <view class="thing-card" v-for="(item,index) in dataList1" :key="index">
<view class="head"> <view class="head">
<view class=""> <view class="">
@ -36,27 +36,48 @@
height="200rpx"></u--image> height="200rpx"></u--image>
</view> </view>
<view class="right"> <view class="right">
<view class="" v-if="item.type==5">
<view class=""> <view class="">
种植种类:{{item.kind}} 参与人员: {{item.detail.user}}
</view>
</view>
<view class="" v-else>
<view class="">
{{item.type_text.slice(0, -2)}}种类:{{item.detail.kind}}
</view> </view>
<view class=""> <view class="">
种植品种: {{item.breed}} {{item.type_text.slice(0, -2)}}品种: {{item.detail.breed}}
</view> </view>
<view class=""> <view class="">
种植面积: {{item.area}} {{item.type_text.slice(0, -2)}}面积: {{item.detail.area}}
</view> </view>
<view class=""> <view class="">
参与人员: {{item.user}} 参与人员: {{item.detail.user}}
</view> </view>
<view class=""> <view class="">
开始日期: {{item.create_time}} 开始日期: {{item.create_time}}
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view>
<view class="coneng-detail" v-else>
<view class="">
<image src="@/static/img/zw.png" mode="aspectFit"></image>
<view class="">
暂无数据
</view>
</view>
</view>
</view>
</view> </view>
<!-- 组件 --> <!-- 组件 -->
<view class=""> <view class="">
@ -76,12 +97,14 @@
import { import {
plantlist, plantlist,
plantdetail,
actionlist, actionlist,
landdetail landdetail
} from '@/api/file.js' } from '@/api/file.js'
import { import {
onLoad onLoad,
onShow
} from "@dcloudio/uni-app" } from "@dcloudio/uni-app"
const list = reactive([{ const list = reactive([{
@ -116,6 +139,7 @@
const dataList1 = reactive([]) const dataList1 = reactive([])
const dataobj = reactive({}) const dataobj = reactive({})
const typeID = ref('') const typeID = ref('')
const showPicker = ref(false) const showPicker = ref(false)
const columns = reactive([ const columns = reactive([
[{ [{
@ -137,24 +161,43 @@
]); ]);
onLoad((query) => { onLoad((query) => {
let data = query.data ? JSON.parse(decodeURIComponent(query.data)) : null; let data = query.data
console.log(data); // { name: 'John', age: 25 } // console.log(data); // { name: 'John', age: 25 }
Object.assign(dataobj, data); // Object.assign(dataobj, data);
typeID.value = data.id; typeID.value = query.data;
getlist2();
});
const getlist1 = () => { // getlist1()
// getlist2();
});
onShow(() => {
getlist3();
getlist2();
})
const getlist1 = (id,a,b) => {
landdetail({ landdetail({
land_id: typeID.value land_id: id
}).then((res) => { }).then((res) => {
console.log(res); console.log(res);
if (res.code == 1) { if (res.code == 1) {
res.data.kind = a
res.data.datapic=b
Object.assign(dataobj, res.data); Object.assign(dataobj, res.data);
console.log(dataobj)
} }
}); });
}; };
const getlist3 = () => {
plantdetail({
plant_id: typeID.value
}).then((res) => {
if (res.code == 1) {
getlist1(res.data.id, res.data.kind,res.data.pic)
}
});
};
const getlist2 = () => { const getlist2 = () => {
actionlist({ actionlist({
@ -187,6 +230,7 @@
uni.navigateTo({ uni.navigateTo({
url: '/pages/husbandryForm/weeding?task=' + encodeURIComponent(JSON.stringify(item)) url: '/pages/husbandryForm/weeding?task=' + encodeURIComponent(JSON.stringify(item))
}) })
break;
// //
case 3: case 3:
@ -213,7 +257,7 @@
} }
const confirm = (e) => { const confirm = (e) => {
showPicker.value = false showPicker.value = false
console.log(typeID.value)
uni.navigateTo({ uni.navigateTo({
url: e.value[0].route + '?id=' + typeID.value url: e.value[0].route + '?id=' + typeID.value
}) })
@ -273,6 +317,31 @@
} }
} }
.coneng-detail {
width: 478rpx;
height: 341rpx;
background: #FFFFFF;
border-radius: 6px 6px 6px 6px;
opacity: 1;
font-size: 25rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #737373;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
margin: 70rpx auto;
image {
width: 280rpx;
height: 142rpx;
margin-bottom: 20rpx;
}
}
.thing-card { .thing-card {
width: 693.93rpx; width: 693.93rpx;
box-sizing: border-box; box-sizing: border-box;

BIN
static/img/ADL.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
static/img/AHL.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
static/img/AQHL.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
static/img/CKGD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
static/img/CO2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
static/img/CTPH.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
static/img/CTWD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
static/img/DJSC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
static/img/zw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 957 B

After

Width:  |  Height:  |  Size: 1016 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 999 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

25
store/index.js Normal file
View File

@ -0,0 +1,25 @@
import {
createStore
} from 'vuex'
const store = createStore({
state: {
userInfo:uni.getStorageSync("SY_USER")||null,
},
mutations: {
saveUserInfo(state, info) {
state.userInfo = info
uni.setStorageSync("SY_USER", info)
}
},
actions: {
saveUserInfo({
commit
}, info) {
commit('saveUserInfo', info)
}
}
})
export default store

View File

@ -1,15 +0,0 @@
import {
defineStore
} from 'pinia'
export const userInfoStore = defineStore('counter', {
state: () => ({
userInfo: {}
}),
getters: {},
actions: {
saveUserInfo(userInfo) {
this.userInfo = userInfo
}
}
})

View File

@ -2,6 +2,11 @@ import {
config config
} from '@/config/app'; } from '@/config/app';
import {
useStore
} from 'vuex'
import store from "@/store/index.js"
function baseRequest(url, method, data, { function baseRequest(url, method, data, {
noAuth = false, noAuth = false,
@ -9,15 +14,21 @@ function baseRequest(url, method, data, {
onReLogin = false onReLogin = false
}) { }) {
let Url = config.HTTP_REQUEST_URL, let Url = config.HTTP_REQUEST_URL,
// config.HEADER.token = token
header = config.HEADER; header = config.HEADER;
if (store.state.userInfo) {
header.TOKEN = store.state.userInfo.token
}
return new Promise((reslove, reject) => { return new Promise((reslove, reject) => {
uni.request({ uni.request({
url: Url + url, url: Url + url,
method: method || 'GET', method: method || 'GET',
header: { header: {
...header ...header,
}, },
data: method != 'GET' ? data || {} : {}, data: method != 'GET' ? data || {} : {},
params: method == 'GET' ? data : {}, params: method == 'GET' ? data : {},

View File

@ -2,6 +2,7 @@ import {
config config
} from '@/config/app'; } from '@/config/app';
import store from "@/store/index.js"
function baseRequest(url, method, data, { function baseRequest(url, method, data, {
noAuth = false, noAuth = false,
@ -9,8 +10,12 @@ function baseRequest(url, method, data, {
onReLogin = false onReLogin = false
}) { }) {
let Url = config.HTTP_REQUEST_URL, let Url = config.HTTP_REQUEST_URL,
// config.HEADER.token = token
header = config.HEADER; header = config.HEADER;
if(store.state.userInfo){
header.TOKEN = store.state.userInfo.token
}
return new Promise((reslove, reject) => { return new Promise((reslove, reject) => {
uni.request({ uni.request({