提交 6c721b77 作者: 翁进城

Merge remote-tracking branch 'origin/caoyun'

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