完成:黄家明项目的开发并存档
This commit is contained in:
@@ -18,6 +18,8 @@ export interface HjmGpsLog {
|
|||||||
ddmmyy?: string;
|
ddmmyy?: string;
|
||||||
// 时分秒
|
// 时分秒
|
||||||
hhmmss?: string;
|
hhmmss?: string;
|
||||||
|
// 速度
|
||||||
|
speed?: string;
|
||||||
// 备注
|
// 备注
|
||||||
comments?: string;
|
comments?: string;
|
||||||
// 状态, 0正常, 1冻结
|
// 状态, 0正常, 1冻结
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ export default defineAppConfig({
|
|||||||
"exam/exam",
|
"exam/exam",
|
||||||
"bx/bx",
|
"bx/bx",
|
||||||
"bx/bx-add",
|
"bx/bx-add",
|
||||||
"trajectory/trajectory"
|
"trajectory/trajectory",
|
||||||
|
"gps-log/gps-log"
|
||||||
// "bx/bx-list",
|
// "bx/bx-list",
|
||||||
// "question/detail"
|
// "question/detail"
|
||||||
]
|
]
|
||||||
|
|||||||
4
src/hjm/gps-log/gps-log.config.ts
Normal file
4
src/hjm/gps-log/gps-log.config.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export default definePageConfig({
|
||||||
|
navigationBarTitleText: '位置明细',
|
||||||
|
navigationBarBackgroundColor: '#ffe0e0'
|
||||||
|
})
|
||||||
91
src/hjm/gps-log/gps-log.tsx
Normal file
91
src/hjm/gps-log/gps-log.tsx
Normal 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
|
||||||
@@ -43,6 +43,7 @@ const Query = () => {
|
|||||||
const [dict, setDict] = useState<DictData[]>([])
|
const [dict, setDict] = useState<DictData[]>([])
|
||||||
const [adminId, setAdminId] = useState<number>()
|
const [adminId, setAdminId] = useState<number>()
|
||||||
const [showPreview, setShowPreview] = useState(false)
|
const [showPreview, setShowPreview] = useState(false)
|
||||||
|
const [disabled, setDisabled] = useState<boolean>(false)
|
||||||
const [userRole, setUserRole] = useState<UserRole>()
|
const [userRole, setUserRole] = useState<UserRole>()
|
||||||
const [fileList, setFileList] = useState<UploadedImageData[]>([]) // 图片文件列表
|
const [fileList, setFileList] = useState<UploadedImageData[]>([]) // 图片文件列表
|
||||||
const [FormData, setFormData] = useState<HjmCar>(
|
const [FormData, setFormData] = useState<HjmCar>(
|
||||||
@@ -106,6 +107,10 @@ const Query = () => {
|
|||||||
|
|
||||||
// 提交表单
|
// 提交表单
|
||||||
const submitSucceed = (values: any) => {
|
const submitSucceed = (values: any) => {
|
||||||
|
// 禁用按钮
|
||||||
|
if(disabled){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
console.log(values)
|
console.log(values)
|
||||||
if(FormData.image == '[]' || !FormData.image){
|
if(FormData.image == '[]' || !FormData.image){
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
@@ -129,6 +134,9 @@ const Query = () => {
|
|||||||
driverId: adminId,
|
driverId: adminId,
|
||||||
driverName: Taro.getStorageSync('RealName')
|
driverName: Taro.getStorageSync('RealName')
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
Taro.showToast({title: `绑定成功`, icon: 'success'})
|
||||||
|
// 变更角色
|
||||||
|
if (Taro.getStorageSync('OrganizationParentId') > 0) {
|
||||||
userRole.roleId = 1738;
|
userRole.roleId = 1738;
|
||||||
updateUserRole(userRole).then(() => {
|
updateUserRole(userRole).then(() => {
|
||||||
Taro.showToast({title: `绑定成功`, icon: 'success'})
|
Taro.showToast({title: `绑定成功`, icon: 'success'})
|
||||||
@@ -137,6 +145,7 @@ const Query = () => {
|
|||||||
userId: Taro.getStorageSync('UserId'),
|
userId: Taro.getStorageSync('UserId'),
|
||||||
organizationId: FormData.organizationId
|
organizationId: FormData.organizationId
|
||||||
}).then(() => {})
|
}).then(() => {})
|
||||||
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
reload();
|
reload();
|
||||||
return Taro.navigateBack()
|
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')
|
const TenantId = Taro.getStorageSync('TenantId')
|
||||||
|
|
||||||
Taro.uploadFile({
|
Taro.uploadFile({
|
||||||
@@ -322,6 +331,13 @@ const Query = () => {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
const reload = () => {
|
const reload = () => {
|
||||||
|
if (!Taro.getStorageSync('UserId')) {
|
||||||
|
Taro.showToast({
|
||||||
|
title: '请先登录',
|
||||||
|
icon: 'error'
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
const code = params.id;
|
const code = params.id;
|
||||||
// 获取数据字典
|
// 获取数据字典
|
||||||
pageDictData({dictCode: 'InsuranceStatus'}).then(res => {
|
pageDictData({dictCode: 'InsuranceStatus'}).then(res => {
|
||||||
@@ -349,6 +365,7 @@ const Query = () => {
|
|||||||
}
|
}
|
||||||
if(data){
|
if(data){
|
||||||
setAdminId(data.userId);
|
setAdminId(data.userId);
|
||||||
|
setFormData( {...FormData, driverName: Taro.getStorageSync('RealName')})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// 获取车辆信息
|
// 获取车辆信息
|
||||||
@@ -384,7 +401,21 @@ const Query = () => {
|
|||||||
Taro.setNavigationBarTitle({
|
Taro.setNavigationBarTitle({
|
||||||
title: '安装设备'
|
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%'
|
width: '100%'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Button nativeType="submit" block type="info">
|
<Button nativeType="submit" block type="info" disabled={disabled}>
|
||||||
提交
|
提交
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@@ -598,7 +629,7 @@ const Query = () => {
|
|||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={'操作员'}
|
label={'操作员'}
|
||||||
name="driver"
|
name="driverName"
|
||||||
rules={[{message: '操作员'}]}
|
rules={[{message: '操作员'}]}
|
||||||
>
|
>
|
||||||
<Input placeholder="操作员" type="text"/>
|
<Input placeholder="操作员" type="text"/>
|
||||||
@@ -685,6 +716,15 @@ const Query = () => {
|
|||||||
}>
|
}>
|
||||||
播放轨迹
|
播放轨迹
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button nativeType="submit" type="default" onClick={
|
||||||
|
() => {
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: `/hjm/gps-log/gps-log?id=${FormData?.gpsNo}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}>
|
||||||
|
位置信息
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {Popup, Avatar, NavBar} from '@nutui/nutui-react-taro'
|
|||||||
import {getUserInfo} from "@/api/layout";
|
import {getUserInfo} from "@/api/layout";
|
||||||
import {TenantId} from "@/utils/config";
|
import {TenantId} from "@/utils/config";
|
||||||
import {getOrganization} from "@/api/system/organization";
|
import {getOrganization} from "@/api/system/organization";
|
||||||
|
import {myUserVerify} from "@/api/system/userVerify";
|
||||||
|
|
||||||
const Header = (props: any) => {
|
const Header = (props: any) => {
|
||||||
const [IsLogin, setIsLogin] = useState<boolean>(true)
|
const [IsLogin, setIsLogin] = useState<boolean>(true)
|
||||||
@@ -101,6 +102,11 @@ const Header = (props: any) => {
|
|||||||
setIsLogin(false);
|
setIsLogin(false);
|
||||||
console.log('未登录')
|
console.log('未登录')
|
||||||
});
|
});
|
||||||
|
myUserVerify({status: 1}).then(data => {
|
||||||
|
if(data?.realName){
|
||||||
|
Taro.setStorageSync('RealName',data.realName)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 获取用户手机号 */
|
/* 获取用户手机号 */
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ function Home() {
|
|||||||
setLongitude(res.longitude)
|
setLongitude(res.longitude)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(Taro.getStorageSync('RoleName'))
|
||||||
// 已认证用户
|
// 已认证用户
|
||||||
if(Taro.getStorageSync('Certification')){
|
if(Taro.getStorageSync('Certification')){
|
||||||
setIsAdmin(true)
|
setIsAdmin(true)
|
||||||
@@ -124,7 +125,7 @@ function Home() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 游客
|
// 游客
|
||||||
if(!Taro.getStorageSync('access_token')){
|
if(!Taro.getStorageSync('access_token') || Taro.getStorageSync('RoleName') == '注册用户'){
|
||||||
setScale(15)
|
setScale(15)
|
||||||
const arr = []
|
const arr = []
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@@ -326,6 +327,11 @@ function Home() {
|
|||||||
}
|
}
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
setIsLogin(false);
|
setIsLogin(false);
|
||||||
|
setMarkers([{
|
||||||
|
id: 123,
|
||||||
|
latitude: latitude,
|
||||||
|
longitude: longitude
|
||||||
|
}])
|
||||||
console.log('未登录')
|
console.log('未登录')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,13 @@ function Index() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!FormData.realName){
|
||||||
|
Taro.showToast({
|
||||||
|
title: '请填写真实姓名',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
const saveOrUpdate = isUpdate ? updateUserVerify : addUserVerify;
|
const saveOrUpdate = isUpdate ? updateUserVerify : addUserVerify;
|
||||||
saveOrUpdate({...FormData, status: 0}).then(() => {
|
saveOrUpdate({...FormData, status: 0}).then(() => {
|
||||||
Taro.showToast({title: `提交成功`, icon: 'success'})
|
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 && (
|
FormData.status != undefined && (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import Taro from '@tarojs/taro'
|
import Taro from '@tarojs/taro'
|
||||||
|
|
||||||
export default function navTo(url: string, isLogin = false){
|
export default function navTo(url: string, isLogin = false) {
|
||||||
if(isLogin){
|
if (isLogin) {
|
||||||
if (!Taro.getStorageSync('access_token')) {
|
if (!Taro.getStorageSync('access_token')) {
|
||||||
return false;
|
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
|
* @param htmlText
|
||||||
@@ -26,7 +41,7 @@ export function wxParse(htmlText) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function copyText(text:string){
|
export function copyText(text: string) {
|
||||||
Taro.setClipboardData({
|
Taro.setClipboardData({
|
||||||
data: text,
|
data: text,
|
||||||
success: function () {
|
success: function () {
|
||||||
|
|||||||
@@ -16,6 +16,5 @@ export function saveStorageByLoginUser(token: string, user: User) {
|
|||||||
Taro.setStorageSync('access_token', token)
|
Taro.setStorageSync('access_token', token)
|
||||||
Taro.setStorageSync('UserId', user.userId)
|
Taro.setStorageSync('UserId', user.userId)
|
||||||
Taro.setStorageSync('Phone', user.phone)
|
Taro.setStorageSync('Phone', user.phone)
|
||||||
Taro.setStorageSync('RealName', user.realName)
|
|
||||||
Taro.setStorageSync('User', user)
|
Taro.setStorageSync('User', user)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user