qiushanhe 3 weeks ago
parent 544226147c
commit 0e6791a61f
  1. 6
      src/pages.json
  2. 151
      src/pages/index/index.vue

@ -9,12 +9,6 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{
"path": "pages/index/index",
"style": {
"navigationStyle": "custom"
}
},
{ {
"path": "pages/choseCity/choseCity", "path": "pages/choseCity/choseCity",
"style": { "style": {

@ -1,151 +0,0 @@
<template>
<view>
<!-- 用j-navbar 组件实现导航栏 -->
<j-navbar :isBack="false" :background="{ background: '#1A8CFE' }" :extraHeight="42">
<template #left>
<view class="cor-fff">
<view class="navbar-left">
<text class="ml10 fs16">{{ title }}</text>
<text class="ml10 fs12">无人机驾考平台</text>
</view>
<view class="mt10 p5tb p15lr" style="width: 100vw">
<u-search v-model="searchValue" placeholder="搜索培训机构" :showAction="false" disabled @click="next('/pages/index/search', false)">搜索</u-search>
</view>
</view>
</template>
</j-navbar>
<view class="container" style="background: #1a8cfe">
<view class="p15tb" style="background: #1a8cfe">
<view class="flex ai-c">
<view class="text-center" style="width: 30%" @click="next('/pages/index/testRoom', true)">
<text class="custom-icon custom-icon-kaodian fs28 cor-fff"></text>
<view class="mt2 cor-fff fs12">CAAC考点</view>
</view>
<view class="text-center" style="width: 30%" @click="next('/pages/index/testCalendar', true)">
<text class="custom-icon custom-icon-kaoshishijian fs28 cor-fff"></text>
<view class="mt2 cor-fff fs12">CAAC考试时间</view>
</view>
</view>
</view>
<view class="mt5 p15 bc-fff" style="border-radius: 16px 16px 0 0">
<!-- 入驻 -->
<view class="flex jc-c ai-c">
<view class="fl1 br10" style="background: linear-gradient(to bottom, #0478d6, #01e2f3)">
<view class="flex jc-c ai-c p10" @tap="next('/pages/index/registerStation', true)">
<view class="fl1">
<view class="fs18 cor-fff">机构入驻</view>
<view class="mt12 fs12 bc-fff text-center br9" style="width: 68px; height: 18px; line-height: 18px; color: #0478d6">立即申请</view>
</view>
<image src="@/static/image/index/wrj1.png" style="width: 64px; height: 64px" />
</view>
</view>
<view class="fl1 br10 ml10" style="background: linear-gradient(to bottom, #e78728, #f2a547)">
<view class="flex jc-c ai-c p10" @tap="next('/pages/index/registerCoach', true)">
<view class="fl1">
<view class="fs18 cor-fff">教员入驻</view>
<view class="mt12 fs12 bc-fff text-center br9" style="width: 68px; height: 18px; line-height: 18px; color: #e78728">立即申请</view>
</view>
<image src="@/static/image/index/wrj2.png" style="width: 64px; height: 64px" />
</view>
</view>
</view>
<!-- 找驾校 -->
<view class="br10 mt10" style="background: linear-gradient(to bottom, #7783e4, #8ebfff)" @tap="next('/pages/index/consult', true)">
<view class="flex jc-c ai-c p10" style="height: 84px">
<view class="fl1">
<view class="fs24 cor-fff fw600">为您甄选优质驾校</view>
<view class="fs14 mt5 cor-fff">离家近 价格低 口碑好 有折扣</view>
</view>
<view class="fs16 bc-fff text-center br14 p5lr" style="height: 28px; line-height: 28px; color: #7783e4">帮我找驾校</view>
</view>
</view>
<!-- 驾校列表 -->
<view class="mt10">
<u-sticky offsetTop="120">
<view class="p10tb flex jc-sb ai-c bc-fff">
<view class="fs15 fw600">无人机驾校</view>
<view class="flex fs12 cor-333" @click="next('/pages/choseCity/choseCity', false)">
<text class="mr5">{{ queryParams.address || '全部城市' }}</text>
<u-icon name="arrow-down" />
</view>
</view>
</u-sticky>
<u-list @scrolltolower="scrolltolower" height="calc(100vh - 120px)">
<u-list-item v-for="(item, index) in pageList" :key="index">
<j-station :info="item" />
</u-list-item>
</u-list>
</view>
</view>
</view>
<u-tabbar :value="tabIndex" @change="name => changeTab(name)">
<u-tabbar-item v-for="(item, index) in tabbarList" :key="index" :text="item.text" :icon="item.icon" :name="item.name"></u-tabbar-item>
</u-tabbar>
</view>
</template>
<script>
import { getStationList } from '@/jtools/api/station';
import { mapState } from 'pinia'; //
import useUserStore from '@/jtools/store/user'; //store
export default {
computed: {
...mapState(useUserStore, ['tabbarList'])
},
data() {
return {
searchValue: '',
title: import.meta.env.VITE_APP_TITLE || '首页',
queryParams: {
address: '',
pageNo: 1,
pageSize: 20
},
total: 0,
pageList: [],
tabIndex: '/pages/index/index',
};
},
onShow() {
this.queryParams.address = uni.getStorageSync('city');
this.pageList = [];
this.queryParams.pageNo = 1;
this.getPageList();
},
methods: {
getPageList() {
const _this = this;
const params = { ...this.queryParams };
getStationList(params).then(res => {
_this.pageList = [..._this.pageList, ...res.data.records];
_this.total = res.data.total;
});
},
next(url, needLogin = false) {
if(needLogin && !useUserStore().isLogin) {
uni.showToast({title: '请先登录', icon: 'none'})
uni.navigateTo({
url: '/pages/me/login'
})
}
uni.navigateTo({
url: url
});
},
scrolltolower() {
if (this.pageList.length < this.total) {
this.queryParams.pageNo++;
this.getPageList();
}
},
changeTab(name) {
this.tabIndex = name;
uni.redirectTo({
url: name
});
}
}
};
</script>
<style lang="scss" scoped></style>
Loading…
Cancel
Save