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 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 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 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';
// import store from '../store';
import { config } from '@/config/app';
import store from "@/store/index.js"
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) {

View File

@ -5,17 +5,25 @@
{{info.title}}
号土地
</view>
<view class="">
溯源码: {{}}
</view>
<!-- <view class="" style="display:flex;">
<view class="" style="margin-right: 10rpx;">溯源码: </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 class="card-li">
<view class="">
当前种植: {{info.residual_area}}
当前种植: {{info.total_area-info.residual_area}}
</view>
<!-- <view class="">
种植品牌: {{}}
种植品牌: {{info.kind}}
</view> -->
</view><view class="card-li">
<view class="">
种植品种: {{info.kind}}
</view>
</view>
<view class="card-li">
<view class="">
@ -55,6 +63,13 @@
info: Object,
})
const perviewFn = (url) => {
console.log(url)
uni.previewImage({
urls: [url]
})
}
</script>
<style lang="scss" scoped>

View File

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

17
main.js
View File

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

View File

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

View File

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

View File

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

View File

@ -51,9 +51,13 @@
<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;">
<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>
</view>
</view>
</view>
</view>
<view class="code-img">
@ -254,7 +258,7 @@
}
const cityn = (id) => {
console.log(id)
city({
province_code: id
}).then((res) => {
@ -283,7 +287,10 @@
});
}
//
const delimg = (i) => {
pic.splice(i, 1);
}
const townsn = (id) => {
towns({
@ -383,7 +390,7 @@
}
const leavaType1 = (e) => {
console.log('Received value:', e)
province_name.value = e.name
data.formData.province_code = e.id
cityn(e.id)
@ -411,7 +418,7 @@
}
const leavaType6 = (e) => {
console.log(e)
group_name.value = e.name
data.formData.group_code = e.id.toString()

View File

@ -52,9 +52,13 @@
<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;">
<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>
</view>
</view>
</view>
</view>
<view class="code-img" v-if="mode=='add'">
@ -145,7 +149,7 @@
'kind': {
type: 'string',
required: true,
message: '请填写杀虫剂种类',
message: '请填写杀虫剂品牌',
trigger: ['blur', 'change']
},
'breed': {
@ -195,6 +199,10 @@
form.value.setRules(rules);
});
//
const delimg = (i) => {
pic.splice(i, 1);
}
//
const updateImgFn = async () => {

View File

@ -3,8 +3,8 @@
<view class="content">
<view class="card">
<u--form labelPosition="top" labelWidth='100' :model="formData" :rules="rules" ref="form">
<u-form-item label="肥料种类" prop="kind" 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>
@ -53,9 +53,14 @@
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="">
<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>
</view>
</view>
</view>
</view>
<view class="code-img" v-if="mode=='add'">
@ -86,7 +91,7 @@
<view class="confirm" v-if="mode=='add'">
<view class="confirm-btn" style="color: white;background-color: #0AA565;" @click="addFn">
完成添加
</view>dateConfirmfn1
</view>
</view>
@ -259,6 +264,17 @@
uni.$u.toast('请上传图片')
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('表单通过');
@ -280,7 +296,10 @@
}
//
const delimg = (i) => {
pic.splice(i, 1);
}
const mode = ref('add')

View File

@ -24,9 +24,13 @@
<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;">
<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>
</view>
</view>
</view>
</view>
<view class="code-img" v-if="mode=='add'">
@ -81,6 +85,7 @@
} from '@/api/file.js'
const form = ref(null)
const task_id = ref('');
const pic = reactive([]);
const formData = reactive({
user: "",
@ -152,6 +157,10 @@
})
}
//
const delimg = (i) => {
pic.splice(i, 1);
}
//
const updateImgFn = async () => {
@ -189,10 +198,24 @@
}
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

@ -46,9 +46,13 @@
<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;">
<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>
</view>
</view>
</view>
</view>
<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="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 :show="showgg" :actions="range" title="请选择灌溉方式" @close="showgg = false"
@select="ggSelect">
</u-action-sheet>
</view>
</view>
@ -109,8 +107,13 @@
} from "vue";
import {
onLoad,
onReady
onReady,
} from "@dcloudio/uni-app"
import {
addaction
} from '@/api/file.js'
const range = reactive([{
value: 0,
name: "喷灌"
@ -124,6 +127,7 @@
name: "沟灌"
},
])
const task_id = ref('');
const pic = reactive([]);
const calendar = ref(null)
const calendar1 = ref(null)
@ -165,7 +169,7 @@
}
const rules = {
'type': {
type: 'string',
type: 'number',
required: true,
message: '请选择灌溉方式',
trigger: ['change']
@ -211,10 +215,10 @@
})
}
const addFn = () => {
console.log(formData)
form.value.validate().then(res => {
console.log(res)
if (res) {
if (res) {
formData.pic = pic
let data1 = {
plant_id: task_id.value,
@ -225,8 +229,19 @@
uni.$u.toast('请上传图片')
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) => {
@ -244,6 +259,10 @@
})
}
//
const delimg = (i) => {
pic.splice(i, 1);
}
//
const updateImgFn = async () => {
@ -287,15 +306,14 @@
console.log(data, data.detail)
Object.assign(formData, data.detail);
pic.splice(0, pic.length, data.detail.pic);
formDatatype.value = range.find(item => item.value === formData.type).name;
mode.value = 'detail'
uni.setNavigationBarTitle({
title: '施肥详情'
title: '灌溉详情'
})
// formData=data.detail
} else {
task_id.value = options.id
}

View File

@ -26,15 +26,19 @@
</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;">
<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>
</view>
</view>
</view>
</view>
<view class="code-img">
@ -167,7 +171,10 @@
}
//
const delimg = (i) => {
pic.splice(i, 1);
}
const navgo = (url) => {
uni.navigateTo({
@ -192,12 +199,13 @@
}
//
addplant(data.formData).then((res) => {
console.log(res)
if (res.code == 1) {
uni.$u.toast(res.msg)
uni.navigateBack({
delta:1
})
uni.$u.toast(res.msg)
}
})
} else {

View File

@ -52,9 +52,13 @@
<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;">
<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>
</view>
</view>
</view>
</view>
<view class="code-img" v-if="mode=='add'">
@ -230,11 +234,9 @@
// data.formData.pic = res.data.image
}
const navgo = (url) => {
uni.navigateTo({
url
})
//
const delimg = (i) => {
pic.splice(i, 1);
}
const addFn = () => {
@ -256,6 +258,17 @@
uni.$u.toast('请上传图片')
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('表单通过');
@ -291,10 +304,8 @@
uni.setNavigationBarTitle({
title: '除草详情'
})
// formData=data.detail
} else {
task_id.value = options.id
}

View File

@ -24,6 +24,9 @@
<view class="">
种植面积:{{item.total_area-item.residual_area}}
</view>
<view class="">
土地面积:{{item.total_area}}
</view>
</view>
<view class="card-li" v-if="item.residual_area==item.total_area">
<view class="">
@ -40,6 +43,16 @@
<!-- <view class="land" @click="navgo('/pages/addLand/addLand')">
土地
</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>
@ -117,6 +130,9 @@
const search = () => {
console.log('111111')
getlist()
}
@ -132,12 +148,15 @@
</script>
<style lang="scss">
page {
background-color: #EAF2EF;
}
.content {
min-height: 100vh;
position: relative;
background-color: #EAF2EF;
padding-top: 180rpx;
.land {
@ -185,7 +204,30 @@
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 {
position: relative;
width: 693.93rpx;

View File

@ -26,7 +26,7 @@
<view class="content" v-if="true">
<!-- 土地信息 -->
<view class="">
<view class="card">
<view class="card" v-if="Object.keys(dataobj).length>0">
<view class="" @click="navgo">
<view class="">
土地名称: {{dataobj.title}}
@ -35,16 +35,26 @@
农作物: 洋芋
</view> -->
<view class="">
面积: {{dataobj.total_area}}
土地面积: {{dataobj.total_area}}
</view>
<view class="">
面积: {{dataobj.total_area}}
种植面积: {{dataobj.total_area-dataobj.residual_area}}
</view>
</view>
<view class="changeLand" @click="show=true">
切换土地
</view>
</view>
<view class="card" v-else>
<view class="" @click="navgo">
<view class="">
暂无信息
</view>
</view>
</view>
</view>
<!-- 苗情监测 -->
@ -61,10 +71,13 @@
</view>
</view>
<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 class="" v-if="dataobj&&dataobj.monitor&&dataobj.monitor.length>0">
<view class="soil-monitor">
<view class="head">
<view class="tit">
@ -122,7 +135,15 @@
</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>
@ -145,17 +166,27 @@
</view>
<!-- 组件 -->
<view class="">
<u-modal title="绑定设备" :show="showModal" @confirm='bindFn' @cancel="showModal=false" :showCancelButton='true'
:closeOnClickOverlay="true" @close="showModal=false" :title="title">
<view class="slot-content">
<view class="" style="display: flex;align-items: center;">
设备编号: <up-input style="margin-left: 20rpx;" placeholder="请输入设备编号" border="surround"
v-model="equipmentId"></up-input>
<view class="Modal">
<u-popup :show="showModal" mode="center" @close="showModal=false" :round="10">
<view class="Modal">
<text> 产品编号:</text>
<uni-data-select v-model="equipmentId" :disabled="mode=='detail'"
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>
</u-modal>
</u-popup>
</view>
</view>
</template>
@ -168,67 +199,82 @@
onLoad
} from "@dcloudio/uni-app"
import {
binddevice,
bindproduct,
lindexist,
landlist
landlist,
landproduct
} from '@/api/file.js'
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 soilList = reactive([{
icon: "/static/img/sj.png",
name: "土壤温度",
num: 20,
unit: "%",
unit: "",
}, {
icon: "/static/img/sj.png",
name: "土壤湿度",
num: 20,
unit: "%",
unit: "%RH",
}, {
icon: "/static/img/sj.png",
name: "土壤导电率",
num: 20,
unit: "%",
unit: "μS/cm",
}, {
icon: "/static/img/sj.png",
name: "土壤PH值",
num: 20,
unit: "",
unit: "PH",
}, {
icon: "/static/img/sj.png",
name: "土壤含氮量",
num: 20,
unit: "",
unit: "mg/kg",
}, {
icon: "/static/img/sj.png",
name: "土壤含磷量",
num: 20,
unit: "",
unit: "mg/kg",
}, {
icon: "/static/img/sj.png",
name: "土壤含钾量",
num: 20,
unit: "",
unit: "mg/kg",
},
])
const dataobj = reactive({})
const tdId = ref()
const tdId = ref('')
//
const equipmentId = ref("")
const bindFn = () => {
bindevice()
biproduct()
showModal.value = false
}
//
@ -261,37 +307,37 @@
icon: "/static/img/sj.png",
name: "温度",
num: 20,
unit: "%",
unit: "",
}, {
icon: "/static/img/sj.png",
name: "湿度",
num: 20,
unit: "",
unit: "%RH",
}, {
icon: "/static/img/sj.png",
name: "二氧化碳",
num: 20,
unit: "",
unit: "ppm",
}, {
icon: "/static/img/sj.png",
name: "气压",
num: 20,
unit: "",
unit: "KPa",
}, {
icon: "/static/img/sj.png",
name: "雨量",
num: 20,
unit: "",
unit: "mm",
}, {
icon: "/static/img/sj.png",
name: "光照量",
num: 20,
unit: "",
unit: "Lux",
},
@ -302,15 +348,42 @@
getlist()
getlist1()
getlist2()
})
//
const getlist = () => {
lindexist({
land_id: ''
land_id: tdId.value
}).then((res) => {
console.log(res)
if (res.code == 1) {
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) => {
if (res.code == 1) {
if (res.data.length > 0) {
columns.splice(0, columns.length, ...res.data.map((step, index) => {
return {
name: step.title,
id: step.id,
};
}));
}
}
})
}
const getlist2 = () => {
landproduct().then((res) => {
if (res.code == 1) {
const bindevice = () => {
binddevice({
console.log(res)
}
})
}
const biproduct = () => {
bindproduct({
land_id: '2222',
device_code: equipmentId.value
product_id: equipmentId.value
}).then((res) => {
if (res.code == 1) {
uni.$u.toast(res.msg);
@ -351,9 +435,10 @@
})
}
const confirm = (e) => {
console.log(e)
// console.log(e)
tdId.value = e.id
getlist()
show.value = false
showLoading.value = true
@ -384,6 +469,10 @@
getNowTimeFn()
</script>
<style lang="scss" scoped>
page {
background-color: $theme-bg-color;
}
.top {
background-color: #34D190;
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 {
height: 70rpx;
display: flex;
@ -418,8 +574,7 @@
}
.content {
min-height: 92vh;
background-color: $theme-bg-color;
// min-height: 92vh;
padding: 0 30rpx;
padding-top: 20rpx;
box-sizing: border-box;

View File

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

View File

@ -5,7 +5,7 @@
<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>
<u-swiper :list="dataobj.pic" width="100%" height="300rpx"></u-swiper>
</view>
<view class="time">
@ -34,7 +34,7 @@
</view>
<view class="card_body">
<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>
</view>
<view class="right">
@ -53,6 +53,13 @@
<view class="">
开始日期: {{item.create_time}}
</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>
@ -61,6 +68,17 @@
</view>
<view class="coneng-detail" v-else>
<view class="">
<image src="@/static/img/zw.png" mode="aspectFit"></image>
<view class="">
暂无数据
</view>
</view>
</view>
</view>
@ -86,7 +104,8 @@
} from '@/api/file.js'
import {
onLoad
onLoad,
onShow
} from "@dcloudio/uni-app"
const list = reactive([{
@ -150,6 +169,12 @@
getlist1();
});
onShow(() => {
getlist();
getlist1();
})
const getlist1 = () => {
landdetail({
@ -193,7 +218,7 @@
const navtoForm = (item, type) => {
console.log(item)
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 {
width: 693.93rpx;
box-sizing: border-box;

View File

@ -3,8 +3,7 @@
<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>
<u-swiper :list="dataobj.datapic" width="100%" height="300rpx"></u-swiper>
</view>
<view class="time">
<u-icon name="clock"></u-icon>
@ -20,6 +19,7 @@
<view class="tit" style="font-size: 33.29rpx;margin: 20rpx 0;">
操作信息
</view>
<view class="" v-if="dataList1.length>0">
<view class="thing-card" v-for="(item,index) in dataList1" :key="index">
<view class="head">
<view class="">
@ -36,27 +36,48 @@
height="200rpx"></u--image>
</view>
<view class="right">
<view class="" v-if="item.type==5">
<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 class="">
种植品种: {{item.breed}}
{{item.type_text.slice(0, -2)}}品种: {{item.detail.breed}}
</view>
<view class="">
种植面积: {{item.area}}
{{item.type_text.slice(0, -2)}}面积: {{item.detail.area}}
</view>
<view class="">
参与人员: {{item.user}}
参与人员: {{item.detail.user}}
</view>
<view class="">
开始日期: {{item.create_time}}
</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 class="">
@ -76,12 +97,14 @@
import {
plantlist,
plantdetail,
actionlist,
landdetail
} from '@/api/file.js'
import {
onLoad
onLoad,
onShow
} from "@dcloudio/uni-app"
const list = reactive([{
@ -116,6 +139,7 @@
const dataList1 = reactive([])
const dataobj = reactive({})
const typeID = ref('')
const showPicker = ref(false)
const columns = reactive([
[{
@ -137,24 +161,43 @@
]);
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();
});
let data = query.data
// console.log(data); // { name: 'John', age: 25 }
// Object.assign(dataobj, data);
typeID.value = query.data;
const getlist1 = () => {
// getlist1()
// getlist2();
});
onShow(() => {
getlist3();
getlist2();
})
const getlist1 = (id,a,b) => {
landdetail({
land_id: typeID.value
land_id: id
}).then((res) => {
console.log(res);
if (res.code == 1) {
res.data.kind = a
res.data.datapic=b
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 = () => {
actionlist({
@ -187,6 +230,7 @@
uni.navigateTo({
url: '/pages/husbandryForm/weeding?task=' + encodeURIComponent(JSON.stringify(item))
})
break;
//
case 3:
@ -213,7 +257,7 @@
}
const confirm = (e) => {
showPicker.value = false
console.log(typeID.value)
uni.navigateTo({
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 {
width: 693.93rpx;
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
} from '@/config/app';
import {
useStore
} from 'vuex'
import store from "@/store/index.js"
function baseRequest(url, method, data, {
noAuth = false,
@ -9,15 +14,21 @@ function baseRequest(url, method, data, {
onReLogin = false
}) {
let Url = config.HTTP_REQUEST_URL,
// config.HEADER.token = token
header = config.HEADER;
if (store.state.userInfo) {
header.TOKEN = store.state.userInfo.token
}
return new Promise((reslove, reject) => {
uni.request({
url: Url + url,
method: method || 'GET',
header: {
...header
...header,
},
data: method != 'GET' ? data || {} : {},
params: method == 'GET' ? data : {},

View File

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