diff --git a/components/plant/landInfo.vue b/components/plant/landInfo.vue index a14cf34..10ef578 100644 --- a/components/plant/landInfo.vue +++ b/components/plant/landInfo.vue @@ -20,12 +20,12 @@ 种植品牌: {{info.kind}} --> - + 土地面积: {{info.total_area}}亩 diff --git a/pages/Login/login.vue b/pages/Login/login.vue index 390cd35..4a34a29 100644 --- a/pages/Login/login.vue +++ b/pages/Login/login.vue @@ -54,6 +54,7 @@ login, xinregister } from '@/api/api.js'; + import { useStore } from 'vuex' @@ -172,7 +173,8 @@ uni.showLoading({ title: '登陆中' }) - store.commit('saveUserInfo', res.data) + + store.dispatch('saveUserInfo', res.data) setTimeout(() => { uni.hideLoading() uni.reLaunch({ diff --git a/pages/addLand/addLand.vue b/pages/addLand/addLand.vue index 0eb9717..a508e4f 100644 --- a/pages/addLand/addLand.vue +++ b/pages/addLand/addLand.vue @@ -392,7 +392,7 @@ try { const valid = await form1.value.validate(); if (valid) { - console.log('表单通过', data.formData); + // console.log('表单通过', data.formData); if (pic.length == 0) { uni.$u.toast('请上传图片') diff --git a/pages/index/index.vue b/pages/index/index.vue index 51a8a7c..294ab8a 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -11,7 +11,8 @@ + v-model="fomData.keyword" shape="round" :clearabled='false' @change="inputval"> + 搜索 @@ -147,9 +148,18 @@ }) } + + //输入监听 + const inputval= (e) => { + // console.log(e) + if(e.length==0){ + list() + } + } +//搜索 const search = () => { - getlist() + list() } diff --git a/pages/index/massif.vue b/pages/index/massif.vue index eea41f8..202e30f 100644 --- a/pages/index/massif.vue +++ b/pages/index/massif.vue @@ -416,6 +416,7 @@ getlist() getlist1() getlist2() + }) diff --git a/store/index.js b/store/index.js index 59dc6a4..cc4a1eb 100644 --- a/store/index.js +++ b/store/index.js @@ -14,9 +14,8 @@ const store = createStore({ } }, actions: { - saveUserInfo({ - commit - }, info) { + saveUserInfo({commit}, info) { + commit('saveUserInfo', info) } diff --git a/utils/http.js b/utils/http.js index cb6b85d..4af274d 100644 --- a/utils/http.js +++ b/utils/http.js @@ -17,11 +17,7 @@ function baseRequest(url, method, data, { header = config.HEADER; if (store.state.userInfo) { header.TOKEN = store.state.userInfo.token - }else{ - uni.redirectTo({ - url:'/pages/Login/login' - }) - } + } return new Promise((reslove, reject) => { @@ -46,9 +42,10 @@ function baseRequest(url, method, data, { if (noVerify) reslove(res.data); else if (res.data.code == -1) { + if (onReLogin) { // store.commit('LOGOUT'); - return reject(); + } } else if (res.data.code == 0) { if (res.data.msg != '用户信息不存在') { diff --git a/utils/syhttp.js b/utils/syhttp.js index 3d7ef6f..930a25c 100644 --- a/utils/syhttp.js +++ b/utils/syhttp.js @@ -37,10 +37,15 @@ function baseRequest(url, method, data, { if (noVerify) reslove(res.data); else if (res.data.code == -1) { - if (onReLogin) { - // store.commit('LOGOUT'); - return reject(); - } + // if (onReLogin) { + // // store.commit('LOGOUT'); + // return reject(); + + // } + uni.showToast({ + title: res.data.msg, + icon: 'none', + }) } else if (res.data.code == 0) { if (res.data.msg != '用户信息不存在') { uni.showToast({