Commit f918eca5 by 潘琦

所有页面需要用到user id的地方都加上非空判断及提示;

parent f8b71f8a
......@@ -22,7 +22,6 @@
<script>
import store from '@/store'
// import store from '@/store'
import CardItem from '@/components/cardItem'
import ListItem from '@/components/listItem'
import { getUserCard, getunUsedCountById } from '@/api/apply/apply'
......
......@@ -66,7 +66,7 @@
</template>
<script>
import { getStore } from '@/util/store'
import store from '@/store'
import { saveMember } from '@/api/basic/basic'
import { validatename, cardid, isvalidatemobile } from '@/util/validate'
import { SubtractDay, getBirthByIdNumber, getSexByIdCard } from '@/util/index'
......@@ -76,7 +76,7 @@ export default {
name: 'Home',
data () {
return {
userId: getStore({ name: 'user_id' }),
userId: store.getters.user_id,
orgId: this.$route.query.orgId ? parseInt(this.$route.query.orgId) : null,
orgName: this.$route.query.orgName ? this.$route.query.orgName : '',
userData: {
......@@ -165,6 +165,14 @@ export default {
if (this.userData.sex === '2' && !this.BaseValidate.lastMensesTimeState) {
return true
}
if (!this.userId || this.userId === 'null' || this.userId !== '') {
this.$toast({
message: '缺少用户标识(user id为空)',
position: 'center',
duration: 3000
})
return
}
let params = {
userId: this.userId,
name: this.userData.name,
......
......@@ -109,7 +109,7 @@
</template>
<script>
import { getStore } from '@/util/store'
import store from '@/store'
import { saveMember } from '@/api/basic/basic'
import { validatename, cardid } from '@/util/validate'
import { SubtractDay, getBirthByIdNumber, getSexByIdCard } from '@/util/index'
......@@ -119,7 +119,7 @@ export default {
name: 'Home',
data () {
return {
userId: getStore({ name: 'user_id' }),
userId: store.getters.user_id,
orgId: this.$route.query.orgId ? parseInt(this.$route.query.orgId) : null,
orgName: this.$route.query.orgName ? this.$route.query.orgName : '',
labelId: this.$route.query.labelId ? parseInt(this.$route.query.labelId) : 1, // 领取角色类型 1=子女 2=配偶
......@@ -238,6 +238,14 @@ export default {
return
}
}
if (!this.userId || this.userId === 'null' || this.userId !== '') {
this.$toast({
message: '缺少用户标识(user id为空)',
position: 'center',
duration: 3000
})
return
}
let params = {
userId: this.userId,
name: this.userData.name,
......
......@@ -24,7 +24,7 @@
</template>
<script>
import { getStore } from '@/util/store'
import store from '@/store'
import { getUserCard } from '@/api/apply/apply'
import CardItem from '@/components/cardItem'
export default {
......@@ -35,7 +35,7 @@ export default {
size: 10,
params: {
states: [1],
userId: getStore({ name: 'user_id' })
userId: store.getters.user_id
}
}
},
......@@ -51,17 +51,25 @@ export default {
},
methods: {
getUserCardByIdFn () {
getUserCard(this.size, this.params).then(res => {
if (res.code === 0) {
this.voucherData = res.data
}
}).catch((error) => {
if (this.params.userId && this.params.userId !== 'null' && this.params.userId !== '') {
getUserCard(this.size, this.params).then(res => {
if (res.code === 0) {
this.voucherData = res.data
}
}).catch((error) => {
this.$toast({
message: error.message,
position: 'center',
duration: 3000
})
})
} else {
this.$toast({
message: error.message,
message: '缺少用户标识(user id为空)',
position: 'center',
duration: 3000
})
})
}
},
filter (state) {
console.log(state)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment