提交 4e343ba3 作者: 曹云

改-飞手培训-详情-页面布局,样式修改

上级 876ef145
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from 'react'
import Layout from "~/components/layout"; import Layout from '~/components/layout'
import { Box } from "./styled"; import { Box } from './styled'
import { Button } from "antd"; import { Button, Tabs } from 'antd'
import { useRouter } from "next/router"; import { useRouter } from 'next/router'
import { ParsedUrlQuery } from "querystring"; import { ParsedUrlQuery } from 'querystring'
import type { TabsProps } from 'antd'
interface RouterDetail { interface RouterDetail {
videoUrl:string | '', videoUrl: string | ''
curriculumName:string curriculumName: string
curriculumDesc: string
} }
export default function FlyingDetail() { const contentStyle: React.CSSProperties = {
width: '100%',
}
const router = useRouter(); export default function FlyingDetail() {
const [detail,setDetail] =useState<ParsedUrlQuery | RouterDetail>() const router = useRouter()
useEffect(()=>{ const [detail, setDetail] = useState<ParsedUrlQuery | RouterDetail>()
useEffect(() => {
setDetail(router.query) setDetail(router.query)
},[router]) }, [router])
const onChange = (key: string) => {
console.log(key)
}
const items: TabsProps['items'] = [
{
key: '1',
label: `介绍`,
children: (
<div className="body">
<div className="top">
<div className="title">课程简介</div>
<div className="content">{detail?.curriculumDesc}</div>
</div>
{/* <div className="bottom">详情</div> */}
</div>
),
},
]
return ( return (
<Layout> <Layout contentStyle={contentStyle}>
<Box> <Box>
<div className="box-top"> <div className="box">
<div className="left">{detail?.curriculumName}</div> <div className="box-body">
<video
className="body-video"
controls
src={detail?.videoUrl as string}
/>
</div>
<div className="box-bottom">
<div className="left">
<div className="top">{detail?.curriculumName}</div>
<div className="bottom">免费</div>
</div>
<div className="right"> <div className="right">
{/* <Button {/* <Button
type="primary" type="primary"
...@@ -34,10 +68,16 @@ export default function FlyingDetail() { ...@@ -34,10 +68,16 @@ export default function FlyingDetail() {
</Button> */} </Button> */}
</div> </div>
</div> </div>
<div className="box-body"> </div>
<video className="body-video" controls src={detail?.videoUrl as string} /> <div className="detail">
<Tabs
className="tabs"
defaultActiveKey="1"
items={items}
onChange={onChange}
/>
</div> </div>
</Box> </Box>
</Layout> </Layout>
); )
} }
import styled from "styled-components"; import styled from 'styled-components'
export default function Style() { export default function Style() {
return <></>; return <></>
} }
export const Box = styled.div` export const Box = styled.div`
box-sizing: border-box; box-sizing: border-box;
.box-top { .box {
background-color: #fff;
height: 586px;
padding-top: 20px;
.box-body {
margin: 0 auto;
display: flex;
width: 1200px;
height: 470px;
/* background: #111111; */
.body-video {
width: 1200px;
height: 470px;
}
/* .right-box {
width: 362px;
height: 470px;
background: #1b2128;
.tabs {
color: #fff;
}
} */
}
.box-bottom {
margin: 0 auto;
width: 1200px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 10px 0; padding: 16px 0 38px 0;
.left { .left {
height: 25px; height: 50px;
font-size: 20px; .top {
font-family: MicrosoftYaHeiUI-Bold, MicrosoftYaHeiUI; font-size: 24px;
font-weight: bold; font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #000000; color: #000000;
line-height: 25px; margin-bottom: 10px;
}
.bottom {
font-size: 18px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #ff552d;
}
} }
.right { .right {
.btn { .btn {
...@@ -35,14 +68,41 @@ export const Box = styled.div` ...@@ -35,14 +68,41 @@ export const Box = styled.div`
} }
} }
} }
.box-body { }
margin-top: 20px; .detail {
width: 1200px; margin: 0 auto;
height: 675px;
background: #111111;
.body-video {
width: 1200px; width: 1200px;
height: 675px; height: 420px;
background: #ffffff;
box-shadow: 0px 2px 6px 0px rgba(183, 188, 197, 0.1);
border-radius: 12px;
margin-top: 16px;
padding: 20px;
.tabs {
.body {
.top {
.title {
font-size: 18px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #000000;
}
.content {
font-size: 18px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #27323f;
margin-top: 10px;
}
}
.bottom {
font-size: 18px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #000000;
margin-top: 29px;
}
}
} }
} }
`; `
import { Button, Cascader, Checkbox, Form, Input, Modal, Pagination, Select, Space, message } from 'antd' import {
Button,
Cascader,
Checkbox,
Form,
Input,
Modal,
Pagination,
Select,
Space,
message,
} from 'antd'
import type { CheckboxValueType } from 'antd/es/checkbox/Group' import type { CheckboxValueType } from 'antd/es/checkbox/Group'
import Image from 'next/image' import Image from 'next/image'
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
...@@ -19,10 +30,19 @@ export default function FlyingHandService() { ...@@ -19,10 +30,19 @@ export default function FlyingHandService() {
const { Option } = Select const { Option } = Select
const router = useRouter() const router = useRouter()
const { userInfo, setNeedLogin } = useContext(UserContext) const { userInfo, setNeedLogin } = useContext(UserContext)
const [list, setList] = useState(['https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/540X844-1(1).jpg', 'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/540X844(1).jpg']) const [list, setList] = useState([
const [productList, setProductList] = useState(Array<{ element: JSX.Element }>) 'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/540X844-1(1).jpg',
const [rightDomList, setRightDomList] = useState(Array<{ element: JSX.Element }>) 'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/540X844(1).jpg',
const [secondDistrictInfo, setSecondDistrictInfo] = useState(Array<RegionResp>) ])
const [productList, setProductList] = useState(
Array<{ element: JSX.Element }>
)
const [rightDomList, setRightDomList] = useState(
Array<{ element: JSX.Element }>
)
const [secondDistrictInfo, setSecondDistrictInfo] = useState(
Array<RegionResp>
)
const [skills, setSkills] = useState(Array<RegionResp>) const [skills, setSkills] = useState(Array<RegionResp>)
const [skillsDefault, setSkillsDefault] = useState<Array<number>>() const [skillsDefault, setSkillsDefault] = useState<Array<number>>()
const [flightSkillsList, setFlightSkillsList] = useState(Array<SkillsType>) const [flightSkillsList, setFlightSkillsList] = useState(Array<SkillsType>)
...@@ -38,13 +58,19 @@ export default function FlyingHandService() { ...@@ -38,13 +58,19 @@ export default function FlyingHandService() {
pathname: `/flyingHandService/detail/${item.id}`, pathname: `/flyingHandService/detail/${item.id}`,
query: { query: {
videoUrl: item.videoUrl, videoUrl: item.videoUrl,
curriculumName: item.curriculumName curriculumName: item.curriculumName,
} curriculumDesc: item.curriculumDesc,
},
}) })
: setNeedLogin(true) : setNeedLogin(true)
}}> }}
>
<div className="item-top"> <div className="item-top">
<Image src={`${item.videoUrl}?x-oss-process=video/snapshot,t_1000,m_fast`} alt="#" fill /> <Image
src={`${item.videoUrl}?x-oss-process=video/snapshot,t_1000,m_fast`}
alt="#"
fill
/>
</div> </div>
<div className="item-bottom"> <div className="item-bottom">
<div className="bottom-title">{item.curriculumName}</div> <div className="bottom-title">{item.curriculumName}</div>
...@@ -79,7 +105,7 @@ export default function FlyingHandService() { ...@@ -79,7 +105,7 @@ export default function FlyingHandService() {
const [pageParams, setPageParams] = useState({ const [pageParams, setPageParams] = useState({
pageNo: 1, pageNo: 1,
pageSize: 12 pageSize: 12,
}) //分页器对象 }) //分页器对象
const [filterParams, setFilterParams] = useState<FilterInfoParams>() const [filterParams, setFilterParams] = useState<FilterInfoParams>()
...@@ -90,7 +116,7 @@ export default function FlyingHandService() { ...@@ -90,7 +116,7 @@ export default function FlyingHandService() {
const onPageChange = (page: number, pageSize: number) => { const onPageChange = (page: number, pageSize: number) => {
setPageParams({ setPageParams({
...pageParams, ...pageParams,
pageNo: page pageNo: page,
}) })
} }
...@@ -112,11 +138,11 @@ export default function FlyingHandService() { ...@@ -112,11 +138,11 @@ export default function FlyingHandService() {
.listPageJobServicesInfo({ .listPageJobServicesInfo({
...pageParams, ...pageParams,
...filterParams, ...filterParams,
...queryVal ...queryVal,
}) })
.then(res => { .then((res) => {
setProductList( setProductList(
res.result?.list?.map(item => { res.result?.list?.map((item) => {
return { element: leftDom(item) } return { element: leftDom(item) }
}) || [] }) || []
) )
...@@ -139,10 +165,10 @@ export default function FlyingHandService() { ...@@ -139,10 +165,10 @@ export default function FlyingHandService() {
} else { } else {
setFlightDefault(null) setFlightDefault(null)
} }
setFilterParams(props => { setFilterParams((props) => {
return { return {
...props, ...props,
licenseId: Number(value) licenseId: Number(value),
} }
}) })
} }
...@@ -154,10 +180,10 @@ export default function FlyingHandService() { ...@@ -154,10 +180,10 @@ export default function FlyingHandService() {
} else { } else {
setSkillsDefault([]) setSkillsDefault([])
} }
setFilterParams(props => { setFilterParams((props) => {
return { return {
...props, ...props,
flightSkillsId: (value && value[value.length - 1]) || undefined flightSkillsId: (value && value[value.length - 1]) || undefined,
} }
}) })
} }
...@@ -170,10 +196,10 @@ export default function FlyingHandService() { ...@@ -170,10 +196,10 @@ export default function FlyingHandService() {
// regionId: (value && value[value.length - 1]) || undefined, // regionId: (value && value[value.length - 1]) || undefined,
// }; // };
// }); // });
setFilterParams(props => { setFilterParams((props) => {
return { return {
...props, ...props,
regionId: value || undefined regionId: value || undefined,
} }
}) })
} }
...@@ -184,14 +210,14 @@ export default function FlyingHandService() { ...@@ -184,14 +210,14 @@ export default function FlyingHandService() {
return { element: rightDom(item) } return { element: rightDom(item) }
}) })
) )
api.region().then(res => { api.region().then((res) => {
setSecondDistrictInfo(res.result || []) setSecondDistrictInfo(res.result || [])
}) })
api.PilotLicense().then(res => { api.PilotLicense().then((res) => {
setSkills(res.result || []) setSkills(res.result || [])
}) })
api.IndustryFlightSkills().then(res => { api.IndustryFlightSkills().then((res) => {
const list = res.result?.map(item => { const list = res.result?.map((item) => {
item.label = item.skillsName item.label = item.skillsName
item.value = item.id item.value = item.id
return item return item
...@@ -211,10 +237,10 @@ export default function FlyingHandService() { ...@@ -211,10 +237,10 @@ export default function FlyingHandService() {
} else { } else {
setFlightDefault(queryVal.licenseId) setFlightDefault(queryVal.licenseId)
} }
setFilterParams(props => { setFilterParams((props) => {
return { return {
...props, ...props,
...queryVal ...queryVal,
} }
}) })
} }
...@@ -226,16 +252,19 @@ export default function FlyingHandService() { ...@@ -226,16 +252,19 @@ export default function FlyingHandService() {
const handleOk = async (values: any) => { const handleOk = async (values: any) => {
form form
.validateFields() .validateFields()
.then(async values => { .then(async (values) => {
setLoading(true) setLoading(true)
try { try {
const res = await api.PilotRegistrations({ const res = await api.PilotRegistrations({
...values, ...values,
city: values.city[values.city.length - 1] || undefined, city: values.city[values.city.length - 1] || undefined,
province: values.city[0] || undefined, province: values.city[0] || undefined,
uavLicenseLevelOne: values.uavLicenseLevelOne && values.uavLicenseLevelOne[0], uavLicenseLevelOne:
uavLicenseLevelTow: values.uavLicenseLevelOne && values.uavLicenseLevelOne[1], values.uavLicenseLevelOne && values.uavLicenseLevelOne[0],
uavLicenseLevelThree: values.uavLicenseLevelOne && values.uavLicenseLevelOne[2] uavLicenseLevelTow:
values.uavLicenseLevelOne && values.uavLicenseLevelOne[1],
uavLicenseLevelThree:
values.uavLicenseLevelOne && values.uavLicenseLevelOne[2],
}) })
if (res.code === '200') { if (res.code === '200') {
setLoading(false) setLoading(false)
...@@ -250,10 +279,10 @@ export default function FlyingHandService() { ...@@ -250,10 +279,10 @@ export default function FlyingHandService() {
message.error(e.message) message.error(e.message)
} }
}) })
.catch(err => { .catch((err) => {
message message
.warning({ .warning({
content: err.errorFields[0].errors[0] content: err.errorFields[0].errors[0],
}) })
.then() .then()
}) })
...@@ -289,7 +318,17 @@ export default function FlyingHandService() { ...@@ -289,7 +318,17 @@ export default function FlyingHandService() {
onChange={onChangeRegion} onChange={onChangeRegion}
changeOnSelect changeOnSelect
/> */} /> */}
<Select className="selectItem" bordered={false} popupMatchSelectWidth={false} placeholder="省份" size="large" onChange={onChangeRegion} options={secondDistrictInfo} fieldNames={{ value: 'id', label: 'name' }} allowClear /> <Select
className="selectItem"
bordered={false}
popupMatchSelectWidth={false}
placeholder="省份"
size="large"
onChange={onChangeRegion}
options={secondDistrictInfo}
fieldNames={{ value: 'id', label: 'name' }}
allowClear
/>
<Cascader <Cascader
allowClear allowClear
placeholder="考证" placeholder="考证"
...@@ -299,17 +338,34 @@ export default function FlyingHandService() { ...@@ -299,17 +338,34 @@ export default function FlyingHandService() {
fieldNames={{ fieldNames={{
label: 'licenseType', label: 'licenseType',
value: 'id', value: 'id',
children: 'childLicenses' children: 'childLicenses',
}} }}
options={skills} options={skills}
onChange={value => onChange(value)} onChange={(value) => onChange(value)}
changeOnSelect changeOnSelect
value={skillsDefault} value={skillsDefault}
/> />
<Select className="selectItem" bordered={false} popupMatchSelectWidth={false} placeholder="技能" size="large" onChange={value => onProvinceChange(value)} options={flightSkillsList} fieldNames={{ value: 'id', label: 'skillsName' }} allowClear value={flightDefault} /> <Select
className="selectItem"
bordered={false}
popupMatchSelectWidth={false}
placeholder="技能"
size="large"
onChange={(value) => onProvinceChange(value)}
options={flightSkillsList}
fieldNames={{ value: 'id', label: 'skillsName' }}
allowClear
value={flightDefault}
/>
</Space> </Space>
</div> </div>
<Button type="primary" className="btn" onClick={() => (userInfo ? setIsModalOpen(true) : setNeedLogin(true))}> <Button
type="primary"
className="btn"
onClick={() =>
userInfo ? setIsModalOpen(true) : setNeedLogin(true)
}
>
报名学习课程 报名学习课程
</Button> </Button>
</div> </div>
...@@ -320,20 +376,52 @@ export default function FlyingHandService() { ...@@ -320,20 +376,52 @@ export default function FlyingHandService() {
onCancel={handleCancel} onCancel={handleCancel}
getContainer={false} getContainer={false}
footer={[ footer={[
<Button style={{ width: '100%', background: 'linear-gradient(135deg, #278EFF 0%, #0052DA 100%)', height: 40 }} key="submit" type="primary" loading={loading} onClick={handleOk}> <Button
style={{
width: '100%',
background: 'linear-gradient(135deg, #278EFF 0%, #0052DA 100%)',
height: 40,
}}
key="submit"
type="primary"
loading={loading}
onClick={handleOk}
>
立即报名 立即报名
</Button> </Button>,
]}> ]}
<Form form={form} layout="vertical" name="application" initialValues={{ modifier: 'public' }}> >
<Form
form={form}
layout="vertical"
name="application"
initialValues={{ modifier: 'public' }}
>
<div style={{ display: 'flex', justifyContent: 'space-between' }}> <div style={{ display: 'flex', justifyContent: 'space-between' }}>
<Form.Item style={{ flex: 1, marginRight: 16 }} name="name" rules={[{ required: true, message: '请输入姓名!' }]}> <Form.Item
style={{ flex: 1, marginRight: 16 }}
name="name"
rules={[{ required: true, message: '请输入姓名!' }]}
>
<Input placeholder="姓名" /> <Input placeholder="姓名" />
</Form.Item> </Form.Item>
<Form.Item style={{ flex: 1 }} name="telephone" rules={[{ required: true, message: '请输入手机号!' }]}> <Form.Item
<Input onInput={phoneNumber} allowClear maxLength={11} placeholder="手机号" /> style={{ flex: 1 }}
name="telephone"
rules={[{ required: true, message: '请输入手机号!' }]}
>
<Input
onInput={phoneNumber}
allowClear
maxLength={11}
placeholder="手机号"
/>
</Form.Item> </Form.Item>
</div> </div>
<Form.Item name="city" rules={[{ required: true, message: '请选择城市!' }]}> <Form.Item
name="city"
rules={[{ required: true, message: '请选择城市!' }]}
>
<Cascader <Cascader
allowClear allowClear
placeholder="城市" placeholder="城市"
...@@ -341,7 +429,7 @@ export default function FlyingHandService() { ...@@ -341,7 +429,7 @@ export default function FlyingHandService() {
fieldNames={{ fieldNames={{
label: 'name', label: 'name',
value: 'id', value: 'id',
children: 'childInfo' children: 'childInfo',
}} }}
options={secondDistrictInfo} options={secondDistrictInfo}
changeOnSelect changeOnSelect
...@@ -362,14 +450,21 @@ export default function FlyingHandService() { ...@@ -362,14 +450,21 @@ export default function FlyingHandService() {
fieldNames={{ fieldNames={{
label: 'licenseType', label: 'licenseType',
value: 'id', value: 'id',
children: 'childLicenses' children: 'childLicenses',
}} }}
options={skills} options={skills}
changeOnSelect changeOnSelect
/> />
</Form.Item> </Form.Item>
<Form.Item name="industryAppAuth" label="行业应用认证(多选)" className="collection-create-form_last-form-item"> <Form.Item
<Checkbox.Group options={flightSkillsList} onChange={onChangeCheck} /> name="industryAppAuth"
label="行业应用认证(多选)"
className="collection-create-form_last-form-item"
>
<Checkbox.Group
options={flightSkillsList}
onChange={onChangeCheck}
/>
</Form.Item> </Form.Item>
<Form.Item name="remark"> <Form.Item name="remark">
<Input placeholder="备注" /> <Input placeholder="备注" />
...@@ -381,15 +476,24 @@ export default function FlyingHandService() { ...@@ -381,15 +476,24 @@ export default function FlyingHandService() {
boxIndex={4} boxIndex={4}
leftcontentstyle={{ leftcontentstyle={{
width: '925px', width: '925px',
margin: { top: 0, right: '10px', bottom: '10px', left: 0 } margin: { top: 0, right: '10px', bottom: '10px', left: 0 },
}} }}
leftRenderDom={{ leftRenderDom={{
columns: productList, columns: productList,
pagination: ( pagination: (
<div className="pagination-page"> <div className="pagination-page">
<Pagination current={pageParams.pageNo} pageSize={pageParams.pageSize} showSizeChanger={false} showQuickJumper total={count} onChange={onPageChange} hideOnSinglePage={true} style={{ marginTop: 20 }} /> <Pagination
current={pageParams.pageNo}
pageSize={pageParams.pageSize}
showSizeChanger={false}
showQuickJumper
total={count}
onChange={onPageChange}
hideOnSinglePage={true}
style={{ marginTop: 20 }}
/>
</div> </div>
) ),
}} }}
rightRenderDom={{ columns: rightDomList }} rightRenderDom={{ columns: rightDomList }}
/> />
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论