登录更新,以及地块搜索更新

This commit is contained in:
jia 2023-12-01 10:54:01 +08:00
parent 64e71a2f25
commit aabd2430d2
8 changed files with 33 additions and 19 deletions

View File

@ -20,12 +20,12 @@
种植品牌: {{info.kind}} 种植品牌: {{info.kind}}
</view> --> </view> -->
</view> </view>
<!-- <view class="card-li"> <view class="card-li" v-if="info.kind">
<view class=""> <view class="">
种植品种: {{info.kind}} 种植品种: {{info.kind}}
</view> </view>
</view> --> </view>
<view class="card-li"> <view class="card-li">
<view class=""> <view class="">
土地面积: {{info.total_area}} 土地面积: {{info.total_area}}

View File

@ -54,6 +54,7 @@
login, login,
xinregister xinregister
} from '@/api/api.js'; } from '@/api/api.js';
import { import {
useStore useStore
} from 'vuex' } from 'vuex'
@ -172,7 +173,8 @@
uni.showLoading({ uni.showLoading({
title: '登陆中' title: '登陆中'
}) })
store.commit('saveUserInfo', res.data)
store.dispatch('saveUserInfo', res.data)
setTimeout(() => { setTimeout(() => {
uni.hideLoading() uni.hideLoading()
uni.reLaunch({ uni.reLaunch({

View File

@ -392,7 +392,7 @@
try { try {
const valid = await form1.value.validate(); const valid = await form1.value.validate();
if (valid) { if (valid) {
console.log('表单通过', data.formData); // console.log('', data.formData);
if (pic.length == 0) { if (pic.length == 0) {
uni.$u.toast('请上传图片') uni.$u.toast('请上传图片')

View File

@ -11,7 +11,8 @@
<!-- #endif --> <!-- #endif -->
<u-search bgColor="white" :show-action="false" margin='0 30rpx' placeholder="搜索你的土地信息" <u-search bgColor="white" :show-action="false" margin='0 30rpx' placeholder="搜索你的土地信息"
v-model="fomData.keyword" shape="round"></u-search> v-model="fomData.keyword" shape="round" :clearabled='false' @change="inputval"></u-search>
<u-button class="custom-style" @click="search">搜索</u-button> <u-button class="custom-style" @click="search">搜索</u-button>
</view> </view>
@ -147,9 +148,18 @@
}) })
} }
//
const inputval= (e) => {
// console.log(e)
if(e.length==0){
list()
}
}
//
const search = () => { const search = () => {
getlist() list()
} }

View File

@ -416,6 +416,7 @@
getlist() getlist()
getlist1() getlist1()
getlist2() getlist2()
}) })

View File

@ -14,9 +14,8 @@ const store = createStore({
} }
}, },
actions: { actions: {
saveUserInfo({ saveUserInfo({commit}, info) {
commit
}, info) {
commit('saveUserInfo', info) commit('saveUserInfo', info)
} }

View File

@ -17,11 +17,7 @@ function baseRequest(url, method, data, {
header = config.HEADER; header = config.HEADER;
if (store.state.userInfo) { if (store.state.userInfo) {
header.TOKEN = store.state.userInfo.token header.TOKEN = store.state.userInfo.token
}else{ }
uni.redirectTo({
url:'/pages/Login/login'
})
}
return new Promise((reslove, reject) => { return new Promise((reslove, reject) => {
@ -46,9 +42,10 @@ function baseRequest(url, method, data, {
if (noVerify) if (noVerify)
reslove(res.data); reslove(res.data);
else if (res.data.code == -1) { else if (res.data.code == -1) {
if (onReLogin) { if (onReLogin) {
// store.commit('LOGOUT'); // store.commit('LOGOUT');
return reject();
} }
} else if (res.data.code == 0) { } else if (res.data.code == 0) {
if (res.data.msg != '用户信息不存在') { if (res.data.msg != '用户信息不存在') {

View File

@ -37,10 +37,15 @@ function baseRequest(url, method, data, {
if (noVerify) if (noVerify)
reslove(res.data); reslove(res.data);
else if (res.data.code == -1) { else if (res.data.code == -1) {
if (onReLogin) { // if (onReLogin) {
// store.commit('LOGOUT'); // // store.commit('LOGOUT');
return reject(); // return reject();
}
// }
uni.showToast({
title: res.data.msg,
icon: 'none',
})
} else if (res.data.code == 0) { } else if (res.data.code == 0) {
if (res.data.msg != '用户信息不存在') { if (res.data.msg != '用户信息不存在') {
uni.showToast({ uni.showToast({