Commit 0ec17fe6 authored by yyh's avatar yyh

proofCount store

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