2024-09-22 15:07:01 +08:00
|
|
|
|
<template>
|
2024-09-24 19:46:55 +08:00
|
|
|
|
<view class="container">
|
|
|
|
|
<VNavigationBar titleColor="rgba(0,0,0,0.9)" backgroundColor="#fff" title="我的车辆"></VNavigationBar>
|
|
|
|
|
<view class="body">
|
|
|
|
|
<scroll-view style="height: 100%" scroll-y="true">
|
|
|
|
|
<view class="carList">
|
|
|
|
|
<view v-for="(item, index) in carList" :key="index" class="carItem" @click="gotoDetail(item)">
|
|
|
|
|
<image class="carImage" :src="config.baseImageUrl+item.logoImg" mode="aspectFit"></image>
|
|
|
|
|
<view class="carInfo">
|
|
|
|
|
<view class="carNum">{{ item.licenseNumber}}</view>
|
|
|
|
|
<view class="name">品牌:{{ item.brandName }}</view>
|
2024-10-11 20:50:05 +08:00
|
|
|
|
<view class="phone">型号:{{ item.carModel || "" }}</view>
|
2024-09-24 19:46:55 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2024-10-11 20:50:05 +08:00
|
|
|
|
<view class="no-data" v-if="carList.length==0">
|
|
|
|
|
<image class="" src="@/static/images/nothing.png" ></image>
|
|
|
|
|
</view>
|
2024-09-24 19:46:55 +08:00
|
|
|
|
</view>
|
|
|
|
|
</scroll-view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="addCarBtn" @click="gotoDetail()">
|
|
|
|
|
<uni-icons color="#0174F6" type="plusempty"></uni-icons>
|
|
|
|
|
添加车辆
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2024-09-22 15:07:01 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2024-09-24 19:46:55 +08:00
|
|
|
|
import VNavigationBar from '@/components/VNavigationBar.vue';
|
|
|
|
|
import request from "../../utils/request";
|
|
|
|
|
import config from "config";
|
2024-10-14 18:06:55 +08:00
|
|
|
|
import {getUserInfoRequest} from "@/utils/common";
|
|
|
|
|
import {getToken,setJSONData} from '@/utils/auth'
|
2024-09-24 19:46:55 +08:00
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
computed: {
|
|
|
|
|
config() {
|
|
|
|
|
return config
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
components: {
|
|
|
|
|
VNavigationBar
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
carList: [
|
2024-10-11 20:50:05 +08:00
|
|
|
|
// {
|
|
|
|
|
// carNum: '鲁A 781NB',
|
|
|
|
|
// name: '魏书豪',
|
|
|
|
|
// phone: '15726786903',
|
|
|
|
|
// image: ''
|
|
|
|
|
// }
|
2024-09-24 19:46:55 +08:00
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
onLoad() {
|
|
|
|
|
|
|
|
|
|
// 页面初始化
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
onShow() {
|
2024-09-27 17:21:10 +08:00
|
|
|
|
if(!getToken()){
|
|
|
|
|
uni.reLaunch({
|
|
|
|
|
url: '/pages/login/login'
|
|
|
|
|
})
|
|
|
|
|
}
|
2024-09-24 19:46:55 +08:00
|
|
|
|
// 页面显示时执行初始化操作
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
getList(){
|
|
|
|
|
request({
|
2024-10-11 20:50:05 +08:00
|
|
|
|
url: '/app-api/base/user-car/getMyCar',
|
2024-09-24 19:46:55 +08:00
|
|
|
|
method: 'GET',
|
2024-10-11 20:50:05 +08:00
|
|
|
|
tenantIdFlag: false
|
2024-09-24 19:46:55 +08:00
|
|
|
|
}).then(res => {
|
|
|
|
|
console.log(res);
|
|
|
|
|
this.carList = res.data;
|
|
|
|
|
console.log('图片路径', config.baseImageUrl+this.carList[0].logoImg)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
gotoDetail(item) {
|
|
|
|
|
if (item){
|
2024-10-11 20:50:05 +08:00
|
|
|
|
setJSONData("carInfo",item)
|
2024-09-24 19:46:55 +08:00
|
|
|
|
uni.navigateTo({
|
2024-10-11 20:50:05 +08:00
|
|
|
|
url: `/pages/myCar/carDetail?id=`+item.id
|
2024-09-24 19:46:55 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: '/pages/myCar/carDetail'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
};
|
2024-09-22 15:07:01 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="less">
|
2024-09-24 19:46:55 +08:00
|
|
|
|
.container {
|
|
|
|
|
height: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
padding-bottom: env(safe-area-inset-bottom);
|
|
|
|
|
|
|
|
|
|
.body {
|
|
|
|
|
flex: 1;
|
|
|
|
|
height: 0;
|
|
|
|
|
background-color: #f3f5f7;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.carList {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-11 20:50:05 +08:00
|
|
|
|
.no-data{
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
2024-09-24 19:46:55 +08:00
|
|
|
|
.carItem {
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
width: 686rpx;
|
|
|
|
|
margin: 20rpx auto;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
padding: 30rpx;
|
|
|
|
|
background: #ffffff;
|
|
|
|
|
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
|
|
|
|
column-gap: 20rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.carImage {
|
|
|
|
|
width: 240rpx;
|
|
|
|
|
height: 150rpx;
|
|
|
|
|
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.carNum {
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
font-size: 36rpx;
|
|
|
|
|
color: #333333;
|
|
|
|
|
margin-bottom: 20rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.name,
|
|
|
|
|
.phone {
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
color: #858ba0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.addCarBtn {
|
|
|
|
|
padding: 34rpx 0;
|
|
|
|
|
background: #ffffff;
|
|
|
|
|
border-radius: 0rpx 0rpx 0rpx 0rpx;
|
|
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
column-gap: 12rpx;
|
|
|
|
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
font-size: 32rpx;
|
|
|
|
|
color: #0174f6;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|