完成:黄家明项目的开发并存档

This commit is contained in:
2025-06-17 23:01:02 +08:00
parent d37e9509c1
commit 26db77ee12
10 changed files with 203 additions and 18 deletions

View File

@@ -18,6 +18,8 @@ export interface HjmGpsLog {
ddmmyy?: string;
// 时分秒
hhmmss?: string;
// 速度
speed?: string;
// 备注
comments?: string;
// 状态, 0正常, 1冻结

View File

@@ -48,7 +48,8 @@ export default defineAppConfig({
"exam/exam",
"bx/bx",
"bx/bx-add",
"trajectory/trajectory"
"trajectory/trajectory",
"gps-log/gps-log"
// "bx/bx-list",
// "question/detail"
]

View File

@@ -0,0 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '位置明细',
navigationBarBackgroundColor: '#ffe0e0'
})

View File

@@ -0,0 +1,91 @@
import {Cell, Space} from '@nutui/nutui-react-taro'
import {useEffect, useState, CSSProperties} from "react";
import {InfiniteLoading} from '@nutui/nutui-react-taro'
import {useRouter} from '@tarojs/taro'
import {pageHjmGpsLog} from "@/api/hjm/hjmGpsLog";
import {HjmGpsLog} from "@/api/hjm/hjmGpsLog/model";
const InfiniteUlStyle: CSSProperties = {
height: '80vh',
width: '100%',
padding: '0',
overflowY: 'auto',
overflowX: 'hidden',
}
function PayRecord() {
const {params} = useRouter();
const [list, setList] = useState<HjmGpsLog[]>([])
const [page, setPage] = useState(1)
const [hasMore, setHasMore] = useState(true)
const reload = async () => {
pageHjmGpsLog({page, gpsNo: params.id}).then(res => {
if (res?.list && res?.list.length > 0) {
const newList = list?.concat(res.list)
setList(newList);
setHasMore(true)
} else {
setHasMore(false)
}
})
}
const reloadMore = async () => {
setPage(page + 1)
reload();
}
useEffect(() => {
setPage(2)
reload()
}, [])
return (
<Cell>
<ul style={InfiniteUlStyle} id="scroll">
<InfiniteLoading
target="scroll"
hasMore={hasMore}
onLoadMore={reloadMore}
onScroll={() => {
console.log('onScroll')
}}
onScrollToUpper={() => {
console.log('onScrollToUpper')
}}
loadingText={
<>
</>
}
loadMoreText={
<>
</>
}
>
{list?.map(item => {
return (
<Cell style={{padding: '0'}}>
<div className={'flex w-full justify-between items-center'}>
<div className={'flex'}>
<Space>
<div className={'flex flex-col'}>
<div className={'real-name py-1'}>
{item.createTime}
</div>
<div className={'text-gray-400 py-1'}>{item.speed} km/h{item.latitude},{item.longitude}</div>
</div>
</Space>
</div>
</div>
</Cell>
)
})}
</InfiniteLoading>
</ul>
</Cell>
)
}
export default PayRecord

View File

@@ -43,6 +43,7 @@ const Query = () => {
const [dict, setDict] = useState<DictData[]>([])
const [adminId, setAdminId] = useState<number>()
const [showPreview, setShowPreview] = useState(false)
const [disabled, setDisabled] = useState<boolean>(false)
const [userRole, setUserRole] = useState<UserRole>()
const [fileList, setFileList] = useState<UploadedImageData[]>([]) // 图片文件列表
const [FormData, setFormData] = useState<HjmCar>(
@@ -106,6 +107,10 @@ const Query = () => {
// 提交表单
const submitSucceed = (values: any) => {
// 禁用按钮
if(disabled){
return false;
}
console.log(values)
if(FormData.image == '[]' || !FormData.image){
Taro.showToast({
@@ -129,14 +134,18 @@ const Query = () => {
driverId: adminId,
driverName: Taro.getStorageSync('RealName')
}).then(() => {
userRole.roleId = 1738;
updateUserRole(userRole).then(() => {
Taro.showToast({title: `绑定成功`, icon: 'success'})
})
updateUser({
userId: Taro.getStorageSync('UserId'),
organizationId: FormData.organizationId
}).then(() => {})
Taro.showToast({title: `绑定成功`, icon: 'success'})
// 变更角色
if (Taro.getStorageSync('OrganizationParentId') > 0) {
userRole.roleId = 1738;
updateUserRole(userRole).then(() => {
Taro.showToast({title: `绑定成功`, icon: 'success'})
})
updateUser({
userId: Taro.getStorageSync('UserId'),
organizationId: FormData.organizationId
}).then(() => {})
}
setTimeout(() => {
reload();
return Taro.navigateBack()
@@ -214,7 +223,7 @@ const Query = () => {
}
// 上传单张图片
const uploadSingleImage = (filePath: string, index: number) => {
const uploadSingleImage = (filePath: any, index: number) => {
const TenantId = Taro.getStorageSync('TenantId')
Taro.uploadFile({
@@ -322,6 +331,13 @@ const Query = () => {
// }
// }
const reload = () => {
if (!Taro.getStorageSync('UserId')) {
Taro.showToast({
title: '请先登录',
icon: 'error'
})
return false
}
const code = params.id;
// 获取数据字典
pageDictData({dictCode: 'InsuranceStatus'}).then(res => {
@@ -349,6 +365,7 @@ const Query = () => {
}
if(data){
setAdminId(data.userId);
setFormData( {...FormData, driverName: Taro.getStorageSync('RealName')})
}
})
// 获取车辆信息
@@ -384,7 +401,21 @@ const Query = () => {
Taro.setNavigationBarTitle({
title: '安装设备'
})
setFormData({...data, driver: Taro.getStorageSync('RealName')})
setFormData({...data})
}
// 查询名下的车辆数
if(data?.status == 0 && Taro.getStorageSync('OrganizationParentId') != 0){
pageHjmCar({driverId: Taro.getStorageSync('UserId')}).then(res => {
if(res?.count && res?.count > 0){
setDisabled(true)
Taro.showToast({
title: '可绑定数量已达上限',
icon: 'none'
})
return false;
}
})
}
}
})
@@ -427,7 +458,7 @@ const Query = () => {
width: '100%'
}}
>
<Button nativeType="submit" block type="info">
<Button nativeType="submit" block type="info" disabled={disabled}>
</Button>
</div>
@@ -598,7 +629,7 @@ const Query = () => {
<Form.Item
label={'操作员'}
name="driver"
name="driverName"
rules={[{message: '操作员'}]}
>
<Input placeholder="操作员" type="text"/>
@@ -685,6 +716,15 @@ const Query = () => {
}>
</Button>
<Button nativeType="submit" type="default" onClick={
() => {
Taro.navigateTo({
url: `/hjm/gps-log/gps-log?id=${FormData?.gpsNo}`
})
}
}>
</Button>
</div>
</div>
</div>

View File

@@ -6,6 +6,7 @@ import {Popup, Avatar, NavBar} from '@nutui/nutui-react-taro'
import {getUserInfo} from "@/api/layout";
import {TenantId} from "@/utils/config";
import {getOrganization} from "@/api/system/organization";
import {myUserVerify} from "@/api/system/userVerify";
const Header = (props: any) => {
const [IsLogin, setIsLogin] = useState<boolean>(true)
@@ -101,6 +102,11 @@ const Header = (props: any) => {
setIsLogin(false);
console.log('未登录')
});
myUserVerify({status: 1}).then(data => {
if(data?.realName){
Taro.setStorageSync('RealName',data.realName)
}
})
}
/* 获取用户手机号 */

View File

@@ -116,6 +116,7 @@ function Home() {
setLongitude(res.longitude)
}
console.log(Taro.getStorageSync('RoleName'))
// 已认证用户
if(Taro.getStorageSync('Certification')){
setIsAdmin(true)
@@ -124,7 +125,7 @@ function Home() {
}
// 游客
if(!Taro.getStorageSync('access_token')){
if(!Taro.getStorageSync('access_token') || Taro.getStorageSync('RoleName') == '注册用户'){
setScale(15)
const arr = []
// @ts-ignore
@@ -326,6 +327,11 @@ function Home() {
}
}).catch(() => {
setIsLogin(false);
setMarkers([{
id: 123,
latitude: latitude,
longitude: longitude
}])
console.log('未登录')
});
}

View File

@@ -85,6 +85,13 @@ function Index() {
return false;
}
}
if(!FormData.realName){
Taro.showToast({
title: '请填写真实姓名',
icon: 'none'
});
return false;
}
const saveOrUpdate = isUpdate ? updateUserVerify : addUserVerify;
saveOrUpdate({...FormData, status: 0}).then(() => {
Taro.showToast({title: `提交成功`, icon: 'success'})
@@ -286,6 +293,20 @@ function Index() {
</>
)
}
<Form.Item
label={'真实姓名'}
name="realName"
required
initialValue={FormData.realName}
rules={[{message: '请输入真实姓名'}]}
>
<Input
placeholder={'请输入真实姓名'}
type="text"
value={FormData?.realName}
onChange={(value) => setFormData({...FormData, realName: value})}
/>
</Form.Item>
{
FormData.status != undefined && (
<Form.Item

View File

@@ -1,7 +1,7 @@
import Taro from '@tarojs/taro'
export default function navTo(url: string, isLogin = false){
if(isLogin){
export default function navTo(url: string, isLogin = false) {
if (isLogin) {
if (!Taro.getStorageSync('access_token')) {
return false;
}
@@ -11,6 +11,21 @@ export default function navTo(url: string, isLogin = false){
})
}
// 转base64
export function fileToBase64(filePath) {
return new Promise((resolve) => {
let fileManager = Taro.getFileSystemManager();
fileManager.readFile({
filePath,
encoding: 'base64',
success: (e: any) => {
resolve(`data:image/jpg;base64,${e.data}`);
}
});
});
};
/**
* 转义微信富文本图片样式
* @param htmlText
@@ -26,7 +41,7 @@ export function wxParse(htmlText) {
}
export function copyText(text:string){
export function copyText(text: string) {
Taro.setClipboardData({
data: text,
success: function () {

View File

@@ -16,6 +16,5 @@ export function saveStorageByLoginUser(token: string, user: User) {
Taro.setStorageSync('access_token', token)
Taro.setStorageSync('UserId', user.userId)
Taro.setStorageSync('Phone', user.phone)
Taro.setStorageSync('RealName', user.realName)
Taro.setStorageSync('User', user)
}