修复已知问题
This commit is contained in:
@@ -12,6 +12,8 @@ export interface HjmBxLog {
|
|||||||
accidentType?: string;
|
accidentType?: string;
|
||||||
// 车辆ID
|
// 车辆ID
|
||||||
carId?: number;
|
carId?: number;
|
||||||
|
// 车辆编号
|
||||||
|
carNo?: string;
|
||||||
// 保险图片
|
// 保险图片
|
||||||
image?: string;
|
image?: string;
|
||||||
// 排序(数字越小越靠前)
|
// 排序(数字越小越靠前)
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ export async function checkMonthTaskCompleted() {
|
|||||||
const res = await request.get<ApiResult<HjmExamLog>>(
|
const res = await request.get<ApiResult<HjmExamLog>>(
|
||||||
'/hjm/hjm-exam-log/checkMonthTaskCompleted'
|
'/hjm/hjm-exam-log/checkMonthTaskCompleted'
|
||||||
);
|
);
|
||||||
console.log(res,'1231231123123123')
|
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
return res.data;
|
return res.data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,9 @@ export default defineAppConfig({
|
|||||||
"video/video",
|
"video/video",
|
||||||
"exam/exam",
|
"exam/exam",
|
||||||
"bx/bx",
|
"bx/bx",
|
||||||
"bx/bx-add"
|
"bx/bx-add",
|
||||||
|
// "bx/bx-list",
|
||||||
|
// "question/detail"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
// {
|
// {
|
||||||
|
|||||||
42
src/components/Questions.tsx
Normal file
42
src/components/Questions.tsx
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import {useEffect, useState} from "react";
|
||||||
|
import {pageHjmQuestions} from "@/api/hjm/hjmQuestions";
|
||||||
|
import {HjmQuestions} from "@/api/hjm/hjmQuestions/model";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章终极列表
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
const Questions = () => {
|
||||||
|
const [list, setList] = useState<HjmQuestions[]>([])
|
||||||
|
|
||||||
|
const reload = () => {
|
||||||
|
pageHjmQuestions({}).then(res => {
|
||||||
|
if (res?.list) {
|
||||||
|
setList(res?.list)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
reload()
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={'px-3 mb-10'}>
|
||||||
|
<div className={'flex flex-col justify-between items-center bg-white rounded-lg p-4'}>
|
||||||
|
<div className={'bg-white w-full'}>
|
||||||
|
{
|
||||||
|
list.map((item, index) => {
|
||||||
|
return (
|
||||||
|
<div key={index} className={'flex justify-between items-center py-2'}>
|
||||||
|
<div className={'text-sm'}>{item.question}</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default Questions
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import {useEffect, useState} from "react";
|
import {useEffect, useState, useCallback} from "react";
|
||||||
import Taro from '@tarojs/taro'
|
import Taro from '@tarojs/taro'
|
||||||
import {
|
import {
|
||||||
Image,
|
Image,
|
||||||
@@ -22,8 +22,10 @@ function BxAdd() {
|
|||||||
const [loading, setLoading] = useState<boolean>(false)
|
const [loading, setLoading] = useState<boolean>(false)
|
||||||
const [uploading, setUploading] = useState<boolean>(false)
|
const [uploading, setUploading] = useState<boolean>(false)
|
||||||
const [carInfo, setCarInfo] = useState<HjmCar | null>(null)
|
const [carInfo, setCarInfo] = useState<HjmCar | null>(null)
|
||||||
|
const [lastClickTime, setLastClickTime] = useState<number>(0)
|
||||||
const [formData, setFormData] = useState<HjmBxLog>({
|
const [formData, setFormData] = useState<HjmBxLog>({
|
||||||
carId: undefined,
|
carId: undefined,
|
||||||
|
accidentType: undefined,
|
||||||
image: '',
|
image: '',
|
||||||
comments: '',
|
comments: '',
|
||||||
status: 0 // 0: 待审核, 1: 已通过, 2: 已驳回
|
status: 0 // 0: 待审核, 1: 已通过, 2: 已驳回
|
||||||
@@ -74,29 +76,75 @@ function BxAdd() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 拍照上传
|
// 拍照上传 - 使用 useCallback 防止重复触发
|
||||||
const takePhoto = () => {
|
const takePhoto = useCallback((event?: any) => {
|
||||||
|
// 阻止事件冒泡
|
||||||
|
if (event) {
|
||||||
|
event.stopPropagation()
|
||||||
|
event.preventDefault()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 防抖:防止快速连续点击
|
||||||
|
const now = Date.now()
|
||||||
|
if (now - lastClickTime < 1000) { // 1秒内不允许重复点击
|
||||||
|
console.log('点击过于频繁,请稍候...')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
setLastClickTime(now)
|
||||||
|
|
||||||
|
// 防止重复点击
|
||||||
|
if (uploading) {
|
||||||
|
console.log('正在上传中,请稍候...')
|
||||||
|
Taro.showToast({
|
||||||
|
title: '正在上传中...',
|
||||||
|
icon: 'loading'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('开始拍照上传...')
|
||||||
|
|
||||||
Taro.chooseImage({
|
Taro.chooseImage({
|
||||||
count: 1,
|
count: 1,
|
||||||
sizeType: ['compressed'],
|
sizeType: ['compressed'],
|
||||||
sourceType: ['camera'],
|
sourceType: ['camera'],
|
||||||
success: async () => {
|
success: async (res) => {
|
||||||
try {
|
try {
|
||||||
setUploading(true)
|
setUploading(true)
|
||||||
|
console.log('选择图片成功:', res.tempFilePaths[0])
|
||||||
|
|
||||||
// 这里应该调用实际的上传接口
|
// 这里应该调用实际的上传接口
|
||||||
uploadFile().then(data => {
|
const uploadResult = await uploadFile()
|
||||||
setFormData({
|
|
||||||
...formData,
|
setFormData(prev => ({
|
||||||
image: data.url
|
...prev,
|
||||||
})
|
image: uploadResult.url || res.tempFilePaths[0]
|
||||||
});
|
}))
|
||||||
|
|
||||||
|
Taro.showToast({
|
||||||
|
title: '照片上传成功',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error('上传失败:', error)
|
||||||
|
Taro.showToast({
|
||||||
|
title: '上传失败,请重试',
|
||||||
|
icon: 'error'
|
||||||
|
})
|
||||||
} finally {
|
} finally {
|
||||||
setUploading(false)
|
setUploading(false)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
fail: (error) => {
|
||||||
|
console.error('选择图片失败:', error)
|
||||||
|
Taro.showToast({
|
||||||
|
title: '选择图片失败',
|
||||||
|
icon: 'error'
|
||||||
|
})
|
||||||
|
setUploading(false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}, [uploading, lastClickTime])
|
||||||
|
|
||||||
// 提交表单
|
// 提交表单
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
@@ -131,7 +179,8 @@ function BxAdd() {
|
|||||||
// 构建提交数据
|
// 构建提交数据
|
||||||
const submitData: HjmBxLog = {
|
const submitData: HjmBxLog = {
|
||||||
...formData,
|
...formData,
|
||||||
comments: `事故类型:${accidentType}\n事故描述:${accidentDescription || '无'}`
|
accidentType: accidentType,
|
||||||
|
comments: `${accidentDescription || '无'}`
|
||||||
}
|
}
|
||||||
|
|
||||||
await addHjmBxLog(submitData)
|
await addHjmBxLog(submitData)
|
||||||
@@ -140,9 +189,10 @@ function BxAdd() {
|
|||||||
title: '报险提交成功',
|
title: '报险提交成功',
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
})
|
})
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
Taro.navigateBack()
|
Taro.navigateBack()
|
||||||
}, 1500)
|
}, 2000)
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('提交失败:', error)
|
console.error('提交失败:', error)
|
||||||
@@ -197,7 +247,7 @@ function BxAdd() {
|
|||||||
<span style={{fontSize: '16px', fontWeight: 'bold'}}>车辆信息</span>
|
<span style={{fontSize: '16px', fontWeight: 'bold'}}>车辆信息</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Space direction="vertical" size={8}>
|
<Space direction="vertical">
|
||||||
<div style={{display: 'flex', justifyContent: 'space-between'}}>
|
<div style={{display: 'flex', justifyContent: 'space-between'}}>
|
||||||
<span style={{color: '#8c8c8c'}}>车辆编号:</span>
|
<span style={{color: '#8c8c8c'}}>车辆编号:</span>
|
||||||
<span style={{fontWeight: 'bold'}}>{carInfo.code}</span>
|
<span style={{fontWeight: 'bold'}}>{carInfo.code}</span>
|
||||||
@@ -322,6 +372,7 @@ function BxAdd() {
|
|||||||
<Button
|
<Button
|
||||||
size="small"
|
size="small"
|
||||||
loading={uploading}
|
loading={uploading}
|
||||||
|
disabled={uploading}
|
||||||
onClick={takePhoto}
|
onClick={takePhoto}
|
||||||
style={{
|
style={{
|
||||||
width: '100px',
|
width: '100px',
|
||||||
@@ -331,11 +382,15 @@ function BxAdd() {
|
|||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
border: '2px dashed #d9d9d9'
|
border: '2px dashed #d9d9d9',
|
||||||
|
opacity: uploading ? 0.6 : 1,
|
||||||
|
cursor: uploading ? 'not-allowed' : 'pointer'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Camera size={24}/>
|
<Camera size={24}/>
|
||||||
<span style={{fontSize: '12px', marginTop: '4px'}}>拍照</span>
|
<span style={{fontSize: '12px', marginTop: '4px'}}>
|
||||||
|
{uploading ? '上传中...' : '拍照'}
|
||||||
|
</span>
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,291 +0,0 @@
|
|||||||
import React, {useEffect, useState} from "react";
|
|
||||||
import {
|
|
||||||
InfiniteLoading,
|
|
||||||
Loading,
|
|
||||||
Empty,
|
|
||||||
Button,
|
|
||||||
Input,
|
|
||||||
Tag,
|
|
||||||
Image,
|
|
||||||
Space,
|
|
||||||
Cell
|
|
||||||
} from '@nutui/nutui-react-taro'
|
|
||||||
import {Search, Calendar, Truck, File} from '@nutui/icons-react-taro'
|
|
||||||
import Taro from '@tarojs/taro'
|
|
||||||
import {pageHjmBxLog} from "@/api/hjm/hjmBxLog";
|
|
||||||
import {HjmBxLog} from "@/api/hjm/hjmBxLog/model";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 报险记录列表页面
|
|
||||||
*/
|
|
||||||
const BxList: React.FC = () => {
|
|
||||||
const [list, setList] = useState<HjmBxLog[]>([])
|
|
||||||
const [loading, setLoading] = useState<boolean>(false)
|
|
||||||
const [keywords, setKeywords] = useState<string>('')
|
|
||||||
const [refreshing, setRefreshing] = useState<boolean>(false)
|
|
||||||
|
|
||||||
// 获取状态显示
|
|
||||||
const getStatusDisplay = (status?: number) => {
|
|
||||||
switch (status) {
|
|
||||||
case 0:
|
|
||||||
return {text: '待审核', color: '#faad14', bgColor: '#fffbe6'}
|
|
||||||
case 1:
|
|
||||||
return {text: '已通过', color: '#52c41a', bgColor: '#f6ffed'}
|
|
||||||
case 2:
|
|
||||||
return {text: '已驳回', color: '#ff4d4f', bgColor: '#fff2f0'}
|
|
||||||
default:
|
|
||||||
return {text: '未知', color: '#8c8c8c', bgColor: '#f5f5f5'}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const reload = async (showLoading = true) => {
|
|
||||||
try {
|
|
||||||
if (showLoading) setLoading(true)
|
|
||||||
setRefreshing(true)
|
|
||||||
|
|
||||||
const res = await pageHjmBxLog({
|
|
||||||
keywords: keywords.trim() || undefined
|
|
||||||
})
|
|
||||||
|
|
||||||
setList(res?.list || [])
|
|
||||||
} catch (error) {
|
|
||||||
console.error('获取报险记录失败:', error)
|
|
||||||
Taro.showToast({
|
|
||||||
title: '获取报险记录失败',
|
|
||||||
icon: 'error'
|
|
||||||
})
|
|
||||||
} finally {
|
|
||||||
setLoading(false)
|
|
||||||
setRefreshing(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const onSearch = () => {
|
|
||||||
reload()
|
|
||||||
}
|
|
||||||
|
|
||||||
const onKeywordsChange = (value: string) => {
|
|
||||||
setKeywords(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
const onAddInsurance = () => {
|
|
||||||
Taro.navigateTo({
|
|
||||||
url: '/hjm/bx/bx-add'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const viewDetail = (item: HjmBxLog) => {
|
|
||||||
Taro.navigateTo({
|
|
||||||
url: `/hjm/bx/bx-detail?id=${item.id}`
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
reload()
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{/* 搜索栏 */}
|
|
||||||
<div style={{
|
|
||||||
position: 'fixed',
|
|
||||||
top: '20px',
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
zIndex: 20,
|
|
||||||
padding: '0 16px',
|
|
||||||
backgroundColor: '#f5f5f5'
|
|
||||||
}}>
|
|
||||||
<div style={{
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
backgroundColor: '#fff',
|
|
||||||
padding: '8px 12px',
|
|
||||||
borderRadius: '20px',
|
|
||||||
boxShadow: '0 2px 8px rgba(0,0,0,0.1)'
|
|
||||||
}}>
|
|
||||||
<Search size={16} color="#999"/>
|
|
||||||
<Input
|
|
||||||
placeholder="搜索报险记录"
|
|
||||||
value={keywords}
|
|
||||||
onChange={onKeywordsChange}
|
|
||||||
onConfirm={onSearch}
|
|
||||||
style={{
|
|
||||||
border: 'none',
|
|
||||||
backgroundColor: 'transparent',
|
|
||||||
flex: 1,
|
|
||||||
marginLeft: '8px'
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
type="primary"
|
|
||||||
size="small"
|
|
||||||
onClick={onSearch}
|
|
||||||
loading={loading}
|
|
||||||
>
|
|
||||||
搜索
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* 报险记录列表 */}
|
|
||||||
<div style={{
|
|
||||||
marginTop: '80px',
|
|
||||||
paddingBottom: '80px'
|
|
||||||
}}>
|
|
||||||
{loading && list.length === 0 ? (
|
|
||||||
<div style={{
|
|
||||||
display: 'flex',
|
|
||||||
justifyContent: 'center',
|
|
||||||
alignItems: 'center',
|
|
||||||
height: '200px'
|
|
||||||
}}>
|
|
||||||
<Loading type="spinner">加载中...</Loading>
|
|
||||||
</div>
|
|
||||||
) : list.length === 0 ? (
|
|
||||||
<Empty description="暂无报险记录">
|
|
||||||
<Button type="primary" onClick={onAddInsurance}>
|
|
||||||
立即报险
|
|
||||||
</Button>
|
|
||||||
</Empty>
|
|
||||||
) : (
|
|
||||||
<div style={{padding: '0 16px'}}>
|
|
||||||
{list.map((item, index) => {
|
|
||||||
const statusDisplay = getStatusDisplay(item.status)
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
key={index}
|
|
||||||
style={{
|
|
||||||
backgroundColor: '#fff',
|
|
||||||
borderRadius: '12px',
|
|
||||||
padding: '16px',
|
|
||||||
marginBottom: '12px',
|
|
||||||
boxShadow: '0 2px 8px rgba(0,0,0,0.06)',
|
|
||||||
border: '1px solid #f0f0f0'
|
|
||||||
}}
|
|
||||||
onClick={() => viewDetail(item)}
|
|
||||||
>
|
|
||||||
<div style={{
|
|
||||||
display: 'flex',
|
|
||||||
justifyContent: 'space-between',
|
|
||||||
alignItems: 'flex-start',
|
|
||||||
marginBottom: '12px'
|
|
||||||
}}>
|
|
||||||
<div style={{flex: 1}}>
|
|
||||||
<div style={{
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
gap: '8px',
|
|
||||||
marginBottom: '8px'
|
|
||||||
}}>
|
|
||||||
<File size={16} color="#1890ff"/>
|
|
||||||
<span style={{
|
|
||||||
fontSize: '16px',
|
|
||||||
fontWeight: 'bold',
|
|
||||||
color: '#262626'
|
|
||||||
}}>
|
|
||||||
报险记录 #{item.id}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Space direction="vertical" size={4}>
|
|
||||||
<div style={{
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
gap: '8px'
|
|
||||||
}}>
|
|
||||||
<Truck size={14} color="#8c8c8c"/>
|
|
||||||
<span style={{fontSize: '13px', color: '#8c8c8c'}}>
|
|
||||||
车辆ID:{item.carId}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style={{
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
gap: '8px'
|
|
||||||
}}>
|
|
||||||
<Calendar size={14} color="#8c8c8c"/>
|
|
||||||
<span style={{fontSize: '13px', color: '#8c8c8c'}}>
|
|
||||||
提交时间:{item.createTime}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</Space>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Tag
|
|
||||||
color={statusDisplay.color}
|
|
||||||
style={{
|
|
||||||
backgroundColor: statusDisplay.bgColor,
|
|
||||||
border: `1px solid ${statusDisplay.color}`,
|
|
||||||
fontSize: '12px'
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{statusDisplay.text}
|
|
||||||
</Tag>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* 事故照片预览 */}
|
|
||||||
{item.image && (
|
|
||||||
<div style={{marginBottom: '12px'}}>
|
|
||||||
<Image
|
|
||||||
src={item.image}
|
|
||||||
width="60"
|
|
||||||
height="60"
|
|
||||||
radius="6px"
|
|
||||||
mode="aspectFill"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* 备注信息 */}
|
|
||||||
{item.comments && (
|
|
||||||
<div style={{
|
|
||||||
backgroundColor: '#f8f9fa',
|
|
||||||
padding: '8px 12px',
|
|
||||||
borderRadius: '6px',
|
|
||||||
fontSize: '13px',
|
|
||||||
color: '#595959',
|
|
||||||
lineHeight: '1.4'
|
|
||||||
}}>
|
|
||||||
{item.comments.length > 50
|
|
||||||
? `${item.comments.substring(0, 50)}...`
|
|
||||||
: item.comments
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* 浮动添加按钮 */}
|
|
||||||
<div style={{
|
|
||||||
position: 'fixed',
|
|
||||||
bottom: '20px',
|
|
||||||
right: '20px',
|
|
||||||
zIndex: 30
|
|
||||||
}}>
|
|
||||||
<Button
|
|
||||||
type="primary"
|
|
||||||
shape="round"
|
|
||||||
size="large"
|
|
||||||
onClick={onAddInsurance}
|
|
||||||
style={{
|
|
||||||
width: '56px',
|
|
||||||
height: '56px',
|
|
||||||
borderRadius: '28px',
|
|
||||||
boxShadow: '0 4px 12px rgba(0,0,0,0.15)'
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
+
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default BxList
|
|
||||||
@@ -1,37 +1,55 @@
|
|||||||
import {useEffect, useState} from "react";
|
import React, {useEffect, useState} from "react";
|
||||||
import {InfiniteLoading, Loading, Empty, Button, Input} from '@nutui/nutui-react-taro'
|
import {
|
||||||
import {Search, Plus} from '@nutui/icons-react-taro'
|
Loading,
|
||||||
|
Empty,
|
||||||
|
Button,
|
||||||
|
Input,
|
||||||
|
Tag,
|
||||||
|
Image,
|
||||||
|
Space
|
||||||
|
} from '@nutui/nutui-react-taro'
|
||||||
|
import {Search, Calendar, Truck, File} from '@nutui/icons-react-taro'
|
||||||
import Taro from '@tarojs/taro'
|
import Taro from '@tarojs/taro'
|
||||||
import {pageHjmCar} from "@/api/hjm/hjmCar";
|
import {pageHjmBxLog} from "@/api/hjm/hjmBxLog";
|
||||||
import {HjmCar} from "@/api/hjm/hjmCar/model";
|
import {HjmBxLog} from "@/api/hjm/hjmBxLog/model";
|
||||||
import BestSellers from "./BestSellers";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 一键报险 - 车辆列表页面
|
* 报险记录列表页面
|
||||||
* @constructor
|
|
||||||
*/
|
*/
|
||||||
const InsuranceList = () => {
|
const Bx: React.FC = () => {
|
||||||
const [list, setList] = useState<HjmCar[]>([])
|
const [list, setList] = useState<HjmBxLog[]>([])
|
||||||
const [loading, setLoading] = useState<boolean>(false)
|
const [loading, setLoading] = useState<boolean>(false)
|
||||||
const [keywords, setKeywords] = useState<string>('')
|
const [keywords, setKeywords] = useState<string>('')
|
||||||
const [refreshing, setRefreshing] = useState<boolean>(false)
|
const [refreshing, setRefreshing] = useState<boolean>(false)
|
||||||
|
console.log(refreshing)
|
||||||
|
// 获取状态显示
|
||||||
|
const getStatusDisplay = (status?: number) => {
|
||||||
|
switch (status) {
|
||||||
|
case 0:
|
||||||
|
return {text: '待审核', color: '#faad14', bgColor: '#fffbe6'}
|
||||||
|
case 1:
|
||||||
|
return {text: '已通过', color: '#52c41a', bgColor: '#f6ffed'}
|
||||||
|
case 2:
|
||||||
|
return {text: '已驳回', color: '#ff4d4f', bgColor: '#fff2f0'}
|
||||||
|
default:
|
||||||
|
return {text: '未知', color: '#8c8c8c', bgColor: '#f5f5f5'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const reload = async (showLoading = true) => {
|
const reload = async (showLoading = true) => {
|
||||||
try {
|
try {
|
||||||
if (showLoading) setLoading(true)
|
if (showLoading) setLoading(true)
|
||||||
setRefreshing(true)
|
setRefreshing(true)
|
||||||
|
|
||||||
// 获取车辆列表 - 只获取正常状态的车辆
|
const res = await pageHjmBxLog({
|
||||||
const res = await pageHjmCar({
|
keywords: keywords.trim()
|
||||||
status: 1,
|
|
||||||
keywords: keywords.trim() || undefined
|
|
||||||
})
|
})
|
||||||
|
|
||||||
setList(res?.list || [])
|
setList(res?.list || [])
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取车辆列表失败:', error)
|
console.error('获取报险记录失败:', error)
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '获取车辆列表失败',
|
title: '获取报险记录失败',
|
||||||
icon: 'error'
|
icon: 'error'
|
||||||
})
|
})
|
||||||
} finally {
|
} finally {
|
||||||
@@ -54,6 +72,12 @@ const InsuranceList = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const viewDetail = (item: HjmBxLog) => {
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: `/hjm/bx/bx-detail?id=${item.id}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
reload()
|
reload()
|
||||||
}, [])
|
}, [])
|
||||||
@@ -66,6 +90,7 @@ const InsuranceList = () => {
|
|||||||
top: '20px',
|
top: '20px',
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
|
display: "none",
|
||||||
zIndex: 20,
|
zIndex: 20,
|
||||||
padding: '0 16px',
|
padding: '0 16px',
|
||||||
backgroundColor: '#f5f5f5'
|
backgroundColor: '#f5f5f5'
|
||||||
@@ -80,7 +105,7 @@ const InsuranceList = () => {
|
|||||||
}}>
|
}}>
|
||||||
<Search size={16} color="#999"/>
|
<Search size={16} color="#999"/>
|
||||||
<Input
|
<Input
|
||||||
placeholder="搜索车辆编号或快递公司"
|
placeholder="搜索报险记录"
|
||||||
value={keywords}
|
value={keywords}
|
||||||
onChange={onKeywordsChange}
|
onChange={onKeywordsChange}
|
||||||
onConfirm={onSearch}
|
onConfirm={onSearch}
|
||||||
@@ -102,9 +127,9 @@ const InsuranceList = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 车辆列表 */}
|
{/* 报险记录列表 */}
|
||||||
<div style={{
|
<div style={{
|
||||||
marginTop: '80px',
|
marginTop: '10px',
|
||||||
paddingBottom: '80px'
|
paddingBottom: '80px'
|
||||||
}}>
|
}}>
|
||||||
{loading && list.length === 0 ? (
|
{loading && list.length === 0 ? (
|
||||||
@@ -117,19 +142,122 @@ const InsuranceList = () => {
|
|||||||
<Loading type="spinner">加载中...</Loading>
|
<Loading type="spinner">加载中...</Loading>
|
||||||
</div>
|
</div>
|
||||||
) : list.length === 0 ? (
|
) : list.length === 0 ? (
|
||||||
<Empty description="暂无车辆数据">
|
<Empty description="暂无报险记录">
|
||||||
<Button type="primary" onClick={() => reload()}>
|
<Button type="primary" onClick={onAddInsurance}>
|
||||||
重新加载
|
立即报险
|
||||||
</Button>
|
</Button>
|
||||||
</Empty>
|
</Empty>
|
||||||
) : (
|
) : (
|
||||||
<InfiniteLoading
|
<div style={{padding: '0 16px'}}>
|
||||||
style={{width: '100%'}}
|
{list.map((item, index) => {
|
||||||
hasMore={false}
|
const statusDisplay = getStatusDisplay(item.status)
|
||||||
onLoadMore={() => {}}
|
|
||||||
>
|
return (
|
||||||
<BestSellers data={list} onRefresh={() => reload(false)}/>
|
<div
|
||||||
</InfiniteLoading>
|
key={index}
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#fff',
|
||||||
|
borderRadius: '12px',
|
||||||
|
padding: '16px',
|
||||||
|
marginBottom: '12px',
|
||||||
|
boxShadow: '0 2px 8px rgba(0,0,0,0.06)',
|
||||||
|
border: '1px solid #f0f0f0'
|
||||||
|
}}
|
||||||
|
onClick={() => viewDetail(item)}
|
||||||
|
>
|
||||||
|
<div style={{
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
alignItems: 'flex-start',
|
||||||
|
marginBottom: '12px'
|
||||||
|
}}>
|
||||||
|
<div style={{flex: 1}}>
|
||||||
|
<div style={{
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
gap: '8px',
|
||||||
|
marginBottom: '8px'
|
||||||
|
}}>
|
||||||
|
<File size={16} color="#1890ff"/>
|
||||||
|
<span style={{
|
||||||
|
fontSize: '16px',
|
||||||
|
fontWeight: 'bold',
|
||||||
|
color: '#262626'
|
||||||
|
}}>
|
||||||
|
报险记录 #{item.id}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Space direction="vertical">
|
||||||
|
<div style={{
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
gap: '8px'
|
||||||
|
}}>
|
||||||
|
<Truck size={14} color="#8c8c8c"/>
|
||||||
|
<span style={{fontSize: '13px', color: '#8c8c8c'}}>
|
||||||
|
车辆编号:{item.carNo}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style={{
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
gap: '8px'
|
||||||
|
}}>
|
||||||
|
<Calendar size={14} color="#8c8c8c"/>
|
||||||
|
<span style={{fontSize: '13px', color: '#8c8c8c'}}>
|
||||||
|
提交时间:{item.createTime}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Tag
|
||||||
|
color={statusDisplay.color}
|
||||||
|
style={{
|
||||||
|
backgroundColor: statusDisplay.bgColor,
|
||||||
|
border: `1px solid ${statusDisplay.color}`,
|
||||||
|
fontSize: '12px'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{statusDisplay.text}
|
||||||
|
</Tag>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 事故照片预览 */}
|
||||||
|
{item.image && (
|
||||||
|
<div style={{marginBottom: '12px'}}>
|
||||||
|
<Image
|
||||||
|
src={item.image}
|
||||||
|
width="60"
|
||||||
|
height="60"
|
||||||
|
radius="6px"
|
||||||
|
mode="aspectFill"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* 备注信息 */}
|
||||||
|
{item.comments && (
|
||||||
|
<div style={{
|
||||||
|
backgroundColor: '#f8f9fa',
|
||||||
|
padding: '8px 12px',
|
||||||
|
borderRadius: '6px',
|
||||||
|
fontSize: '13px',
|
||||||
|
color: '#595959',
|
||||||
|
lineHeight: '1.4'
|
||||||
|
}}>
|
||||||
|
{item.comments.length > 50
|
||||||
|
? `${item.comments.substring(0, 50)}...`
|
||||||
|
: item.comments
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -152,11 +280,11 @@ const InsuranceList = () => {
|
|||||||
boxShadow: '0 4px 12px rgba(0,0,0,0.15)'
|
boxShadow: '0 4px 12px rgba(0,0,0,0.15)'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Plus size={24}/>
|
+
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default InsuranceList
|
export default Bx
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import {useEffect, useState} from "react";
|
import {useEffect, useState} from "react";
|
||||||
import {Image} from '@nutui/nutui-react-taro'
|
import {Image} from '@nutui/nutui-react-taro';
|
||||||
import Taro from '@tarojs/taro'
|
import Taro from '@tarojs/taro';
|
||||||
import {pageCmsArticle} from "@/api/cms/cmsArticle";
|
import {pageCmsArticle} from "@/api/cms/cmsArticle";
|
||||||
import {CmsArticle} from "@/api/cms/cmsArticle/model";
|
import {CmsArticle} from "@/api/cms/cmsArticle/model";
|
||||||
import {checkMonthTaskCompleted} from "@/api/hjm/hjmExamLog";
|
import {checkMonthTaskCompleted} from "@/api/hjm/hjmExamLog";
|
||||||
|
import Questions from '@/components/Questions';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文章终极列表
|
* 文章终极列表
|
||||||
@@ -17,7 +18,7 @@ const Study = () => {
|
|||||||
const reload = () => {
|
const reload = () => {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
checkMonthTaskCompleted().then(res => {
|
checkMonthTaskCompleted().then(res => {
|
||||||
if(res){
|
if (res) {
|
||||||
setMonthTaskCompleted(true)
|
setMonthTaskCompleted(true)
|
||||||
}
|
}
|
||||||
pageCmsArticle({categoryId: 4289, status: 0}).then(data => {
|
pageCmsArticle({categoryId: 4289, status: 0}).then(data => {
|
||||||
@@ -47,12 +48,14 @@ const Study = () => {
|
|||||||
{
|
{
|
||||||
!monthTaskCompleted && list?.map((item, index) => {
|
!monthTaskCompleted && list?.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<div key={index} className={'flex flex-col justify-between items-center bg-white rounded-lg p-2'} onClick={() => Taro.navigateTo({url: `/hjm/video/video?id=${item.articleId}`})}>
|
<div key={index} className={'flex flex-col justify-between items-center bg-white rounded-lg p-2'}
|
||||||
|
onClick={() => Taro.navigateTo({url: `/hjm/video/video?id=${item.articleId}`})}>
|
||||||
<Image src={item.image} height={200}/>
|
<Image src={item.image} height={200}/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
{list?.length == 0 && <Questions/>}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {BaseUrl, TenantId} from "@/utils/config";
|
|||||||
let baseUrl = BaseUrl
|
let baseUrl = BaseUrl
|
||||||
|
|
||||||
if(process.env.NODE_ENV === 'development'){
|
if(process.env.NODE_ENV === 'development'){
|
||||||
baseUrl = 'http://localhost:9000/api'
|
// baseUrl = 'http://localhost:9000/api'
|
||||||
}
|
}
|
||||||
export function request<T>(options:any) {
|
export function request<T>(options:any) {
|
||||||
const token = Taro.getStorageSync('access_token');
|
const token = Taro.getStorageSync('access_token');
|
||||||
|
|||||||
Reference in New Issue
Block a user