保誠-保戶業務員媒合平台
Tomas
2021-12-09 26dbfaafa064ee79fd4d07aed8e8fa15ec737c46
fixed: my-consultant-list - childRoute error
刪除1個檔案
修改5個檔案
新增3個檔案
修改3個檔案名稱
147 ■■■■■ 已變更過的檔案
PAMapp/components/Ui/UiPagination.vue 8 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/middleware/login.ts 7 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/middleware/my-consultant-list.guard.ts 5 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/agentInfo/_agentNo.vue 1 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/my-consultant-list.component.scss 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/my-consultant-list.component.ts 63 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/myConsultantList.vue 13 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/myConsultantList/consultantList/consultant-list.component.ts 5 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/myConsultantList/contactedList/contacted-list.component.ts 1 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/myConsultantList/contactedList/index.vue 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/myConsultantList/my-consultant-list.component.ts 41 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/store/index.ts 3 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/components/Ui/UiPagination.vue
@@ -25,7 +25,7 @@
        this.handleCurrentChange(this.currentPage);
    }
    @Emit('changePage') chagnePage(): Consultant[] {
    @Emit('changePage') changePage(): Consultant[] {
        return this.pageList
    }
@@ -37,14 +37,14 @@
        if (this.totalList) {
            this.pageList = this.totalList.slice(this.pageSize * currentPage - this.pageSize, this.pageSize * currentPage)
            this.chagnePage();
            this.changePage();
        }
    }
    @Watch('totalList') watchtotalList(newValue: Consultant[]) {
    @Watch('totalList') watchTotalList(newValue: Consultant[]) {
        if (newValue) {
            this.handleCurrentChange(this.currentPage);
        }
    }
}
</script>
</script>
PAMapp/middleware/login.ts
比對新檔案
@@ -0,0 +1,7 @@
import { isLogin } from '~/assets/ts/auth';
export default function({ store, redirect}) {
  if (!isLogin()) {
    return redirect('/login');
  }
}
PAMapp/middleware/my-consultant-list.guard.ts
比對新檔案
@@ -0,0 +1,5 @@
export default function ({ route, redirect }) {
  if (route.name === "myConsultantList") {
    return redirect('/myConsultantList/consultantList')
  }
}
PAMapp/pages/agentInfo/_agentNo.vue
@@ -144,7 +144,6 @@
        </UiField>
      </el-row>
      <AddAndReservedBtns
        v-if="currentRole!==role.ADMIN"
        :cusClass="'pam-paragraph'"
PAMapp/pages/my-consultant-list.component.scss
PAMapp/pages/my-consultant-list.component.ts
比對新檔案
@@ -0,0 +1,63 @@
import { Vue, Component, Watch, State, Action } from 'nuxt-property-decorator';
import { Consultant } from '~/assets/ts/models/consultant.model';
@Component
export default class myConsultantList extends Vue {
    activeTabName = 'consultantList';
    contactedList: Consultant[] = [];
    consultantList: Consultant[] = [];
    @State('myConsultantList') myConsultantList!: Consultant[];
    @Action storeConsultantList!: any;
    @Watch('myConsultantList')
    onMyConsultantListChange() {
      this.filterContactedList();
    }
    beforeRouteEnter(to: any, from: any, next: any) {
      next((vm: any) => {
        if (to.name === 'myConsultantList') {
            vm.$router.push('/myConsultantList/consultantList');
          return;
        }
      })
    }
    mounted() {
        this.storeConsultantList();
        if (this.$route.name) {
         this.activeTabName = this.$route.name.split('-')[1]
        }
    }
    tabClick(path: string) {
      this.activeTabName = path;
      this.$router.push('/myConsultantList/' + this.activeTabName)
    }
    filterContactedList() {
        this.consultantList = (this.myConsultantList || [])
                .filter((item) => item.contactStatus !== 'contacted')
                .map((item) => {
                  return {
                    ...item,
                    formatDate: new Date(item.updateTime)
                  }
                })
                .sort((previousItem, nextItem) => +nextItem.formatDate - +previousItem.formatDate);
        this.contactedList = (this.myConsultantList || [])
                .filter(item => item.contactStatus === 'contacted')
                .map((item) => {
                  return {
                    ...item,
                    formatDate: new Date(item.updateTime)
                  }
                })
                .sort((a, b) => +a.formatDate - +b.formatDate);
    }
}
PAMapp/pages/myConsultantList.vue
File was renamed from PAMapp/pages/myConsultantList/index.vue
@@ -18,18 +18,9 @@
        </div>
        <NuxtChild
            :contactedList="contactedList"
            :consultantList="consultantList"
          :consultantList="consultantList"
          :contactedList="contactedList"
        ></NuxtChild>
        <!-- <ConsultantList
            :agents="pageList"
        ></ConsultantList>
        <UiPagination
            :totalList="consultantList"
            @changePage="changePage"
        ></UiPagination> -->
    </div>
</template>
PAMapp/pages/myConsultantList/consultantList/consultant-list.component.ts
@@ -1,12 +1,9 @@
import { Vue, Component, Prop, Getter } from 'nuxt-property-decorator';
import { Vue, Component, Prop } from 'nuxt-property-decorator';
import { Consultant } from '~/assets/ts/models/consultant.model';
@Component
export default class ConsultantPage extends Vue {
    @Prop() consultantList!: Consultant[];
    @Getter isLogin!: boolean;
    pageList: Consultant[] = [];
    changePage(pageList: Consultant[]) {
PAMapp/pages/myConsultantList/contactedList/contacted-list.component.ts
@@ -1,7 +1,6 @@
import { Vue, Component, Prop } from 'nuxt-property-decorator' ;
import { Consultant } from '~/assets/ts/models/consultant.model';
@Component
export default class ContactedList extends Vue {
    @Prop() contactedList!: Consultant[];
PAMapp/pages/myConsultantList/contactedList/index.vue
PAMapp/pages/myConsultantList/my-consultant-list.component.ts
檔案已刪除
PAMapp/store/index.ts
@@ -51,7 +51,6 @@
            return;
        };
        if (localData?.length) {
            const agentNoList = localData.map(i => i.agentNo)
            await addFavoriteConsultant(agentNoList).then(res => {
@@ -141,4 +140,4 @@
        });
    }
}
}