From aabd2430d284525035aca56ffcd7d1be258b39d4 Mon Sep 17 00:00:00 2001 From: jia <1451658316@qq.com> Date: Fri, 1 Dec 2023 10:54:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=9B=B4=E6=96=B0=EF=BC=8C?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E5=9C=B0=E5=9D=97=E6=90=9C=E7=B4=A2=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/plant/landInfo.vue | 4 ++-- pages/Login/login.vue | 4 +++- pages/addLand/addLand.vue | 2 +- pages/index/index.vue | 14 ++++++++++++-- pages/index/massif.vue | 1 + store/index.js | 5 ++--- utils/http.js | 9 +++------ utils/syhttp.js | 13 +++++++++---- 8 files changed, 33 insertions(+), 19 deletions(-) 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({