Browse Source

驾校分页

master
unknown 1 year ago
parent
commit
1d17ecd840
  1. 8
      config/api.js
  2. 3
      config/request.js
  3. 2
      index.html
  4. 31
      pages/indexEntry/findShcool/findShcool.vue
  5. 59
      pages/indexEntry/findShcool/screen/screen.vue
  6. 68
      pages/mineEntry/refund/refund - 副本.vue
  7. 4
      pages/tabbar/index/index.vue
  8. 72
      store/modules/user.js

8
config/api.js

@ -11,7 +11,7 @@ export const getLoginCode = (data) => http.post('member/auth/send-sms-code', dat
// 获取个人信息
export const getUserInfo = (data) => http.post('member/user/get', {header: {'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'}})
// 退出登录
export const logOut = (data={}) => http.post('member/auth/logout', data, { custom: { noToken: true }})
export const logOut = (data={}) => http.post('member/auth/logout', data,)
// 驾校列表分页
export const schoolPage = (params) => http.get('business/school/page', {params: params})
// 教练列表分页
@ -26,6 +26,12 @@ export const getarticleList = (params) => http.get('business/video/article', {pa
export const getarticlezcList = (params) => http.get('business/video/articlezc', {params: params})
// 行业资讯,行业政策 详情
export const getarticle = (params) => http.get('business/video/getarticle', {params: params})
// 驾照类型
export const licenseType = () => http.get('system/dict/licenseType', )
// 区域
export const nachangList = () => http.get('system/area/nachangList', )

3
config/request.js

@ -76,7 +76,8 @@ module.exports = (vm) => {
}
// 如果不需要token就把header里的token删除,并且不需要去刷新token
let noToken = response.config.custom?.noToken
if(!noToken) {
console.log(response.config.url)
if(!noToken&&response.config.url!=='member/auth/logout') {
checkToken(vm)
}
return data === undefined ? {} : data

2
index.html

@ -9,6 +9,8 @@
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<script src="https://map.qq.com/api/js?v=2.exp&key=2BTBZ-6BQRB-ZG4UG-NOYYG-KZMH7-B4BYN"></script>
<title></title>
<!--preload-links-->
<!--app-context-->

31
pages/indexEntry/findShcool/findShcool.vue

@ -6,7 +6,7 @@
<searchRow placeholder="搜索驾校、教练…"></searchRow>
</view>
<view class="navBox">
<view class="tab" v-for="(item,index) in tabData" :key="index" :class="{active: currentTab==item.id}" @click="tabClick(item)">
<view class="tab" v-for="(item,index) in tabData" :key="index" :class="{active: params.sercheType==item.id}" @click="tabClick(item)">
{{ item.text }}</view>
<view class="screen" @click="$goPage('/pages/indexEntry/findShcool/screen/screen')">
<view class="txt">筛选</view>
@ -38,26 +38,27 @@
currentTab: 0,
tabData: [{
text: '全部',
id: 0
id: 1
},
{
text: '场地优先',
id: 1
id: 2
},
{
text: '距离优先',
id: 2
id: 3
},
{
text: '好评优先',
id: 3
id: 4
},
],
params: {
pageNo: 1,
pageSize: 20,
lat: 30.27419537786047,
lng: 120.20633397715788,
lat: '',
lng: '',
sercheType: 1,
},
total: 20,
listData: [],
@ -65,7 +66,19 @@
}
},
onLoad() {
let vuex_cityInfo = this.$store.state.user.vuex_cityInfo
if(!vuex_cityInfo.lat) {
this.$store.dispatch('getCity')
return
}else {
this.params.lat = vuex_cityInfo.lat
this.params.lng = vuex_cityInfo.lng
this.schoolPageFn()
}
uni.$on('screenConfirm',(obj)=>{
this.params = Object.assign(this.params, obj)
this.listInit()
})
},
onPullDownRefresh() {
this.listInit()
@ -80,9 +93,11 @@
this.$goPage('/pages/indexEntry/findShcool/shcoolDetail/shcoolDetail?schoolId='+ item.id)
},
tabClick(item) {
this.currentTab = item.id
this.params.sercheType = item.id
this.listInit()
},
async listInit() {
this.listData = []
this.params.pageNo = 1
await this.schoolPageFn()

59
pages/indexEntry/findShcool/screen/screen.vue

@ -4,17 +4,20 @@
<view class="type">
<view class="h1">驾照类型</view>
<view class="tagFlex">
<view class="tab" v-for="(item,index) in tagList" :class="{active: driverTypeArr.indexOf(item.id)!=-1}" @click="driverTypeClick(item)">{{ item.text }}</view>
<view class="tab" v-for="(item,index) in driverList" :class="{active: driverTypeArr.indexOf(item.label)!=-1}" @click="driverTypeClick(item)">{{ item.label }}</view>
</view>
</view>
<view class="region">
<view class="h1">区域</view>
<view class="tagFlex">
<view class="tab" v-for="(item,index) in areList" :class="{active: areTypeArr.indexOf(item.areaCode)!=-1}" @click="areTypeClick(item)">{{ item.areaName }}</view>
</view>
</view>
<view class="btn_row">
<view class="btn border" @click="reSetFn">重置</view>
<view class="btn">确定</view>
<view class="btn" @click="screenConfirm">确定</view>
</view>
</view>
@ -22,30 +25,60 @@
</template>
<script>
import { licenseType, nachangList } from '@/config/api.js'
export default {
data() {
return {
tagList: [
{text: '名称', id: 1},
{text: '名称', id: 2},
{text: '名称', id: 3},
],
driverTypeArr: []
driverList: [],//
areList: [],//
driverTypeArr: [],
areTypeArr: []
}
},
onLoad() {
this.licenseTypeFn()
this.nachangListFn()
},
methods: {
async licenseTypeFn() {
const {data: res} = await licenseType()
this.driverList = res
console.log(res)
},
async nachangListFn() {
const {data: res} = await nachangList()
this.areList = res
console.log(res)
},
driverTypeClick(item) {
let index = this.driverTypeArr.indexOf(item.id)
let index = this.driverTypeArr.indexOf(item.label)
if( index==-1) {
this.driverTypeArr.push(item.id)
this.driverTypeArr.push(item.label)
}else {
this.driverTypeArr.splice(index,1)
}
console.log(index)
console.log(this.driverTypeArr)
},
reSetFn() {
areTypeClick(item) {
let index = this.areTypeArr.indexOf(item.areaCode)
if( index==-1) {
this.areTypeArr.push(item.areaCode)
}else {
this.areTypeArr.splice(index,1)
}
},
reSetFn() {
this.areTypeArr = []
this.driverTypeArr = []
},
screenConfirm() {
console.log( this.driverTypeArr)
let obj = {
businessScope: this.driverTypeArr.join(','),
district: this.areTypeArr.join(',')
}
uni.$emit('screenConfirm', obj)
uni.navigateBack()
}
}
}

68
pages/mineEntry/refund/refund - 副本.vue

@ -0,0 +1,68 @@
<template>
<view class="pageBgImg">
<topNavbar title="同城转校"></topNavbar>
<view class="pad">
<view class="card">
<view class="tpsBox">
<view class="row">
<view class="icon">
<image src="@/static/images/userCenter/warn.png" mode=""></image>
</view>
<view class="tps">请与教练协商确认达成一致后填写协商好的退款金额</view>
</view>
</view>
</view>
<myform></myform>
<view class="btnBg">提交</view>
</view>
</view>
</template>
<script>
import myform from './comp/myform'
export default {
components: { myform },
data() {
return {
}
},
methods: {
}
}
</script>
<style lang="scss" scoped>
.card {
padding: 12rpx 28rpx;
margin-bottom: 24rpx;
.tpsBox {
height: 140rpx;
background: #FFFFFF;
border-radius: 16rpx;
.row {
height: 100%;
display: flex;
align-items: center;
.icon {
width: 36rpx;
height: 36rpx;
}
.tps {
padding-left: 26rpx;
font-size: 28rpx;
font-weight: 600;
color: $themC;
line-height: 1.2em;
}
}
}
}
.btnBg {
width: 396rpx;
margin: 94rpx auto;
}
</style>

4
pages/tabbar/index/index.vue

@ -276,9 +276,9 @@
}
},
async onLoad() {
// await this.$store.dispatch('getCity')
await this.$store.dispatch('getCity')
// console.log(' ')
// console.log(this.$store.state.user.vuex_cityInfo.city)
// console.log(this.$store.state.user.vuex_cityInfo)
},
onShow() {

72
store/modules/user.js

@ -1,4 +1,5 @@
import qqmapWx from '../../common/sdk/qqmap-wx-jssdk.min.js'; // 引入
import { httpPrefix } from '../../config/site.config.js';
const user = {
@ -89,31 +90,55 @@ const user = {
export default user
function getCityInfo(resolve, reject, commit) {
uni.showLoading({
title: '加载中...'
// h5高德地图
function gaoDeFn(longitude,latitude,commit,resolve, reject,) {
uni.request({
method: 'GET',
url: 'https://restapi.amap.com/v3/geocode/regeo?parameters',
data: {
key: 'a0dde4c05390e689ea2c19d8ec447f62',
location: `${longitude},${latitude}`,
output: 'JSON'
},
success: (res) => {
console.log(res) // 数据结构见下方
let result = res.data.regeocode.addressComponent
let obj = {
lat: latitude,
lng: longitude,
city: result.city,
cityCode: result.adcode,
province: result.province,
district: result.district
}
commit('update_vuex_cityInfo', obj)
resolve(obj)
uni.hideLoading()
},
fail: res => {
reject(new Error('获取地理位置信息失败'))
uni.hideLoading()
}
})
}
function wxAdsFn(longitude,latitude, commit,resolve, reject,) {
var qqmapKey = new qqmapWx({
key: '2BTBZ-6BQRB-ZG4UG-NOYYG-KZMH7-B4BYN'
})
uni.getLocation({
type: 'wgs84',
// type: 'gcj02',
success: function(res) {
console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude);
qqmapKey.reverseGeocoder({
location: {
latitude: res.latitude,
longitude: res.longitude
latitude: latitude,
longitude:longitude
},
success(res2) {
// console.log('城市信息')
// console.log(res2.result)
let result = res2.result
let obj = {
latitude: res.latitude,
longitude: res.longitude,
lat: latitude,
lng: longitude,
city: result.address_component.city,
cityCode: result.ad_info.adcode,
province: result.address_component.province,
@ -129,9 +154,30 @@ function getCityInfo(resolve, reject, commit) {
uni.hideLoading();
},
})
}
function getCityInfo(resolve, reject, commit) {
uni.showLoading({
title: '加载中...'
})
uni.getLocation({
type: 'wgs84',
// type: 'gcj02',
success: function(res) {
console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res);
// #ifdef APP-PLUS||H5
gaoDeFn(res.longitude,res.latitude, commit, resolve, reject,);
// #endif
// #ifdef MP-WEIXIN
wxAdsFn(res.longitude,res.latitude, commit,resolve, reject,)
// #endif
},
fail(e) {
console.log(e)
uni.hideLoading()
}
})
}
Loading…
Cancel
Save