| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <template>
- <view class="container">
- <!-- 首页 -->
- <Home v-if="show === 'home'" />
- <!-- 工单管理 -->
- <Management v-if="show === 'management'" />
- <!-- 通讯录 -->
- <AddressBook v-if="show === 'addressBook'" />
- <!-- 待处理池 -->
- <Pending v-if="show === 'pending'" />
- <!-- 报修 -->
- <Repairs v-if="show === 'repairs'" />
- <!-- 我的报修 -->
- <MyRepairs v-if="show === 'myRepairs'" />
- <!-- 底部导航栏 -->
- <Tabbar :list="routes" @changeRouter="handleChangeRouter" />
- </view>
- </template>
- <script>
- import Home from '../home/home.vue'
- import Management from '../management/management.vue'
- import AddressBook from '../addressBook/addressBook.vue'
- import Pending from '../pending/pending.vue'
- import Repairs from '../repairs/repairs.vue'
- import MyRepairs from '../myRepairs/myRepairs.vue'
- import Tabbar from '../components/tabbar.vue'
- export default {
- components: {
- Home,
- Management,
- AddressBook,
- Pending,
- Repairs,
- MyRepairs,
- Tabbar
- },
- mounted() {
- const repairsUserInfo = uni.getStorageSync('repairsUserInfo')
- console.log(repairsUserInfo)
- if (repairsUserInfo.routes) {
- this.routes = this.filterRoute(this.list, repairsUserInfo.routes)
- }
- this.show = this.routes[0].show
- uni.setNavigationBarTitle({
- title: this.routes[0].text
- })
- },
- data() {
- return {
- routes: [],
- list: [
- {
- text: '报修',
- imgUrl: '../../static/images/repairsImg/repairs.png',
- imgUrlActive: '../../static/images/repairsImg/repairs-active.png',
- show: 'repairs'
- },
- {
- text: '我的报修',
- imgUrl: '../../static/images/repairsImg/myRepairs.png',
- imgUrlActive: '../../static/images/repairsImg/myRepairs-active.png',
- show: 'myRepairs'
- },
- {
- text: '首页',
- imgUrl: '../../static/images/repairsImg/home.png',
- imgUrlActive: '../../static/images/repairsImg/home-active.png',
- show: 'home'
- },
- {
- text: '工单管理',
- imgUrl: '../../static/images/repairsImg/management.png',
- imgUrlActive: '../../static/images/repairsImg/management-active.png',
- show: 'management'
- },
- {
- text: '待处理池',
- imgUrl: '../../static/images/repairsImg/myRepairs.png',
- imgUrlActive: '../../static/images/repairsImg/myRepairs-active.png',
- show: 'pending'
- },
- {
- text: '通讯录',
- imgUrl: '../../static/images/repairsImg/addressBook.png',
- imgUrlActive: '../../static/images/repairsImg/addressBook-active.png',
- show: 'addressBook'
- }
- ],
- show: ''
- }
- },
- methods: {
- handleChangeRouter(show, text) {
- this.show = show
- uni.setNavigationBarTitle({
- title: text
- })
- },
- filterRoute(arr1, arr2) {
- return arr1.filter((item) => {
- return arr2.includes(item.text)
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- width: 100vw;
- height: calc(100vh - 102rpx);
- }
- </style>
|