|
@@ -19,12 +19,19 @@
|
|
|
<view class="bus-title">
|
|
<view class="bus-title">
|
|
|
选择预约车辆 <span>/ 墨轩湖 - 综合楼</span>
|
|
选择预约车辆 <span>/ 墨轩湖 - 综合楼</span>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="bus-list">
|
|
|
|
|
|
|
+ <view class="bus-list" v-if="busList.length">
|
|
|
<view :class="currentIndex2 === index?'active':'bus-list-item'" v-for="(item,index) in busList"
|
|
<view :class="currentIndex2 === index?'active':'bus-list-item'" v-for="(item,index) in busList"
|
|
|
:key="index" @click="handleChangeCurrentIndex(index,2,item)">
|
|
:key="index" @click="handleChangeCurrentIndex(index,2,item)">
|
|
|
{{item}}
|
|
{{item}}
|
|
|
</view>
|
|
</view>
|
|
|
-
|
|
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="bus-list-nodata" v-else>
|
|
|
|
|
+ <view class="nodata-img">
|
|
|
|
|
+ <img src="../../static/no-bus.png" alt="">
|
|
|
|
|
+ <view class="nodata-info">
|
|
|
|
|
+ 请先选择发车时间
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
@@ -67,71 +74,9 @@
|
|
|
onLoad
|
|
onLoad
|
|
|
} from "@dcloudio/uni-app"
|
|
} from "@dcloudio/uni-app"
|
|
|
|
|
|
|
|
- const wxCode = ref('')
|
|
|
|
|
- const access_token = ref('')
|
|
|
|
|
-
|
|
|
|
|
onLoad(() => {
|
|
onLoad(() => {
|
|
|
- const busUserInfo = uni.getStorageSync('busUserInfo');
|
|
|
|
|
- if (!busUserInfo) {
|
|
|
|
|
- wxCode.value = getQueryString('wxcode')
|
|
|
|
|
- get_access_token(wxCode.value)
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- // 通过wxcode换取access_token
|
|
|
|
|
- const get_access_token = (wxCode) => {
|
|
|
|
|
- uni.request({
|
|
|
|
|
- url: 'open.wecard.qq.com/connect/oauth2/token',
|
|
|
|
|
- method: 'POST',
|
|
|
|
|
- // header: {
|
|
|
|
|
- // 'content-type': 'application/json'
|
|
|
|
|
- // },
|
|
|
|
|
- data: {
|
|
|
|
|
- "wxcode": wxCode,
|
|
|
|
|
- "app_key": "4AA7B3944BDF3739",
|
|
|
|
|
- "app_secret": "69E762653EF393C0122278F21754B6CF",
|
|
|
|
|
- "grant_type": "authorization_code",
|
|
|
|
|
- "redirect_uri": "http://192.168.161.125:5173/#/pages/home/home"
|
|
|
|
|
- },
|
|
|
|
|
- success: (res) => {
|
|
|
|
|
- alert(JSON.stringify(res))
|
|
|
|
|
- // access_token.value = res.data.access_token
|
|
|
|
|
- // alert(access_token.value)
|
|
|
|
|
- // getUserInfo(access_token.value)
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 通过access_token换取用户信息
|
|
|
|
|
- const getUserInfo = (access_token) => {
|
|
|
|
|
- uni.request({
|
|
|
|
|
- url: 'open.wecard.qq.com/connect/oauth/get-user-info',
|
|
|
|
|
- method: "POST",
|
|
|
|
|
- data: {
|
|
|
|
|
- "access_token": access_token
|
|
|
|
|
- },
|
|
|
|
|
- header: {
|
|
|
|
|
- 'content-type': 'application/json'
|
|
|
|
|
- },
|
|
|
|
|
- success: (res) => {
|
|
|
|
|
- alert(JSON.stringify(res))
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- //获取当前URL指定参数
|
|
|
|
|
- const getQueryString = (name) => {
|
|
|
|
|
- // 获取URL
|
|
|
|
|
- let url = window.location.href;
|
|
|
|
|
- // 正则匹配URL
|
|
|
|
|
- let pattern = new RegExp("[?&]" + name + "=([^&]+)", "i");
|
|
|
|
|
- let matcher = pattern.exec(url);
|
|
|
|
|
- if (matcher == null || matcher.length < 1) {
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- // 输出指定的参数值
|
|
|
|
|
- return decodeURIComponent(matcher[1]);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
const currentIndex1 = ref(null)
|
|
const currentIndex1 = ref(null)
|
|
|
const currentIndex2 = ref(null)
|
|
const currentIndex2 = ref(null)
|
|
@@ -145,6 +90,7 @@
|
|
|
|
|
|
|
|
// 发车车辆列表
|
|
// 发车车辆列表
|
|
|
const busList = ref(['车牌尾号:6601(63/63)', '车牌尾号:6661(63/63)', '车牌尾号:6001(63/63)'])
|
|
const busList = ref(['车牌尾号:6601(63/63)', '车牌尾号:6661(63/63)', '车牌尾号:6001(63/63)'])
|
|
|
|
|
+ // const busList = ref([])
|
|
|
|
|
|
|
|
// 改变选中项回调
|
|
// 改变选中项回调
|
|
|
const handleChangeCurrentIndex = (index, type, value) => {
|
|
const handleChangeCurrentIndex = (index, type, value) => {
|
|
@@ -253,34 +199,60 @@
|
|
|
.bus-list {
|
|
.bus-list {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- .bus-list-item {
|
|
|
|
|
- display: flex;
|
|
|
|
|
- justify-content: center;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- margin-bottom: 30rpx;
|
|
|
|
|
- height: 100rpx;
|
|
|
|
|
- font-size: 26rpx;
|
|
|
|
|
- border: 1rpx solid #CCCCCC;
|
|
|
|
|
- border-radius: 12rpx;
|
|
|
|
|
|
|
+ .bus-list-item {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ margin-bottom: 30rpx;
|
|
|
|
|
+ height: 100rpx;
|
|
|
|
|
+ font-size: 26rpx;
|
|
|
|
|
+ border: 1rpx solid #CCCCCC;
|
|
|
|
|
+ border-radius: 12rpx;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .active {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ margin-bottom: 30rpx;
|
|
|
|
|
+ height: 100rpx;
|
|
|
|
|
+ font-size: 26rpx;
|
|
|
|
|
+ border: 1rpx solid #CCCCCC;
|
|
|
|
|
+ border-radius: 12rpx;
|
|
|
|
|
+ color: #fff;
|
|
|
|
|
+ background-image: linear-gradient(#8684FF, #3D50E7);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .disable {
|
|
|
|
|
+ background: #E6E6E6;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- .active {
|
|
|
|
|
|
|
+ .bus-list-nodata {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
- justify-content: center;
|
|
|
|
|
|
|
+ flex-direction: column;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
- margin-bottom: 30rpx;
|
|
|
|
|
- height: 100rpx;
|
|
|
|
|
- font-size: 26rpx;
|
|
|
|
|
- border: 1rpx solid #CCCCCC;
|
|
|
|
|
- border-radius: 12rpx;
|
|
|
|
|
- color: #fff;
|
|
|
|
|
- background-image: linear-gradient(#8684FF, #3D50E7);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ color: #B3B3B3;
|
|
|
|
|
|
|
|
- .disable {
|
|
|
|
|
- background: #E6E6E6;
|
|
|
|
|
|
|
+ .nodata-img {
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ width: 500rpx;
|
|
|
|
|
+ height: 500rpx;
|
|
|
|
|
+
|
|
|
|
|
+ img {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .nodata-info {
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ left: 250rpx;
|
|
|
|
|
+ bottom: 50rpx;
|
|
|
|
|
+ transform: translateX(-50%);
|
|
|
|
|
+ white-space: nowrap;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|