提交 6c721b77 作者: 翁进城

Merge remote-tracking branch 'origin/caoyun'

......@@ -4,6 +4,7 @@ import { CommonContext } from "~/lib/commonProvider";
import { useGeolocation } from "~/lib/hooks";
import api, { PublishParams, TypeResp } from "./api";
import styles from "./index.module.scss";
import {phoneNumber} from '~/lib/validateUtils'
type Props = {
open?: boolean;
......@@ -84,7 +85,10 @@ export default function PublishModal(props: Props) {
name="publishPhone"
rules={[{ required: true, message: "请输入手机号!" }]}
>
<Input placeholder="输入手机号"></Input>
<Input
onInput={phoneNumber} maxLength={11}
allowClear
placeholder="输入手机号"></Input>
</Form.Item>
<Form.Item
label="需求类型"
......
......@@ -9,10 +9,10 @@ export function useGeolocation() {
useEffect(() => {
const AMapLoader = require("@amap/amap-jsapi-loader");
window._AMapSecurityConfig = {
securityJsCode: 'b00440e4bf3989bb2481297acaa05908',
securityJsCode: 'd7492300c43c8d3737909b77f2b2c387',
}
AMapLoader.load({
key: "826769d41d66ebd005ffa0b3e0013781", // 申请好的Web端开发者Key,首次调用 load 时必填
key: "87b424e68754efc3ba9d11ae07475091", // 申请好的Web端开发者Key,首次调用 load 时必填
version: "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
plugins: ['AMap.Geolocation', "AMap.Geocoder"], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
})
......
// 不能输入数字,其他可惜输入
export const exceptNumber = (val: any) => {
val.target.value = val.target.value
.replace(/1?(\d|([1-9]\d+))(.\d+)?$/g, "")
.replace(/\s/g, "");
};
// 只能输入正整数
export const onlyNumberPositive = (val: any) => {
// eslint-disable-next-line eqeqeq
if (val.target.value == 0) {
val.target.value = val.target.value.replace(/0/g, "");
}
val.target.value = val.target.value.replace(/\D/g, "");
};
// 不能输入汉字,其他可输入
export const exceptChinese = (val: any) => {
val.target.value = val.target.value
.replace(/[\u4E00-\u9FA5]|[\uFE30-\uFFA0]/g, "")
.replace(/\s/g, "");
};
// 只能输入字母和中文,不能输入数字和符号
export const onlyCharacter = (val: any) => {
val.target.value = val.target.value
.replace(/[^a-zA-Z\u4E00-\u9FA5]/g, "")
.replace(/\s/g, "");
};
// 手机号输入,限制11位
export const phoneNumber = (val: any) => {
if (val.target.value.length > 11) {
val.target.value = val.target.value.slice(0, 11);
} else {
val.target.value = val.target.value.replace(/\D/g, "");
}
};
// 开头不能输入空格
export const noSpaceFront = (val: any) => {
val.target.value = val.target.value.replace(/^\s/g, "");
};
......@@ -8,6 +8,7 @@ import ContentBox from "~/components/contentBox";
import api, { Flying, SkillsType, RegionResp } from "./api";
import { useRouter } from "next/router";
import { UserContext } from "~/lib/userProvider";
import {phoneNumber} from '~/lib/validateUtils'
interface FilterInfoParams {
regionId?: number;
flightSkillsId?: number;
......@@ -43,13 +44,13 @@ export default function FlyingHandService() {
className="item"
key={item.id}
onClick={() => {
router.push({
userInfo ? router.push({
pathname: `/flyingHandService/detail/${item.id}`,
query: {
videoUrl: item.videoUrl ,
curriculumName: item.curriculumName
},
})
}) : setNeedLogin(true)
} }
>
<div className="item-top">
......@@ -239,7 +240,10 @@ export default function FlyingHandService() {
.then(async (values) => {
setLoading(true);
try{
const res = await api.PilotRegistrations(values)
const res = await api.PilotRegistrations({
...values,
city: values.city[values.city.length-1] || null
})
if (res.code === "200") {
setLoading(false);
setIsModalOpen(false);
......@@ -326,7 +330,7 @@ export default function FlyingHandService() {
<Button
type="primary"
className="btn"
onClick={() => userInfo ? setIsModalOpen(true) : setNeedLogin(true)}
onClick={() => userInfo ? setIsModalOpen(true) : setNeedLogin(true)}
>
报名学习课程
</Button>
......@@ -363,7 +367,7 @@ export default function FlyingHandService() {
<Input placeholder="姓名" />
</Form.Item>
<Form.Item style={{flex:1}} name="telephone" rules={[{ required: true, message: '请输入手机号!' }]}>
<Input placeholder="手机号" />
<Input onInput={phoneNumber} allowClear maxLength={11} placeholder="手机号" />
</Form.Item>
</div>
<Form.Item
......
......@@ -54,6 +54,7 @@ export const Box = styled.div`
position: relative;
}
&-bottom {
width: 220px;
padding: 9px 12px 12px;
border-radius: 0px 0px 6px 6px;
background-color: #fff;
......
......@@ -95,6 +95,8 @@ export default function MapComponent() {
});
if(markerList.length) MAP?.add(markerList);setMarkerCol([...markerList]);
}
//自适应显示多个点位
MAP?.setFitView();
}
const showFlyerBitmap = async (index:number,data?:UserInfoType,pageSize?:number) => {
const res = await api.listFlyerBitmap({
......@@ -112,6 +114,8 @@ export default function MapComponent() {
});
if(markerList.length) MAP?.add(markerList);setMarkerCol(markerList)
}
//自适应显示多个点位
MAP?.setFitView();
}
const showUavBitmap = async (index:number,data?:UserInfoType) => {
const res = await api.listUavBitmap({
......@@ -129,11 +133,12 @@ export default function MapComponent() {
});
if(markerList.length) MAP?.add(markerList);setMarkerCol(markerList)
}
//自适应显示多个点位
MAP?.setFitView();
}
//添加点位
const mapEntiy = async (index: number,data?:UserInfoType) => {
MAP?.remove(markerCol);
if (index === 0) {
showPositioningInfo(index,data)
}else if (index === 1) {
......
......@@ -102,6 +102,8 @@ export default function MoreServicePoints() {
if (markerList.length) MAP?.add(markerList);
setMarkerCol([...markerList]);
}
//自适应显示多个点位
MAP?.setFitView();
};
const showFlyerBitmap = async (
index: number,
......@@ -125,6 +127,8 @@ export default function MoreServicePoints() {
if (markerList.length) MAP?.add(markerList);
setMarkerCol(markerList);
}
//自适应显示多个点位
MAP?.setFitView();
};
const showUavBitmap = async (index: number, data?: UserInfoType) => {
const res = await api.listUavBitmap({
......@@ -144,6 +148,8 @@ export default function MoreServicePoints() {
if (markerList.length) MAP?.add(markerList);
setMarkerCol(markerList);
}
//自适应显示多个点位
MAP?.setFitView();
};
//添加点位
const mapEntiy = async (index: number, data?: UserInfoType) => {
......@@ -180,9 +186,14 @@ export default function MoreServicePoints() {
return marker;
};
const moveTo = (item: any) => {
console.log(markerCol);
const moveTo = (item: any,index:number) => {
// const p = markerCol[index].getPosition()
// var infoWindow = new Amap.InfoWindow({
// position: p,
// offset: new Amap.Pixel(20, -10),
// content: item.dizhi
// });
// infoWindow.open(MAP);
if (item.dizhi) {
return MAP?.setCenter([item.jd, item.wd]);
} else if (item.flyerName || item.uavName) {
......@@ -231,10 +242,10 @@ export default function MoreServicePoints() {
<div className="left">
<div className="left-title">服务网点</div>
<div className="left-content">
{servicePoints.map((item: any) => (
{servicePoints.map((item: any,index:number) => (
<div
key={item.id}
onClick={() => moveTo(item)}
onClick={() => moveTo(item,index)}
className="left-content-item"
title={item.dizhi || item.flyerName || item.uavName}
>
......
......@@ -5,5 +5,6 @@ declare global {
messageApi: MessageInstance; //全局消息提示api
WxLogin: any; //微信登录对象
_AMapSecurityConfig: { securityJsCode: string }; //高德地图api密钥配置
AMap:any
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论