|
|
<template> <view class="main"> <view class="status_bar"></view> <view class="TopCon pad" > <!-- 地址、 --> <view class="adrsCon"> <view class="adr">{{ vuex_cityInfo.city || '杭州' }} </view> <view class="adrsIcon"> <image src="@/static/images/icon/down.png" mode=""></image> </view> </view> <view class="flex-b"> <!-- 搜索 --> <view class="searchCon" > <searchRow placeholder="搜索驾校名称" :disable="true" bg="#fff" @searchFn="$goPage('/pages/indexEntry/findShcool/searchShcool/searchShcool')"></searchRow> </view> <!-- 扫一扫 --> <view class="scan" @click="scanCodeFn"> <image src="@/static/images/indexIcon/sancode.png" mode="aspectFill"></image> </view> </view> </view> <!-- 海报 --> <view class="pad"> <uni-swiper-dot class="uni-swiper-dot-box bannerCon" @clickItem=clickItem :info="swiperInfo" v-if="swiperInfo.length" :current="current" :mode="mode" :dots-styles="dotsStyles" field="content"> <swiper class="swiper-box" @change="change" :current="swiperDotIndex" > <swiper-item v-for="(item, index) in swiperInfo" :key="index" @click="$goPage('/pages/indexEntry/iIndustryInfo/detail/detail?id='+ item.id)"> <view class="swiper-item" :class="'swiper-item' + index"> <view class="imgBox"> <image :src="item.picture" mode="widthFix"></image> </view> </view> </swiper-item> </swiper> </uni-swiper-dot> </view> <view class="pad"> <!-- 精钢区 --> <view class="card"> <view class="ul"> <view class="li" v-for="(item,index) in entrySection" :key="index" @tap="entrySectionClick(item)"> <view class="icon"> <image :src="item.icon" mode=""></image> </view> <view class="name">{{ item.text }}</view> </view> </view> </view> <!-- 优质驾校 --> <view class="schoolCon card"> <view class="h1_row"> <view class="h1" style="margin: 28rpx 0;"><text class="active">优质驾校</text></view> <moreRight text="查看全部"/> </view> <view class="li" v-for="(item,index) in 3" :key="index"> <schoolItem :item="{}"/> </view> </view> <!-- 推荐教练 --> <view class="coachCon"> <view class="h1_row"> <view class="h1" style="margin: 28rpx 0;"><text class="active">推荐教练</text></view> <moreRight text="查看全部"/> </view> <scroll-view style="width: 100%;" scroll-x="true" scroll-with-animation > <view class="ul3"> <view class="li3" v-for="item in 6" :key="item"> <coachItem/> </view> </view> </scroll-view> </view> <!-- 行业资讯,政策法规 --> <view class="card"> <view class="h1_row"> <view class="tabs"> <view class="h1 "><text class="active">行业资讯</text></view> <view class="h1"><text>政策法规</text></view> </view> <moreRight text="查看全部"/> </view> <view class="ul2"> <view class="li2" v-for="(item,index) in 3" :key="index"> <informaItem/> </view> </view> </view> <!-- 服务专区 --> <view class="card"> <view class="h1" style="margin-top: 20rpx;"><text class="active">服务专区</text></view> <view class="severCon"> <view class="severItem" @click="$goPage('/pages/indexEntry/parse/parse')"> <view class="tit">学车指南</view> <view class="tps">政府平台 一站服务</view> <view class="go"> <view class="goTxt">GO</view> <u-icon name="arrow-right" color="#fff" size="14"></u-icon> </view> </view> <view class="severItem tow" @click="$goPage('/pages/indexEntry/consult/consult')"> <view class="tit">咨询投诉</view> <view class="tps">畅达沟通 听取民声</view> <view class="go"> <view class="goTxt">GO</view> <u-icon name="arrow-right" color="#fff" size="14"></u-icon> </view> </view> </view> </view> </view> <u-popup :show="showPrivacy" mode="center" :round="20" > <privacyPopup @disagree="showPrivacy=false" @agree="showPrivacy=false"></privacyPopup> </u-popup> </view> </template>
<script> import { imgUrl } from '@/config/site.config' import { getarticleList } from '@/config/api.js' import schoolItem from './comp/schoolItem' import informaItem from './comp/informaItem' import coachItem from './comp/coachItem' export default { components: { schoolItem, informaItem, coachItem }, data() { return { showPrivacy: false, imgUrl: imgUrl+'banner.png', backgroundSize: '100% 100%', keywords: '', entrySection: [{ text: '学车报名', icon: require('../../../static/images/indexIcon/entryIcon (3).png'), url: '/pages/indexEntry/enroll/enroll', goPage: function (){ console.log(666) // this.$goPage(item.url)
} }, { text: '找驾校', icon: require('../../../static/images/indexIcon/entryIcon (4).png'), url: '/pages/indexEntry/findShcool/findShcool', goPage: (item)=>{ this.$goPage(item.url) } }, { text: '找教练', icon: require('../../../static/images/indexIcon/entryIcon (1).png'), url: '/pages/indexEntry/examines/examines', goPage: ((item)=>{ this.$goPage(item.url) }) }, { text: '签到签退', icon: require('../../../static/images/indexIcon/entryIcon (5).png'), goPage: ((item)=>{ this.$u.toast('正在开发中,敬请期待...') }) }, { text: '理论学习', icon: require('../../../static/images/indexIcon/entryIcon (2).png'), url: '/pages/carEntry/simulateAppointment/simulateAppointment', goPage: ((item)=>{ this.$goPage(item.url) }) }, ], serviceSector: [{ text: '学车指南', tps: '政府平台 一站服务', icon: require('../../../static/images/index/img_1@2x.png'), url: '/pages/indexEntry/parse/parse' }, { text: '公益视频', tps: '立体呈现 学驾无忧', icon: require('../../../static/images/index/img_2@2x.png'), url: '/pages/indexEntry/publicVideo/publicVideo' }, { text: '合格率排行', tps: '官方数据 阳光透明', icon: require('../../../static/images/index/img_3@2x.png'), url: '/pages/indexEntry/credit/credit?type=1' }, { text: '行业政策', tps: '权威发布 精准解读', icon: require('../../../static/images/index/img_4@2x.png'), url: '/pages/indexEntry/industryPolicy/industryPolicy' }, { text: '质量信誉排行', tps: '官方数据 阳光透明', icon: require('../../../static/images/index/img_5@2x.png'), url: '/pages/indexEntry/credit/credit' }, { text: '咨询投诉', tps: '畅达沟通 听取民声', icon: require('../../../static/images/index/img_6@2x.png'), url: '/pages/indexEntry/consult/consult' }, { text: '满分学习考试', tps: '网络教育 数据联网', icon: require('../../../static/images/index/img_7@2x.png'), url: '' }, { text: '送考卷下乡', tps: '便民利民 就近考试', icon: require('../../../static/images/index/img_8@2x.png'), url: '' }, ], swiperDotIndex: 0, current: 1, mode: 'default', swiperInfo: [ {picture: require('../../../static/images/bigImg/banner.jpg')}, {picture: require('../../../static/images/bigImg/banner2.jpg')} ], dotsStyles: { backgroundColor: '#E8E9EC', border: '1px #E8E9EC solid', color: '#fff', selectedBackgroundColor: '#1989FA', selectedBorder: '1px #1989FA solid' }, bgColor: 'transparent' } }, async onLoad() { // this.getarticleListFn()
// uni.getLocation({
// type: 'wgs84',
// success: function (res) {
// console.log('当前位置的经度:' + res.longitude);
// console.log('当前位置的纬度:' + res.latitude);
// },
// fail(err) {
// console.log(err)
// }
// });
if(!this.$store.state.user.vuex_cityInfo.lat) { await this.$store.dispatch('getCity') } // console.log(this.$store.state.user.vuex_cityInfo)
}, onPullDownRefresh() { }, onShow() { this.$store.dispatch('getUserInfo') if(!this.swiperInfo.length) { // this.getarticleListFn()
} this.getarticleListFn() }, computed: { }, methods: { async entrySectionClick(item) { if(item.text=='我要报名') { return this.$u.utils.clickSignUp() } if(item.text=='找驾驶馆') { const res = await this.$store.dispatch('checkLogin') if(!res) return if(!this.vuex_userInfo.schoolId) return this.$u.toast('您不是平台学员') } this.$goPage(item.url) }, async getarticleListFn() { const {data: res} = await getarticleList(this.params) // this.swiperInfo = res.list[0].articleManagementDO
}, async refereshFn() { const res = await this.$store.dispatch('refreshToken') console.log(res) uni.$u.http.setConfig((config) => { config.header.Authorization = 'Bearer ' + this.$store.state.user.vuex_loginInfo.accessToken console.log(111) return config }) console.log(222) // this.$store.dispatch('getUserInfo')
}, close() { }, goPageSection(item) { uni.navigateTo({ url:item.url }) }, // 扫码
scanCodeFn() { let _this = this uni.scanCode({ success: function(res) { console.log('条码类型:' + res.scanType); console.log('条码内容6:' + res.result); let obj = JSON.parse(res.result) // 扫教练码去报名的
if(obj.coachId) { obj.nickname = decodeURIComponent(obj.nickname) obj.schoolName = decodeURIComponent(obj.schoolName) let item = { schoolName: obj.schoolName, schoolId: obj.schoolId, name: obj.nickname, id: obj.coachId } console.log('***********') console.log(item) _this.$store.commit('upDateSchoolClass', {}) _this.$store.commit('upDateSchoolCoach', item) _this.$goPage('/pages/indexEntry/enroll/enroll') } // _this.$store.commit('updateWebVeiwUrl', res.result)
// uni.navigateTo({
// url: '/pages/other/webView/webView'
// })
} }); }, clickItem(e) { this.swiperDotIndex = e }, change(e) { this.current = e.detail.current }, goPage() { uni.navigateTo({ url: '/pages/userCenter/login/loginByPhone' }) }, initFn() { uni.requestSubscribeMessage({ tmplIds: ['0yaIdyI9NlHvGYwb3IIaIQq6uBhulYGN-rGVnJk4hZ4'], success(res) { console.log('消息是否有权限呢') console.log(res) } }) } } } </script>
<style lang="scss" scoped> .h1_row { display: flex; align-items: center; justify-content: space-between; padding-right: 20rpx; } .h1 { padding-top: 10rpx; .active { &::before { background: url('../../../static/images/icon/h1Active.png') #F6F7FA no-repeat; background-size: 52rpx 12rpx; } } } .ul2 { padding: 10rpx 20rpx 0 20rpx; } .main { width: 100%; background: url('../../../static/images/bigImg/homeBg.png') #F6F7FA no-repeat; background-size: 100% 600rpx; .TopCon { width: 100%; // height: 120rpx;
.flex-b { display: flex; height: 100%; height: 72rpx; margin-bottom: 20rpx; } .adrsCon { display: flex; align-items: center; width: 180rpx; height: 88rpx; .adrsIcon { width: 17rpx; height: 17rpx; margin-top: 4rpx; } .adr { padding-right: 14rpx; font-size: 28rpx; color: #fff; } } .searchCon { flex:1; } .scan { width: 100rpx; height: 100%; display: flex; justify-content: flex-end; align-items: center; image { width: 52rpx; height: 52rpx; } } }
.bannerCon { border-radius: 20rpx; margin-bottom: 20rpx; overflow: hidden; }
.card { background: #FFFFFF; border-radius: 16rpx; margin-bottom: 20rpx;
.ul { height: 164rpx; display: flex; justify-content: space-between; align-items: center; padding: 0 20rpx;
.li { flex: 1; display: flex; align-items: center; flex-direction: column;
.icon { width: 72rpx; height: 72rpx; }
.name { font-size: 26rpx; color: #333; padding-top: 20rpx; text-align: center; } } } } } .tabs { display: flex; padding: 20rpx 0 10rpx 0; } .severCon { display: flex; align-items: center; justify-content: space-between; padding: 40rpx 20rpx 20rpx 20rpx; } .severItem { width: 320rpx; height: 186rpx; background: url('../../../static/images/indexIcon/xccard.png') no-repeat; background-size: 100% 100%; padding: 30rpx 20rpx; font-size: 24rpx; color: #fff; &.tow { background: url('../../../static/images/indexIcon/zxcard.png') no-repeat; background-size: 100% 100%; .go { background: #2AB188; } } .tit { font-size: 32rpx; } .tps { opacity: 0.8; margin: 12rpx 0; } .go { width: 70rpx; height: 38rpx; background: #1A61FB; border-radius: 10rpx; display: flex; align-items: center; .goTxt { padding-left: 4rpx; } } } .ul3 { display: flex; margin-bottom: 20rpx; } </style>
|