项目开发完成

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

128
src/api/hjm/hjmCar/index.ts Normal file
View File

@@ -0,0 +1,128 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api/index';
import type { HjmCar, HjmCarParam } from './model';
/**
* 分页查询黄家明_车辆管理
*/
export async function pageHjmCar(params: HjmCarParam) {
const res = await request.get<ApiResult<PageResult<HjmCar>>>(
'/hjm/hjm-car/page',
params
);
if (res.code === 0) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 查询黄家明_车辆管理列表
*/
export async function listHjmCar(params?: HjmCarParam) {
const res = await request.get<ApiResult<HjmCar[]>>(
'/hjm/hjm-car',
{
params
}
);
if (res.code === 0 && res.data) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 添加黄家明_车辆管理
*/
export async function addHjmCar(data: HjmCar) {
const res = await request.post<ApiResult<unknown>>(
'/hjm/hjm-car',
data
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 修改黄家明_车辆管理
*/
export async function updateHjmCar(data: HjmCar) {
const res = await request.put<ApiResult<unknown>>(
'/hjm/hjm-car',
data
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 删除黄家明_车辆管理
*/
export async function removeHjmCar(id?: number) {
const res = await request.del<ApiResult<unknown>>(
'/hjm/hjm-car/' + id
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 批量删除黄家明_车辆管理
*/
export async function removeBatchHjmCar(data: (number | undefined)[]) {
const res = await request.del<ApiResult<unknown>>(
'/hjm/hjm-car/batch',
{
data
}
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 根据id查询黄家明_车辆管理
*/
export async function getHjmCar(id: number) {
const res = await request.get<ApiResult<HjmCar>>(
'/hjm/hjm-car/' + id
);
if (res.code === 0 && res.data) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 根据code查询黄家明_车辆管理
*/
export async function getHjmCarByCode(code: string) {
const res = await request.get<ApiResult<HjmCar>>(
'/hjm/hjm-car/getByCode/' + code
);
if (res.code === 0 && res.data) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
export async function pageByQQMap(params: HjmCarParam) {
const res = await request.get<ApiResult<PageResult<HjmCar>>>(
'/hjm/hjm-car/pageByQQMap',
params
);
if (res.code === 0) {
return res.data;
}
return Promise.reject(new Error(res.message));
}

View File

@@ -0,0 +1,68 @@
import type { PageParam } from '@/api/index';
/**
* 黄家明_车辆管理
*/
export interface HjmCar {
// 自增ID
id?: number;
// 车辆名称
name?: string;
// 车辆图片
image?: string;
// 类型 0汽车 1其他车
type?: number;
// 快递公司
kuaidi?: string;
// 管理负责人
kuaidiAdmin?: string;
organization?: string;
organizationParentId?: number;
parentOrganization?: string;
parentOrganizationAdmin?: string;
// 车辆编号
code?: string;
// 操作员
driver?: number;
// 保险状态
insuranceStatus?: number;
// GPS设备编号
gpsNo?: string;
// 电子围栏
fence?: string;
// 位置
location?: string;
// 经度
longitude?: number,
// 纬度
latitude?: number,
// 地址
address?: string,
// 用户ID
userId?: number;
// 排序(数字越小越靠前)
sortNumber?: number;
// 备注
comments?: string;
// 状态, 0正常, 1冻结
status?: number;
// 是否删除, 0否, 1是
deleted?: number;
// 租户id
tenantId?: number;
// 创建时间
createTime?: string;
// 更新时间
updateTime?: string;
}
/**
* 黄家明_车辆管理搜索条件
*/
export interface HjmCarParam extends PageParam {
id?: number;
userId?: number;
latitude?: number;
longitude?: number;
keywords?: string;
}

View File

@@ -109,7 +109,7 @@ export async function getWxOpenId(data: any) {
// 获取微信openId
export async function loginByOpenId(data: any) {
const res = await request.post<ApiResult<any>>('/wx-login/loginByOpenId', data);
const res = await request.post<ApiResult<any>>(SERVER_API_URL + '/wx-login/loginByOpenId', data);
if (res.code === 0) {
return res.data;
}

View File

@@ -6,7 +6,7 @@ import type {
CaptchaResult,
SmsCaptchaResult
} from './model';
import {SERVER_API_URL} from "@/utils/server";
import {saveStorageByLoginUser, SERVER_API_URL} from "@/utils/server";
/**
* 登录
@@ -50,6 +50,10 @@ export async function loginBySms(data: LoginParam) {
);
if (res.code === 0) {
console.log(res.data,'登录成功')
console.log(res.data?.user,'2222')
if(res.data?.user){
saveStorageByLoginUser(`${res.data?.access_token}`, res.data?.user)
}
// setToken(res.data.data?.access_token, data.remember);
// if (res.data.data?.user) {
// const user = res.data.data?.user;

View File

@@ -28,15 +28,21 @@ export default defineAppConfig({
{
"root": "user",
"pages": [
"car/index",
"bx/index",
"company/company",
"profile/profile",
"setting/setting"
]
},
{
"root": "website",
"root": "hjm",
"pages": [
"modify"
"list",
"location",
"query",
"fence",
"baoxiu"
]
}
// {
@@ -64,36 +70,45 @@ export default defineAppConfig({
navigationBarTitleText: 'WeChat',
navigationBarTextStyle: 'black'
},
tabBar: {
custom: false,
color: "#8a8a8a",
selectedColor: "#9a23d4",
backgroundColor: "#ffffff",
list: [
{
pagePath: "pages/index/index",
iconPath: "assets/tabbar/home.png",
selectedIconPath: "assets/tabbar/home-active.png",
text: "寄件",
},
{
pagePath: "pages/order/order",
iconPath: "assets/tabbar/order.png",
selectedIconPath: "assets/tabbar/order-active.png",
text: "查件",
},
{
pagePath: "pages/kefu/kefu",
iconPath: "assets/tabbar/kefu.png",
selectedIconPath: "assets/tabbar/kefu-active.png",
text: "客服",
},
{
pagePath: "pages/user/user",
iconPath: "assets/tabbar/user.png",
selectedIconPath: "assets/tabbar/user-active.png",
text: "我的",
},
],
// tabBar: {
// custom: false,
// color: "#8a8a8a",
// selectedColor: "#9a23d4",
// backgroundColor: "#ffffff",
// list: [
// {
// pagePath: "pages/index/index",
// iconPath: "assets/tabbar/home.png",
// selectedIconPath: "assets/tabbar/home-active.png",
// text: "寄件",
// },
// {
// pagePath: "pages/order/order",
// iconPath: "assets/tabbar/order.png",
// selectedIconPath: "assets/tabbar/order-active.png",
// text: "查件",
// },
// {
// pagePath: "pages/kefu/kefu",
// iconPath: "assets/tabbar/kefu.png",
// selectedIconPath: "assets/tabbar/kefu-active.png",
// text: "客服",
// },
// {
// pagePath: "pages/user/user",
// iconPath: "assets/tabbar/user.png",
// selectedIconPath: "assets/tabbar/user-active.png",
// text: "我的",
// },
// ],
// },
requiredPrivateInfos: [
"getLocation",
"chooseLocation"
],
permission: {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
}
}
})

View File

@@ -1,29 +1,26 @@
import {useEffect} from 'react'
import Taro, { useDidShow, useDidHide } from '@tarojs/taro'
import Taro, {useDidShow, useDidHide} from '@tarojs/taro'
// 全局样式
import './app.scss'
import {loginByOpenId} from "@/api/layout";
import {TenantId} from "@/utils/config";
import {saveStorageByLoginUser} from "@/utils/server";
// import {saveStorageByLoginUser} from "@/utils/server";
function App(props) {
const reload = () => {
// 根据openid无感登录
if (!Taro.getStorageSync('access_token')) {
Taro.login({
success: (res) => {
loginByOpenId({
code: res.code,
tenantId: TenantId
}).then(data => {
if(data){
saveStorageByLoginUser(data.access_token, data.user)
}
})
}
})
}
Taro.login({
success: (res) => {
loginByOpenId({
code: res.code,
tenantId: TenantId
}).then(data => {
if (data) {
// saveStorageByLoginUser(data.access_token, data.user)
}
})
}
})
};
// 可以使用所有的 React Hooks
useEffect(() => {
@@ -38,10 +35,12 @@ function App(props) {
}, []);
// 对应 onShow
useDidShow(() => {})
useDidShow(() => {
})
// 对应 onHide
useDidHide(() => {})
useDidHide(() => {
})
return props.children
}

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

View File

@@ -0,0 +1,30 @@
import { useEffect, useState } from 'react'
import { Swiper } from '@nutui/nutui-react-taro'
import {CmsAd} from "@/api/cms/cmsAd/model";
import {getCmsAd} from "@/api/cms/cmsAd";
const MyPage = () => {
const [item, setItem] = useState<CmsAd>()
const reload = () => {
getCmsAd(366).then(data => {
setItem(data)
})
}
useEffect(() => {
reload()
}, [])
return (
<>
<Swiper defaultValue={0} height={279} indicator style={{ height: '280px' }}>
{item?.imageList?.map((item) => (
<Swiper.Item key={item}>
<img width="100%" height="100%" src={item.url} alt="" style={{ height: '280px' }} />
</Swiper.Item>
))}
</Swiper>
</>
)
}
export default MyPage

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 p-3'}>
{props.data?.map((item, index) => {
return (
<div key={index} className={'flex bg-white rounded-lg w-full p-3 mb-2'}
onClick={() => Taro.navigateTo({url: '/hjm/location?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

View File

@@ -0,0 +1,69 @@
import {useEffect, useState} from "react";
import {Tabs, TabPane} from '@nutui/nutui-react-taro'
const list = [
{
title: '今天',
id: 1
},
{
title: '昨天',
id: 2
},
{
title: '过去7天',
id: 3
},
{
title: '过去30天',
id: 4
}
]
const Chart = () => {
const [tapIndex, setTapIndex] = useState<string | number>('0')
const reload = () => {
}
useEffect(() => {
reload()
}, [])
return (
<>
<Tabs
align={'left'}
tabStyle={{position: 'sticky', top: '0px'}}
value={tapIndex}
onChange={(paneKey) => {
setTapIndex(paneKey)
}}
>
{
list?.map((item, index) => {
return (
<TabPane key={index} title={item.title}/>
)
})
}
</Tabs>
{
list?.map((item, index) => {
console.log(item.title)
return (
<div key={index} className={'px-3'}>
{
tapIndex != index ? null :
<div className={'bg-white rounded-lg p-4 flex justify-center items-center text-center text-gray-300'} style={{height: '200px'}}>
线
</div>
}
</div>
)
})
}
</>
)
}
export default Chart

View File

@@ -0,0 +1,56 @@
import {useEffect, useState} from "react";
import Taro from '@tarojs/taro'
import {Button} from '@nutui/nutui-react-taro'
import {Target, Scan} from '@nutui/icons-react-taro'
import {getUserInfo} from "@/api/layout";
const ExpirationTime = () => {
const [roleName, setRoleName] = useState<string>()
const onScanCode = () => {
Taro.scanCode({
onlyFromCamera: true,
scanType: ['qrCode'],
success: (res) => {
console.log(res,'qrcode...')
Taro.navigateTo({ url: '/hjm/query?id=' + res.result })
},
fail: (res) => {
console.log(res,'扫码失败')
Taro.showToast({
title: '扫码失败',
icon: 'none',
duration: 2000
})
}
})
}
useEffect(() => {
getUserInfo().then((data) => {
if (data) {
data.roles?.map((item,index) => {
if(index == 0){
setRoleName(item.roleCode)
}
})
}
})
}, [])
return (
<div className={'mb-3 w-full fixed'} style={{ marginTop: '90px'}}>
<div className={'w-full flex justify-around items-center py-3 rounded-lg'}>
<Button size={'large'} style={{ background: 'linear-gradient(to right, #f3f2f7, #805de1)',borderColor:'#f3f2f7'}} icon={<Target />} onClick={() => Taro.navigateTo({ url: '/hjm/location' })}></Button>
<Button size={'large'} style={{ background: 'linear-gradient(to right, #fffbe6, #ffc53d)',borderColor:'#f3f2f7'}} icon={<Scan />} onClick={onScanCode}></Button>
{
roleName == 'youzheng' && <Button size={'large'} style={{ background: 'linear-gradient(to right, #eaff8f, #7cb305)',borderColor:'#f3f2f7'}} icon={<Target />} onClick={() => Taro.navigateTo({ url: '/hjm/fence' })}></Button>
}
{
roleName == 'kuaidiyuan' && <Button size={'large'} style={{ background: 'linear-gradient(to right, #ffa39e, #ff4d4f)',borderColor:'#f3f2f7'}} icon={<Target />} onClick={() => Taro.navigateTo({ url: '/hjm/baoxiu' })}></Button>
}
</div>
</div>
)
}
export default ExpirationTime

View File

@@ -0,0 +1,56 @@
import {useEffect, useState} from "react";
import Taro from '@tarojs/taro';
import {TriangleDown} from '@nutui/icons-react-taro'
import {Popup, Avatar, NavBar} from '@nutui/nutui-react-taro'
const Header = (props: any) => {
const [showBasic, setShowBasic] = useState(false)
const [statusBarHeight, setStatusBarHeight] = useState<number>()
const reload = () => {
Taro.getSystemInfo({
success: (res) => {
setStatusBarHeight(res.statusBarHeight)
},
})
}
useEffect(() => {
reload()
}, [])
return (
<>
<NavBar
fixed={true}
style={{marginTop: `${statusBarHeight}px`, backgroundColor: 'transparent'}}
onBackClick={() => {
}}
left={
<div className={'flex items-center gap-2'} onClick={() => setShowBasic(true)}>
<Avatar
size="22"
shape="square"
src={props.user?.avatar}
/>
{props.user?.nickname}
<TriangleDown size={9}/>
</div>
}
>
</NavBar>
<Popup
visible={showBasic}
position="bottom"
className={'w-full h-full'}
onClose={() => {
setShowBasic(false)
}}
>
<div className={'py-3 font-bold text-center'}></div>
</Popup>
</>
)
}
export default Header

View File

@@ -0,0 +1,68 @@
import {useEffect, useState} from "react";
import {ArrowRight} from '@nutui/icons-react-taro'
import {CmsArticle} from "@/api/cms/cmsArticle/model";
import Taro from '@tarojs/taro'
import {useRouter} from '@tarojs/taro'
import {BaseUrl} from "@/utils/config";
import {TEMPLATE_ID} from "@/utils/server";
/**
* 帮助中心
* @constructor
*/
const Help = () => {
const {params} = useRouter();
const [categoryId, setCategoryId] = useState<number>(3494)
const [list, setList] = useState<CmsArticle[]>([])
const reload = () => {
if (params.id) {
setCategoryId(Number(params.id))
}
Taro.request({
url: BaseUrl + '/cms/cms-article/page',
method: 'GET',
data: {
categoryId
},
header: {
'content-type': 'application/json',
TenantId: TEMPLATE_ID
},
success: function (res) {
const data = res.data.data;
if (data?.list) {
setList(data?.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={'title-bar flex justify-between items-center w-full mb-2'}>
<div className={'font-bold text-lg flex text-gray-800 justify-center items-center'}></div>
<a className={'text-gray-400 text-sm'} onClick={() => Taro.navigateTo({url: `/cms/article?id=${categoryId}`})}></a>
</div>
<div className={'bg-white min-h-36 w-full'}>
{
list.map((item, index) => {
return (
<div key={index} className={'flex justify-between items-center py-2'} onClick={() => Taro.navigateTo({url: `/cms/help?id=${item.articleId}`}) }>
<div className={'text-sm'}>{item.title}</div>
<ArrowRight color={'#cccccc'} size={18} />
</div>
)
})
}
</div>
</div>
</div>
)
}
export default Help

View File

@@ -0,0 +1,106 @@
import {useEffect, useState} from "react";
import Taro from '@tarojs/taro'
import {Input, Radio, Button} from '@nutui/nutui-react-taro'
import {TenantId} from "@/utils/config";
import './login.scss';
import {saveStorageByLoginUser} from "@/utils/server";
const Login = (props:any) => {
const [isAgree, setIsAgree] = useState(false)
const [env, setEnv] = useState<string>()
/* 获取用户手机号 */
const handleGetPhoneNumber = ({detail}) => {
const {code, encryptedData, iv} = detail
Taro.login({
success: function () {
if (code) {
Taro.request({
url: 'https://server.gxwebsoft.com/api/wx-login/loginByMpWxPhone',
method: 'POST',
data: {
code,
encryptedData,
iv,
notVerifyPhone: true,
refereeId: 0,
sceneType: 'save_referee',
tenantId: TenantId
},
header: {
'content-type': 'application/json',
TenantId
},
success: function (res) {
saveStorageByLoginUser(res.data.data.access_token,res.data.data.user)
props.done(res.data.data.user);
}
})
} else {
console.log('登录失败!')
}
}
})
}
const reload = () => {
Taro.hideTabBar()
setEnv(Taro.getEnv())
}
useEffect(() => {
reload()
}, [])
return (
<>
<div style={{height: '80vh'}} className={'flex flex-col justify-center px-5'}>
<div className={'text-3xl text-center py-5 font-normal mb-10 '}></div>
{
env === 'WEAPP' && (
<>
<div className={'flex flex-col w-full text-white rounded-full justify-between items-center my-2'} style={{ background: 'linear-gradient(to right, #7e22ce, #9333ea)'}}>
<Button open-type="getPhoneNumber" onGetPhoneNumber={handleGetPhoneNumber}>
</Button>
</div>
</>
)
}
{
env === 'WEB' && (
<>
<div className={'flex flex-col justify-between items-center my-2'}>
<Input type="text" placeholder="手机号" maxLength={11}
style={{backgroundColor: '#ffffff', borderRadius: '8px'}}/>
</div>
<div className={'flex flex-col justify-between items-center my-2'}>
<Input type="password" placeholder="密码" style={{backgroundColor: '#ffffff', borderRadius: '8px'}}/>
</div>
<div className={'flex justify-between my-2 text-left px-1'}>
<a href={'#'} className={'text-blue-600 text-sm'}
onClick={() => Taro.navigateTo({url: '/passport/forget'})}></a>
<a href={'#'} className={'text-blue-600 text-sm'}
onClick={() => Taro.navigateTo({url: '/passport/setting'})}></a>
</div>
<div className={'flex justify-center my-5'}>
<Button type="info" size={'large'} className={'w-full rounded-lg p-2'} disabled={!isAgree}></Button>
</div>
<div className={'w-full bottom-20 my-2 flex justify-center text-sm items-center text-center'}>
<a href={''} onClick={() => Taro.navigateTo({url: '/passport/register'})}
className={'text-blue-600'}></a>
</div>
<div className={'my-2 flex fixed bottom-20 text-sm items-center px-1'}>
<Radio style={{color: '#333333'}} checked={isAgree} onClick={() => setIsAgree(!isAgree)}></Radio>
<span className={'text-gray-400'} onClick={() => setIsAgree(!isAgree)}></span><a
onClick={() => Taro.navigateTo({url: '/passport/agreement'})}
className={'text-blue-600'}></a>
</div>
</>
)
}
</div>
</>
)
}
export default Login

View File

@@ -0,0 +1,211 @@
import {useEffect, useState} from 'react'
import {navigateTo} from '@tarojs/taro'
import Taro from '@tarojs/taro'
import {Button} from '@tarojs/components';
import {Image} from '@nutui/nutui-react-taro'
import {getUserInfo, getWxOpenId} from "@/api/layout";
import {TenantId} from "@/utils/config";
import {User} from "@/api/system/user/model";
// import News from "./News";
import {myPageBszxBm} from "@/api/bszx/bszxBm";
import {listCmsNavigation} from "@/api/cms/cmsNavigation";
const Page = () => {
const [loading, setLoading] = useState(true)
const [isLogin, setIsLogin] = useState<boolean>(false)
const [userInfo, setUserInfo] = useState<User>()
const [bmLogs, setBmLogs] = useState<any>()
const [navItems, setNavItems] = useState<any>([])
/* 获取用户手机号 */
const handleGetPhoneNumber = ({detail}) => {
const {code, encryptedData, iv} = detail
Taro.login({
success: function () {
if (code) {
Taro.request({
url: 'https://server.gxwebsoft.com/api/wx-login/loginByMpWxPhone',
method: 'POST',
data: {
code,
encryptedData,
iv,
notVerifyPhone: true,
refereeId: 0,
sceneType: 'save_referee',
tenantId: TenantId
},
header: {
'content-type': 'application/json',
TenantId
},
success: function (res) {
Taro.setStorageSync('access_token', res.data.data.access_token)
Taro.setStorageSync('UserId', res.data.data.user.userId)
setUserInfo(res.data.data.user)
Taro.setStorageSync('Phone', res.data.data.user.phone)
setIsLogin(true)
Taro.showToast({
title: '登录成功',
icon: 'success'
});
}
})
} else {
console.log('登录失败!')
}
}
})
}
const onLogin = (item: any, index: number) => {
if(!isLogin){
return navigateTo({url: `/pages/category/category?id=${item.navigationId}`})
}else {
// 报名链接
if(index == 0){
console.log(bmLogs,'bmLogs')
if(bmLogs && bmLogs.length > 0){
return navigateTo({url: `/bszx/bm-cert/bm-cert?id=${bmLogs[0].id}`})
}else {
navigateTo({url: `/user/profile/profile`})
}
}
// 善款明细
if(item.navigationId == 4119){
return navigateTo({url: `/bszx/pay-record/pay-record`})
}
return navigateTo({url: `/pages/category/category?id=${item.navigationId}`})
}
}
const reload = () => {
// 读取栏目
listCmsNavigation({parentId: 2828,hide: 0}).then(res => {
console.log(res,'9999')
setNavItems(res);
})
Taro.getUserInfo({
success: (res) => {
const avatar = res.userInfo.avatarUrl;
setUserInfo({
avatar,
nickname: res.userInfo.nickName,
sexName: res.userInfo.gender == 1 ? '男' : '女'
})
getUserInfo().then((data) => {
if (data) {
setUserInfo(data)
setIsLogin(true);
console.log(userInfo, 'userInfo...')
Taro.setStorageSync('UserId', data.userId)
// 获取openId
if (!data.openid) {
Taro.login({
success: (res) => {
getWxOpenId({code: res.code}).then(() => {
})
}
})
}
}
}).catch(() => {
console.log('未登录')
});
}
});
// 报名日志
myPageBszxBm({limit: 1}).then(res => {
if (res.list) {
setBmLogs(res.list);
}
})
setLoading(false);
};
const showAuthModal = () => {
Taro.showModal({
title: '授权提示',
content: '需要获取您的用户信息',
confirmText: '去授权',
cancelText: '取消',
success: (res) => {
if (res.confirm) {
// 用户点击确认,打开授权设置页面
openSetting();
}
}
});
};
const openSetting = () => {
// Taro.openSetting调起客户端小程序设置界面返回用户设置的操作结果。设置界面只会出现小程序已经向用户请求过的权限。
Taro.openSetting({
success: (res) => {
if (res.authSetting['scope.userInfo']) {
// 用户授权成功,可以获取用户信息
reload();
} else {
// 用户拒绝授权,提示授权失败
Taro.showToast({
title: '授权失败',
icon: 'none'
});
}
}
});
};
useEffect(() => {
Taro.getSetting({
success: (res) => {
if (res.authSetting['scope.userInfo']) {
// 用户已经授权过,可以直接获取用户信息
console.log('用户已经授权过,可以直接获取用户信息')
reload();
} else {
// 用户未授权,需要弹出授权窗口
console.log('用户未授权,需要弹出授权窗口')
showAuthModal();
}
}
});
reload();
}, [])
return (
<div className={'my-3'}>
<div className={'pt-4 bg-yellow-50 rounded-2xl'}
style={{background: 'linear-gradient(to bottom, #ffffff, #ffffcc)'}}>
<div className={'flex justify-between pb-2 px-1'}>
{
navItems.map((item, index) => (
<div key={index} className={'text-center'}>
{
isLogin && !loading ?
<div className={'flex flex-col justify-center items-center'} onClick={() => {
onLogin(item, index)
}}>
<Image src={item.icon} height={28} width={28}/>
<div className={'mt-2'} style={{fontSize: '15px'}}>{item?.title}</div>
</div>
:
<Button className={'text-white'} open-type="getPhoneNumber" onGetPhoneNumber={handleGetPhoneNumber}>
<div className={'flex flex-col justify-center items-center'}>
<Image src={item.icon} height={28} width={28}/>
<div className={'mt-2 text-gray-700'} style={{fontSize: '15px'}}>{item?.title}</div>
</div>
</Button>
}
</div>
))
}
</div>
</div>
{/*<image src={'https://oss.wsdns.cn/20250224/18a2f3b807c94aac8a67af34e95534d6.jpeg'} className={'book'}>倡议书</image>*/}
{/*<News id={categoryId}/>*/}
</div>
)
}
export default Page

View File

@@ -0,0 +1,29 @@
import {useEffect, useState} from "react";
import {Input, Button} from '@nutui/nutui-react-taro'
import {copyText} from "@/utils/common";
import Taro from '@tarojs/taro'
const SiteUrl = (props: any) => {
const [siteUrl, setSiteUrl] = useState<string>('')
const reload = () => {
if(props.tenantId){
setSiteUrl(`https://${props.tenantId}.shoplnk.cn`)
}else {
setSiteUrl(`https://${Taro.getStorageSync('TenantId')}.shoplnk.cn`)
}
}
useEffect(() => {
reload()
}, [props])
return (
<div className={'px-3 mt-1 mb-4'}>
<div className={'flex justify-between items-center bg-gray-300 rounded-lg pr-2'}>
<Input type="text" value={siteUrl} disabled style={{backgroundColor: '#d1d5db', borderRadius: '8px'}}/>
<Button type={'info'} onClick={() => copyText(siteUrl)}></Button>
</div>
</div>
)
}
export default SiteUrl

View File

@@ -0,0 +1,38 @@
import { useRef, useEffect } from 'react'
import { View } from '@tarojs/components'
import { EChart } from "echarts-taro3-react";
import './index.scss'
export default function Index() {
const refBarChart = useRef<any>()
const defautOption = {
xAxis: {
type: "category",
data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
},
yAxis: {
type: "value",
},
series: [
{
data: [120, 200, 150, 80, 70, 110, 130],
type: "line",
showBackground: true,
backgroundStyle: {
color: "rgba(220, 220, 220, 0.8)",
},
},
],
};
useEffect(() => {
if(refBarChart.current) {
refBarChart.current?.refresh(defautOption);
}
})
return (
<View className='index'>
<EChart ref={refBarChart} canvasId='line-canvas' />
</View>
)
}

View File

@@ -0,0 +1,7 @@
.index {
width: 100vw;
height: 100vh;
background-color: #F3F3F3;
background-repeat: no-repeat;
background-size: 100%;
}

View File

@@ -0,0 +1,5 @@
export default definePageConfig({
navigationBarTitleText: 'shopLnk.cn - 数灵云店',
navigationBarTextStyle: 'black',
navigationStyle: 'custom'
})

View File

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

View File

@@ -0,0 +1,166 @@
import Header from './Header'
import BestSellers from "./BestSellers";
import './index.scss'
import Taro from '@tarojs/taro';
import {InfiniteLoading} from '@nutui/nutui-react-taro'
import {useShareAppMessage, useShareTimeline} from "@tarojs/taro"
import {useEffect, useState} from "react";
import ExpirationTime from "./ExpirationTime";
import {User} from "@/api/system/user/model";
import {getSiteInfo, getUserInfo, getWxOpenId} from "@/api/layout";
import Login from "./Login";
import {CmsWebsite} from "@/api/cms/cmsWebsite/model";
import {pageHjmCar} from "@/api/hjm/hjmCar";
import {HjmCar} from "@/api/hjm/hjmCar/model";
function Home() {
const [website, setWebsite] = useState<CmsWebsite>()
const [IsLogin, setIsLogin] = useState<boolean>(true)
const [userInfo, setUserInfo] = useState<User>()
const [list, setList] = useState<HjmCar[]>([])
console.log(userInfo?.nickname)
console.log(website?.websiteName)
// const [hasMore, setHasMore] = useState(true)
// const [list, setList] = useState<BszxPay[]>([])
// const [page, setPage] = useState(1)
useShareTimeline(() => {
return {
title: '注册即可开通 - webSoft云应用',
path: `/pages/index/index`
};
});
useShareAppMessage(() => {
return {
title: '注册即可开通 - webSoft云应用',
path: `/pages/index/index`,
success: function (res) {
console.log('分享成功', res);
},
fail: function (res) {
console.log('分享失败', res);
}
};
});
// const reloadMore = async () => {
// setPage(page + 1)
// }
const showAuthModal = () => {
Taro.showModal({
title: '授权提示',
content: '需要获取您的用户信息',
confirmText: '去授权',
cancelText: '取消',
success: (res) => {
if (res.confirm) {
// 用户点击确认,打开授权设置页面
openSetting();
}
}
});
};
const openSetting = () => {
// Taro.openSetting调起客户端小程序设置界面返回用户设置的操作结果。设置界面只会出现小程序已经向用户请求过的权限。
Taro.openSetting({
success: (res) => {
if (res.authSetting['scope.userInfo']) {
// 用户授权成功,可以获取用户信息
reload();
} else {
// 用户拒绝授权,提示授权失败
Taro.showToast({
title: '授权失败',
icon: 'none'
});
}
}
});
};
// 登录成功后回调
const handleLogin = (data: User) => {
setIsLogin(true)
setUserInfo(data)
Taro.showTabBar()
reload();
}
const reload = () => {
Taro.hideTabBar()
// 获取站点信息
getSiteInfo().then((data) => {
console.log(data,'siteInfo')
setWebsite(data)
})
// 获取用户信息
Taro.getUserInfo({
success: (res) => {
const avatar = res.userInfo.avatarUrl;
setUserInfo({
avatar,
nickname: res.userInfo.nickName,
sexName: res.userInfo.gender == 1 ? '男' : '女'
})
getUserInfo().then((data) => {
if (data) {
setUserInfo(data)
setIsLogin(true);
Taro.setStorageSync('UserId', data.userId)
// 获取openId
if (!data.openid) {
Taro.login({
success: (res) => {
getWxOpenId({code: res.code}).then(() => {
})
}
})
}
}
}).catch(() => {
setIsLogin(false);
console.log('未登录')
});
}
});
pageHjmCar({}).then(res => {
setList(res?.list || [])
})
};
useEffect(() => {
// Taro.getSetting获取用户的当前设置。返回值中只会出现小程序已经向用户请求过的权限。
Taro.getSetting({
success: (res) => {
if (res.authSetting['scope.userInfo']) {
// 用户已经授权过,可以直接获取用户信息
console.log('用户已经授权过,可以直接获取用户信息')
reload();
} else {
// 用户未授权,需要弹出授权窗口
console.log('用户未授权,需要弹出授权窗口')
showAuthModal();
}
}
});
}, []);
return (
<>
{!IsLogin ? (<Login done={handleLogin}/>) : (<>
<Header user={userInfo}/>
<ExpirationTime />
<InfiniteLoading
className={'w-full fixed left-0 top-40'}
>
<BestSellers data={list}/>
</InfiniteLoading>
</>)}
</>
)
}
export default Home

View File

@@ -0,0 +1,10 @@
// 微信授权按钮的特殊样式
button[open-type="getPhoneNumber"] {
width: 100%;
padding: 8px 0 !important;
height: 80px;
color: #ffffff !important;
margin: 0 !important;
border: none !important;
border-radius: 50px !important;
}

View File

@@ -1,5 +1,8 @@
import {useEffect} from "react";
const BestSellers = () => {
import {Image, Space} from '@nutui/nutui-react-taro'
import Taro from '@tarojs/taro'
const BestSellers = (props: any) => {
const reload = () => {
}
@@ -9,16 +12,30 @@ const BestSellers = () => {
}, [])
return (
<div className={'px-3 mb-4'}>
<div className={'flex flex-col justify-between items-center bg-white rounded-lg p-3'}>
<div className={'title-bar flex justify-between items-center w-full mb-2'}>
<div className={'font-bold text-lg text-gray-800 flex justify-center items-center'}></div>
<a className={'text-gray-400 text-sm'}></a>
</div>
<div className={'bg-white h-48 w-full'}>
</div>
<div className={'px-2 mb-4'}>
<div className={'flex flex-col justify-between items-center rounded-lg p-3'}>
{props.data?.map((item, index) => {
return (
<div key={index} className={'flex bg-white rounded-lg w-full p-3 mb-2'}
onClick={() => Taro.navigateTo({url: '/hjm/location?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>
)
}

View File

@@ -1,16 +1,54 @@
import {useEffect} from "react";
import {useEffect, useState} from "react";
import Taro from '@tarojs/taro'
import {Button} from '@nutui/nutui-react-taro'
import {Target, Scan, Truck} from '@nutui/icons-react-taro'
import {getUserInfo} from "@/api/layout";
const ExpirationTime = () => {
const [roleName, setRoleName] = useState<string>()
const onScanCode = () => {
Taro.scanCode({
onlyFromCamera: true,
scanType: ['qrCode'],
success: (res) => {
console.log(res,'qrcode...')
Taro.navigateTo({ url: '/hjm/query?id=' + res.result })
},
fail: (res) => {
console.log(res,'扫码失败')
Taro.showToast({
title: '扫码失败',
icon: 'none',
duration: 2000
})
}
})
}
useEffect(() => {
getUserInfo().then((data) => {
if (data) {
data.roles?.map((item,index) => {
if(index == 0){
setRoleName(item.roleCode)
}
})
}
})
}, [])
return (
<div className={'px-3 my-4'}>
<div className={'w-full flex flex-col justify-center items-center bg-white py-4 rounded-lg'}>
<div className={'text-lg py-2 text-gray-800 font-bold'}>11</div>
<Button></Button>
<div className={'mb-3 fixed top-36 z-20'} style={{ width: '94%', marginLeft: '3%'}}>
<div className={'w-full flex justify-around items-center py-3 rounded-lg'}>
<Button size={'large'} style={{ background: 'linear-gradient(to right, #f3f2f7, #805de1)',borderColor:'#f3f2f7'}} icon={<Truck />} onClick={() => Taro.navigateTo({ url: '/hjm/list' })}></Button>
<Button size={'large'} style={{ background: 'linear-gradient(to right, #fffbe6, #ffc53d)',borderColor:'#f3f2f7'}} icon={<Scan />} onClick={onScanCode}></Button>
{
roleName == 'youzheng' && <Button size={'large'} style={{ background: 'linear-gradient(to right, #eaff8f, #7cb305)',borderColor:'#f3f2f7'}} icon={<Target />} onClick={() => Taro.navigateTo({ url: '/hjm/fence' })}></Button>
}
{
roleName == 'kuaidiyuan' && <Button size={'large'} style={{ background: 'linear-gradient(to right, #ffa39e, #ff4d4f)',borderColor:'#f3f2f7'}} icon={<Target />} onClick={() => Taro.navigateTo({ url: '/hjm/baoxiu' })}></Button>
}
</div>
</div>
)

View File

@@ -1,11 +1,17 @@
import {useEffect, useState} from "react";
import Taro from '@tarojs/taro';
import {TriangleDown} from '@nutui/icons-react-taro'
import { Avatar,NavBar} from '@nutui/nutui-react-taro'
import {Popup, Avatar, NavBar} from '@nutui/nutui-react-taro'
const Header = (props: any) => {
const [showBasic, setShowBasic] = useState(false)
const [statusBarHeight, setStatusBarHeight] = useState<number>()
const onNav = () => {
Taro.navigateTo({
url: '/pages/user/user',
})
}
const reload = () => {
Taro.getSystemInfo({
success: (res) => {
@@ -22,22 +28,33 @@ const Header = (props: any) => {
<>
<NavBar
fixed={true}
style={{marginTop: `${statusBarHeight}px`}}
style={{marginTop: `${statusBarHeight}px`, backgroundColor: 'transparent'}}
onBackClick={() => {
}}
left={
<div className={'flex items-center gap-2'}>
<div className={'flex items-center gap-2'} onClick={onNav}>
<Avatar
size="22"
shape="square"
src={props.website?.websiteLogo}
src={props.user?.avatar}
/>
{props.website?.websiteName}
{props.user?.nickname}
<TriangleDown size={9}/>
</div>
}
>
</NavBar>
<Popup
visible={showBasic}
position="bottom"
className={'w-full h-full'}
onClose={() => {
setShowBasic(false)
}}
>
<div className={'py-3 font-bold text-center'}></div>
</Popup>
</>
)
}

View File

@@ -24,7 +24,6 @@ const Login = (props:any) => {
iv,
notVerifyPhone: true,
refereeId: 0,
isSuperAdmin: true,
sceneType: 'save_referee',
tenantId: TenantId
},

View File

@@ -1,3 +1,4 @@
page {
background: url("https://oss.wsdns.cn/20250414/5bed65bff2f8434995e6c22d67271c77.png");
background-size: cover;
}

View File

@@ -1,11 +1,11 @@
import Header from './Header'
import Chart from "./Chart"
import SiteUrl from "./SiteUrl"
import BestSellers from "./BestSellers";
import Help from "./Help";
// import BestSellers from "./BestSellers";
import './index.scss'
import Taro from '@tarojs/taro';
import {InfiniteLoading} from '@nutui/nutui-react-taro'
import {Map} from '@tarojs/components'
import {Search} from '@nutui/icons-react-taro'
import {Button, Input} from '@nutui/nutui-react-taro'
// import {InfiniteLoading} from '@nutui/nutui-react-taro'
import {useShareAppMessage, useShareTimeline} from "@tarojs/taro"
import {useEffect, useState} from "react";
import ExpirationTime from "./ExpirationTime";
@@ -13,13 +13,31 @@ import {User} from "@/api/system/user/model";
import {getSiteInfo, getUserInfo, getWxOpenId} from "@/api/layout";
import Login from "./Login";
import {CmsWebsite} from "@/api/cms/cmsWebsite/model";
import {pageByQQMap, pageHjmCar} from "@/api/hjm/hjmCar";
import {HjmCar} from "@/api/hjm/hjmCar/model";
export interface Market {
// 自增ID
id?: number;
latitude?: number;
longitude?: number;
name?: string;
title?: string;
}
function Home() {
const [website, setWebsite] = useState<CmsWebsite>()
const [IsLogin, setIsLogin] = useState<boolean>(true)
const [current, setCurrent] = useState<User>()
const [userInfo, setUserInfo] = useState<User>()
const [longitude, setLongitude] = useState<any>(108.374959)
const [latitude, setLatitude] = useState<any>(22.767024)
const [markers, setMarkers] = useState<Market[]>([])
const [scale, setScale] = useState<any>(16)
const [keywords, setKeywords] = useState<string>('')
const [list, setList] = useState<HjmCar[]>([])
console.log(userInfo?.nickname)
console.log(website?.websiteName)
console.log(list.length)
// const [hasMore, setHasMore] = useState(true)
// const [list, setList] = useState<BszxPay[]>([])
// const [page, setPage] = useState(1)
@@ -81,6 +99,10 @@ function Home() {
});
};
const onKeywords = (keywords: string) => {
setKeywords(keywords)
}
// 登录成功后回调
const handleLogin = (data: User) => {
setIsLogin(true)
@@ -89,20 +111,79 @@ function Home() {
reload();
}
// 选择站点
const handleSite = (data: User) => {
setCurrent(data)
Taro.reLaunch({
url: '/pages/index/index'
})
// 获取当前位置
const getLocation = async () => {
try {
const res = await Taro.getLocation({
type: 'gcj02' //返回可以用于wx.openLocation的经纬度
})
pageByQQMap({
latitude: res.latitude,
longitude: res.longitude,
}).then(res => {
if (res?.list && res?.list.length > 0) {
const data = res?.list;
const arr = []
data?.map((item: HjmCar) => {
// @ts-ignore
arr.push({
id: item.id,
latitude: item.latitude,
longitude: item.longitude,
name: item.organization
})
})
setMarkers(arr)
}
})
if (res.latitude) {
setLatitude(res.latitude)
}
if (res.longitude) {
setLongitude(res.longitude)
}
console.log(res)
console.log('当前位置:', res.latitude, res.longitude);
return res;
} catch (err) {
console.error('获取位置失败:', err);
}
}
const reload = () => {
pageHjmCar({keywords}).then(res => {
setList(res?.list || [])
if (res?.list && res?.list.length > 0) {
// const data = res?.list[0];
// setLongitude(data?.longitude)
// setLatitude(data?.latitude)
}
})
};
useEffect(() => {
Taro.hideTabBar()
setScale(14)
getLocation().then()
// 获取站点信息
getSiteInfo().then((data) => {
console.log(data,'siteInfo')
console.log(data, 'siteInfo')
setWebsite(data)
})
// Taro.getSetting获取用户的当前设置。返回值中只会出现小程序已经向用户请求过的权限。
Taro.getSetting({
success: (res) => {
if (res.authSetting['scope.userInfo']) {
// 用户已经授权过,可以直接获取用户信息
console.log('用户已经授权过,可以直接获取用户信息')
reload();
} else {
// 用户未授权,需要弹出授权窗口
console.log('用户未授权,需要弹出授权窗口')
showAuthModal();
}
}
});
// 获取用户信息
Taro.getUserInfo({
success: (res) => {
@@ -133,39 +214,58 @@ function Home() {
});
}
});
};
useEffect(() => {
// Taro.getSetting获取用户的当前设置。返回值中只会出现小程序已经向用户请求过的权限。
Taro.getSetting({
success: (res) => {
if (res.authSetting['scope.userInfo']) {
// 用户已经授权过,可以直接获取用户信息
console.log('用户已经授权过,可以直接获取用户信息')
reload();
} else {
// 用户未授权,需要弹出授权窗口
console.log('用户未授权,需要弹出授权窗口')
showAuthModal();
}
}
});
}, []);
return (
<>
{!IsLogin ? (<Login done={handleLogin}/>) : (<>
<Header website={website} onSite={handleSite}/>
<InfiniteLoading
className={'top-24 w-full fixed left-0'}
>
<SiteUrl tenantId={current?.tenantId}/>
<Chart/>
<ExpirationTime/>
<BestSellers/>
<Help />
<div className={'h-20'}/>
</InfiniteLoading>
<Header user={userInfo}/>
<ExpirationTime/>
<div className={'fixed z-20 top-24 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>
<Map
id="map"
longitude={longitude}
latitude={latitude}
scale={scale}
// @ts-ignore
markers={markers}
onTap={(map) => {
console.log('map tap',map)
}}
style={{width: '100%', height: '100vh'}}
/>
{/*<InfiniteLoading*/}
{/* className={'w-full fixed left-0 top-40'}*/}
{/*>*/}
{/* <BestSellers data={list}/>*/}
{/*</InfiniteLoading>*/}
</>)}
</>
)

View File

@@ -136,7 +136,7 @@ function UserCard() {
<div
className={'user-card w-full bg-blue-900 flex flex-col justify-center rounded-xl'}
style={{
background: 'linear-gradient(to bottom, #7e22ce, #9333ea)', // 这种情况建议使用类名来控制样式(引入外联样式)
background: 'linear-gradient(to bottom, #e1dfff, #f3f2f7)', // 这种情况建议使用类名来控制样式(引入外联样式)
// width: '720rpx',
// margin: '10px auto 0px auto',
height: '144px',
@@ -149,23 +149,23 @@ function UserCard() {
IsLogin ? (
<Avatar size="large" src={userInfo?.avatar} shape="round"/>
) : (
<Button className={'text-white'} open-type="getPhoneNumber" onGetPhoneNumber={handleGetPhoneNumber}>
<Button className={'text-black'} open-type="getPhoneNumber" onGetPhoneNumber={handleGetPhoneNumber}>
<Avatar size="large" src={userInfo?.avatar} shape="round"/>
</Button>
)
}
<div className={'user-info flex flex-col px-2'}>
<div className={'py-1 text-white font-bold'}>{IsLogin ? userInfo?.mobile : '请点击头像登录'}</div>
<div className={'py-1 text-black font-bold'}>{IsLogin ? userInfo?.mobile : '请点击头像登录'}</div>
{IsLogin ? (
<div className={'grade text-xs py-1'}>
<Tag type="success" round>
<div className={'p-1'}>{userInfo?.gradeName || '注册用户'}</div>
<div className={'p-1'}>{userInfo?.realName || '注册用户'}</div>
</Tag>
</div>
) : ''}
</div>
</div>
<div className={'mx-4 text-sm px-3 py-1 text-white border-gray-400 border-solid border-2 rounded-3xl'}
<div className={'mx-4 text-sm px-3 py-1 text-black border-gray-400 border-solid border-2 rounded-3xl'}
onClick={() => navTo('/user/profile/profile', true)}>
{'个人资料'}
</div>

View File

@@ -3,7 +3,7 @@ import {ArrowRight} from '@nutui/icons-react-taro'
import navTo from "@/utils/common";
import UserFooter from "./UserFooter";
import Taro from '@tarojs/taro'
import {Shop, Presentation, PickedUp, Coupon, Bell} from '@nutui/icons-react-taro'
import {Truck, LogisticsError} from '@nutui/icons-react-taro'
import {CSSProperties} from "react";
const UserCell = () => {
@@ -40,14 +40,14 @@ const UserCell = () => {
className="nutui-cell-clickable"
title={
<div style={{display: 'inline-flex', alignItems: 'center'}}>
<Shop size={18}/>
<span className={'pl-3 text-sm'}>线</span>
<Truck size={16}/>
<span className={'pl-3 text-sm'}></span>
</div>
}
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => {
navTo('/bszx/bm-cert/bm-cert', true)
navTo('/user/car/index', true)
}}
/>
</Cell.Group>
@@ -56,96 +56,96 @@ const UserCell = () => {
className="nutui-cell-clickable"
title={
<div style={{display: 'inline-flex', alignItems: 'center'}}>
<Bell size={18}/>
<span style={{marginLeft: '5px'}}></span>
<LogisticsError size={16}/>
<span className={'pl-3 text-sm'}></span>
</div>
}
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => {
navTo('/bszx/pay-log/pay-log', true)
}}
/>
</Cell.Group>
<Cell.Group divider={true} description={
<div style={{display: 'inline-flex', alignItems: 'center'}}>
<span style={{marginTop: '12px'}}></span>
</div>
}>
<Cell
className="nutui-cell-clickable"
title={
<div style={{display: 'inline-flex', alignItems: 'center'}}>
<Presentation size={18}/>
<span style={{marginLeft: '5px'}}></span>
</div>
}
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => {
navTo('/bszx/bm-cert/bm-cert', true)
}}
/>
<Cell
className="nutui-cell-clickable"
title={
<div style={{display: 'inline-flex', alignItems: 'center'}}>
<PickedUp size={18}/>
<span style={{marginLeft: '5px'}}></span>
</div>
}
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => {
navTo('/bszx/pay-log/pay-log', true)
}}
/>
<Cell
className="nutui-cell-clickable"
title={
<div style={{display: 'inline-flex', alignItems: 'center'}}>
<Coupon size={18}/>
<span style={{marginLeft: '5px'}}></span>
</div>
}
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => {
navTo('/user/profile/profile', true)
}}
/>
</Cell.Group>
<Cell.Group divider={true} description={
<div style={{display: 'inline-flex', alignItems: 'center'}}>
<span style={{marginTop: '12px'}}></span>
</div>
}>
<Cell
className="nutui-cell-clickable"
title="店铺设置"
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => Taro.navigateTo({url: '/website/modify'})}
/>
<Cell
className="nutui-cell-clickable"
title="帮助中心"
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => {
navTo('/user/profile/profile', true)
}}
/>
<Cell
className="nutui-cell-clickable"
title="问题反馈"
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => {
navTo('/user/profile/profile', true)
navTo('/user/bx/index', true)
}}
/>
</Cell.Group>
{/*<Cell.Group divider={true} description={*/}
{/* <div style={{display: 'inline-flex', alignItems: 'center'}}>*/}
{/* <span style={{marginTop: '12px'}}>管理</span>*/}
{/* </div>*/}
{/*}>*/}
{/* <Cell*/}
{/* className="nutui-cell-clickable"*/}
{/* title={*/}
{/* <div style={{display: 'inline-flex', alignItems: 'center'}}>*/}
{/* <Presentation size={18}/>*/}
{/* <span style={{marginLeft: '5px'}}>分析</span>*/}
{/* </div>*/}
{/* }*/}
{/* align="center"*/}
{/* extra={<ArrowRight color="#cccccc" size={18}/>}*/}
{/* onClick={() => {*/}
{/* navTo('/bszx/bm-cert/bm-cert', true)*/}
{/* }}*/}
{/* />*/}
{/* <Cell*/}
{/* className="nutui-cell-clickable"*/}
{/* title={*/}
{/* <div style={{display: 'inline-flex', alignItems: 'center'}}>*/}
{/* <PickedUp size={18}/>*/}
{/* <span style={{marginLeft: '5px'}}>客户</span>*/}
{/* </div>*/}
{/* }*/}
{/* align="center"*/}
{/* extra={<ArrowRight color="#cccccc" size={18}/>}*/}
{/* onClick={() => {*/}
{/* navTo('/bszx/pay-log/pay-log', true)*/}
{/* }}*/}
{/* />*/}
{/* <Cell*/}
{/* className="nutui-cell-clickable"*/}
{/* title={*/}
{/* <div style={{display: 'inline-flex', alignItems: 'center'}}>*/}
{/* <Coupon size={18}/>*/}
{/* <span style={{marginLeft: '5px'}}>折扣</span>*/}
{/* </div>*/}
{/* }*/}
{/* align="center"*/}
{/* extra={<ArrowRight color="#cccccc" size={18}/>}*/}
{/* onClick={() => {*/}
{/* navTo('/user/profile/profile', true)*/}
{/* }}*/}
{/* />*/}
{/*</Cell.Group>*/}
{/*<Cell.Group divider={true} description={*/}
{/* <div style={{display: 'inline-flex', alignItems: 'center'}}>*/}
{/* <span style={{marginTop: '12px'}}>设置与帮助</span>*/}
{/* </div>*/}
{/*}>*/}
{/* <Cell*/}
{/* className="nutui-cell-clickable"*/}
{/* title="店铺设置"*/}
{/* align="center"*/}
{/* extra={<ArrowRight color="#cccccc" size={18}/>}*/}
{/* onClick={() => Taro.navigateTo({url: '/website/modify'})}*/}
{/* />*/}
{/* <Cell*/}
{/* className="nutui-cell-clickable"*/}
{/* title="帮助中心"*/}
{/* align="center"*/}
{/* extra={<ArrowRight color="#cccccc" size={18}/>}*/}
{/* onClick={() => {*/}
{/* navTo('/user/profile/profile', true)*/}
{/* }}*/}
{/* />*/}
{/* <Cell*/}
{/* className="nutui-cell-clickable"*/}
{/* title="问题反馈"*/}
{/* align="center"*/}
{/* extra={<ArrowRight color="#cccccc" size={18}/>}*/}
{/* onClick={() => {*/}
{/* navTo('/user/profile/profile', true)*/}
{/* }}*/}
{/* />*/}
{/*</Cell.Group>*/}
<Cell.Group divider={true} description={
<div style={{display: 'inline-flex', alignItems: 'center'}}>
<span style={{marginTop: '12px'}}></span>

View File

@@ -1,5 +1,6 @@
import {loginBySms} from "@/api/passport/login";
import {useState} from "react";
import Taro from '@tarojs/taro'
import {Popup} from '@nutui/nutui-react-taro'
import {UserParam} from "@/api/system/user/model";
import {Button} from '@nutui/nutui-react-taro'
@@ -36,6 +37,11 @@ const UserFooter = () => {
tenantId: 10324
}).then(() => {
setOpenLoginByPhone(false);
setTimeout(() => {
Taro.reLaunch({
url: '/pages/index/index'
})
},1000)
})
}

View File

@@ -1,4 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '我的',
navigationStyle: 'custom'
navigationBarTitleText: '我的'
})

View File

@@ -1,36 +1,16 @@
import {useEffect, useState} from 'react'
import Taro from '@tarojs/taro'
import {NavBar} from '@nutui/nutui-react-taro';
import {useEffect} from 'react'
import UserCard from "./components/UserCard";
import OrderIcon from "./components/OrderIcon";
import UserCell from "./components/UserCell";
function User() {
const [statusBarHeight, setStatusBarHeight] = useState<number>()
useEffect(() => {
Taro.getSystemInfo({
success: (res) => {
setStatusBarHeight(res.statusBarHeight)
},
})
}, []);
return (
<>
<NavBar
fixed={true}
style={{marginTop: `${statusBarHeight}px`}}
onBackClick={() => {
}}
left={
<>
</>
}
>
<span></span>
</NavBar>
<div className={'fixed w-full'} style={{ top: '80px'}}>
<div className={'fixed w-full'}>
<UserCard />
<OrderIcon />
<UserCell />
</div>
</>
)

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

View File

@@ -0,0 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '报险记录',
navigationStyle: 'custom'
})

62
src/user/bx/index.tsx Normal file
View File

@@ -0,0 +1,62 @@
import {useEffect, useState} from "react";
import Taro from '@tarojs/taro'
import {ArrowLeft} from '@nutui/icons-react-taro'
import {NavBar, InfiniteLoading} from '@nutui/nutui-react-taro'
import {pageHjmCar} from "@/api/hjm/hjmCar";
import {HjmCar} from "@/api/hjm/hjmCar/model";
import BestSellers from "./BestSellers";
/**
* 文章终极列表
* @constructor
*/
const Index = () => {
const [statusBarHeight, setStatusBarHeight] = useState<number>()
const [list, setList] = useState<HjmCar[]>([])
const reload = () => {
// 获取车辆列表
pageHjmCar({userId: Taro.getStorageSync('UserId')}).then(res => {
setList(res?.list || [])
})
}
useEffect(() => {
Taro.getSystemInfo({
success: (res) => {
setStatusBarHeight(res.statusBarHeight)
},
})
reload()
}, [])
return (
<>
<NavBar
fixed={true}
style={{marginTop: `${statusBarHeight}px`}}
onBackClick={() => {
}}
left={
<>
<ArrowLeft size={18} onClick={() => {Taro.navigateBack()}} />
{/*<SearchBar shape="round" maxLength={5} style={{paddingLeft: '1px'}}/>*/}
{/*<div className={'flex flex-col text-center justify-center items-center'}>*/}
{/* <Filter size={14}/>*/}
{/* <div className={'text-xs text-gray-600 whitespace-nowrap'}>筛选</div>*/}
{/*</div>*/}
</>
}
>
<span></span>
</NavBar>
<InfiniteLoading
className={'w-full fixed left-0 top-24'}
>
<BestSellers data={list}/>
</InfiniteLoading>
</>
)
}
export default Index

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

View File

@@ -0,0 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '车辆管理',
navigationStyle: 'custom'
})

62
src/user/car/index.tsx Normal file
View File

@@ -0,0 +1,62 @@
import {useEffect, useState} from "react";
import Taro from '@tarojs/taro'
import {ArrowLeft} from '@nutui/icons-react-taro'
import {NavBar, InfiniteLoading} from '@nutui/nutui-react-taro'
import {pageHjmCar} from "@/api/hjm/hjmCar";
import {HjmCar} from "@/api/hjm/hjmCar/model";
import BestSellers from "./BestSellers";
/**
* 文章终极列表
* @constructor
*/
const Index = () => {
const [statusBarHeight, setStatusBarHeight] = useState<number>()
const [list, setList] = useState<HjmCar[]>([])
const reload = () => {
// 获取车辆列表
pageHjmCar({userId: Taro.getStorageSync('UserId')}).then(res => {
setList(res?.list || [])
})
}
useEffect(() => {
Taro.getSystemInfo({
success: (res) => {
setStatusBarHeight(res.statusBarHeight)
},
})
reload()
}, [])
return (
<>
<NavBar
fixed={true}
style={{marginTop: `${statusBarHeight}px`}}
onBackClick={() => {
}}
left={
<>
<ArrowLeft size={18} onClick={() => {Taro.navigateBack()}} />
{/*<SearchBar shape="round" maxLength={5} style={{paddingLeft: '1px'}}/>*/}
{/*<div className={'flex flex-col text-center justify-center items-center'}>*/}
{/* <Filter size={14}/>*/}
{/* <div className={'text-xs text-gray-600 whitespace-nowrap'}>筛选</div>*/}
{/*</div>*/}
</>
}
>
<span></span>
</NavBar>
<InfiniteLoading
className={'w-full fixed left-0 top-24'}
>
<BestSellers data={list}/>
</InfiniteLoading>
</>
)
}
export default Index

View File

@@ -12,11 +12,7 @@ import {
Form,
Button,
Input,
Radio,
// SideNavBar,
// SideNavBarItem,
// SubSideNavBar,
// Cascader
Radio
} from '@nutui/nutui-react-taro'
import {DictData} from "@/api/system/dict-data/model";
import {pageDictData} from "@/api/system/dict-data";
@@ -25,12 +21,12 @@ function Profile() {
const formId = Number(router?.params.id)
const [form] = Form.useForm()
const [type, setType] = useState<number>(0)
const [sex, setSex] = useState<DictData[]>()
const [FormData, setFormData] = useState<User>(
{
userId: undefined,
nickname: undefined,
realName: undefined,
avatar: undefined,
sex: undefined,
phone: undefined,
@@ -48,41 +44,23 @@ function Profile() {
// 获取数据字典
pageDictData({limit: 200}).then(res => {
setSex(res?.list.filter((item) => item.dictCode === 'sex'))
// setPresent(res?.list.filter((item) => item.dictCode === 'present'))
})
// 获取用户信息
getUserInfo().then((data) => {
setUser(data)
setFormData(data)
})
// pageDictData({limit: 200}).then(res => {
// setSex(res?.list.filter((item) => item.dictCode === 'sex'))
// setPresent(res?.list.filter((item) => item.dictCode === 'present'))
// // setClassList([res?.list.filter((item) => item.dictCode === 'Class')])
// setGradeList(res?.list.filter((item) => {
// if (item.dictCode === 'Grade') {
// item.value = item.dictDataCode;
// item.text = item.dictDataName;
// return item
// }
// }))
// })
}
// 提交表单
const submitSucceed = (values: any) => {
console.log(values, 'values')
console.log(formId, 'formId>>')
if(values.type === 1 && values.name == ''){
Taro.showToast({
title: '请填写单位名称',
icon: 'error'
});
return false;
}
updateUserInfo(values).then(() => {
Taro.showToast({title: `保存成功`, icon: 'success'})
return Taro.navigateBack()
setTimeout(() => {
return Taro.navigateBack()
},1000)
}).catch(() => {
Taro.showToast({
title: '保存失败',
@@ -92,12 +70,6 @@ function Profile() {
}
const submitFailed = (error: any) => {
console.log(error, 'err...')
// Taro.showToast({ title: error[0].message, icon: 'error' })
}
const changeType = (type: any) => {
console.log(type, 'type>>>>')
setType(type)
}
const uploadAvatar = ({detail}) => {
@@ -170,105 +142,58 @@ function Profile() {
}
>
<Form.Item
label="类型"
name="type"
style={{marginTop: '10px'}}
required
initialValue={type}
label={'昵称'}
name="nickname"
initialValue={FormData.nickname}
rules={[{message: '请输入昵称'}]}
>
<Radio.Group defaultValue={type} direction="horizontal" onChange={(e) => changeType(e)}>
<Radio value={0}></Radio>
<Radio value={1}></Radio>
<Radio value={2}></Radio>
<Input placeholder="请输入昵称" type="text"/>
</Form.Item>
<Form.Item
label={'真实姓名'}
name="realName"
initialValue={FormData.realName}
rules={[{message: '请输入真实姓名'}]}
>
<Input placeholder="请输入真实姓名或单位名称" type="text"/>
</Form.Item>
<Form.Item
label="性别"
name="sex"
initialValue={FormData.sex}
rules={[
{message: '请选择性别'}
]}
>
<Radio.Group defaultValue={FormData.sex} direction="horizontal">
{
sex?.map((item, index) => (
<Radio key={index} value={item.dictDataCode}>
{item.dictDataName}
</Radio>
))
}
</Radio.Group>
</Form.Item>
<Form.Item
label={type === 1 ? '单位名称' : '真实姓名'}
name="name"
required={type === 1}
initialValue={FormData.realName}
rules={[{message: '请输入姓名或单位名称'}]}
>
<Input placeholder="请输入姓名或单位名称" type="text"/>
</Form.Item>
{type !== 1 && (
<Form.Item
label="性别"
name="sex"
initialValue={FormData.sex}
rules={[
{message: '请选择性别'}
]}
>
<Radio.Group defaultValue={FormData.sex} direction="horizontal">
{
sex?.map((item, index) => (
<Radio key={index} value={item.dictDataCode}>
{item.dictDataName}
</Radio>
))
}
</Radio.Group>
</Form.Item>
)}
{/*<Form.Item*/}
{/* label="手机号码"*/}
{/* name="phone"*/}
{/* required*/}
{/* initialValue={phone}*/}
{/* rules={[{max: 11, message: '请输入手机号码'}]}*/}
{/*>*/}
{/* <Input placeholder="手机号码" maxLength={11} type="number"/>*/}
{/*</Form.Item>*/}
<Form.Item
label={type === 1 ? '单位地址' : '联系地址'}
label={'联系地址'}
name="address"
initialValue={FormData.address}
rules={[{message: '请输入现居住地'}]}
rules={[{message: '请输入联系地址'}]}
>
<Input placeholder="请输入现居住地" type="text"/>
<Input placeholder="请输入联系地址" type="text"/>
</Form.Item>
{/*<Form.Item*/}
{/* label="参加校庆活动"*/}
{/* name="present"*/}
{/* initialValue={FormData.present}*/}
{/* required*/}
{/*>*/}
{/* <Radio.Group defaultValue={FormData.present} direction="horizontal">*/}
{/* {*/}
{/* present?.map((item, index) => (*/}
{/* <Radio key={index} value={item.dictDataCode}>*/}
{/* {item.dictDataName}*/}
{/* </Radio>*/}
{/* ))*/}
{/* }*/}
{/* </Radio.Group>*/}
{/*</Form.Item>*/}
<Form.Item
label="备注信息"
name="comments"
initialValue={FormData.comments}
rules={[{message: '备注信息'}]}
>
<Input placeholder={type == 2 ? '可注明身份,如:家长、小学教师、公务员等' : '未找到班级年级请在标注(初/高xx班)'} />
<Input placeholder={'个性签名'} />
</Form.Item>
</Form>
</ConfigProvider>
</div>
{/*<Cascader*/}
{/* popupProps={{*/}
{/* className: 'cascader-popup',*/}
{/* }}*/}
{/* visible={navBarState.visible}*/}
{/* optionKey={{valueKey: 'name', textKey: 'name', childrenKey: 'children'}}*/}
{/* title="选择所在班级"*/}
{/* options={classList}*/}
{/* closeable*/}
{/* onChange={change6}*/}
{/* onClose={() => {*/}
{/* changeNarBar(false)*/}
{/* }}*/}
{/*/>*/}
</>
)
}