Commit 0ec17fe6 authored by yyh's avatar yyh

proofCount store

parent a19135b1
......@@ -8,6 +8,7 @@ export default new Vuex.Store({
userInfo: {},
authInfo: {}, // 个人认证信息
companyAuthInfo: {}, // 企业认证信息
proofCount: 0,
},
getters: {
},
......@@ -27,6 +28,9 @@ export default new Vuex.Store({
updateCompanyAuthInfo(state: any, payload: any) {
state.companyAuthInfo = payload;
},
updateProofCount(state: any, payload: any) {
state.proofCount = payload;
},
},
actions: {
getUserInfo({ commit }) {
......@@ -38,6 +42,13 @@ export default new Vuex.Store({
commit('updateIsLogin', false);
});
},
getProofCount( { commit } ) {
Vue.prototype.$api.proof.count().then((res: any) => {
commit('updateProofCount', res.total);
}).catch((err: any) => {
commit('updateProofCount', 0);
});
},
isSetPwd({ commit , state}) {
const { phone, email } = state.userInfo;
Vue.prototype.$api.user.isSetPwd({phone , email}).then((res: any) => {
......
......@@ -56,7 +56,7 @@
import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
import { List, Image } from 'vant';
import { TEMPLATETYPE } from '@/const/enum';
import { State } from 'vuex-class';
import { State, Action } from 'vuex-class';
@Component({
components: {
[List.name]: List,
......@@ -65,6 +65,8 @@ import { State } from 'vuex-class';
})
export default class Index extends Vue {
@State('isLogin') private isLogin!: boolean;
@State('proofCount') private proofCount!: number;
@Action('getProofCount') private getProofCount!: any;
private systemList: any[] = [];
private list: any[] = [];
private page: number = 1;
......@@ -73,16 +75,13 @@ export default class Index extends Vue {
private loading: boolean = false;
private finished: boolean = false;
private proofCount: number = 0;
private addFolderShow: boolean = false;
@Watch('isLogin', { immediate: true })
private onIsLoginChange(newVal: boolean, oldVal: boolean) {
if (newVal) {
this.$api.proof.count().then((res: any) => {
this.proofCount = res.total;
});
this.getProofCount();
this.$api.template.folderList({
template_type: 1,
}).then((res: any) => {
......
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