修复已知问题
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import type { PageParam } from '@/api/index';
|
import type { PageParam } from '@/api/index';
|
||||||
|
import {HjmFence} from "@/api/hjm/hjmFence/model";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 黄家明_车辆管理
|
* 黄家明_车辆管理
|
||||||
@@ -22,14 +23,20 @@ export interface HjmCar {
|
|||||||
parentOrganizationAdmin?: string;
|
parentOrganizationAdmin?: string;
|
||||||
// 车辆编号
|
// 车辆编号
|
||||||
code?: string;
|
code?: string;
|
||||||
|
// 操作员ID
|
||||||
|
driverId?: number;
|
||||||
// 操作员
|
// 操作员
|
||||||
driver?: number;
|
driver?: any;
|
||||||
// 保险状态
|
// 保险状态
|
||||||
insuranceStatus?: number;
|
insuranceStatus?: number;
|
||||||
// GPS设备编号
|
// GPS设备编号
|
||||||
gpsNo?: string;
|
gpsNo?: string;
|
||||||
|
// 电子围栏ID
|
||||||
|
fenceId?: number;
|
||||||
|
// 电子围栏名称
|
||||||
|
fenceName?: string;
|
||||||
// 电子围栏
|
// 电子围栏
|
||||||
fence?: string;
|
fence?: HjmFence;
|
||||||
// 位置
|
// 位置
|
||||||
location?: string;
|
location?: string;
|
||||||
// 经度
|
// 经度
|
||||||
@@ -62,6 +69,8 @@ export interface HjmCar {
|
|||||||
export interface HjmCarParam extends PageParam {
|
export interface HjmCarParam extends PageParam {
|
||||||
id?: number;
|
id?: number;
|
||||||
userId?: number;
|
userId?: number;
|
||||||
|
driverId?: number;
|
||||||
|
status?: number;
|
||||||
latitude?: number;
|
latitude?: number;
|
||||||
longitude?: number;
|
longitude?: number;
|
||||||
keywords?: string;
|
keywords?: string;
|
||||||
|
|||||||
105
src/api/hjm/hjmChoices/index.ts
Normal file
105
src/api/hjm/hjmChoices/index.ts
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api/index';
|
||||||
|
import type { HjmChoices, HjmChoicesParam } from './model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询选择题选项
|
||||||
|
*/
|
||||||
|
export async function pageHjmChoices(params: HjmChoicesParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<HjmChoices>>>(
|
||||||
|
'/hjm/hjm-choices/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询选择题选项列表
|
||||||
|
*/
|
||||||
|
export async function listHjmChoices(params?: HjmChoicesParam) {
|
||||||
|
const res = await request.get<ApiResult<HjmChoices[]>>(
|
||||||
|
'/hjm/hjm-choices',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.code === 0 && res.data) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加选择题选项
|
||||||
|
*/
|
||||||
|
export async function addHjmChoices(data: HjmChoices) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
'/hjm/hjm-choices',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改选择题选项
|
||||||
|
*/
|
||||||
|
export async function updateHjmChoices(data: HjmChoices) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
'/hjm/hjm-choices',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除选择题选项
|
||||||
|
*/
|
||||||
|
export async function removeHjmChoices(id?: number) {
|
||||||
|
const res = await request.del<ApiResult<unknown>>(
|
||||||
|
'/hjm/hjm-choices/' + id
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除选择题选项
|
||||||
|
*/
|
||||||
|
export async function removeBatchHjmChoices(data: (number | undefined)[]) {
|
||||||
|
const res = await request.del<ApiResult<unknown>>(
|
||||||
|
'/hjm/hjm-choices/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询选择题选项
|
||||||
|
*/
|
||||||
|
export async function getHjmChoices(id: number) {
|
||||||
|
const res = await request.get<ApiResult<HjmChoices>>(
|
||||||
|
'/hjm/hjm-choices/' + id
|
||||||
|
);
|
||||||
|
if (res.code === 0 && res.data) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
37
src/api/hjm/hjmChoices/model/index.ts
Normal file
37
src/api/hjm/hjmChoices/model/index.ts
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import type { PageParam } from '@/api/index';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择题选项
|
||||||
|
*/
|
||||||
|
export interface HjmChoices {
|
||||||
|
// 自增ID
|
||||||
|
id?: number;
|
||||||
|
// 题目ID
|
||||||
|
questionId?: number;
|
||||||
|
// 题目
|
||||||
|
content?: string;
|
||||||
|
// 是否正确
|
||||||
|
isCorrect?: boolean;
|
||||||
|
// 排序(数字越小越靠前)
|
||||||
|
sortNumber?: number;
|
||||||
|
// 备注
|
||||||
|
comments?: string;
|
||||||
|
// 状态, 0正常, 1冻结
|
||||||
|
status?: number;
|
||||||
|
// 是否删除, 0否, 1是
|
||||||
|
deleted?: number;
|
||||||
|
// 租户id
|
||||||
|
tenantId?: number;
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string;
|
||||||
|
// 修改时间
|
||||||
|
updateTime?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择题选项搜索条件
|
||||||
|
*/
|
||||||
|
export interface HjmChoicesParam extends PageParam {
|
||||||
|
id?: number;
|
||||||
|
keywords?: string;
|
||||||
|
}
|
||||||
105
src/api/hjm/hjmCourses/index.ts
Normal file
105
src/api/hjm/hjmCourses/index.ts
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type {ApiResult, PageResult} from '@/api/index';
|
||||||
|
import type {HjmCourses, HjmCoursesParam} from './model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询课程
|
||||||
|
*/
|
||||||
|
export async function pageHjmCourses(params: HjmCoursesParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<HjmCourses>>>(
|
||||||
|
'/hjm/hjm-courses/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询课程列表
|
||||||
|
*/
|
||||||
|
export async function listHjmCourses(params?: HjmCoursesParam) {
|
||||||
|
const res = await request.get<ApiResult<HjmCourses[]>>(
|
||||||
|
'/hjm/hjm-courses',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.code === 0 && res.data) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加课程
|
||||||
|
*/
|
||||||
|
export async function addHjmCourses(data: HjmCourses) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
'/hjm/hjm-courses',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改课程
|
||||||
|
*/
|
||||||
|
export async function updateHjmCourses(data: HjmCourses) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
'/hjm/hjm-courses',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除课程
|
||||||
|
*/
|
||||||
|
export async function removeHjmCourses(id?: number) {
|
||||||
|
const res = await request.del<ApiResult<unknown>>(
|
||||||
|
'/hjm/hjm-courses/' + id
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除课程
|
||||||
|
*/
|
||||||
|
export async function removeBatchHjmCourses(data: (number | undefined)[]) {
|
||||||
|
const res = await request.del<ApiResult<unknown>>(
|
||||||
|
'/hjm/hjm-courses/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询课程
|
||||||
|
*/
|
||||||
|
export async function getHjmCourses(id: number) {
|
||||||
|
const res = await request.get<ApiResult<HjmCourses>>(
|
||||||
|
'/hjm/hjm-courses/' + id
|
||||||
|
);
|
||||||
|
if (res.code === 0 && res) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
41
src/api/hjm/hjmCourses/model/index.ts
Normal file
41
src/api/hjm/hjmCourses/model/index.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import type { PageParam } from '@/api/index';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程
|
||||||
|
*/
|
||||||
|
export interface HjmCourses {
|
||||||
|
// 自增ID
|
||||||
|
id?: number;
|
||||||
|
// 课程名称
|
||||||
|
name?: string;
|
||||||
|
// 类型
|
||||||
|
type?: number;
|
||||||
|
// 课程编号
|
||||||
|
code?: string;
|
||||||
|
// 课程封面图
|
||||||
|
image?: 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 HjmCoursesParam extends PageParam {
|
||||||
|
id?: number;
|
||||||
|
keywords?: string;
|
||||||
|
}
|
||||||
105
src/api/hjm/hjmFence/index.ts
Normal file
105
src/api/hjm/hjmFence/index.ts
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type {ApiResult, PageResult} from '@/api/index';
|
||||||
|
import type {HjmFence, HjmFenceParam} from './model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询电子围栏
|
||||||
|
*/
|
||||||
|
export async function pageHjmFence(params: HjmFenceParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<HjmFence>>>(
|
||||||
|
'/hjm/hjm-fence/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询电子围栏列表
|
||||||
|
*/
|
||||||
|
export async function listHjmFence(params?: HjmFenceParam) {
|
||||||
|
const res = await request.get<ApiResult<HjmFence[]>>(
|
||||||
|
'/hjm/hjm-fence',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.code === 0 && res.data) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加电子围栏
|
||||||
|
*/
|
||||||
|
export async function addHjmFence(data: HjmFence) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
'/hjm/hjm-fence',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改电子围栏
|
||||||
|
*/
|
||||||
|
export async function updateHjmFence(data: HjmFence) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
'/hjm/hjm-fence',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除电子围栏
|
||||||
|
*/
|
||||||
|
export async function removeHjmFence(id?: number) {
|
||||||
|
const res = await request.del<ApiResult<unknown>>(
|
||||||
|
'/hjm/hjm-fence/' + id
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除电子围栏
|
||||||
|
*/
|
||||||
|
export async function removeBatchHjmFence(data: (number | undefined)[]) {
|
||||||
|
const res = await request.del<ApiResult<unknown>>(
|
||||||
|
'/hjm/hjm-fence/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询电子围栏
|
||||||
|
*/
|
||||||
|
export async function getHjmFence(id: number) {
|
||||||
|
const res = await request.get<ApiResult<HjmFence>>(
|
||||||
|
'/hjm/hjm-fence/' + id
|
||||||
|
);
|
||||||
|
if (res.code === 0 && res.data) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
39
src/api/hjm/hjmFence/model/index.ts
Normal file
39
src/api/hjm/hjmFence/model/index.ts
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import type { PageParam } from '@/api/index';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏
|
||||||
|
*/
|
||||||
|
export interface HjmFence {
|
||||||
|
// 自增ID
|
||||||
|
id?: number;
|
||||||
|
// 围栏名称
|
||||||
|
name?: string;
|
||||||
|
// 类型 0圆形 1方形
|
||||||
|
type?: number;
|
||||||
|
// 位置
|
||||||
|
location?: string;
|
||||||
|
// 经度
|
||||||
|
longitude?: number;
|
||||||
|
// 纬度
|
||||||
|
latitude?: number;
|
||||||
|
// 区域
|
||||||
|
district?: string;
|
||||||
|
// 轮廓
|
||||||
|
points?: string;
|
||||||
|
// 颜色
|
||||||
|
color?: string;
|
||||||
|
// 填充颜色
|
||||||
|
fillColor?: string;
|
||||||
|
// 圆角
|
||||||
|
radius?: number;
|
||||||
|
// 边框宽度
|
||||||
|
strokeWidth?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏搜索条件
|
||||||
|
*/
|
||||||
|
export interface HjmFenceParam extends PageParam {
|
||||||
|
id?: number;
|
||||||
|
keywords?: string;
|
||||||
|
}
|
||||||
105
src/api/hjm/hjmQuestions/index.ts
Normal file
105
src/api/hjm/hjmQuestions/index.ts
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api/index';
|
||||||
|
import type { HjmQuestions, HjmQuestionsParam } from './model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询题目
|
||||||
|
*/
|
||||||
|
export async function pageHjmQuestions(params: HjmQuestionsParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<HjmQuestions>>>(
|
||||||
|
'/hjm/hjm-questions/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询题目列表
|
||||||
|
*/
|
||||||
|
export async function listHjmQuestions(params?: HjmQuestionsParam) {
|
||||||
|
const res = await request.get<ApiResult<HjmQuestions[]>>(
|
||||||
|
'/hjm/hjm-questions',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.code === 0 && res.data) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加题目
|
||||||
|
*/
|
||||||
|
export async function addHjmQuestions(data: HjmQuestions) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
'/hjm/hjm-questions',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改题目
|
||||||
|
*/
|
||||||
|
export async function updateHjmQuestions(data: HjmQuestions) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
'/hjm/hjm-questions',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除题目
|
||||||
|
*/
|
||||||
|
export async function removeHjmQuestions(id?: number) {
|
||||||
|
const res = await request.del<ApiResult<unknown>>(
|
||||||
|
'/hjm/hjm-questions/' + id
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除题目
|
||||||
|
*/
|
||||||
|
export async function removeBatchHjmQuestions(data: (number | undefined)[]) {
|
||||||
|
const res = await request.del<ApiResult<unknown>>(
|
||||||
|
'/hjm/hjm-questions/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询题目
|
||||||
|
*/
|
||||||
|
export async function getHjmQuestions(id: number) {
|
||||||
|
const res = await request.get<ApiResult<HjmQuestions>>(
|
||||||
|
'/hjm/hjm-questions/' + id
|
||||||
|
);
|
||||||
|
if (res.code === 0 && res.data) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
54
src/api/hjm/hjmQuestions/model/index.ts
Normal file
54
src/api/hjm/hjmQuestions/model/index.ts
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
import type { PageParam } from '@/api/index';
|
||||||
|
import {HjmChoices} from "@/api/hjm/hjmChoices/model";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 题目
|
||||||
|
*/
|
||||||
|
export interface HjmQuestions {
|
||||||
|
// 自增ID
|
||||||
|
id?: number;
|
||||||
|
// 课程ID
|
||||||
|
courseId?: number;
|
||||||
|
// 课程名称
|
||||||
|
courseName?: string;
|
||||||
|
// 类型 0choice 1fill 2essay
|
||||||
|
type?: number;
|
||||||
|
// 题目
|
||||||
|
question?: string;
|
||||||
|
// 正确答案
|
||||||
|
correctAnswer?: string;
|
||||||
|
// 难度,'easy', 'medium', 'hard'
|
||||||
|
difficulty?: number;
|
||||||
|
// 用户ID
|
||||||
|
userId?: number;
|
||||||
|
// 排序(数字越小越靠前)
|
||||||
|
sortNumber?: number;
|
||||||
|
// 备注
|
||||||
|
comments?: string;
|
||||||
|
// 状态, 0正常, 1冻结
|
||||||
|
status?: number;
|
||||||
|
// 是否删除, 0否, 1是
|
||||||
|
deleted?: number;
|
||||||
|
// 租户id
|
||||||
|
tenantId?: number;
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string;
|
||||||
|
// 修改时间
|
||||||
|
updateTime?: string;
|
||||||
|
// 选项
|
||||||
|
choicesA?: string,
|
||||||
|
choicesB?: string,
|
||||||
|
choicesC?: string,
|
||||||
|
choicesD?: string,
|
||||||
|
choices?: number;
|
||||||
|
choicesList?: HjmChoices[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 题目搜索条件
|
||||||
|
*/
|
||||||
|
export interface HjmQuestionsParam extends PageParam {
|
||||||
|
id?: number;
|
||||||
|
courseId?: number;
|
||||||
|
keywords?: string;
|
||||||
|
}
|
||||||
@@ -3,6 +3,9 @@ import Taro from '@tarojs/taro'
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import crypto from 'crypto-js';
|
import crypto from 'crypto-js';
|
||||||
import {Base64} from 'js-base64';
|
import {Base64} from 'js-base64';
|
||||||
|
import {FileRecord} from "@/api/system/file/model";
|
||||||
|
import {TenantId} from "@/utils/config";
|
||||||
|
|
||||||
export async function uploadOssByPath(filePath: string) {
|
export async function uploadOssByPath(filePath: string) {
|
||||||
return new Promise(async (resolve) => {
|
return new Promise(async (resolve) => {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
@@ -16,7 +19,7 @@ export async function uploadOssByPath(filePath: string) {
|
|||||||
};
|
};
|
||||||
let sts = Taro.getStorageSync('sts');
|
let sts = Taro.getStorageSync('sts');
|
||||||
let stsExpired = Taro.getStorageSync('stsExpiredAt');
|
let stsExpired = Taro.getStorageSync('stsExpiredAt');
|
||||||
if(!sts || (stsExpired && dayjs().isBefore(dayjs(stsExpired)))){
|
if (!sts || (stsExpired && dayjs().isBefore(dayjs(stsExpired)))) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const {data: {data: {credentials}}} = await request.get(`https://server.gxwebsoft.com/api/oss/getSTSToken`)
|
const {data: {data: {credentials}}} = await request.get(`https://server.gxwebsoft.com/api/oss/getSTSToken`)
|
||||||
Taro.setStorageSync('sts', credentials)
|
Taro.setStorageSync('sts', credentials)
|
||||||
@@ -49,3 +52,50 @@ export async function uploadOssByPath(filePath: string) {
|
|||||||
const computeSignature = (accessKeySecret, canonicalString) => {
|
const computeSignature = (accessKeySecret, canonicalString) => {
|
||||||
return crypto.enc.Base64.stringify(crypto.HmacSHA1(canonicalString, accessKeySecret));
|
return crypto.enc.Base64.stringify(crypto.HmacSHA1(canonicalString, accessKeySecret));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传阿里云OSS
|
||||||
|
*/
|
||||||
|
export async function uploadFile() {
|
||||||
|
return new Promise(async (resolve: (result: FileRecord) => void, reject) => {
|
||||||
|
Taro.chooseImage({
|
||||||
|
count: 1,
|
||||||
|
sizeType: ['compressed'],
|
||||||
|
sourceType: ['album', 'camera'],
|
||||||
|
success: async (res) => {
|
||||||
|
const tempFilePath = res.tempFilePaths[0];
|
||||||
|
// 上传图片到OSS
|
||||||
|
Taro.uploadFile({
|
||||||
|
url: 'https://server.gxwebsoft.com/api/oss/upload',
|
||||||
|
filePath: tempFilePath,
|
||||||
|
name: 'file',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json',
|
||||||
|
TenantId
|
||||||
|
},
|
||||||
|
success: (res) => {
|
||||||
|
try {
|
||||||
|
const data = JSON.parse(res.data);
|
||||||
|
if (data.code === 0) {
|
||||||
|
resolve(data.data)
|
||||||
|
} else {
|
||||||
|
reject(new Error(data.message || '上传失败'))
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
reject(new Error('解析响应数据失败'))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.log('上传请求失败', err);
|
||||||
|
reject(new Error('上传请求失败'))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.log('选择图片失败', err);
|
||||||
|
reject(new Error('选择图片失败'))
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { PageParam } from '@/api';
|
import { PageParam } from '@/api/index';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传记录
|
* 文件上传记录
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ export interface User {
|
|||||||
companyName?: string;
|
companyName?: string;
|
||||||
gradeName?: string;
|
gradeName?: string;
|
||||||
idCard?: string;
|
idCard?: string;
|
||||||
|
sfz1?: string;
|
||||||
|
sfz2?: string;
|
||||||
comments?: string;
|
comments?: string;
|
||||||
recommend?: number;
|
recommend?: number;
|
||||||
system?: any;
|
system?: any;
|
||||||
|
|||||||
130
src/api/system/userVerify/index.ts
Normal file
130
src/api/system/userVerify/index.ts
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type {ApiResult, PageResult} from '@/api/index';
|
||||||
|
import type {UserVerify, UserVerifyParam} from './model';
|
||||||
|
import {SERVER_API_URL} from "@/utils/server";
|
||||||
|
|
||||||
|
export async function myUserVerify(params: UserVerifyParam) {
|
||||||
|
const res = await request.get<ApiResult<UserVerify>>(
|
||||||
|
SERVER_API_URL + '/system/user-verify/myUserVerify',
|
||||||
|
params
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询实名认证
|
||||||
|
*/
|
||||||
|
export async function pageUserVerify(params: UserVerifyParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<UserVerify>>>(
|
||||||
|
SERVER_API_URL + '/system/user-verify/page',
|
||||||
|
params
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询实名认证列表
|
||||||
|
*/
|
||||||
|
export async function listUserVerify(params?: UserVerifyParam) {
|
||||||
|
const res = await request.get<ApiResult<UserVerify[]>>(
|
||||||
|
SERVER_API_URL + '/system/user-verify',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.code === 0 && res.data) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加实名认证
|
||||||
|
*/
|
||||||
|
export async function addUserVerify(data: UserVerify) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
SERVER_API_URL + '/system/user-verify',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改实名认证
|
||||||
|
*/
|
||||||
|
export async function updateUserVerify(data: UserVerify) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
SERVER_API_URL + '/system/user-verify',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除实名认证
|
||||||
|
*/
|
||||||
|
export async function removeUserVerify(id?: number) {
|
||||||
|
const res = await request.del<ApiResult<unknown>>(
|
||||||
|
SERVER_API_URL + '/system/user-verify/' + id
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除实名认证
|
||||||
|
*/
|
||||||
|
export async function removeBatchUserVerify(data: (number | undefined)[]) {
|
||||||
|
const res = await request.del<ApiResult<unknown>>(
|
||||||
|
SERVER_API_URL + '/system/user-verify/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询实名认证
|
||||||
|
*/
|
||||||
|
export async function getUserVerify(id: number) {
|
||||||
|
const res = await request.get<ApiResult<UserVerify>>(
|
||||||
|
SERVER_API_URL + '/system/user-verify/' + id
|
||||||
|
);
|
||||||
|
if (res.code === 0 && res.data) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交实名认证申请
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export async function submit(data: UserVerify) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
SERVER_API_URL + '/system/user-verify/submit',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.code === 0) {
|
||||||
|
return res.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
58
src/api/system/userVerify/model/index.ts
Normal file
58
src/api/system/userVerify/model/index.ts
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
import type { PageParam } from '@/api/index';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实名认证
|
||||||
|
*/
|
||||||
|
export interface UserVerify {
|
||||||
|
// 自增ID
|
||||||
|
id?: number;
|
||||||
|
// 用户ID
|
||||||
|
userId?: number;
|
||||||
|
// 认证类型, 0个人, 1企业
|
||||||
|
type?: any;
|
||||||
|
// 主体名称
|
||||||
|
name?: string;
|
||||||
|
// 真实姓名
|
||||||
|
realName?: string;
|
||||||
|
// 手机号码
|
||||||
|
phone?: string;
|
||||||
|
// 头像
|
||||||
|
avatar?: string;
|
||||||
|
// 证件号码
|
||||||
|
idCard?: string;
|
||||||
|
// 出生日期
|
||||||
|
birthday?: string;
|
||||||
|
// 正面
|
||||||
|
sfz1?: string;
|
||||||
|
// 反面
|
||||||
|
sfz2?: string;
|
||||||
|
// 企业名称
|
||||||
|
company?: string;
|
||||||
|
// 营业执照号码
|
||||||
|
zzCode?: string;
|
||||||
|
// 营业执照
|
||||||
|
zzImg?: string;
|
||||||
|
// 备注
|
||||||
|
comments?: string;
|
||||||
|
// 状态, 0在线, 1离线
|
||||||
|
status?: number;
|
||||||
|
// 是否删除, 0否, 1是
|
||||||
|
deleted?: number;
|
||||||
|
// 租户id
|
||||||
|
tenantId?: number;
|
||||||
|
// 注册时间
|
||||||
|
createTime?: string;
|
||||||
|
// 修改时间
|
||||||
|
updateTime?: string;
|
||||||
|
// 状态名称
|
||||||
|
statusText?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实名认证搜索条件
|
||||||
|
*/
|
||||||
|
export interface UserVerifyParam extends PageParam {
|
||||||
|
id?: number;
|
||||||
|
status?: number;
|
||||||
|
keywords?: string;
|
||||||
|
}
|
||||||
@@ -33,7 +33,8 @@ export default defineAppConfig({
|
|||||||
"bx/index",
|
"bx/index",
|
||||||
"company/company",
|
"company/company",
|
||||||
"profile/profile",
|
"profile/profile",
|
||||||
"setting/setting"
|
"setting/setting",
|
||||||
|
"userVerify/index"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ const Fence = () => {
|
|||||||
GPS编号:{item?.gpsNo}
|
GPS编号:{item?.gpsNo}
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell className={'car-info-item-content'}>
|
<Cell className={'car-info-item-content'}>
|
||||||
电子围栏:{item?.fence}
|
电子围栏:{item?.fenceName}
|
||||||
</Cell>
|
</Cell>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ const Fence = () => {
|
|||||||
GPS编号:{item?.gpsNo}
|
GPS编号:{item?.gpsNo}
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell className={'car-info-item-content'}>
|
<Cell className={'car-info-item-content'}>
|
||||||
电子围栏:{item?.fence}
|
电子围栏:{item?.fenceName}
|
||||||
</Cell>
|
</Cell>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const List = () => {
|
|||||||
|
|
||||||
const reload = () => {
|
const reload = () => {
|
||||||
// 获取车辆列表
|
// 获取车辆列表
|
||||||
pageHjmCar({keywords}).then(res => {
|
pageHjmCar({status: 1, keywords}).then(res => {
|
||||||
setList(res?.list || [])
|
setList(res?.list || [])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,8 @@ import {useEffect, useState} from "react";
|
|||||||
import {Map} from '@tarojs/components'
|
import {Map} from '@tarojs/components'
|
||||||
import {Search} from '@nutui/icons-react-taro'
|
import {Search} from '@nutui/icons-react-taro'
|
||||||
import {Button, Input} from '@nutui/nutui-react-taro'
|
import {Button, Input} from '@nutui/nutui-react-taro'
|
||||||
import Taro from '@tarojs/taro'
|
|
||||||
import {useRouter} from '@tarojs/taro'
|
import {useRouter} from '@tarojs/taro'
|
||||||
import {getHjmCar, pageHjmCar} from "@/api/hjm/hjmCar";
|
import {getHjmCar, getHjmCarByCode} from "@/api/hjm/hjmCar";
|
||||||
import {HjmCar} from "@/api/hjm/hjmCar/model";
|
import {HjmCar} from "@/api/hjm/hjmCar/model";
|
||||||
import './location.scss'
|
import './location.scss'
|
||||||
|
|
||||||
@@ -19,55 +18,57 @@ const Location = () => {
|
|||||||
const [longitude, setLongitude] = useState<any>()
|
const [longitude, setLongitude] = useState<any>()
|
||||||
const [latitude, setLatitude] = useState<any>()
|
const [latitude, setLatitude] = useState<any>()
|
||||||
const [scale, setScale] = useState<any>(16)
|
const [scale, setScale] = useState<any>(16)
|
||||||
|
const [showCircles, setShowCircles] = useState<boolean>(false)
|
||||||
|
const [points, setPoints] = useState<any[]>([])
|
||||||
|
|
||||||
const onKeywords = (keywords: string) => {
|
const onKeywords = (keywords: string) => {
|
||||||
setKeywords(keywords)
|
setKeywords(keywords)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取当前位置
|
// 通用的坐标字符串转数组函数
|
||||||
const getLocation = async () => {
|
const parseCoordinateString = (coordStr: string) => {
|
||||||
|
if (!coordStr) return { points: [] };
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await Taro.getLocation({
|
// 分割坐标点
|
||||||
type: 'gcj02' //返回可以用于wx.openLocation的经纬度
|
const coordPairs = coordStr.split(';');
|
||||||
})
|
|
||||||
if (res.latitude) {
|
// 转为多边形点数组
|
||||||
setLatitude(res.latitude)
|
const points = coordPairs.map(coord => {
|
||||||
|
const [lat, lng] = coord.split(',');
|
||||||
|
return {
|
||||||
|
latitude: parseFloat(lat),
|
||||||
|
longitude: parseFloat(lng)
|
||||||
}
|
}
|
||||||
if (res.longitude) {
|
});
|
||||||
setLongitude(res.longitude)
|
|
||||||
}
|
return { points };
|
||||||
console.log('当前位置:', res.latitude, res.longitude);
|
} catch (error) {
|
||||||
return res;
|
console.error('解析坐标字符串失败:', error);
|
||||||
} catch (err) {
|
return { points: [] };
|
||||||
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 reload = () => {
|
||||||
const id = Number(params.id);
|
const id = Number(params.id);
|
||||||
setScale(16)
|
setScale(14)
|
||||||
getLocation()
|
|
||||||
// 执行搜索
|
// 执行搜索
|
||||||
if (keywords) {
|
if (keywords) {
|
||||||
pageHjmCar({keywords}).then(res => {
|
getHjmCarByCode(keywords).then(data => {
|
||||||
if (res?.list && res?.list?.length > 0) {
|
console.log('执行搜索', data)
|
||||||
const data = res?.list[0];
|
|
||||||
setItem(data)
|
setItem(data)
|
||||||
setLatitude(data.latitude)
|
setLatitude(data.latitude)
|
||||||
setLongitude(data.longitude)
|
setLongitude(data.longitude)
|
||||||
setKeywords(data.code)
|
setKeywords(data.code)
|
||||||
|
if (data.fence) {
|
||||||
|
// 方法2:使用实际的 fence 数据(如果是字符串格式)
|
||||||
|
const coordStr = data.fence.points || '';
|
||||||
|
|
||||||
|
// 使用通用函数解析坐标字符串
|
||||||
|
const { points } = parseCoordinateString(coordStr);
|
||||||
|
console.log('解析结果 - 多边形点:', points);
|
||||||
|
setPoints(points);
|
||||||
|
setShowCircles(true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return false;
|
return false;
|
||||||
@@ -79,6 +80,16 @@ const Location = () => {
|
|||||||
setLatitude(data.latitude)
|
setLatitude(data.latitude)
|
||||||
setLongitude(data.longitude)
|
setLongitude(data.longitude)
|
||||||
setKeywords(data.code)
|
setKeywords(data.code)
|
||||||
|
if (data.fence) {
|
||||||
|
// 方法2:使用实际的 fence 数据(如果是字符串格式)
|
||||||
|
const coordStr = data.fence.points || '';
|
||||||
|
|
||||||
|
// 使用通用函数解析坐标字符串
|
||||||
|
const { points } = parseCoordinateString(coordStr);
|
||||||
|
console.log('解析结果 - 多边形点:', points);
|
||||||
|
setPoints(points);
|
||||||
|
setShowCircles(true)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,6 +98,9 @@ const Location = () => {
|
|||||||
reload()
|
reload()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
// 监听圈圈数据变化
|
||||||
|
useEffect(() => {
|
||||||
|
}, [showCircles])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -126,7 +140,7 @@ const Location = () => {
|
|||||||
<div className={'car-info-item-content'}>
|
<div className={'car-info-item-content'}>
|
||||||
操作员:{item?.driver}
|
操作员:{item?.driver}
|
||||||
</div>
|
</div>
|
||||||
<div className={'car-info-item-content'}>
|
<div className={'car-info-item-content pr-6'}>
|
||||||
位置信息:{item?.address}
|
位置信息:{item?.address}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -145,11 +159,20 @@ const Location = () => {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
name: '位置'
|
name: '位置'
|
||||||
}]}
|
}]}
|
||||||
|
polygons={points.length > 0 ? [
|
||||||
|
{
|
||||||
|
points: points,
|
||||||
|
color: '#ff0000',
|
||||||
|
fillColor: '#ffcccc',
|
||||||
|
strokeWidth: 2
|
||||||
|
}
|
||||||
|
] : []}
|
||||||
onTap={() => {
|
onTap={() => {
|
||||||
console.log('map tap')
|
console.log('map tap')
|
||||||
}}
|
}}
|
||||||
style={{width: '100%', height: '100vh'}}
|
style={{width: '100%', height: '100vh'}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ import {
|
|||||||
import {Scan} from '@nutui/icons-react-taro'
|
import {Scan} from '@nutui/icons-react-taro'
|
||||||
import {pageDictData} from "@/api/system/dict-data";
|
import {pageDictData} from "@/api/system/dict-data";
|
||||||
import {DictData} from "@/api/system/dict-data/model";
|
import {DictData} from "@/api/system/dict-data/model";
|
||||||
import {TenantId} from "@/utils/config";
|
import {myUserVerify} from "@/api/system/userVerify";
|
||||||
|
import {uploadFile} from "@/api/system/file";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文章终极列表
|
* 文章终极列表
|
||||||
@@ -25,9 +26,8 @@ import {TenantId} from "@/utils/config";
|
|||||||
const Query = () => {
|
const Query = () => {
|
||||||
const {params} = useRouter();
|
const {params} = useRouter();
|
||||||
const [keywords, setKeywords] = useState<string>()
|
const [keywords, setKeywords] = useState<string>()
|
||||||
const [item, setItem] = useState<HjmCar>()
|
|
||||||
const [dict, setDict] = useState<DictData[]>([])
|
const [dict, setDict] = useState<DictData[]>([])
|
||||||
|
const [adminId, setAdminId] = useState<number>()
|
||||||
const [FormData, setFormData] = useState<HjmCar>(
|
const [FormData, setFormData] = useState<HjmCar>(
|
||||||
{
|
{
|
||||||
// 自增ID
|
// 自增ID
|
||||||
@@ -54,6 +54,10 @@ const Query = () => {
|
|||||||
insuranceStatus: undefined,
|
insuranceStatus: undefined,
|
||||||
// GPS设备编号
|
// GPS设备编号
|
||||||
gpsNo: undefined,
|
gpsNo: undefined,
|
||||||
|
// 电子围栏ID
|
||||||
|
fenceId: undefined,
|
||||||
|
// 电子围栏名称
|
||||||
|
fenceName: undefined,
|
||||||
// 电子围栏
|
// 电子围栏
|
||||||
fence: undefined,
|
fence: undefined,
|
||||||
// 位置
|
// 位置
|
||||||
@@ -85,14 +89,16 @@ const Query = () => {
|
|||||||
|
|
||||||
// 提交表单
|
// 提交表单
|
||||||
const submitSucceed = (values: any) => {
|
const submitSucceed = (values: any) => {
|
||||||
updateHjmCar({...values, ...FormData, status: 1}).then(() => {
|
console.log(values)
|
||||||
Taro.showToast({title: `保存成功`, icon: 'success'})
|
updateHjmCar({...FormData, status: 1, driverId: adminId}).then(() => {
|
||||||
|
Taro.showToast({title: `绑定成功`, icon: 'success'})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
reload();
|
||||||
return Taro.navigateBack()
|
return Taro.navigateBack()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '保存失败',
|
title: '绑定失败',
|
||||||
icon: 'error'
|
icon: 'error'
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@@ -131,50 +137,12 @@ const Query = () => {
|
|||||||
|
|
||||||
// 拍照上传功能
|
// 拍照上传功能
|
||||||
const takePhoto = () => {
|
const takePhoto = () => {
|
||||||
Taro.chooseImage({
|
uploadFile().then(res => {
|
||||||
count: 1,
|
setFormData({
|
||||||
sizeType: ['compressed'],
|
...FormData,
|
||||||
sourceType: ['camera'], // 只允许拍照
|
image: res.url
|
||||||
success: async (res) => {
|
|
||||||
const tempFilePath = res.tempFilePaths[0];
|
|
||||||
console.log(tempFilePath, 'tempFilePath')
|
|
||||||
// 上传图片到OSS
|
|
||||||
Taro.uploadFile({
|
|
||||||
url: 'https://server.gxwebsoft.com/api/oss/upload',
|
|
||||||
filePath: tempFilePath,
|
|
||||||
name: 'file',
|
|
||||||
header: {
|
|
||||||
'content-type': 'application/json',
|
|
||||||
TenantId
|
|
||||||
},
|
|
||||||
success: (res) => {
|
|
||||||
const data = JSON.parse(res.data);
|
|
||||||
if (data && data.code === 0) {
|
|
||||||
console.log(data.data.url, '1url.....')
|
|
||||||
updateHjmCar({
|
|
||||||
id: FormData.id,
|
|
||||||
image: data.data.downloadUrl + '?x-oss-process=image/resize,w_750/quality,Q_90'
|
|
||||||
}).then(() => {
|
|
||||||
Taro.showToast({
|
|
||||||
title: '上传成功',
|
|
||||||
icon: 'success',
|
|
||||||
duration: 2000
|
|
||||||
});
|
|
||||||
setFormData({...FormData,image: data.data.downloadUrl + '?x-oss-process=image/resize,w_750/quality,Q_90'})
|
|
||||||
})
|
})
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
},
|
|
||||||
fail: (err) => {
|
|
||||||
console.log('拍照失败', err);
|
|
||||||
Taro.showToast({
|
|
||||||
title: '拍照失败',
|
|
||||||
icon: 'error',
|
|
||||||
duration: 2000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除图片
|
// 删除图片
|
||||||
@@ -205,39 +173,50 @@ const Query = () => {
|
|||||||
pageDictData({dictCode: 'InsuranceStatus'}).then(res => {
|
pageDictData({dictCode: 'InsuranceStatus'}).then(res => {
|
||||||
setDict(res?.list || [])
|
setDict(res?.list || [])
|
||||||
})
|
})
|
||||||
// 执行搜索
|
// 检查是否已实名
|
||||||
if (keywords) {
|
myUserVerify({status: 1}).then(data => {
|
||||||
pageHjmCar({keywords}).then(res => {
|
if (!data) {
|
||||||
if (res?.list && res?.list?.length > 0) {
|
Taro.showToast({
|
||||||
const data = res?.list[0];
|
title: '未实名认证',
|
||||||
setItem(data)
|
icon: 'error'
|
||||||
setKeywords(data.code)
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: '/user/userVerify/index'
|
||||||
|
})
|
||||||
|
}, 1000)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if(data){
|
||||||
|
setAdminId(data.userId);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// 获取车辆信息
|
// 获取车辆信息
|
||||||
if (id) {
|
if (id) {
|
||||||
getHjmCar(id).then(data => {
|
getHjmCar(id).then(data => {
|
||||||
setItem(data)
|
if(data){
|
||||||
setKeywords(data.code)
|
|
||||||
setFormData(data)
|
setFormData(data)
|
||||||
|
setKeywords(data.code)
|
||||||
// 初始化已上传的图片
|
|
||||||
// if (data.image) {
|
|
||||||
// const images = data.image.split(',').filter(img => img.trim());
|
|
||||||
// setUploadedImages(images);
|
|
||||||
// }
|
|
||||||
|
|
||||||
console.log(data.status, '1213')
|
|
||||||
if (data.status == 0) {
|
if (data.status == 0) {
|
||||||
Taro.setNavigationBarTitle({
|
Taro.setNavigationBarTitle({
|
||||||
title: '安装设备'
|
title: '安装设备'
|
||||||
})
|
})
|
||||||
setFormData({...data, driver: Taro.getStorageSync('RealName')})
|
setFormData({...data, driver: Taro.getStorageSync('RealName')})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 执行搜索
|
||||||
|
if (keywords) {
|
||||||
|
pageHjmCar({keywords}).then(res => {
|
||||||
|
if (res?.list && res?.list?.length > 0) {
|
||||||
|
const data = res?.list[0];
|
||||||
|
// setFormData(data)
|
||||||
|
setKeywords(data.code)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -247,9 +226,8 @@ const Query = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
||||||
{/* 未安装 */}
|
{/* 未安装 */}
|
||||||
{item?.status == 0 ? (
|
{FormData?.status == 0 ? (
|
||||||
<div className={'car-info w-full bg-white'}>
|
<div className={'car-info w-full bg-white'}>
|
||||||
<div className={'px-0'}>
|
<div className={'px-0'}>
|
||||||
<Form
|
<Form
|
||||||
@@ -277,7 +255,7 @@ const Query = () => {
|
|||||||
name="code"
|
name="code"
|
||||||
rules={[{message: '请输入车辆编号'}]}
|
rules={[{message: '请输入车辆编号'}]}
|
||||||
>
|
>
|
||||||
<View onClick={() => copyText(`${item?.code}`)}>{item?.code}</View>
|
<View onClick={() => copyText(`${FormData?.code}`)}>{FormData?.code}</View>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={'快递公司品牌'}
|
label={'快递公司品牌'}
|
||||||
@@ -320,6 +298,7 @@ const Query = () => {
|
|||||||
<Form.Item
|
<Form.Item
|
||||||
label={'GPS编号'}
|
label={'GPS编号'}
|
||||||
name="gpsNo"
|
name="gpsNo"
|
||||||
|
required
|
||||||
rules={[{message: 'GPS编号'}]}
|
rules={[{message: 'GPS编号'}]}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@@ -345,6 +324,7 @@ const Query = () => {
|
|||||||
<Form.Item
|
<Form.Item
|
||||||
label={'拍照上传'}
|
label={'拍照上传'}
|
||||||
name="image"
|
name="image"
|
||||||
|
required
|
||||||
rules={[{message: '请上传照片'}]}
|
rules={[{message: '请上传照片'}]}
|
||||||
onClick={takePhoto}
|
onClick={takePhoto}
|
||||||
>
|
>
|
||||||
@@ -353,6 +333,7 @@ const Query = () => {
|
|||||||
radius="10%" width="80" height="80"/>
|
radius="10%" width="80" height="80"/>
|
||||||
</div>
|
</div>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={'操作员'}
|
label={'操作员'}
|
||||||
name="driver"
|
name="driver"
|
||||||
@@ -366,33 +347,42 @@ const Query = () => {
|
|||||||
) : ''}
|
) : ''}
|
||||||
|
|
||||||
{/* 已安装 */}
|
{/* 已安装 */}
|
||||||
{item?.status == 1 ? (
|
{FormData?.status == 1 ? (
|
||||||
<div className={'car-info w-full bg-white'}>
|
<div className={'car-info w-full bg-white'}>
|
||||||
<Image src={item?.image} mode={'aspectFit'} width={'100%'} height={'300px'}/>
|
<Image src={FormData?.image} mode={'aspectFit'} width={'100%'} height={'300px'}/>
|
||||||
<div className={'px-2'}>
|
<div className={'px-2'}>
|
||||||
<Cell className={'car-info-item-title'} onClick={() => copyText(`${item?.code}`)}>
|
<Cell className={'car-info-item-title'} onClick={() => copyText(`${FormData?.code}`)}>
|
||||||
车辆编号:{item?.code}
|
车辆编号:{FormData?.code}
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell className={'car-info-item-title'}>
|
<Cell className={'car-info-item-title'}>
|
||||||
快递公司品牌:{item?.parentOrganization}
|
快递公司品牌:{FormData?.parentOrganization}
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell className={'car-info-item-title'}>
|
<Cell className={'car-info-item-title'}>
|
||||||
管理责任人:{item?.parentOrganizationAdmin}
|
管理责任人:{FormData?.parentOrganizationAdmin}
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell className={'car-info-item-content'}>
|
<Cell className={'car-info-item-content'}>
|
||||||
操作员:{item?.driver}
|
操作员:{FormData?.driver}
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell className={'car-info-item-content'}>
|
<Cell className={'car-info-item-content'}>
|
||||||
保险状态:{item?.insuranceStatus}
|
保险状态:{FormData?.insuranceStatus}
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell className={'car-info-item-content'}>
|
<Cell className={'car-info-item-content'}>
|
||||||
GPS编号:{item?.gpsNo}
|
GPS编号:{FormData?.gpsNo}
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell className={'car-info-item-content'}>
|
<Cell className={'car-info-item-content'}>
|
||||||
电子围栏:{item?.fence}
|
电子围栏:{FormData?.fenceName}
|
||||||
</Cell>
|
</Cell>
|
||||||
|
<Button nativeType="submit" block type="info" onClick={
|
||||||
|
() => {
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: `/hjm/location?id=${FormData?.id}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}>
|
||||||
|
查看定位
|
||||||
|
</Button>
|
||||||
{/*<Cell className={'car-info-item-content'}>*/}
|
{/*<Cell className={'car-info-item-content'}>*/}
|
||||||
{/* 状态:{item?.status == 1 ? '已安装' : '未安装'}*/}
|
{/* 状态:{FormData?.status == 1 ? '已安装' : '未安装'}*/}
|
||||||
{/*</Cell>*/}
|
{/*</Cell>*/}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import {Cell, InfiniteLoading} from '@nutui/nutui-react-taro'
|
import {Cell, InfiniteLoading} from '@nutui/nutui-react-taro'
|
||||||
import {ArrowRight} from '@nutui/icons-react-taro'
|
|
||||||
import navTo from "@/utils/common";
|
import navTo from "@/utils/common";
|
||||||
import UserFooter from "./UserFooter";
|
import UserFooter from "./UserFooter";
|
||||||
import Taro from '@tarojs/taro'
|
import Taro from '@tarojs/taro'
|
||||||
import {Truck, LogisticsError} from '@nutui/icons-react-taro'
|
import {ArrowRight, ShieldCheck, Truck, LogisticsError} from '@nutui/icons-react-taro'
|
||||||
import {CSSProperties} from "react";
|
import {CSSProperties} from "react";
|
||||||
|
|
||||||
const UserCell = () => {
|
const UserCell = () => {
|
||||||
@@ -35,6 +34,22 @@ const UserCell = () => {
|
|||||||
<>
|
<>
|
||||||
<div style={InfiniteUlStyle} id="scroll">
|
<div style={InfiniteUlStyle} id="scroll">
|
||||||
<InfiniteLoading>
|
<InfiniteLoading>
|
||||||
|
<Cell.Group divider={true}>
|
||||||
|
<Cell
|
||||||
|
className="nutui-cell-clickable"
|
||||||
|
title={
|
||||||
|
<div style={{display: 'inline-flex', alignItems: 'center'}}>
|
||||||
|
<ShieldCheck size={16}/>
|
||||||
|
<span className={'pl-3 text-sm'}>实名认证</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
align="center"
|
||||||
|
extra={<ArrowRight color="#cccccc" size={18}/>}
|
||||||
|
onClick={() => {
|
||||||
|
navTo('/user/userVerify/index', true)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Cell.Group>
|
||||||
<Cell.Group divider={true}>
|
<Cell.Group divider={true}>
|
||||||
<Cell
|
<Cell
|
||||||
className="nutui-cell-clickable"
|
className="nutui-cell-clickable"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import {useEffect, useState} from "react";
|
|||||||
import Taro from '@tarojs/taro'
|
import Taro from '@tarojs/taro'
|
||||||
import {ArrowLeft} from '@nutui/icons-react-taro'
|
import {ArrowLeft} from '@nutui/icons-react-taro'
|
||||||
import {NavBar, InfiniteLoading} from '@nutui/nutui-react-taro'
|
import {NavBar, InfiniteLoading} from '@nutui/nutui-react-taro'
|
||||||
import {pageHjmCar} from "@/api/hjm/hjmCar";
|
|
||||||
import {HjmCar} from "@/api/hjm/hjmCar/model";
|
import {HjmCar} from "@/api/hjm/hjmCar/model";
|
||||||
import BestSellers from "./BestSellers";
|
import BestSellers from "./BestSellers";
|
||||||
|
|
||||||
@@ -16,9 +15,7 @@ const Index = () => {
|
|||||||
|
|
||||||
const reload = () => {
|
const reload = () => {
|
||||||
// 获取车辆列表
|
// 获取车辆列表
|
||||||
pageHjmCar({userId: Taro.getStorageSync('UserId')}).then(res => {
|
setList([])
|
||||||
setList(res?.list || [])
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -49,7 +46,7 @@ const Index = () => {
|
|||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<span>车辆管理</span>
|
<span>报险记录</span>
|
||||||
</NavBar>
|
</NavBar>
|
||||||
<InfiniteLoading
|
<InfiniteLoading
|
||||||
className={'w-full fixed left-0 top-24'}
|
className={'w-full fixed left-0 top-24'}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const Index = () => {
|
|||||||
|
|
||||||
const reload = () => {
|
const reload = () => {
|
||||||
// 获取车辆列表
|
// 获取车辆列表
|
||||||
pageHjmCar({}).then(res => {
|
pageHjmCar({driverId: Taro.getStorageSync('UserId')}).then(res => {
|
||||||
setList(res?.list || [])
|
setList(res?.list || [])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {ConfigProvider} from '@nutui/nutui-react-taro'
|
|||||||
import Taro, {getCurrentInstance} from '@tarojs/taro'
|
import Taro, {getCurrentInstance} from '@tarojs/taro'
|
||||||
import {getUserInfo, updateUserInfo} from "@/api/layout";
|
import {getUserInfo, updateUserInfo} from "@/api/layout";
|
||||||
import {TenantId} from "@/utils/config";
|
import {TenantId} from "@/utils/config";
|
||||||
|
import { TextArea } from '@nutui/nutui-react-taro'
|
||||||
import './profile.scss'
|
import './profile.scss'
|
||||||
|
|
||||||
const {router} = getCurrentInstance()
|
const {router} = getCurrentInstance()
|
||||||
@@ -12,7 +13,7 @@ import {
|
|||||||
Form,
|
Form,
|
||||||
Button,
|
Button,
|
||||||
Input,
|
Input,
|
||||||
Radio
|
Radio,
|
||||||
} from '@nutui/nutui-react-taro'
|
} from '@nutui/nutui-react-taro'
|
||||||
import {DictData} from "@/api/system/dict-data/model";
|
import {DictData} from "@/api/system/dict-data/model";
|
||||||
import {pageDictData} from "@/api/system/dict-data";
|
import {pageDictData} from "@/api/system/dict-data";
|
||||||
@@ -20,7 +21,6 @@ import {User} from "@/api/system/user/model";
|
|||||||
function Profile() {
|
function Profile() {
|
||||||
const formId = Number(router?.params.id)
|
const formId = Number(router?.params.id)
|
||||||
|
|
||||||
const [form] = Form.useForm()
|
|
||||||
const [sex, setSex] = useState<DictData[]>()
|
const [sex, setSex] = useState<DictData[]>()
|
||||||
const [FormData, setFormData] = useState<User>(
|
const [FormData, setFormData] = useState<User>(
|
||||||
{
|
{
|
||||||
@@ -34,12 +34,7 @@ function Profile() {
|
|||||||
comments: undefined
|
comments: undefined
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
const [user, setUser] = useState<any>({
|
|
||||||
nickname: '',
|
|
||||||
avatar: undefined,
|
|
||||||
username: '',
|
|
||||||
mobile: ''
|
|
||||||
})
|
|
||||||
const reload = () => {
|
const reload = () => {
|
||||||
// 获取数据字典
|
// 获取数据字典
|
||||||
pageDictData({limit: 200}).then(res => {
|
pageDictData({limit: 200}).then(res => {
|
||||||
@@ -47,8 +42,8 @@ function Profile() {
|
|||||||
})
|
})
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
getUserInfo().then((data) => {
|
getUserInfo().then((data) => {
|
||||||
setUser(data)
|
// 更新表单数据
|
||||||
setFormData(data)
|
setFormData(data);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +55,7 @@ function Profile() {
|
|||||||
Taro.showToast({title: `保存成功`, icon: 'success'})
|
Taro.showToast({title: `保存成功`, icon: 'success'})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
return Taro.navigateBack()
|
return Taro.navigateBack()
|
||||||
},1000)
|
}, 1000)
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '保存失败',
|
title: '保存失败',
|
||||||
@@ -73,8 +68,8 @@ function Profile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const uploadAvatar = ({detail}) => {
|
const uploadAvatar = ({detail}) => {
|
||||||
setUser({
|
setFormData({
|
||||||
...user,
|
...FormData,
|
||||||
avatar: `${detail.avatarUrl}`,
|
avatar: `${detail.avatarUrl}`,
|
||||||
})
|
})
|
||||||
Taro.uploadFile({
|
Taro.uploadFile({
|
||||||
@@ -89,7 +84,7 @@ function Profile() {
|
|||||||
const data = JSON.parse(res.data);
|
const data = JSON.parse(res.data);
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
updateUserInfo({
|
updateUserInfo({
|
||||||
userId: user.userId,
|
userId: FormData?.userId,
|
||||||
avatar: `${data.data.thumbnail}`
|
avatar: `${data.data.thumbnail}`
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
@@ -101,9 +96,18 @@ function Profile() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取微信昵称
|
||||||
|
const getWxNickname = (nickname: string) => {
|
||||||
|
// 更新表单数据
|
||||||
|
setFormData({
|
||||||
|
...FormData,
|
||||||
|
nickname: nickname
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
reload()
|
reload()
|
||||||
}, [form]);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -112,13 +116,13 @@ function Profile() {
|
|||||||
<Cell title={'头像'} align={'center'} extra={
|
<Cell title={'头像'} align={'center'} extra={
|
||||||
<>
|
<>
|
||||||
<Button open-type="chooseAvatar" style={{height: '58px'}} onChooseAvatar={uploadAvatar}>
|
<Button open-type="chooseAvatar" style={{height: '58px'}} onChooseAvatar={uploadAvatar}>
|
||||||
<Avatar src={user.avatar} size="54"/>
|
<Avatar src={FormData?.avatar} size="54"/>
|
||||||
</Button>
|
</Button>
|
||||||
<ArrowRight color="#cccccc" className={'ml-1'} size={20}/>
|
<ArrowRight color="#cccccc" className={'ml-1'} size={20}/>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Cell title={'手机号码'} align={'center'} extra={user.mobile}/>
|
<Cell title={'手机号码'} align={'center'} extra={FormData?.phone}/>
|
||||||
</Cell.Group>
|
</Cell.Group>
|
||||||
<ConfigProvider>
|
<ConfigProvider>
|
||||||
<Form
|
<Form
|
||||||
@@ -145,17 +149,15 @@ function Profile() {
|
|||||||
label={'昵称'}
|
label={'昵称'}
|
||||||
name="nickname"
|
name="nickname"
|
||||||
initialValue={FormData.nickname}
|
initialValue={FormData.nickname}
|
||||||
rules={[{message: '请输入昵称'}]}
|
rules={[{message: '请获取微信昵称'}]}
|
||||||
>
|
>
|
||||||
<Input placeholder="请输入昵称" type="text"/>
|
<Input
|
||||||
</Form.Item>
|
type="nickname"
|
||||||
<Form.Item
|
className="info-content__input"
|
||||||
label={'真实姓名'}
|
placeholder="请输入昵称"
|
||||||
name="realName"
|
value={FormData?.nickname}
|
||||||
initialValue={FormData.realName}
|
onInput={(e) => getWxNickname(e.detail.value)}
|
||||||
rules={[{message: '请输入真实姓名'}]}
|
/>
|
||||||
>
|
|
||||||
<Input placeholder="请输入真实姓名或单位名称" type="text"/>
|
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="性别"
|
label="性别"
|
||||||
@@ -165,7 +167,7 @@ function Profile() {
|
|||||||
{message: '请选择性别'}
|
{message: '请选择性别'}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Radio.Group defaultValue={FormData.sex} direction="horizontal">
|
<Radio.Group value={FormData?.sex} direction="horizontal">
|
||||||
{
|
{
|
||||||
sex?.map((item, index) => (
|
sex?.map((item, index) => (
|
||||||
<Radio key={index} value={item.dictDataCode}>
|
<Radio key={index} value={item.dictDataCode}>
|
||||||
@@ -175,20 +177,17 @@ function Profile() {
|
|||||||
}
|
}
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
|
||||||
label={'联系地址'}
|
|
||||||
name="address"
|
|
||||||
initialValue={FormData.address}
|
|
||||||
rules={[{message: '请输入联系地址'}]}
|
|
||||||
>
|
|
||||||
<Input placeholder="请输入联系地址" type="text"/>
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="备注信息"
|
label="备注信息"
|
||||||
name="comments"
|
name="comments"
|
||||||
initialValue={FormData.comments}
|
initialValue={FormData.comments}
|
||||||
rules={[{message: '备注信息'}]}
|
rules={[{message: '备注信息'}]}
|
||||||
>
|
>
|
||||||
|
<TextArea
|
||||||
|
placeholder={'个性签名'}
|
||||||
|
value={FormData?.comments}
|
||||||
|
onChange={(value) => setFormData({...FormData, comments: value})}
|
||||||
|
/>
|
||||||
<Input placeholder={'个性签名'} />
|
<Input placeholder={'个性签名'} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
|
|||||||
3
src/user/userVerify/index.config.ts
Normal file
3
src/user/userVerify/index.config.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export default definePageConfig({
|
||||||
|
navigationBarTitleText: '实名认证'
|
||||||
|
})
|
||||||
314
src/user/userVerify/index.tsx
Normal file
314
src/user/userVerify/index.tsx
Normal file
@@ -0,0 +1,314 @@
|
|||||||
|
import {useEffect, useState} from "react";
|
||||||
|
import {Image, Tag} from '@nutui/nutui-react-taro'
|
||||||
|
import {ConfigProvider} from '@nutui/nutui-react-taro'
|
||||||
|
import Taro from '@tarojs/taro'
|
||||||
|
|
||||||
|
import {
|
||||||
|
Form,
|
||||||
|
Button,
|
||||||
|
Input,
|
||||||
|
Radio,
|
||||||
|
} from '@nutui/nutui-react-taro'
|
||||||
|
import {UserVerify} from "@/api/system/userVerify/model";
|
||||||
|
import {addUserVerify, myUserVerify, updateUserVerify} from "@/api/system/userVerify";
|
||||||
|
import {uploadFile} from "@/api/system/file";
|
||||||
|
|
||||||
|
function Index() {
|
||||||
|
const [isUpdate, setIsUpdate] = useState<boolean>(false)
|
||||||
|
|
||||||
|
const [FormData, setFormData] = useState<UserVerify>({
|
||||||
|
userId: undefined,
|
||||||
|
type: undefined,
|
||||||
|
phone: undefined,
|
||||||
|
avatar: undefined,
|
||||||
|
realName: undefined,
|
||||||
|
idCard: undefined,
|
||||||
|
birthday: undefined,
|
||||||
|
sfz1: undefined,
|
||||||
|
sfz2: undefined,
|
||||||
|
zzCode: undefined,
|
||||||
|
zzImg: undefined,
|
||||||
|
status: undefined,
|
||||||
|
statusText: undefined,
|
||||||
|
comments: undefined
|
||||||
|
})
|
||||||
|
const reload = () => {
|
||||||
|
myUserVerify({}).then(data => {
|
||||||
|
if (data) {
|
||||||
|
setIsUpdate(true);
|
||||||
|
setFormData(data)
|
||||||
|
} else {
|
||||||
|
setFormData({
|
||||||
|
type: 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交表单
|
||||||
|
const submitSucceed = (values: any) => {
|
||||||
|
console.log('提交表单', values);
|
||||||
|
if (FormData.status != 2 && FormData.status != undefined) return false;
|
||||||
|
if (FormData.type == 0) {
|
||||||
|
if (!FormData.sfz1 || !FormData.sfz2) {
|
||||||
|
Taro.showToast({
|
||||||
|
title: '请上传身份证正反面',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!FormData.realName || !FormData.idCard) {
|
||||||
|
Taro.showToast({
|
||||||
|
title: '请填写真实姓名和身份证号码',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (FormData.type == 1) {
|
||||||
|
if (!FormData.zzImg) {
|
||||||
|
Taro.showToast({
|
||||||
|
title: '请上传营业执照',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!FormData.name || !FormData.zzCode) {
|
||||||
|
Taro.showToast({
|
||||||
|
title: '请填写主体名称和营业执照号码',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const saveOrUpdate = isUpdate ? updateUserVerify : addUserVerify;
|
||||||
|
saveOrUpdate({...FormData, status: 0}).then(() => {
|
||||||
|
Taro.showToast({title: `提交成功`, icon: 'success'})
|
||||||
|
setTimeout(() => {
|
||||||
|
return Taro.navigateBack()
|
||||||
|
}, 1000)
|
||||||
|
}).catch(() => {
|
||||||
|
Taro.showToast({
|
||||||
|
title: '提交失败',
|
||||||
|
icon: 'error'
|
||||||
|
});
|
||||||
|
}).finally(() => {
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const submitFailed = (error: any) => {
|
||||||
|
console.log(error, 'err...')
|
||||||
|
}
|
||||||
|
|
||||||
|
const uploadSfz1 = () => {
|
||||||
|
if (FormData.status != 2 && FormData.status != undefined) return false;
|
||||||
|
uploadFile().then(data => {
|
||||||
|
setFormData({
|
||||||
|
...FormData,
|
||||||
|
sfz1: data.url
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const uploadSfz2 = () => {
|
||||||
|
if (FormData.status != 2 && FormData.status != undefined) return false;
|
||||||
|
uploadFile().then(data => {
|
||||||
|
setFormData({
|
||||||
|
...FormData,
|
||||||
|
sfz2: data.url
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const uploadZzImg = () => {
|
||||||
|
if (FormData.status != 2 && FormData.status != undefined) return false;
|
||||||
|
uploadFile().then(data => {
|
||||||
|
setFormData({
|
||||||
|
...FormData,
|
||||||
|
zzImg: data.url
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
reload()
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className={'p-4'}>
|
||||||
|
<ConfigProvider>
|
||||||
|
<Form
|
||||||
|
divider
|
||||||
|
initialValues={FormData}
|
||||||
|
labelPosition="left"
|
||||||
|
onFinish={(values) => submitSucceed(values)}
|
||||||
|
onFinishFailed={(errors) => submitFailed(errors)}
|
||||||
|
footer={
|
||||||
|
FormData.status != 1 && (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'center',
|
||||||
|
width: '100%'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Button nativeType="submit" block type={'info'}
|
||||||
|
disabled={FormData.status != 2 && FormData.status != undefined}>
|
||||||
|
提交
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Form.Item
|
||||||
|
label="类型"
|
||||||
|
name="type"
|
||||||
|
initialValue={FormData.type}
|
||||||
|
required
|
||||||
|
>
|
||||||
|
<Radio.Group value={FormData?.type} direction="horizontal"
|
||||||
|
disabled={FormData.status != 2 && FormData.status != undefined}
|
||||||
|
onChange={(value) => setFormData({...FormData, type: value})}>
|
||||||
|
<Radio key={0} value={0}>
|
||||||
|
个人
|
||||||
|
</Radio>
|
||||||
|
<Radio key={1} value={1}>
|
||||||
|
企业
|
||||||
|
</Radio>
|
||||||
|
</Radio.Group>
|
||||||
|
</Form.Item>
|
||||||
|
{
|
||||||
|
// 个人类型
|
||||||
|
FormData.type == 0 && (
|
||||||
|
<>
|
||||||
|
<Form.Item
|
||||||
|
label={'真实姓名'}
|
||||||
|
name="realName"
|
||||||
|
required
|
||||||
|
initialValue={FormData.realName}
|
||||||
|
rules={[{message: '请输入真实姓名'}]}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
placeholder={'请输入真实姓名'}
|
||||||
|
type="text"
|
||||||
|
disabled={FormData.status != 2 && FormData.status != undefined}
|
||||||
|
value={FormData?.realName}
|
||||||
|
onChange={(value) => setFormData({...FormData, realName: value})}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={'身份证号码'}
|
||||||
|
name="idCard"
|
||||||
|
required
|
||||||
|
initialValue={FormData.idCard}
|
||||||
|
rules={[{message: '请输入身份证号码'}]}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
placeholder="请输入身份证号码"
|
||||||
|
type="text"
|
||||||
|
value={FormData?.idCard}
|
||||||
|
disabled={FormData.status != 2 && FormData.status != undefined}
|
||||||
|
maxLength={18}
|
||||||
|
onChange={(value) => setFormData({...FormData, idCard: value})}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={'上传证件'}
|
||||||
|
name="image"
|
||||||
|
required
|
||||||
|
rules={[{message: '请上传身份证正反面'}]}
|
||||||
|
>
|
||||||
|
<div className={'flex gap-2'}>
|
||||||
|
<div onClick={uploadSfz1}>
|
||||||
|
<Image src={FormData.sfz1}
|
||||||
|
radius="10%" width="80" height="80"/>
|
||||||
|
</div>
|
||||||
|
<div onClick={uploadSfz2}>
|
||||||
|
<Image src={FormData.sfz2} mode={'scaleToFill'}
|
||||||
|
radius="10%" width="80" height="80"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Form.Item>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
// 企业类型
|
||||||
|
FormData.type == 1 && (
|
||||||
|
<>
|
||||||
|
<Form.Item
|
||||||
|
label={'主体名称'}
|
||||||
|
name="name"
|
||||||
|
required
|
||||||
|
initialValue={FormData.name}
|
||||||
|
rules={[{message: '请输入公司名称或单位名称'}]}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
placeholder={'请输入主体名称'}
|
||||||
|
type="text"
|
||||||
|
value={FormData?.name}
|
||||||
|
onChange={(value) => setFormData({...FormData, name: value})}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={'营业执照号码'}
|
||||||
|
name="zzCode"
|
||||||
|
required
|
||||||
|
initialValue={FormData.zzCode}
|
||||||
|
rules={[{message: '请输入营业执照号码'}]}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
placeholder="请输入营业执照号码"
|
||||||
|
type="text"
|
||||||
|
value={FormData?.zzCode}
|
||||||
|
maxLength={18}
|
||||||
|
onChange={(value) => setFormData({...FormData, zzCode: value})}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={'上传营业执照'}
|
||||||
|
name="zzImg"
|
||||||
|
required
|
||||||
|
rules={[{message: '请上传营业执照'}
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<div onClick={uploadZzImg}>
|
||||||
|
<Image src={FormData.zzImg} mode={'scaleToFill'}
|
||||||
|
radius="10%" width="80" height="80"/>
|
||||||
|
</div>
|
||||||
|
</Form.Item>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
FormData.status != undefined && (
|
||||||
|
<Form.Item
|
||||||
|
label={'审核状态'}
|
||||||
|
name="status"
|
||||||
|
>
|
||||||
|
<Tag plain>{FormData.statusText}</Tag>
|
||||||
|
</Form.Item>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
{FormData.status == 2 && (
|
||||||
|
<Form.Item
|
||||||
|
label={'驳回原因'}
|
||||||
|
name="comments"
|
||||||
|
>
|
||||||
|
<div className={'flex text-orange-500'}>
|
||||||
|
{FormData.comments}
|
||||||
|
</div>
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
|
|
||||||
|
</Form>
|
||||||
|
</ConfigProvider>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Index
|
||||||
@@ -5,6 +5,7 @@ import {User} from "@/api/system/user/model";
|
|||||||
export const TEMPLATE_ID = 10398;
|
export const TEMPLATE_ID = 10398;
|
||||||
// 服务接口
|
// 服务接口
|
||||||
export const SERVER_API_URL = 'https://server.gxwebsoft.com/api';
|
export const SERVER_API_URL = 'https://server.gxwebsoft.com/api';
|
||||||
|
// export const SERVER_API_URL = 'http://127.0.0.1:8000/api';
|
||||||
/**
|
/**
|
||||||
* 保存用户信息到本地存储
|
* 保存用户信息到本地存储
|
||||||
* @param token
|
* @param token
|
||||||
|
|||||||
Reference in New Issue
Block a user