| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- <template>
- <view class="">
- <view class="tab-box tab_height sys-background-fff">
- <view class="tab-item " :class="{'tab-check':tabIndex==index}" @click="setTab(item.path,index)"
- v-for="(item,index) in tabList" :key="index">
- <view class="tab-content">
- <image class="tab-img"
- :src="`https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/tabBar/${tabIndex==index?item.selectedIconPath:item.iconPath}.png`">
- </image>
- <view class="tab-text sys-size-24 text-color-dominant">{{item.name}}</view>
- </view>
- </view>
- <!-- <view class="tab-item" :class="{'tab-check':tabIndex===2}" @click="setTab(2)">
- <view class="tab-content">
- <image v-if="tabIndex===2" class="tab-img" src="https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/tabBar/task-select.png"></image>
- <image v-else class="tab-img" src="https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/tabBar/task-default.png"></image>
- <view class="tab-text sys-size-24 text-color-dominant">任务</view>
- </view>
- </view>
- <view class="tab-item" :class="{'tab-check':tabIndex===3}" @click="setTab(3)">
- <view class="tab-content">
- <image v-if="tabIndex===3" class="tab-img" src="https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/tabBar/loan-select.png"></image>
- <image v-else class="tab-img" src="https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/tabBar/loan-default.png"></image>
- <view class="tab-text sys-size-24 text-color-dominant ">贷后</view>
- </view>
- </view>
- <view class="tab-item" :class="{'tab-check':tabIndex===4}" @click="setTab(3)">
- <view class="tab-content">
- <image v-if="tabIndex===4" class="tab-img" src="https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/tabBar/statistics-select.png"></image>
- <image v-else class="tab-img" src="https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/tabBar/statistics-default.png"></image>
- <view class="tab-text sys-size-24 text-color-dominant ">统计</view>
- </view>
- </view> -->
- </view>
- <view class="zw">
- </view>
- </view>
- </template>
- <script>
- export default {
- name: 'en-tab',
- props: {
- 'tabIndex': {
- default: 0
- }
- },
- data() {
- return {
- tabList: [{
- name: '首页',
- path: '/pages/loan/loan',
- iconPath: 'loan-default',
- selectedIconPath: 'loan-select',
- },
- {
- name: '市场',
- path: '/pages/index/index',
- iconPath: 'home-default',
- selectedIconPath: 'home-select',
- },
- {
- name: '任务',
- path: '/pages/task/task',
- iconPath: 'task-default',
- selectedIconPath: 'task-select',
- },
- // {
- // name: '统计',
- // path: '/pages/statistics/statistics',
- // iconPath: 'statistics-default',
- // selectedIconPath: 'statistics-select',
- // },
- ]
- };
- },
- created() {
- this.getTabHeight()
- },
- methods: {
- setTab(path) {
- console.log(path)
- uni.switchTab({
- url: path
- })
- },
- getTabHeight() {
- const query = uni.createSelectorQuery().in(this);
- query.select('.tab_height').boundingClientRect(data => {
- if (data) {
- // data.height 就是元素的高度
- uni.setStorageSync('tab_height', data.height)
- }
- }).exec();
- }
- },
- }
- </script>
- <style lang="scss">
- .zw {
- height: 120rpx;
- }
- .tab-box {
- display: flex;
- justify-content: space-around;
- height: 120rpx;
- padding-bottom: 14rpx;
- position: fixed;
- bottom: 0;
- padding-bottom: env(safe-area-inset-bottom);
- width: 100%;
- .tab-item {
- // width: 50%;
- display: flex;
- justify-content: center;
- .tab-content {
- padding-top: 25rpx;
- width: 108rpx;
- height: 130rpx;
- box-sizing: border-box;
- border-radius: 0 0 100rpx 100rpx;
- text-align: center;
- .tab-img {
- width: 42rpx;
- height: 42rpx;
- }
- .tab-text {
- font-weight: 400;
- line-height: 34rpx;
- color: #333333;
- }
- }
- }
- .tab-check {
- .tab-content {
- background-color: rgba(15, 177, 128, 0.1);
- .tab-text {
- font-weight: 500;
- color: #0FB180;
- }
- }
- }
- }
- </style>
|