| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <template>
- <view>
- <home v-show="current == 0" ref="home"></home>
- <recruitment v-show="current == 1" ref="recruitment"></recruitment>
- <my v-show="current == 2" ref="refMy"></my>
- <u-tabbar v-model="current" :safe-area-inset-bottom="true" :list="list" active-color="#2F4379" :before-switch="beforeSwitch"></u-tabbar>
- </view>
- </template>
- <script>
- import home from '@/components/home.vue';
- import my from '@/components/my.vue';
- import recruitment from '@/components/recruitment.vue';
- import { mapGetters } from 'vuex';
- export default {
- components: {
- home,
- my,
- recruitment
- },
- data() {
- return {
- list: [
- {
- iconPath: '/static/nav1.png',
- selectedIconPath: '/static/nav1_on.png',
- text: '学习中心',
- customIcon: false
- },
- {
- iconPath: '/static/job@3x.png',
- selectedIconPath: '/static/job@3xactive.png',
- text: '求职',
- customIcon: false
- },
- {
- iconPath: '/static/nav4.png',
- selectedIconPath: '/static/nav4_on.png',
- text: '我的',
- customIcon: false
- }
- ],
- current: 0,
- isClick1: false
- };
- },
- onPullDownRefresh(){
- console.log(34)
- },
- onLoad(option) {
- this.$refs.home.init();
- this.getDict()
- // this.$refs.recruitment.inits();
- },
- onShow() {},
- onShareAppMessage(res) {
- var self = this;
- return {
- title: '中正',
- path: `/pages/index/index?inviteCode=` + userInfo == null ? '' : userInfo.userAccount
- };
- },
- methods: {
- getDict(){
- let that = this
- this.$api.dictList().then(res => {
- if (res.data.code === 200) {
- let newList = {}
- let list = res.data.data
- for(let i =0 ;i<list.length;i++){
- let item = list[i]
- if(newList.hasOwnProperty(item.dictType)){
- newList[item.dictType].push(item.dictLabel)
- }else{
- newList[item.dictType] = [item.dictLabel]
- }
- }
- that.$store.state.dictObj = newList;
- console.log(newList)
- }
- });
- },
- updateHomePlan() {
- this.$refs.home.init();
- },
- beforeSwitch(index) {
- let that = this;
- if (index == 1) {
- this.isClick1 = true;
- }
- if (index == this.current) {
- return false;
- }
- if (!this.$method.isLogin()) {
- if (index == 0 || index == 1) {
- return true;
- } else {
- this.$navTo.togo('/pages/login/login');
- return false;
- }
- } else {
- if (index == 2) {
- this.$refs.refMy.init();
- }
- return true;
- }
- }
- },
- onReachBottom() {},
- computed: { ...mapGetters(['userInfo']) }
- };
- </script>
- <style scoped></style>
|