给定默认值

This commit is contained in:
aixianling
2022-05-09 10:13:53 +08:00
parent e8f736fce8
commit 995ac78a85
4 changed files with 8 additions and 18 deletions

View File

@@ -2,7 +2,7 @@ const getVuex = () => {
return JSON.parse(uni.getStorageSync('vuex') || {})
}
const setVuex = vuex => {
uni.setStorageSync("vuex", vuex)
uni.setStorageSync("vuex", JSON.stringify(vuex))
}
export default {
instance: null,
@@ -14,8 +14,8 @@ export default {
let vuex = getVuex()
this.instance?.post("/app/appgirdmemberinfo/checkLogOnUser").then(res => {
if (res?.data) {
let {girdId, girdMemberId, girdName, checkType: girdCheckType} = res.data
vuex.user = {...vuex.user, girdId, girdMemberId, girdName, girdCheckType}
let {girdId, girdMemberId, girdName, checkType: girdCheckType, appGirdInfo: gridInfo} = res.data
vuex.user = {...vuex.user, girdId, girdMemberId, girdName, girdCheckType, gridInfo}
setVuex(vuex)
}
})

View File

@@ -11,7 +11,7 @@
</AiPagePicker>
<span @click="linkTo('./SetGird')" v-if="isGridAdmin">网格配置</span>
</div>
<component v-if="refresh && isGridMember" :is="component" @change="onChange" :params="params"></component>
<component v-if="refresh && isGridMember" :is="component" @change="onChange" :params="params"/>
<div class="tabs" v-if="isTab && isGridMember">
<div class="item" @click="tabClick(index, item.component)" v-for="(item, index) in tabs" :key="index">
<img :src="tabIndex == index ? item.activeImg : item.img" alt=""/>
@@ -101,6 +101,7 @@ export default {
}
},
onLoad() {
this.handleSelectGird(this.user.gridInfo)
uni.$on('hideTab', () => {
this.isTab = false
})

View File

@@ -30,9 +30,7 @@
<div class="girdCont">
<div class="boxes">
<span class="boxesLeft">网格名称</span>
<span class="boxesRight">{{ gridInfo.girdName || '' }}</span>
<!-- <span class="boxesRight">{{ girdUser.appGirdInfo.girdName }}</span> -->
</div>
<div class="boxes">
@@ -56,14 +54,12 @@ export default {
},
data() {
return {
girdUser: [],
peopleList: {},
gridInfo: {},
checkType: '',
}
},
created() {
this.isGirdUser()
this.gridInfo = this.params
this.getList()
uni.$on('goback', (res) => {
@@ -72,17 +68,9 @@ export default {
})
},
methods: {
isGirdUser() {
this.$http.post('/app/appgirdmemberinfo/checkLogOnUser').then((res) => {
if (res.code == 0) {
this.girdUser = res.data
}
})
},
getList() {
this.$http.post(`/app/appgirdmemberinfo/girdMemberAndResidentStatistic?girdId=${this.gridInfo.id}`).then((res) => {
if (res.code == 0) {
if (res?.data) {
this.peopleList = res.data
}
})

View File

@@ -3,6 +3,7 @@ import Vuex from 'vuex'
import perState from 'vuex-persistedstate'
import http from '../common/axios'
import CryptoJS from '../utils/crypto-js'
import action from "../common/action";
Vue.use(Vuex)
let agentSignURL = "", apiList = []
@@ -210,7 +211,7 @@ const store = new Vuex.Store({
return http.post("/admin/user/detail-phone").then(res => {
if (res?.code == 0) {
state.commit('setUser', res.data)
this.$action.getGridInfo()
action.getGridInfo()
}
})
},