代码更新

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);
uni.reLaunch({
url: '/pages/index/massif'
})
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,7 +51,11 @@
<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 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>
@ -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()
@ -439,7 +446,7 @@
uni.$u.toast('请上传图片')
return
}
//
addland(data.formData).then((res) => {
console.log(res)

View File

@ -52,7 +52,11 @@
<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 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>
@ -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>
@ -51,9 +51,14 @@
<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 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>
@ -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>
@ -135,11 +140,11 @@
const dateConfirmfn = (e) => {
formData.start_date = e.fulldate
}
const dateConfirmfn1 = (e) => {
formData.end_date = e.fulldate
}
const rules = ref({
@ -207,9 +212,9 @@
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('上传成功')
@ -248,7 +253,7 @@
formData.pic = pic
let data1 = {
plant_id: task_id.value,
type: 1,
@ -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,12 +296,15 @@
}
//
const delimg = (i) => {
pic.splice(i, 1);
}
const mode = ref('add')
onLoad((options) => {
if (options.task) {
let data = options.task ? JSON.parse(decodeURIComponent(options.task)) : null;
console.log(data, data.detail)

View File

@ -13,7 +13,7 @@
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"
<up-input placeholder="请输入参与人" :disabled="mode=='detail'" type="txt" border="surround"
v-model="formData.user"></up-input>
</u-form-item>
<view class="card-li">
@ -24,7 +24,11 @@
<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 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>
@ -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,9 +198,23 @@
}
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,11 +3,11 @@
<view class="content">
<view class="card">
<u--form labelPosition="top" labelWidth='100' :model="formData" :rules="rules" ref="form">
<u-form-item label="灌溉方式" prop="type" borderBottom required @click="showggai">
<!-- <uni-data-select v-model="formData.type" :disabled="mode=='detail'"
<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>
<up-input placeholder="请选择灌溉方式" :disabled="true" border="surround"
v-model="formDatatype"></up-input>
</u-form-item>
<view class="" v-if="mode=='add'">
@ -46,7 +46,11 @@
<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 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>
@ -67,21 +71,15 @@
<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>
<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,11 +127,12 @@
name: "沟灌"
},
])
const task_id = ref('');
const pic = reactive([]);
const calendar = ref(null)
const calendar1 = ref(null)
const formDatatype = ref('')
const showgg= ref(false)
const showgg = ref(false)
const form = ref(null)
const openDate = () => {
calendar.value.open()
@ -139,22 +143,22 @@
// console.log()
const formData = reactive({
type: "",
})
//
const ggSelect = (e) => {
formDatatype.value=e.name
formDatatype.value = e.name
formData.type = e.value
}
//
const showggai = () => {
showgg.value=true
showgg.value = true
}
//
const dateConfirmfn = (e) => {
formData.start_date = e.fulldate
@ -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,13 +26,17 @@
</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 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>
@ -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

@ -41,7 +41,7 @@
v-model="formData.area"></up-input>
</u-form-item>
<u-form-item label="参与人" prop="user" borderBottom required>
<up-input placeholder="请输入参与人" :disabled="mode=='detail'" type="txt" border="surround"
<up-input placeholder="请输入参与人" :disabled="mode=='detail'" type="txt" border="surround"
v-model="formData.user"></up-input>
</u-form-item>
<view class="card-li">
@ -52,7 +52,11 @@
<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 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>
@ -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>
@ -103,10 +116,10 @@
}
const getlist = () => {
landlist(fomData).then((res) => {
if (res.code == 1) {
datalist.splice(0, datalist.length, ...res.data);
fomData.page_no += fomData.page_no
}
@ -116,6 +129,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,68 +71,79 @@
</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="soil-monitor">
<view class="head">
<view class="tit">
土壤监测数据
<view class="" v-if="dataobj&&dataobj.monitor&&dataobj.monitor.length>0">
<view class="soil-monitor">
<view class="head">
<view class="tit">
土壤监测数据
</view>
<view class="flushed-time">
<u-icon name="clock"></u-icon>
<text>刷新时间: {{getNowTimeFn()}} </text>
</view>
</view>
<view class="flushed-time">
<u-icon name="clock"></u-icon>
<text>刷新时间: {{getNowTimeFn()}} </text>
<view class="monitor-content">
<view class="monitor-card" v-for="(item,index) in soilList" :key="index">
<view class="name">
<view class="">
<u--image :src="item.icon" width="38.55rpx" height="38.55rpx"></u--image>
</view>
<view class="" style="margin-left: 10rpx;">
{{item.name}}
</view>
</view>
<view class="num">
<text style="font-size: 70rpx;">{{item.num}}</text>
<text>{{item.unit}}</text>
</view>
</view>
</view>
</view>
<view class="monitor-content">
<view class="monitor-card" v-for="(item,index) in soilList" :key="index">
<view class="name">
<view class="">
<u--image :src="item.icon" width="38.55rpx" height="38.55rpx"></u--image>
</view>
<view class="" style="margin-left: 10rpx;">
{{item.name}}
</view>
<!-- 环境监测 -->
<view class="soil-monitor">
<view class="head">
<view class="tit">
环境监测数据
</view>
<view class="num">
<text style="font-size: 70rpx;">{{item.num}}</text>
<text>{{item.unit}}</text>
<view class="flushed-time">
<u-icon name="clock"></u-icon>
<text>刷新时间: {{getNowTimeFn()}} </text>
</view>
</view>
<view class="monitor-content">
<view class="monitor-card" v-for="(item,index) in environmentList" :key="index">
<view class="name">
<view class="">
<u--image :src="item.icon" width="38.55rpx" height="38.55rpx"></u--image>
</view>
<view class="" style="margin-left: 10rpx;">
{{item.name}}
</view>
</view>
<view class="num">
<text style="font-size: 70rpx;">{{item.num}}</text>
<text>{{item.unit}}</text>
</view>
</view>
</view>
</view>
</view>
<!-- 环境监测 -->
<view class="soil-monitor">
<view class="head">
<view class="tit">
环境监测数据
</view>
<view class="flushed-time">
<u-icon name="clock"></u-icon>
<text>刷新时间: {{getNowTimeFn()}} </text>
</view>
</view>
<view class="monitor-content">
<view class="monitor-card" v-for="(item,index) in environmentList" :key="index">
<view class="name">
<view class="">
<u--image :src="item.icon" width="38.55rpx" height="38.55rpx"></u--image>
</view>
<view class="" style="margin-left: 10rpx;">
{{item.name}}
</view>
</view>
<view class="num">
<text style="font-size: 70rpx;">{{item.num}}</text>
<text>{{item.unit}}</text>
</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",
},
@ -300,17 +346,44 @@
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,
};
}));
}
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,10 +435,11 @@
})
}
const confirm = (e) => {
console.log(e)
// console.log(e)
tdId.value = e.id
getlist()
show.value = false
showLoading.value = true
setTimeout(() => {
@ -371,7 +456,7 @@
return currentTime
}
const navgo = () => {
uni.navigateTo({
url: '/pages/landDetail/index?id=' + dataobj.id
})
@ -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,8 +4,8 @@
<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}}
</view>
@ -16,7 +16,7 @@
公司: 里海弄农业科技有限公司
</view> -->
</view>
<view class="" v-else @click="revto('/pages/Login/login')">
<view class="" v-else @click="revto('/pages/Login/login')">
请登录
</view>
</view>
@ -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,29 +69,37 @@
}
const cardLiList = reactive([{
text: "片区经理"
},
{
text: "安全设置",
nav: "/pages/updatePassword/updatePassword"
},
const cardLiList = reactive([
{
text: "安全设置",
nav: "/pages/updatePassword/updatePassword"
},
])
const loginOutFn = () => {
logout().then((res)=>{
if(res.code==1){
uni.$u.toast('退出登录');
uni.navigateTo({
url: "/pages/Login/login"
})
uni.clearStorageSync()
}
})
if (store.state.userInfo) {
logout().then((res) => {
if (res.code == 1) {
uni.$u.toast('退出登录');
uni.navigateTo({
url: "/pages/Login/login"
})
uni.clearStorageSync()
}
})
} else {
uni.navigateTo({
url: "/pages/Login/login"
})
}
}
const navto = (url) => {
uni.navigateTo({
@ -95,12 +107,11 @@
})
}
const revto = (url) => {
uni.redirectTo({
url
})
}
</script>
<style lang="scss" scoped>

View File

@ -1,11 +1,11 @@
<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="dataobj.pic"></u-swiper>
<u-swiper :list="dataobj.pic" width="100%" height="300rpx"></u-swiper>
</view>
<view class="time">
@ -18,56 +18,74 @@
<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 class="thing-card" v-for="(item,index) in dataList" :key="index">
<view class="head">
<view class="">
种植
</view>
<view class="" @click="navtoForm(item,i)">
农事查看
</view>
</view>
<view class="" @click="navtoForm(item,i)">
农事查看
<view class="card_body">
<view class="left">
<u--image @click="perviewFn(item.pic[0])" 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 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 class="card_body">
<view class="left">
<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 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>
</template>
@ -81,12 +99,13 @@
import {
plantlist,
landdetail
} from '@/api/file.js'
import {
onLoad
onLoad,
onShow
} from "@dcloudio/uni-app"
const list = reactive([{
@ -148,8 +167,14 @@
typeID.value = option.id;
getlist();
getlist1();
});
onShow(() => {
getlist();
getlist1();
})
const getlist1 = () => {
landdetail({
@ -158,13 +183,13 @@
console.log(res);
if (res.code == 1) {
Object.assign(dataobj, res.data);
}
});
};
const getlist = () => {
plantlist({
land_id: typeID.value
@ -175,14 +200,14 @@
}
});
};
//
const addshowPicke = ()=> {
const addshowPicke = () => {
uni.navigateTo({
url:'/pages/husbandryForm/sow?id='+typeID.value
url: '/pages/husbandryForm/sow?id=' + typeID.value
})
}
//
const navto = (url) => {
@ -192,14 +217,14 @@
}
const navtoForm = (item, type) => {
console.log(item)
uni.navigateTo({
url:'/pages/landDetail/tudi?data='+ encodeURIComponent(JSON.stringify(item))
})
uni.navigateTo({
url: '/pages/landDetail/tudi?data=' +item.id
})
// }
}
const getNowTimeFn = () => {
const now = new Date();
@ -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,40 +19,62 @@
<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 class="" v-if="dataList1.length>0">
<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="" @click="navtoForm(item,item.type)">
农事查看
<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="" v-if="item.type==5">
<view class="">
参与人员: {{item.detail.user}}
</view>
</view>
<view class="" v-else>
<view class="">
{{item.type_text.slice(0, -2)}}种类:{{item.detail.kind}}
</view>
<view class="">
{{item.type_text.slice(0, -2)}}品种: {{item.detail.breed}}
</view>
<view class="">
{{item.type_text.slice(0, -2)}}面积: {{item.detail.area}}
</view>
<view class="">
参与人员: {{item.detail.user}}
</view>
<view class="">
开始日期: {{item.create_time}}
</view>
</view>
</view>
</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 class="coneng-detail" v-else>
<view class="">
<image src="@/static/img/zw.png" mode="aspectFit"></image>
<view class="">
暂无数据
</view>
</view>
</view>
</view>
@ -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({
@ -174,10 +217,10 @@
const navtoForm = (item, type) => {
console.log(item, type)
switch (type) {
//
case 1:
uni.navigateTo({
url: '/pages/husbandryForm/fertilize?task=' + encodeURIComponent(JSON.stringify(item))
})
@ -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 : {},
@ -44,7 +55,7 @@ function baseRequest(url, method, data, {
icon: 'none',
})
}
reslove(res.data);
reslove(res.data);
} else if (res.data.code == 1) {
// store.commit("SET_REQUEST");
reslove(res.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({