From 04594c640ecee52dc2fcb7210b74c781b6ae593c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Wed, 16 Apr 2025 09:21:50 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BC=80=E5=8F=91=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/hjm/hjmCar/index.ts | 128 ++++++++++++++ src/api/hjm/hjmCar/model/index.ts | 68 ++++++++ src/api/layout/index.ts | 2 +- src/api/passport/login/index.ts | 6 +- src/app.config.ts | 81 +++++---- src/app.ts | 37 ++-- src/hjm/BestSellers.tsx | 42 +++++ src/hjm/baoxiu.config.ts | 3 + src/hjm/baoxiu.tsx | 116 +++++++++++++ src/hjm/fence.config.ts | 3 + src/hjm/fence.tsx | 116 +++++++++++++ src/hjm/list.config.ts | 3 + src/hjm/list.tsx | 71 ++++++++ src/hjm/location.config.ts | 3 + src/hjm/location.scss | 4 + src/hjm/location.tsx | 156 +++++++++++++++++ src/hjm/query.config.ts | 3 + src/hjm/query.tsx | 116 +++++++++++++ src/pages/index.bak/Banner.tsx | 30 ++++ src/pages/index.bak/BestSellers.tsx | 42 +++++ src/pages/index.bak/Chart.tsx | 69 ++++++++ src/pages/index.bak/ExpirationTime.tsx | 56 ++++++ src/pages/index.bak/Header.tsx | 56 ++++++ src/pages/index.bak/Help.tsx | 68 ++++++++ src/pages/index.bak/Login.tsx | 106 ++++++++++++ src/pages/index.bak/Menu.tsx | 211 +++++++++++++++++++++++ src/pages/index.bak/SiteUrl.tsx | 29 ++++ src/pages/index.bak/chart/DemoLine.tsx | 38 ++++ src/pages/index.bak/chart/index.scss | 7 + src/pages/index.bak/index.config.ts | 5 + src/pages/index.bak/index.scss | 4 + src/pages/index.bak/index.tsx | 166 ++++++++++++++++++ src/pages/index.bak/login.scss | 10 ++ src/pages/index/BestSellers.tsx | 37 ++-- src/pages/index/ExpirationTime.tsx | 48 +++++- src/pages/index/Header.tsx | 29 +++- src/pages/index/Login.tsx | 1 - src/pages/index/index.scss | 3 +- src/pages/index/index.tsx | 182 ++++++++++++++----- src/pages/user/components/UserCard.tsx | 10 +- src/pages/user/components/UserCell.tsx | 172 +++++++++--------- src/pages/user/components/UserFooter.tsx | 6 + src/pages/user/user.config.ts | 3 +- src/pages/user/user.tsx | 28 +-- src/user/bx/BestSellers.tsx | 42 +++++ src/user/bx/index.config.ts | 4 + src/user/bx/index.tsx | 62 +++++++ src/user/car/BestSellers.tsx | 42 +++++ src/user/car/index.config.ts | 4 + src/user/car/index.tsx | 62 +++++++ src/user/profile/profile.tsx | 153 +++++----------- 51 files changed, 2394 insertions(+), 349 deletions(-) create mode 100644 src/api/hjm/hjmCar/index.ts create mode 100644 src/api/hjm/hjmCar/model/index.ts create mode 100644 src/hjm/BestSellers.tsx create mode 100644 src/hjm/baoxiu.config.ts create mode 100644 src/hjm/baoxiu.tsx create mode 100644 src/hjm/fence.config.ts create mode 100644 src/hjm/fence.tsx create mode 100644 src/hjm/list.config.ts create mode 100644 src/hjm/list.tsx create mode 100644 src/hjm/location.config.ts create mode 100644 src/hjm/location.scss create mode 100644 src/hjm/location.tsx create mode 100644 src/hjm/query.config.ts create mode 100644 src/hjm/query.tsx create mode 100644 src/pages/index.bak/Banner.tsx create mode 100644 src/pages/index.bak/BestSellers.tsx create mode 100644 src/pages/index.bak/Chart.tsx create mode 100644 src/pages/index.bak/ExpirationTime.tsx create mode 100644 src/pages/index.bak/Header.tsx create mode 100644 src/pages/index.bak/Help.tsx create mode 100644 src/pages/index.bak/Login.tsx create mode 100644 src/pages/index.bak/Menu.tsx create mode 100644 src/pages/index.bak/SiteUrl.tsx create mode 100644 src/pages/index.bak/chart/DemoLine.tsx create mode 100644 src/pages/index.bak/chart/index.scss create mode 100644 src/pages/index.bak/index.config.ts create mode 100644 src/pages/index.bak/index.scss create mode 100644 src/pages/index.bak/index.tsx create mode 100644 src/pages/index.bak/login.scss create mode 100644 src/user/bx/BestSellers.tsx create mode 100644 src/user/bx/index.config.ts create mode 100644 src/user/bx/index.tsx create mode 100644 src/user/car/BestSellers.tsx create mode 100644 src/user/car/index.config.ts create mode 100644 src/user/car/index.tsx diff --git a/src/api/hjm/hjmCar/index.ts b/src/api/hjm/hjmCar/index.ts new file mode 100644 index 0000000..704ea96 --- /dev/null +++ b/src/api/hjm/hjmCar/index.ts @@ -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>>( + '/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>( + '/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>( + '/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>( + '/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>( + '/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>( + '/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>( + '/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>( + '/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>>( + '/hjm/hjm-car/pageByQQMap', + params + ); + if (res.code === 0) { + return res.data; + } + return Promise.reject(new Error(res.message)); +} diff --git a/src/api/hjm/hjmCar/model/index.ts b/src/api/hjm/hjmCar/model/index.ts new file mode 100644 index 0000000..0cbaee8 --- /dev/null +++ b/src/api/hjm/hjmCar/model/index.ts @@ -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; +} diff --git a/src/api/layout/index.ts b/src/api/layout/index.ts index 400b1bc..c172c91 100644 --- a/src/api/layout/index.ts +++ b/src/api/layout/index.ts @@ -109,7 +109,7 @@ export async function getWxOpenId(data: any) { // 获取微信openId export async function loginByOpenId(data: any) { - const res = await request.post>('/wx-login/loginByOpenId', data); + const res = await request.post>(SERVER_API_URL + '/wx-login/loginByOpenId', data); if (res.code === 0) { return res.data; } diff --git a/src/api/passport/login/index.ts b/src/api/passport/login/index.ts index 4af461f..ff893f6 100644 --- a/src/api/passport/login/index.ts +++ b/src/api/passport/login/index.ts @@ -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; diff --git a/src/app.config.ts b/src/app.config.ts index 576497e..bcf1ed9 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -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": "你的位置信息将用于小程序位置接口的效果展示" + } } }) diff --git a/src/app.ts b/src/app.ts index 60fe4b7..2e552f6 100644 --- a/src/app.ts +++ b/src/app.ts @@ -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 } diff --git a/src/hjm/BestSellers.tsx b/src/hjm/BestSellers.tsx new file mode 100644 index 0000000..03fb29a --- /dev/null +++ b/src/hjm/BestSellers.tsx @@ -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 ( +
+
+ {props.data?.map((item, index) => { + return ( +
Taro.navigateTo({url: '/hjm/query?id=' + item.id})}> + +
+ +
{item.code}
+
快递公司:{item.parentOrganization}
+
保险状态:{item.insuranceStatus} +
+
绑定操作员:{item.driver}
+
+
+
+ ) + })} +
+
+
+ ) +} +export default BestSellers diff --git a/src/hjm/baoxiu.config.ts b/src/hjm/baoxiu.config.ts new file mode 100644 index 0000000..b61e5cc --- /dev/null +++ b/src/hjm/baoxiu.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + navigationBarTitleText: '一键报修' +}) diff --git a/src/hjm/baoxiu.tsx b/src/hjm/baoxiu.tsx new file mode 100644 index 0000000..f0c277a --- /dev/null +++ b/src/hjm/baoxiu.tsx @@ -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() + const [item, setItem] = useState() + + // 打开地图选择位置 + // 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 ( + <> + {/*
*/} + {/*
*/} + {/* */} + {/* */} + {/* */} + {/* */} + {/* */} + {/*
*/} + {/*
*/} + {/* */} + {/**/} + {item ? ( +
+ +
+ + 车辆编号:{item?.code} + + + 快递公司:{item?.kuaidi} + + + 管理负责人:{item?.kuaidiAdmin} + + + 操作员:{item?.driver} + + + 保险状态:{item?.insuranceStatus} + + + GPS编号:{item?.gpsNo} + + + 电子围栏:{item?.fence} + +
+
+ ) : ''} + + ) +} +export default Fence diff --git a/src/hjm/fence.config.ts b/src/hjm/fence.config.ts new file mode 100644 index 0000000..8a447c7 --- /dev/null +++ b/src/hjm/fence.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + navigationBarTitleText: '电子围栏' +}) diff --git a/src/hjm/fence.tsx b/src/hjm/fence.tsx new file mode 100644 index 0000000..f0c277a --- /dev/null +++ b/src/hjm/fence.tsx @@ -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() + const [item, setItem] = useState() + + // 打开地图选择位置 + // 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 ( + <> + {/*
*/} + {/*
*/} + {/* */} + {/* */} + {/* */} + {/* */} + {/* */} + {/*
*/} + {/*
*/} + {/* */} + {/**/} + {item ? ( +
+ +
+ + 车辆编号:{item?.code} + + + 快递公司:{item?.kuaidi} + + + 管理负责人:{item?.kuaidiAdmin} + + + 操作员:{item?.driver} + + + 保险状态:{item?.insuranceStatus} + + + GPS编号:{item?.gpsNo} + + + 电子围栏:{item?.fence} + +
+
+ ) : ''} + + ) +} +export default Fence diff --git a/src/hjm/list.config.ts b/src/hjm/list.config.ts new file mode 100644 index 0000000..d58b89c --- /dev/null +++ b/src/hjm/list.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + navigationBarTitleText: '车辆列表' +}) diff --git a/src/hjm/list.tsx b/src/hjm/list.tsx new file mode 100644 index 0000000..f70844d --- /dev/null +++ b/src/hjm/list.tsx @@ -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('') + const [list, setList] = useState([]) + + const onKeywords = (keywords: string) => { + setKeywords(keywords) + } + + const reload = () => { + // 获取车辆列表 + pageHjmCar({keywords}).then(res => { + setList(res?.list || []) + }) + } + + useEffect(() => { + reload() + }, []) + + + return ( + <> +
+
+
+ + +
+ +
+
+
+
+ + + + + ) +} +export default List diff --git a/src/hjm/location.config.ts b/src/hjm/location.config.ts new file mode 100644 index 0000000..0c9d0be --- /dev/null +++ b/src/hjm/location.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + navigationBarTitleText: '定位查询' +}) diff --git a/src/hjm/location.scss b/src/hjm/location.scss new file mode 100644 index 0000000..76b6786 --- /dev/null +++ b/src/hjm/location.scss @@ -0,0 +1,4 @@ +page { + //background: url("https://oss.wsdns.cn/20250414/58cac36d806a40e298def726bcd9e44b.jpeg"); + //background-size: cover; +} diff --git a/src/hjm/location.tsx b/src/hjm/location.tsx new file mode 100644 index 0000000..2f7556e --- /dev/null +++ b/src/hjm/location.tsx @@ -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() + const [item, setItem] = useState() + const [longitude, setLongitude] = useState() + const [latitude, setLatitude] = useState() + const [scale, setScale] = useState(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 ( + <> +
+
+
+ + +
+ +
+
+
+
+ {item ? ( +
+
+
+ 最后更新时间:{item?.updateTime} +
+
+ 操作员:{item?.driver} +
+
+ 位置信息:{item?.address} +
+
+
+ ) : ''} + + { + console.log('map tap') + }} + style={{width: '100%', height: '100vh'}} + /> + + ) +} +export default Location diff --git a/src/hjm/query.config.ts b/src/hjm/query.config.ts new file mode 100644 index 0000000..084a5d2 --- /dev/null +++ b/src/hjm/query.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + navigationBarTitleText: '车辆查询' +}) diff --git a/src/hjm/query.tsx b/src/hjm/query.tsx new file mode 100644 index 0000000..4af04b4 --- /dev/null +++ b/src/hjm/query.tsx @@ -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() + const [item, setItem] = useState() + + // 打开地图选择位置 + // 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 ( + <> + {/*
*/} + {/*
*/} + {/* */} + {/* */} + {/* */} + {/* */} + {/* */} + {/*
*/} + {/*
*/} + {/* */} + {/**/} + {item ? ( +
+ +
+ + 车辆编号:{item?.code} + + + 快递公司:{item?.parentOrganization} + + + 管理负责人:{item?.parentOrganizationAdmin} + + + 操作员:{item?.driver} + + + 保险状态:{item?.insuranceStatus} + + + GPS编号:{item?.gpsNo} + + + 电子围栏:{item?.fence} + +
+
+ ) : ''} + + ) +} +export default Query diff --git a/src/pages/index.bak/Banner.tsx b/src/pages/index.bak/Banner.tsx new file mode 100644 index 0000000..6de0425 --- /dev/null +++ b/src/pages/index.bak/Banner.tsx @@ -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() + const reload = () => { + getCmsAd(366).then(data => { + setItem(data) + }) + } + + useEffect(() => { + reload() + }, []) + + return ( + <> + + {item?.imageList?.map((item) => ( + + + + ))} + + + ) +} +export default MyPage diff --git a/src/pages/index.bak/BestSellers.tsx b/src/pages/index.bak/BestSellers.tsx new file mode 100644 index 0000000..5a9d52f --- /dev/null +++ b/src/pages/index.bak/BestSellers.tsx @@ -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 ( +
+
+ {props.data?.map((item, index) => { + return ( +
Taro.navigateTo({url: '/hjm/location?id=' + item.id})}> + +
+ +
{item.code}
+
快递公司:{item.parentOrganization}
+
保险状态:{item.insuranceStatus} +
+
绑定操作员:{item.driver}
+
+
+
+ ) + })} +
+
+
+ ) +} +export default BestSellers diff --git a/src/pages/index.bak/Chart.tsx b/src/pages/index.bak/Chart.tsx new file mode 100644 index 0000000..7445b5b --- /dev/null +++ b/src/pages/index.bak/Chart.tsx @@ -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('0') + const reload = () => { + + } + + useEffect(() => { + reload() + }, []) + + return ( + <> + { + setTapIndex(paneKey) + }} + > + { + list?.map((item, index) => { + return ( + + ) + }) + } + + { + list?.map((item, index) => { + console.log(item.title) + return ( +
+ { + tapIndex != index ? null : +
+ 线状图 +
+ } +
+ ) + }) + } + + + ) +} +export default Chart diff --git a/src/pages/index.bak/ExpirationTime.tsx b/src/pages/index.bak/ExpirationTime.tsx new file mode 100644 index 0000000..547047d --- /dev/null +++ b/src/pages/index.bak/ExpirationTime.tsx @@ -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() + 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 ( +
+
+ + + { + roleName == 'youzheng' && + } + { + roleName == 'kuaidiyuan' && + } +
+
+ ) +} +export default ExpirationTime diff --git a/src/pages/index.bak/Header.tsx b/src/pages/index.bak/Header.tsx new file mode 100644 index 0000000..37d8141 --- /dev/null +++ b/src/pages/index.bak/Header.tsx @@ -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() + + const reload = () => { + Taro.getSystemInfo({ + success: (res) => { + setStatusBarHeight(res.statusBarHeight) + }, + }) + } + + useEffect(() => { + reload() + }, []) + + return ( + <> + { + }} + left={ +
setShowBasic(true)}> + + {props.user?.nickname} + +
+ } + > +
+ { + setShowBasic(false) + }} + > +
车辆信息
+ +
+ + ) +} +export default Header diff --git a/src/pages/index.bak/Help.tsx b/src/pages/index.bak/Help.tsx new file mode 100644 index 0000000..59ce37b --- /dev/null +++ b/src/pages/index.bak/Help.tsx @@ -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(3494) + const [list, setList] = useState([]) + + 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 ( +
+
+ +
+ { + list.map((item, index) => { + return ( +
Taro.navigateTo({url: `/cms/help?id=${item.articleId}`}) }> +
{item.title}
+ +
+ ) + }) + } +
+
+
+ ) +} +export default Help diff --git a/src/pages/index.bak/Login.tsx b/src/pages/index.bak/Login.tsx new file mode 100644 index 0000000..a2528e6 --- /dev/null +++ b/src/pages/index.bak/Login.tsx @@ -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() + + /* 获取用户手机号 */ + 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 ( + <> +
+
登录
+ { + env === 'WEAPP' && ( + <> +
+ +
+ + ) + } + { + env === 'WEB' && ( + <> +
+ +
+
+ +
+ +
+ +
+ +
+ setIsAgree(!isAgree)}> + setIsAgree(!isAgree)}>登录表示您已阅读并同意 Taro.navigateTo({url: '/passport/agreement'})} + className={'text-blue-600'}>《服务协议及隐私政策》 +
+ + ) + } +
+ + ) +} +export default Login diff --git a/src/pages/index.bak/Menu.tsx b/src/pages/index.bak/Menu.tsx new file mode 100644 index 0000000..dad48f8 --- /dev/null +++ b/src/pages/index.bak/Menu.tsx @@ -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(false) + const [userInfo, setUserInfo] = useState() + const [bmLogs, setBmLogs] = useState() + const [navItems, setNavItems] = useState([]) + + /* 获取用户手机号 */ + 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 ( +
+
+
+ { + navItems.map((item, index) => ( +
+ { + isLogin && !loading ? +
{ + onLogin(item, index) + }}> + +
{item?.title}
+
+ : + + } +
+ )) + } +
+
+ {/*倡议书*/} + {/**/} +
+ ) +} +export default Page diff --git a/src/pages/index.bak/SiteUrl.tsx b/src/pages/index.bak/SiteUrl.tsx new file mode 100644 index 0000000..2fc5723 --- /dev/null +++ b/src/pages/index.bak/SiteUrl.tsx @@ -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('') + const reload = () => { + if(props.tenantId){ + setSiteUrl(`https://${props.tenantId}.shoplnk.cn`) + }else { + setSiteUrl(`https://${Taro.getStorageSync('TenantId')}.shoplnk.cn`) + } + } + + useEffect(() => { + reload() + }, [props]) + + return ( +
+
+ + +
+
+ ) +} +export default SiteUrl diff --git a/src/pages/index.bak/chart/DemoLine.tsx b/src/pages/index.bak/chart/DemoLine.tsx new file mode 100644 index 0000000..3e55279 --- /dev/null +++ b/src/pages/index.bak/chart/DemoLine.tsx @@ -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() + 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 ( + + + + ) +} diff --git a/src/pages/index.bak/chart/index.scss b/src/pages/index.bak/chart/index.scss new file mode 100644 index 0000000..10b6a0a --- /dev/null +++ b/src/pages/index.bak/chart/index.scss @@ -0,0 +1,7 @@ +.index { + width: 100vw; + height: 100vh; + background-color: #F3F3F3; + background-repeat: no-repeat; + background-size: 100%; +} diff --git a/src/pages/index.bak/index.config.ts b/src/pages/index.bak/index.config.ts new file mode 100644 index 0000000..09f9fa8 --- /dev/null +++ b/src/pages/index.bak/index.config.ts @@ -0,0 +1,5 @@ +export default definePageConfig({ + navigationBarTitleText: 'shopLnk.cn - 数灵云店', + navigationBarTextStyle: 'black', + navigationStyle: 'custom' +}) diff --git a/src/pages/index.bak/index.scss b/src/pages/index.bak/index.scss new file mode 100644 index 0000000..7ed1db0 --- /dev/null +++ b/src/pages/index.bak/index.scss @@ -0,0 +1,4 @@ +page { + background: url("https://oss.wsdns.cn/20250414/5bed65bff2f8434995e6c22d67271c77.png"); + background-size: cover; +} diff --git a/src/pages/index.bak/index.tsx b/src/pages/index.bak/index.tsx new file mode 100644 index 0000000..6a83dab --- /dev/null +++ b/src/pages/index.bak/index.tsx @@ -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() + const [IsLogin, setIsLogin] = useState(true) + const [userInfo, setUserInfo] = useState() + const [list, setList] = useState([]) + console.log(userInfo?.nickname) + console.log(website?.websiteName) + // const [hasMore, setHasMore] = useState(true) + // const [list, setList] = useState([]) + // 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 ? () : (<> +
+ + + + + )} + + ) +} + +export default Home diff --git a/src/pages/index.bak/login.scss b/src/pages/index.bak/login.scss new file mode 100644 index 0000000..97f2ab4 --- /dev/null +++ b/src/pages/index.bak/login.scss @@ -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; +} diff --git a/src/pages/index/BestSellers.tsx b/src/pages/index/BestSellers.tsx index aabfb5b..5a9d52f 100644 --- a/src/pages/index/BestSellers.tsx +++ b/src/pages/index/BestSellers.tsx @@ -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 ( -
-
-
-
热卖商品
- 查看更多 -
-
- 商品列表 -
+
+
+ {props.data?.map((item, index) => { + return ( +
Taro.navigateTo({url: '/hjm/location?id=' + item.id})}> + +
+ +
{item.code}
+
快递公司:{item.parentOrganization}
+
保险状态:{item.insuranceStatus} +
+
绑定操作员:{item.driver}
+
+
+
+ ) + })}
+
) } diff --git a/src/pages/index/ExpirationTime.tsx b/src/pages/index/ExpirationTime.tsx index 7a041ed..cac601d 100644 --- a/src/pages/index/ExpirationTime.tsx +++ b/src/pages/index/ExpirationTime.tsx @@ -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() + 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 ( -
-
-
您的试用期还剩余11天
- +
+
+ + + { + roleName == 'youzheng' && + } + { + roleName == 'kuaidiyuan' && + }
) diff --git a/src/pages/index/Header.tsx b/src/pages/index/Header.tsx index 2a1604e..c362449 100644 --- a/src/pages/index/Header.tsx +++ b/src/pages/index/Header.tsx @@ -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() + const onNav = () => { + Taro.navigateTo({ + url: '/pages/user/user', + }) + } const reload = () => { Taro.getSystemInfo({ success: (res) => { @@ -22,22 +28,33 @@ const Header = (props: any) => { <> { }} left={ -
+
- {props.website?.websiteName} + {props.user?.nickname}
} > + 首页 + { + setShowBasic(false) + }} + > +
车辆信息
+ +
) } diff --git a/src/pages/index/Login.tsx b/src/pages/index/Login.tsx index 56e41e8..a2528e6 100644 --- a/src/pages/index/Login.tsx +++ b/src/pages/index/Login.tsx @@ -24,7 +24,6 @@ const Login = (props:any) => { iv, notVerifyPhone: true, refereeId: 0, - isSuperAdmin: true, sceneType: 'save_referee', tenantId: TenantId }, diff --git a/src/pages/index/index.scss b/src/pages/index/index.scss index f79efd0..7ed1db0 100644 --- a/src/pages/index/index.scss +++ b/src/pages/index/index.scss @@ -1,3 +1,4 @@ page { - + background: url("https://oss.wsdns.cn/20250414/5bed65bff2f8434995e6c22d67271c77.png"); + background-size: cover; } diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index eb4215c..2f49863 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -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() const [IsLogin, setIsLogin] = useState(true) - const [current, setCurrent] = useState() const [userInfo, setUserInfo] = useState() + const [longitude, setLongitude] = useState(108.374959) + const [latitude, setLatitude] = useState(22.767024) + const [markers, setMarkers] = useState([]) + const [scale, setScale] = useState(16) + const [keywords, setKeywords] = useState('') + const [list, setList] = useState([]) console.log(userInfo?.nickname) + console.log(website?.websiteName) + console.log(list.length) // const [hasMore, setHasMore] = useState(true) // const [list, setList] = useState([]) // 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 ? () : (<> -
- - - - - - -
- +
+ +
+
+
+ + +
+ +
+
+
+
+ { + console.log('map tap',map) + }} + style={{width: '100%', height: '100vh'}} + /> + {/**/} + {/* */} + {/**/} )} ) diff --git a/src/pages/user/components/UserCard.tsx b/src/pages/user/components/UserCard.tsx index 07894fa..0d7550f 100644 --- a/src/pages/user/components/UserCard.tsx +++ b/src/pages/user/components/UserCard.tsx @@ -136,7 +136,7 @@ function UserCard() {
) : ( - ) }
-
{IsLogin ? userInfo?.mobile : '请点击头像登录'}
+
{IsLogin ? userInfo?.mobile : '请点击头像登录'}
{IsLogin ? (
-
{userInfo?.gradeName || '注册用户'}
+
{userInfo?.realName || '注册用户'}
) : ''}
-
navTo('/user/profile/profile', true)}> {'个人资料'}
diff --git a/src/pages/user/components/UserCell.tsx b/src/pages/user/components/UserCell.tsx index edfb213..a414ded 100644 --- a/src/pages/user/components/UserCell.tsx +++ b/src/pages/user/components/UserCell.tsx @@ -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={
- - 在线商店 + + 车辆信息
} align="center" extra={} onClick={() => { - navTo('/bszx/bm-cert/bm-cert', true) + navTo('/user/car/index', true) }} /> @@ -56,96 +56,96 @@ const UserCell = () => { className="nutui-cell-clickable" title={
- - 消息 + + 报险记录
} align="center" extra={} onClick={() => { - navTo('/bszx/pay-log/pay-log', true) - }} - /> - - - 管理 -
- }> - - - 分析 -
- } - align="center" - extra={} - onClick={() => { - navTo('/bszx/bm-cert/bm-cert', true) - }} - /> - - - 客户 -
- } - align="center" - extra={} - onClick={() => { - navTo('/bszx/pay-log/pay-log', true) - }} - /> - - - 折扣 -
- } - align="center" - extra={} - onClick={() => { - navTo('/user/profile/profile', true) - }} - /> - - - 设置与帮助 -
- }> - } - onClick={() => Taro.navigateTo({url: '/website/modify'})} - /> - } - onClick={() => { - navTo('/user/profile/profile', true) - }} - /> - } - onClick={() => { - navTo('/user/profile/profile', true) + navTo('/user/bx/index', true) }} /> + {/**/} + {/* 管理*/} + {/*
*/} + {/*}>*/} + {/* */} + {/* */} + {/* 分析*/} + {/* */} + {/* }*/} + {/* align="center"*/} + {/* extra={}*/} + {/* onClick={() => {*/} + {/* navTo('/bszx/bm-cert/bm-cert', true)*/} + {/* }}*/} + {/* />*/} + {/* */} + {/* */} + {/* 客户*/} + {/* */} + {/* }*/} + {/* align="center"*/} + {/* extra={}*/} + {/* onClick={() => {*/} + {/* navTo('/bszx/pay-log/pay-log', true)*/} + {/* }}*/} + {/* />*/} + {/* */} + {/* */} + {/* 折扣*/} + {/* */} + {/* }*/} + {/* align="center"*/} + {/* extra={}*/} + {/* onClick={() => {*/} + {/* navTo('/user/profile/profile', true)*/} + {/* }}*/} + {/* />*/} + {/**/} + {/**/} + {/* 设置与帮助*/} + {/* */} + {/*}>*/} + {/* }*/} + {/* onClick={() => Taro.navigateTo({url: '/website/modify'})}*/} + {/* />*/} + {/* }*/} + {/* onClick={() => {*/} + {/* navTo('/user/profile/profile', true)*/} + {/* }}*/} + {/* />*/} + {/* }*/} + {/* onClick={() => {*/} + {/* navTo('/user/profile/profile', true)*/} + {/* }}*/} + {/* />*/} + {/**/} 账号管理 diff --git a/src/pages/user/components/UserFooter.tsx b/src/pages/user/components/UserFooter.tsx index 4a9d7cd..5cdc5e9 100644 --- a/src/pages/user/components/UserFooter.tsx +++ b/src/pages/user/components/UserFooter.tsx @@ -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) }) } diff --git a/src/pages/user/user.config.ts b/src/pages/user/user.config.ts index 30baf1b..2bd0633 100644 --- a/src/pages/user/user.config.ts +++ b/src/pages/user/user.config.ts @@ -1,4 +1,3 @@ export default definePageConfig({ - navigationBarTitleText: '我的', - navigationStyle: 'custom' + navigationBarTitleText: '我的' }) diff --git a/src/pages/user/user.tsx b/src/pages/user/user.tsx index e873d43..33e25da 100644 --- a/src/pages/user/user.tsx +++ b/src/pages/user/user.tsx @@ -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() useEffect(() => { - Taro.getSystemInfo({ - success: (res) => { - setStatusBarHeight(res.statusBarHeight) - }, - }) }, []); return ( <> - { - }} - left={ - <> - - } - > - 我的 - -
+
- +
) diff --git a/src/user/bx/BestSellers.tsx b/src/user/bx/BestSellers.tsx new file mode 100644 index 0000000..03fb29a --- /dev/null +++ b/src/user/bx/BestSellers.tsx @@ -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 ( +
+
+ {props.data?.map((item, index) => { + return ( +
Taro.navigateTo({url: '/hjm/query?id=' + item.id})}> + +
+ +
{item.code}
+
快递公司:{item.parentOrganization}
+
保险状态:{item.insuranceStatus} +
+
绑定操作员:{item.driver}
+
+
+
+ ) + })} +
+
+
+ ) +} +export default BestSellers diff --git a/src/user/bx/index.config.ts b/src/user/bx/index.config.ts new file mode 100644 index 0000000..777ca9d --- /dev/null +++ b/src/user/bx/index.config.ts @@ -0,0 +1,4 @@ +export default definePageConfig({ + navigationBarTitleText: '报险记录', + navigationStyle: 'custom' +}) diff --git a/src/user/bx/index.tsx b/src/user/bx/index.tsx new file mode 100644 index 0000000..2a9e327 --- /dev/null +++ b/src/user/bx/index.tsx @@ -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() + const [list, setList] = useState([]) + + const reload = () => { + // 获取车辆列表 + pageHjmCar({userId: Taro.getStorageSync('UserId')}).then(res => { + setList(res?.list || []) + }) + } + + useEffect(() => { + Taro.getSystemInfo({ + success: (res) => { + setStatusBarHeight(res.statusBarHeight) + }, + }) + reload() + }, []) + + + return ( + <> + { + }} + left={ + <> + {Taro.navigateBack()}} /> + {/**/} + {/*
*/} + {/* */} + {/*
筛选
*/} + {/*
*/} + + } + > + 车辆管理 +
+ + + + + ) +} +export default Index diff --git a/src/user/car/BestSellers.tsx b/src/user/car/BestSellers.tsx new file mode 100644 index 0000000..03fb29a --- /dev/null +++ b/src/user/car/BestSellers.tsx @@ -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 ( +
+
+ {props.data?.map((item, index) => { + return ( +
Taro.navigateTo({url: '/hjm/query?id=' + item.id})}> + +
+ +
{item.code}
+
快递公司:{item.parentOrganization}
+
保险状态:{item.insuranceStatus} +
+
绑定操作员:{item.driver}
+
+
+
+ ) + })} +
+
+
+ ) +} +export default BestSellers diff --git a/src/user/car/index.config.ts b/src/user/car/index.config.ts new file mode 100644 index 0000000..74bd449 --- /dev/null +++ b/src/user/car/index.config.ts @@ -0,0 +1,4 @@ +export default definePageConfig({ + navigationBarTitleText: '车辆管理', + navigationStyle: 'custom' +}) diff --git a/src/user/car/index.tsx b/src/user/car/index.tsx new file mode 100644 index 0000000..2a9e327 --- /dev/null +++ b/src/user/car/index.tsx @@ -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() + const [list, setList] = useState([]) + + const reload = () => { + // 获取车辆列表 + pageHjmCar({userId: Taro.getStorageSync('UserId')}).then(res => { + setList(res?.list || []) + }) + } + + useEffect(() => { + Taro.getSystemInfo({ + success: (res) => { + setStatusBarHeight(res.statusBarHeight) + }, + }) + reload() + }, []) + + + return ( + <> + { + }} + left={ + <> + {Taro.navigateBack()}} /> + {/**/} + {/*
*/} + {/* */} + {/*
筛选
*/} + {/*
*/} + + } + > + 车辆管理 +
+ + + + + ) +} +export default Index diff --git a/src/user/profile/profile.tsx b/src/user/profile/profile.tsx index 0513ff6..54eb88a 100644 --- a/src/user/profile/profile.tsx +++ b/src/user/profile/profile.tsx @@ -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(0) const [sex, setSex] = useState() const [FormData, setFormData] = useState( { 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() { } > - changeType(e)}> - 校友 - 友好单位 - 爱心人士 + + + + + + + + { + sex?.map((item, index) => ( + + {item.dictDataName} + + )) + } - - - {type !== 1 && ( - - - { - sex?.map((item, index) => ( - - {item.dictDataName} - - )) - } - - - )} - {/**/} - {/* */} - {/**/} - - + - {/**/} - {/* */} - {/* {*/} - {/* present?.map((item, index) => (*/} - {/* */} - {/* {item.dictDataName}*/} - {/* */} - {/* ))*/} - {/* }*/} - {/* */} - {/**/} - +
- {/* {*/} - {/* changeNarBar(false)*/} - {/* }}*/} - {/*/>*/} ) }