Commit 077c4c03 by 肖康

网站注册调整

parent dfcc7742
......@@ -59,11 +59,15 @@ const SearchH = () => {
<div className={`${styles.cons} row bothSide boxsiz`}>
<Link href='/'><img className={styles.logoImg} src='/images/logo.png' alt='' /></Link>
<div className={`${styles.searchInputBox} row boxsiz`}>
{
router.pathname=="/login"|| router.pathname=="/reg"?'':
<div className={`${styles.searchInputBox} row boxsiz`}>
<input type='text' className={`${styles.inputGoods} boxsiz`} value={key} onKeyPress={(e) => { handleKeyPress(e.key) }} onChange={(e) => { setKey(e.target.value) }} placeholder='请输入元器件型号、参数查找' />
<input type='text' className={`${styles.inputNums} boxsiz`} value={num} placeholder='需求数量' onKeyPress={(e) => { handleKeyPress(e.key) }} onChange={(e) => { changeNum(e) }} />
<div className={`${styles.searchbtn} row rowCenter verCenter`} onClick={goSearch}><i className='icon iconfont icon-iconfontsousuo '></i></div>
</div>
</div>
}
<>
<ShopCart></ShopCart>
{/* <div>
......
......@@ -21,7 +21,7 @@ const TopH=()=>{
useEffect(() => {
setBackUrl(encodeURIComponent(window.location.href));
if(router.pathname=="/login"||router.pathname=="/passwordRecover"){
if(router.pathname=="/login"||router.pathname=="/passwordRecover"||router.pathname=="/reg"||router.pathname=="/regChoose"){
setTopheadtype("1")
}
}, [router.asPath]);
......@@ -54,7 +54,7 @@ const TopH=()=>{
<>
<Link href={'/login?type=1&backUrl='+backUrl}>立即登录</Link>
<span className={styles.line}></span>
<Link href={'/login?type=2&backUrl='+backUrl}>立即注册</Link>
<Link href={'/reg?backUrl='+backUrl}>立即注册</Link>
<span className={styles.line}></span>
</>
) : (
......
......@@ -2,5 +2,5 @@ const os = require('os');
export const QQURL='https://wpa.qq.com/msgrd?v=3&amp;uin=1908059998&amp;site=qq&amp;menu=yes'
export const API_URL=((os.hostname()=="MS-NDPSTQVAWPAX"||os.hostname()=="dev235"||os.hostname()=="localhost"||os.hostname()=="erpweb.liexindev.com")?'http://erpweb.liexindev.net':'http://api.chiplinks.net')
export const API_URL=((os.hostname()=="192.168.1.62"||os.hostname()=="MS-NDPSTQVAWPAX"||os.hostname()=="dev235"||os.hostname()=="localhost"||os.hostname()=="erpweb.liexindev.com")?'http://erpweb.liexindev.net':'http://api.chiplinks.net')
......@@ -44,7 +44,8 @@ export const useSeoTitle = (props?:any) => {
'/about.html': { title: '关于我们' },
'/contact.html': { title: '联系我们' },
'/notice.html': { title: '公告' },
'/login': { title: '登录/注册' },
'/login': { title: '登录' },
'/reg': { title: '注册' },
'/regChoose': { title: '注册发票' },
'/customer': { title: '会员中心' ,needLogin:true},
'/myOrder': { title: '我的订单',needLogin:true },
......
......@@ -137,22 +137,26 @@ const Page = () => {
messageRef.current("登录成功")
loginRequest({ url: '/api/userInfo/userInvoiceList?limit=100', method: 'get'}).then((res) => {
if (res?.code === 0) {
if(res?.data?.list.length>0){
if(query.backUrl){
window.location.href=String(query.backUrl)
return
}
router.push("/")
}else{
router.push("/regChoose?backUrl="+encodeURIComponent(String(query.backUrl)))
}
} else {
messageRef.current(res?.msg)
}
})
if(query.backUrl){
window.location.href=String(query.backUrl)
return
}
router.push("/")
// loginRequest({ url: '/api/userInfo/userInvoiceList?limit=100', method: 'get'}).then((res) => {
// if (res?.code === 0) {
// if(res?.data?.list.length>0){
// if(query.backUrl){
// window.location.href=String(query.backUrl)
// return
// }
// router.push("/")
// }else{
// router.push("/regChoose?backUrl="+encodeURIComponent(String(query.backUrl)))
// }
// } else {
// messageRef.current(res?.msg)
// }
// })
}
......@@ -216,7 +220,7 @@ const Page = () => {
</div>
<button type="submit" className={style.loginButton} >登录</button>
<div className={style.registerButton}>
<span className={style.cursorPointer} onClick={() => handleTypeChange('2')}>立即注册</span>
<Link href="/reg" className={style.cursorPointer} >立即注册</Link>
</div>
</>
) : (
......@@ -231,7 +235,7 @@ const Page = () => {
<input type="contacts_tel" value={count} className={style.areaInput} placeholder='请输入手机号' onChange={handleCountChange} required />
</div>
<div>
<input type="password" value={code} className={style.registerInput} placeholder='请输入短信验证码' onChange={handleCodeChange} required />
<input type="text" value={code} className={style.registerInput} placeholder='请输入短信验证码' onChange={handleCodeChange} required />
<button className={codeText=='发送验证码'?`${style.codeButton }`:`${style.codeButton } ${style.dis}`} onClick={handleCodeSend}>{codeText}</button>
</div>
<div className={style.registerTips}>未注册的手机号将自动完成注册</div>
......
......@@ -81,21 +81,21 @@ const TopH = (props: { cateList: ResponseTypeCateList }) =>{
handleDataInit()
}, [query,sourceType])
// useEffect(() => {
// if(userInfo){return}
// userRequest({ url: '/api/userInfo/userInfo', method: 'get', data: { } }).then((res) => {
useEffect(() => {
if(userInfo){return}
userRequest({ url: '/api/userInfo/userInfo', method: 'get', data: { } }).then((res) => {
// if (res?.code === 0) {
// setUserInfo(res?.data)
// if(res?.data.audit_status!=1){
// message("请先审核用户发票!",3000)
// }
// }else{
// message(res?.msg)
// }
// })
if (res?.code === 0) {
setUserInfo(res?.data)
if(res?.data.audit_status!=1){
message("请先审核用户发票!",3000)
}
}else{
message(res?.msg)
}
})
// }, [])
}, [])
useEffect(() => {
handleInvoiceInit()
handleAddressInit()
......@@ -189,10 +189,10 @@ const TopH = (props: { cateList: ResponseTypeCateList }) =>{
}
const handleOrderSubmit = async () => {
// if(userInfo?.audit_status!=1){
// message("请先审核用户发票!",3000)
// return
// }
if(userInfo?.audit_status!=1){
message("请先审核用户发票!",3000)
return
}
const param = {
goods_list: disList.map((disItem:any) => {
return {
......
......@@ -205,7 +205,7 @@ const Page = () => {
<input type="contacts_tel" value={count} className={style.areaInput} placeholder='请输入手机号' onChange={handleCountChange} required />
</div>
<div>
<input type="password" value={code} className={style.registerInput} placeholder='请输入短信验证码' onChange={handleCodeChange} required />
<input type="text" value={code} className={style.registerInput} placeholder='请输入短信验证码' onChange={handleCodeChange} required />
<button className={codeText=='发送验证码'?`${style.codeButton }`:`${style.codeButton } ${style.dis}`} onClick={handleCodeSend}>{codeText}</button>
</div>
{ showMsg && (
......
.loginPage {
background: #fff;
padding: 40px 0;
height: 740px;
width: 100%;
border-top: 1px solid #FF9A00;
position: relative;
}
.loginPage .codeButton {
display: inline-block;
width: 100px;
height: 32px;
line-height: 32px;
background: #FF9A00;
border-radius: 1px;
font-size: 14px;
color: #FFFFFF;
cursor: pointer;
vertical-align: center;
}
.loginPage .codeButton.dis {
background: #ccc;
cursor: not-allowed;
}
.loginPage .loginBox {
width: 500px;
height: 100%;
position: absolute;
left: 50%;
transform: translate(-50%);
text-align: center;
}
.loginPage .loginBox .typeBox {
padding: 10px 110px 22px 200px;
display: flex;
justify-content: space-between;
cursor: pointer;
}
.loginPage .loginBox .typeBox .typeButton {
color: #808080;
}
.loginPage .loginBox .typeBox .typeButton:hover {
color: #FF9A00;
}
.loginPage .loginBox .typeBox .typeButtonChoosen {
color: #FF9A00;
font-weight: bold;
}
.loginPage .loginButton {
width: 300px;
height: 36px;
background: #FF9A00;
border-radius: 1px;
font-size: 18px;
color: #FFFFFF;
cursor: pointer;
position: relative;
left: 50px;
}
.loginPage .modalContent {
padding: 30px 0;
box-sizing: border-box;
}
.loginPage .modalContent :global .ant-form-item {
margin-bottom: 20px;
}
.loginPage .modalContent :global .ant-select-selection-item {
text-align: left !important;
}
.loginPage{background:#fff;padding:40px 0;height:740px;width:100%;border-top:1px solid #FF9A00;position:relative}.loginPage .codeButton{display:inline-block;width:100px;height:32px;line-height:32px;background:#FF9A00;border-radius:1px;font-size:14px;color:#FFFFFF;cursor:pointer;vertical-align:center}.loginPage .codeButton.dis{background:#ccc;cursor:not-allowed}.loginPage .loginBox{width:500px;height:100%;position:absolute;left:50%;transform:translate(-50%);text-align:center}.loginPage .loginBox .typeBox{padding:10px 110px 22px 200px;display:flex;justify-content:space-between;cursor:pointer}.loginPage .loginBox .typeBox .typeButton{color:#808080}.loginPage .loginBox .typeBox .typeButton:hover{color:#FF9A00}.loginPage .loginBox .typeBox .typeButtonChoosen{color:#FF9A00;font-weight:bold}.loginPage .loginButton{width:300px;height:36px;background:#FF9A00;border-radius:1px;font-size:18px;color:#FFFFFF;cursor:pointer;position:relative;left:50px}.loginPage .modalContent{padding:30px 0;box-sizing:border-box}.loginPage .modalContent :global .ant-form-item{margin-bottom:20px}.loginPage .modalContent :global .ant-select-selection-item{text-align:left !important}
.loginPage{
background: #fff;
padding:40px 0;
height: 740px;
width: 100%;
border-top: 1px solid #FF9A00;
position: relative;
.codeButton {
display: inline-block;
width: 100px;
height: 32px;
line-height: 32px;
background: #FF9A00;
border-radius: 1px;
font-size: 14px;
color: #FFFFFF;
cursor: pointer;
vertical-align: center;
&.dis{
background: #ccc;
cursor: not-allowed;
}
}
.loginBox {
width: 500px;
height: 100%;
position: absolute;
left: 50%;
transform: translate(-50%);
text-align: center;
.typeBox {
padding: 10px 110px 22px 200px;
display: flex;
justify-content: space-between;
cursor: pointer;
.typeButton {
color: #808080;
&:hover {
color: #FF9A00;
}
}
.typeButtonChoosen {
color: #FF9A00;
font-weight: bold;
}
}
}
.loginButton {
width: 300px;
height: 36px;
background: #FF9A00;
border-radius: 1px;
font-size: 18px;
color: #FFFFFF;
cursor: pointer;
position: relative;
left:50px;
}
.modalContent {
padding: 30px 0;
box-sizing: border-box;
:global {
.ant-form-item {
margin-bottom:20px;
}
.ant-select-selection-item {
text-align: left !important;
}
}
}
}
\ No newline at end of file
import React, { useEffect, useState, useRef } from 'react';
import useRequest from "@/hooks/useRequest"
import style from './index.module.scss'
import Footer from "@/components/Footer";
import TopH from "@/components/Header/components/TopH"
import SearchH from "@/components/Header/components/SearchH"
import { useRouter } from 'next/router';
import { useCookies } from '@/hooks/useCookies'
import { Form, Input, Select, Space } from 'antd'
import { useToast } from '@/hooks/useToast';
import { useSeoTitle } from '@/hooks/useSeoTitle';
import { relative } from 'path';
const Page = () => {
const router = useRouter()
const seoTitle = useSeoTitle()
const { query } = router
const { message } = useToast()
const messageRef = useRef(message);
const { setCookie } = useCookies()
const [form] = Form.useForm()
const [count, setCount] = useState('');
const { request: userRequest } = useRequest<any>({ manual: true })
const validateMessages = {
required: '${label}不能为空!'
}
const [type, setType] = useState("1");
const handleTypeChange = (type: string) => {
setType(type)
}
const codeTimer = useRef<any>();
const [codeText, setCodeText] = useState<string>("发送验证码")
const [codeTimeVal, setCodeTimeVal] = useState<number>(60)
useEffect(() => {
if (codeText === '发送验证码') {
return;
}
codeTimer.current = setInterval(() => {
setCodeTimeVal((prevCodeTimeVal) => {
const newTime = prevCodeTimeVal - 1;
if (newTime < 1) {
clearInterval(codeTimer.current);
setCodeText('发送验证码');
setCodeTimeVal(60);
return 60;
}
setCodeText(`重发(${newTime}S)`);
return newTime;
});
}, 1000);
return () => {
if (codeTimer.current) {
clearInterval(codeTimer.current);
}
};
}, [codeText, setCodeTimeVal]);
const regex = /^1[3-9]\d{9}$/;
//发送验证码
const handleCodeSend = async (e: any) => {
if (codeText !== '发送验证码') {
return;
}
e.preventDefault()
if (!regex.test(count)) {
messageRef.current("请填写正确手机号")
return false
}
const param = {
send_type: '1',
send_user: count,
send_fun: 'login'
}
userRequest({
url: '/sendMsgCode',
method: 'post',
data: param,
}).then(res => {
if (res.code == 0) {
messageRef.current("发送成功")
setCodeText('重发(60S)')
} else {
messageRef.current(res.msg)
}
})
return false
}
const manualValidate = () => {
form.validateFields().then((value: any) => {
let params_ = { ...JSON.parse(JSON.stringify(value)) }
params_.customer_type = type
if(params_.password!=params_.confirm_password){
messageRef.current("密码和确认密码不一致")
return
}
userRequest({ url: '/api/userInfo/userRegister', method: 'post', data: params_ }).then((res) => {
if (res?.code === 0) {
setCookie('token', res?.data.token, 1)
setCookie('userId', res?.data.user.web_user_id, 1)
setCookie('userName', count, 1)
messageRef.current("注册成功")
if (query.backUrl) {
window.location.href = String(query.backUrl)
return
}
router.push("/")
} else {
messageRef.current(res?.msg)
}
})
}).catch((e) => { });
}
return (
<>
{seoTitle}
<TopH />
<SearchH />
<div className={style.loginPage}>
<div className={style.loginBox}>
<div className={style.typeBox}>
<span
className={`${style.typeButton} ${style.cursorPointer} ${(type === "1") && style.typeButtonChoosen}`}
onClick={() => handleTypeChange('1')}>
公司
</span>
<span
className={`${style.typeButton} ${style.cursorPointer} ${(type === '2') && style.typeButtonChoosen}`}
onClick={() => handleTypeChange('2')}>
个人
</span>
</div>
<Form
className={style.modalContent}
validateMessages={validateMessages}
validateTrigger={['onSubmit']}
form={form}
autoComplete="off"
initialValues={{ area: "0086", customer_industry_id: "", company_nature_id: "" }}
labelCol={{ span: 6 }}
wrapperCol={{ span: 20 }}>
<input type="text" style={{ display: 'none' }} />
{
type == "1" &&
<Form.Item
className={style.lineItem}
label="公司名称"
name="customer_name"
rules={[{ required: true }]}>
<Input />
</Form.Item>
}
<Form.Item
className={style.lineItem}
label="联系人"
name="contacts_name"
rules={[{ required: true }]}>
<Input />
</Form.Item>
<Form.Item
className={style.lineItem}
label="岗位"
name="contacts_name_post">
<Input />
</Form.Item>
<Form.Item label={<span><span style={{ color: "#ff4d4f", fontSize: "14px", marginRight: "4px" }}>*</span>手机号</span>} >
<Space.Compact style={{ height: "32px" }}>
<Form.Item
name="area"
rules={[{ required: true }]}
>
<Select style={{ height: "32px", width: "145px" }}>
<Select.Option value="0086">0086(中国大陆)</Select.Option>
<Select.Option value="00852">00852(中国香港)</Select.Option>
<Select.Option value="00853">00853(中国澳门)</Select.Option>
<Select.Option value="00886">00886(中国台湾)</Select.Option>
</Select>
</Form.Item>
<Form.Item
name="contacts_tel"
label="手机号"
rules={[{ required: true }]}
noStyle
>
<Input style={{ height: "32px" , width: "231px" }} onChange={(e: any) => setCount(e.target.value)}
value={count} />
</Form.Item>
</Space.Compact>
</Form.Item>
<Form.Item
className={style.lineItem}
label="验证码"
name="code"
rules={[{ required: true }]}
>
<Space.Compact style={{ height: "32px" }}>
<Input style={{ width: "276px" }} />
<span className={codeText == '发送验证码' ? `${style.codeButton}` : `${style.codeButton} ${style.dis}`} onClick={handleCodeSend}>{codeText}</span>
</Space.Compact>
</Form.Item>
<Form.Item
className={style.lineItem}
label="账号"
name="web_user_account"
rules={[{ required: true }]}>
<Input />
</Form.Item>
<Form.Item
className={style.lineItem}
label="密码"
name="password"
rules={[{ required: true }]}>
<Input.Password />
</Form.Item>
<Form.Item
className={style.lineItem}
label="确认密码"
name="confirm_password"
rules={[{ required: true }]}>
<Input.Password />
</Form.Item>
{
type == "1" &&
<>
<Form.Item
className={style.lineItem}
label="公司性质"
name="customer_industry_id"
>
<Select >
<Select.Option value="">请选择</Select.Option>
<Select.Option value="1">股份合作制企业</Select.Option>
<Select.Option value="2">私营企业</Select.Option>
<Select.Option value="3">联营企业</Select.Option>
<Select.Option value="4">国有企业</Select.Option>
<Select.Option value="5">股份有限公司</Select.Option>
<Select.Option value="6">跨国企业</Select.Option>
</Select>
</Form.Item>
<Form.Item
className={style.lineItem}
label="公司行业"
name="company_nature_id"
>
<Select >
<Select.Option value="">请选择</Select.Option>
<Select.Option value="2">消费电子</Select.Option>
<Select.Option value="3">医疗</Select.Option>
<Select.Option value="5">工业控制</Select.Option>
<Select.Option value="6">汽车电子</Select.Option>
<Select.Option value="7">新能源</Select.Option>
<Select.Option value="8">人工智能</Select.Option>
<Select.Option value="9">电力</Select.Option>
<Select.Option value="10">仪器仪表</Select.Option>
<Select.Option value="11">轨道交通</Select.Option>
<Select.Option value="12">OEM代工</Select.Option>
<Select.Option value="13">航空航天航海</Select.Option>
<Select.Option value="14">勘探</Select.Option>
<Select.Option value="15">通信</Select.Option>
<Select.Option value="16">盗墓业</Select.Option>
</Select>
</Form.Item>
</>
}
</Form>
<button type="submit" className={style.loginButton} onClick={() => manualValidate()}>注册</button>
</div>
</div>
<Footer />
</>
);
};
export default Page;
......@@ -274,6 +274,7 @@ html {
color: #313131;
}
.ant-pagination {
display: flex;
justify-content: flex-end;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment