项目开发完成

This commit is contained in:
2025-04-16 09:21:50 +08:00
parent eec6aef7d7
commit 04594c640e
51 changed files with 2394 additions and 349 deletions

42
src/hjm/BestSellers.tsx Normal file
View File

@@ -0,0 +1,42 @@
import {useEffect} from "react";
import {Image, Space} from '@nutui/nutui-react-taro'
import Taro from '@tarojs/taro'
const BestSellers = (props: any) => {
const reload = () => {
}
useEffect(() => {
reload()
}, [])
return (
<div className={'px-2 mb-4'}>
<div className={'flex flex-col justify-between items-center rounded-lg px-3'}>
{props.data?.map((item, index) => {
return (
<div key={index} className={'flex bg-white rounded-lg w-full p-3 mb-3'}
onClick={() => Taro.navigateTo({url: '/hjm/query?id=' + item.id})}>
<Image src={item.image} mode={'scaleToFill'}
radius="10%" width="80" height="80"/>
<div className={'mx-3 flex flex-col'}>
<Space direction={'vertical'}>
<div className={'car-no text-lg font-bold'}>{item.code}</div>
<div className={'flex text-xs text-gray-500'}><span
className={'text-gray-700'}>{item.parentOrganization}</span></div>
<div className={'flex text-xs text-gray-500'}><span className={'text-green-600'}>{item.insuranceStatus}</span>
</div>
<div className={'flex text-xs text-gray-500'}><span
className={'text-gray-700'}>{item.driver}</span></div>
</Space>
</div>
</div>
)
})}
</div>
<div style={{height: '170px'}}></div>
</div>
)
}
export default BestSellers

3
src/hjm/baoxiu.config.ts Normal file
View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '一键报修'
})

116
src/hjm/baoxiu.tsx Normal file
View File

@@ -0,0 +1,116 @@
import {useEffect, useState} from "react";
import {useRouter} from '@tarojs/taro'
import {getHjmCar, pageHjmCar} from "@/api/hjm/hjmCar";
import {HjmCar} from "@/api/hjm/hjmCar/model";
import {Image,Cell} from '@nutui/nutui-react-taro'
import './location.scss'
/**
* 电子围栏
* @constructor
*/
const Fence = () => {
const {params} = useRouter();
const [keywords, setKeywords] = useState<string>()
const [item, setItem] = useState<HjmCar>()
// 打开地图选择位置
// const chooseLocation = async () => {
// try {
// const res = await Taro.chooseLocation({
// latitude, // 默认纬度
// longitude // 默认经度
// })
// console.log('选择的位置:', res);
// } catch (err) {
// console.error('选择位置失败:', err);
// }
// }
const reload = () => {
const id = Number(params.id);
// 执行搜索
if (keywords) {
pageHjmCar({keywords}).then(res => {
if (res?.list && res?.list?.length > 0) {
const data = res?.list[0];
setItem(data)
setKeywords(data.code)
}
})
return false;
}
// 获取车辆信息
if (id) {
getHjmCar(id).then(data => {
setItem(data)
setKeywords(data.code)
})
}
}
useEffect(() => {
reload()
}, [])
return (
<>
{/*<div className={'fixed z-20 top-5 left-0 w-full'}>*/}
{/* <div className={'px-4'}>*/}
{/* <div*/}
{/* style={{*/}
{/* display: 'flex',*/}
{/* alignItems: 'center',*/}
{/* background: '#fff',*/}
{/* padding: '0 10px',*/}
{/* borderRadius: '20px'*/}
{/* }}*/}
{/* >*/}
{/* <Search/>*/}
{/* <Input*/}
{/* placeholder="车辆编号"*/}
{/* value={keywords}*/}
{/* onChange={onKeywords}*/}
{/* />*/}
{/* <div*/}
{/* className={'flex items-center'}*/}
{/* >*/}
{/* <Button type="warning" onClick={reload}>*/}
{/* 查询*/}
{/* </Button>*/}
{/* </div>*/}
{/* </div>*/}
{/* </div>*/}
{/*</div>*/}
{item ? (
<div className={'car-info w-full bg-white'}>
<Image src={item?.image} mode={'widthFix'} width={'100%'} className={'bg-gray-50'}/>
<div className={'px-2'}>
<Cell className={'car-info-item-title'}>
{item?.code}
</Cell>
<Cell className={'car-info-item-title'}>
{item?.kuaidi}
</Cell>
<Cell className={'car-info-item-title'}>
{item?.kuaidiAdmin}
</Cell>
<Cell className={'car-info-item-content'}>
{item?.driver}
</Cell>
<Cell className={'car-info-item-content'}>
{item?.insuranceStatus}
</Cell>
<Cell className={'car-info-item-content'}>
GPS编号{item?.gpsNo}
</Cell>
<Cell className={'car-info-item-content'}>
{item?.fence}
</Cell>
</div>
</div>
) : ''}
</>
)
}
export default Fence

3
src/hjm/fence.config.ts Normal file
View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '电子围栏'
})

116
src/hjm/fence.tsx Normal file
View File

@@ -0,0 +1,116 @@
import {useEffect, useState} from "react";
import {useRouter} from '@tarojs/taro'
import {getHjmCar, pageHjmCar} from "@/api/hjm/hjmCar";
import {HjmCar} from "@/api/hjm/hjmCar/model";
import {Image,Cell} from '@nutui/nutui-react-taro'
import './location.scss'
/**
* 电子围栏
* @constructor
*/
const Fence = () => {
const {params} = useRouter();
const [keywords, setKeywords] = useState<string>()
const [item, setItem] = useState<HjmCar>()
// 打开地图选择位置
// const chooseLocation = async () => {
// try {
// const res = await Taro.chooseLocation({
// latitude, // 默认纬度
// longitude // 默认经度
// })
// console.log('选择的位置:', res);
// } catch (err) {
// console.error('选择位置失败:', err);
// }
// }
const reload = () => {
const id = Number(params.id);
// 执行搜索
if (keywords) {
pageHjmCar({keywords}).then(res => {
if (res?.list && res?.list?.length > 0) {
const data = res?.list[0];
setItem(data)
setKeywords(data.code)
}
})
return false;
}
// 获取车辆信息
if (id) {
getHjmCar(id).then(data => {
setItem(data)
setKeywords(data.code)
})
}
}
useEffect(() => {
reload()
}, [])
return (
<>
{/*<div className={'fixed z-20 top-5 left-0 w-full'}>*/}
{/* <div className={'px-4'}>*/}
{/* <div*/}
{/* style={{*/}
{/* display: 'flex',*/}
{/* alignItems: 'center',*/}
{/* background: '#fff',*/}
{/* padding: '0 10px',*/}
{/* borderRadius: '20px'*/}
{/* }}*/}
{/* >*/}
{/* <Search/>*/}
{/* <Input*/}
{/* placeholder="车辆编号"*/}
{/* value={keywords}*/}
{/* onChange={onKeywords}*/}
{/* />*/}
{/* <div*/}
{/* className={'flex items-center'}*/}
{/* >*/}
{/* <Button type="warning" onClick={reload}>*/}
{/* 查询*/}
{/* </Button>*/}
{/* </div>*/}
{/* </div>*/}
{/* </div>*/}
{/*</div>*/}
{item ? (
<div className={'car-info w-full bg-white'}>
<Image src={item?.image} mode={'widthFix'} width={'100%'} className={'bg-gray-50'}/>
<div className={'px-2'}>
<Cell className={'car-info-item-title'}>
{item?.code}
</Cell>
<Cell className={'car-info-item-title'}>
{item?.kuaidi}
</Cell>
<Cell className={'car-info-item-title'}>
{item?.kuaidiAdmin}
</Cell>
<Cell className={'car-info-item-content'}>
{item?.driver}
</Cell>
<Cell className={'car-info-item-content'}>
{item?.insuranceStatus}
</Cell>
<Cell className={'car-info-item-content'}>
GPS编号{item?.gpsNo}
</Cell>
<Cell className={'car-info-item-content'}>
{item?.fence}
</Cell>
</div>
</div>
) : ''}
</>
)
}
export default Fence

3
src/hjm/list.config.ts Normal file
View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '车辆列表'
})

71
src/hjm/list.tsx Normal file
View File

@@ -0,0 +1,71 @@
import {useEffect, useState} from "react";
import {Search} from '@nutui/icons-react-taro'
import {Button, Input, InfiniteLoading} from '@nutui/nutui-react-taro'
import {pageHjmCar} from "@/api/hjm/hjmCar";
import {HjmCar} from "@/api/hjm/hjmCar/model";
import './location.scss'
import BestSellers from "./BestSellers";
/**
* 文章终极列表
* @constructor
*/
const List = () => {
const [keywords, setKeywords] = useState<string>('')
const [list, setList] = useState<HjmCar[]>([])
const onKeywords = (keywords: string) => {
setKeywords(keywords)
}
const reload = () => {
// 获取车辆列表
pageHjmCar({keywords}).then(res => {
setList(res?.list || [])
})
}
useEffect(() => {
reload()
}, [])
return (
<>
<div className={'fixed z-20 top-5 left-0 w-full'}>
<div className={'px-4'}>
<div
style={{
display: 'flex',
alignItems: 'center',
background: '#fff',
padding: '0 10px',
borderRadius: '20px'
}}
>
<Search/>
<Input
placeholder="车辆编号"
value={keywords}
onChange={onKeywords}
onConfirm={reload}
/>
<div
className={'flex items-center'}
>
<Button type="warning" onClick={reload}>
</Button>
</div>
</div>
</div>
</div>
<InfiniteLoading
className={'w-full fixed left-0 top-20'}
>
<BestSellers data={list}/>
</InfiniteLoading>
</>
)
}
export default List

View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '定位查询'
})

4
src/hjm/location.scss Normal file
View File

@@ -0,0 +1,4 @@
page {
//background: url("https://oss.wsdns.cn/20250414/58cac36d806a40e298def726bcd9e44b.jpeg");
//background-size: cover;
}

156
src/hjm/location.tsx Normal file
View File

@@ -0,0 +1,156 @@
import {useEffect, useState} from "react";
import {Map} from '@tarojs/components'
import {Search} from '@nutui/icons-react-taro'
import {Button, Input} from '@nutui/nutui-react-taro'
import Taro from '@tarojs/taro'
import {useRouter} from '@tarojs/taro'
import {getHjmCar, pageHjmCar} from "@/api/hjm/hjmCar";
import {HjmCar} from "@/api/hjm/hjmCar/model";
import './location.scss'
/**
* 文章终极列表
* @constructor
*/
const Location = () => {
const {params} = useRouter();
const [keywords, setKeywords] = useState<string>()
const [item, setItem] = useState<HjmCar>()
const [longitude, setLongitude] = useState<any>()
const [latitude, setLatitude] = useState<any>()
const [scale, setScale] = useState<any>(16)
const onKeywords = (keywords: string) => {
setKeywords(keywords)
}
// 获取当前位置
const getLocation = async () => {
try {
const res = await Taro.getLocation({
type: 'gcj02' //返回可以用于wx.openLocation的经纬度
})
if (res.latitude) {
setLatitude(res.latitude)
}
if (res.longitude) {
setLongitude(res.longitude)
}
console.log('当前位置:', res.latitude, res.longitude);
return res;
} catch (err) {
console.error('获取位置失败:', err);
}
}
// 打开地图选择位置
// const chooseLocation = async () => {
// try {
// const res = await Taro.chooseLocation({
// latitude, // 默认纬度
// longitude // 默认经度
// })
// console.log('选择的位置:', res);
// } catch (err) {
// console.error('选择位置失败:', err);
// }
// }
const reload = () => {
const id = Number(params.id);
setScale(16)
getLocation()
// 执行搜索
if (keywords) {
pageHjmCar({keywords}).then(res => {
if (res?.list && res?.list?.length > 0) {
const data = res?.list[0];
setItem(data)
setLatitude(data.latitude)
setLongitude(data.longitude)
setKeywords(data.code)
}
})
return false;
}
// 获取车辆信息
if (id) {
getHjmCar(id).then(data => {
setItem(data)
setLatitude(data.latitude)
setLongitude(data.longitude)
setKeywords(data.code)
})
}
}
useEffect(() => {
reload()
}, [])
return (
<>
<div className={'fixed z-20 top-5 left-0 w-full'}>
<div className={'px-4'}>
<div
style={{
display: 'flex',
alignItems: 'center',
background: '#fff',
padding: '0 10px',
borderRadius: '20px'
}}
>
<Search/>
<Input
placeholder="车辆编号"
value={keywords}
onChange={onKeywords}
/>
<div
className={'flex items-center'}
>
<Button type="warning" onClick={reload}>
</Button>
</div>
</div>
</div>
</div>
{item ? (
<div className={'car-info fixed bottom-0 left-0 w-full z-20 bg-white p-4'}>
<div className={'car-info-item'}>
<div className={'car-info-item-title'}>
{item?.updateTime}
</div>
<div className={'car-info-item-content'}>
{item?.driver}
</div>
<div className={'car-info-item-content'}>
{item?.address}
</div>
</div>
</div>
) : ''}
<Map
id="map"
longitude={longitude}
latitude={latitude}
scale={scale}
markers={[{
id: 1,
latitude: latitude,
longitude: longitude,
// @ts-ignore
name: '位置'
}]}
onTap={() => {
console.log('map tap')
}}
style={{width: '100%', height: '100vh'}}
/>
</>
)
}
export default Location

3
src/hjm/query.config.ts Normal file
View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '车辆查询'
})

116
src/hjm/query.tsx Normal file
View File

@@ -0,0 +1,116 @@
import {useEffect, useState} from "react";
import {useRouter} from '@tarojs/taro'
import {getHjmCar, pageHjmCar} from "@/api/hjm/hjmCar";
import {HjmCar} from "@/api/hjm/hjmCar/model";
import {Image,Cell} from '@nutui/nutui-react-taro'
import './location.scss'
/**
* 文章终极列表
* @constructor
*/
const Query = () => {
const {params} = useRouter();
const [keywords, setKeywords] = useState<string>()
const [item, setItem] = useState<HjmCar>()
// 打开地图选择位置
// const chooseLocation = async () => {
// try {
// const res = await Taro.chooseLocation({
// latitude, // 默认纬度
// longitude // 默认经度
// })
// console.log('选择的位置:', res);
// } catch (err) {
// console.error('选择位置失败:', err);
// }
// }
const reload = () => {
const id = Number(params.id);
// 执行搜索
if (keywords) {
pageHjmCar({keywords}).then(res => {
if (res?.list && res?.list?.length > 0) {
const data = res?.list[0];
setItem(data)
setKeywords(data.code)
}
})
return false;
}
// 获取车辆信息
if (id) {
getHjmCar(id).then(data => {
setItem(data)
setKeywords(data.code)
})
}
}
useEffect(() => {
reload()
}, [])
return (
<>
{/*<div className={'fixed z-20 top-5 left-0 w-full'}>*/}
{/* <div className={'px-4'}>*/}
{/* <div*/}
{/* style={{*/}
{/* display: 'flex',*/}
{/* alignItems: 'center',*/}
{/* background: '#fff',*/}
{/* padding: '0 10px',*/}
{/* borderRadius: '20px'*/}
{/* }}*/}
{/* >*/}
{/* <Search/>*/}
{/* <Input*/}
{/* placeholder="车辆编号"*/}
{/* value={keywords}*/}
{/* onChange={onKeywords}*/}
{/* />*/}
{/* <div*/}
{/* className={'flex items-center'}*/}
{/* >*/}
{/* <Button type="warning" onClick={reload}>*/}
{/* 查询*/}
{/* </Button>*/}
{/* </div>*/}
{/* </div>*/}
{/* </div>*/}
{/*</div>*/}
{item ? (
<div className={'car-info w-full bg-white'}>
<Image src={item?.image} mode={'aspectFit'} width={'100%'} height={'300px'}/>
<div className={'px-2'}>
<Cell className={'car-info-item-title'}>
{item?.code}
</Cell>
<Cell className={'car-info-item-title'}>
{item?.parentOrganization}
</Cell>
<Cell className={'car-info-item-title'}>
{item?.parentOrganizationAdmin}
</Cell>
<Cell className={'car-info-item-content'}>
{item?.driver}
</Cell>
<Cell className={'car-info-item-content'}>
{item?.insuranceStatus}
</Cell>
<Cell className={'car-info-item-content'}>
GPS编号{item?.gpsNo}
</Cell>
<Cell className={'car-info-item-content'}>
{item?.fence}
</Cell>
</div>
</div>
) : ''}
</>
)
}
export default Query