Commit c945923f by zhanghaozhe

Merge branch 'search-result' into dev

# Conflicts:
#	public/api.js
parents ba312042 40315e34
import './style.scss' import './style.scss'
\ No newline at end of file import '../src/assets/font/iconfont.css'
import '@csstools/normalize.css/normalize.css'
\ No newline at end of file
var API = { var API = {
'www': 'http://www-test.julyedu.com', 'www': 'http://www-test.julyedu.com',
'home': 'http://fast-test.julyedu.com', 'home': 'http://fast-test.julyedu.com',
'search-api': 'https://search.julyedu.com', 'search-api': 'http://search-test.julyedu.com',
'passport-api': 'http://passport-test.julyedu.com', 'passport-api': 'http://passport-test.julyedu.com',
'base-api': 'http://api-test.julyedu.com', 'base-api': 'http://api-test.julyedu.com',
'record': 'record.julyedu.com:8001', 'record': 'record.julyedu.com:8001',
'process-api': 'ws:process-test.julyedu.com:9502', 'process-api': 'ws:process-test.julyedu.com:9502',
'm': 'http://m-test.julyedu.com', 'm': 'http://m-test.julyedu.com',
//terminal 'ws': 'ws://47.93.119.175:8888/ws',
'ws': 'ws://47.93.119.175:8888/ws',
} }
import React from 'react'
import Address from "./index";
import {text, boolean, withKnobs} from '@storybook/addon-knobs'
import {action} from '@storybook/addon-actions'
export default {
title: 'address',
component: Address,
decorators: [withKnobs]
}
let visible = true,
title = '收货地址',
subtitle = '获奖用户(以最终榜单为准)请及时填写收货信息',
address = '金域国际中心',
phone = '1331234123',
name = '某某某'
export const Default = () => {
visible = boolean('visible', visible)
name = text('name', name)
phone = text('phone', phone)
address = text('address', address)
title = text('title(optional)', title)
subtitle = text('subtitle(optional)', subtitle)
return <Address visible={visible}
subtitle={subtitle}
title={title}
name={name}
phone={phone}
address={address}
onClose={action('onClose')}
validate={() => ({name: '姓名'})}
onError={(errors) => {
console.log(errors);}}
onSubmit={(values, formikHelpers) => {
console.log(formikHelpers);
}}
/>
}
\ No newline at end of file
.common-address-container {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 300px;
padding: 20px 25px;
background: #fff;
border-radius: 10px;
box-sizing: border-box;
text-align: center;
.title {
margin-bottom: 8px;
color: #525C65;
font-size: 16px;
}
.subtitle {
margin-bottom: 15px;
font-size: 13px;
color: #ED6A1D;
text-align: left;
}
input {
width: 250px;
height: 40px;
line-height: 40px;
border: 1px solid #DDD;
font-size: 13px;
color: #999;
outline: 0;
-webkit-appearance: none;
&:nth-child(n+2) {
margin-top: 10px;
}
&::placeholder {
color: #999;
}
}
.submit {
margin-top: 18px;
width: 121px;
height: 33px;
background: #09f;
border-radius: 17px;
font-size: 15px;
color: #fff;
-webkit-appearance: none;
outline: 0;
border: 0;
}
.close{
position: absolute;
left: 50%;
bottom: -56px;
transform: translateX(-50%);
font-size: 26px;
color: #fff;
}
}
\ No newline at end of file
import React, {Component} from 'react' import React, {Component} from 'react'
import './index.scss' import './index.scss'
import MaskCover from "../cover"; import MaskCover from "../cover";
import {Formik, Form, Field, FormikHelpers, FormikErrors} from "formik";
interface PersonalInfo { interface PersonalInfo {
name: string name: string
...@@ -9,20 +10,51 @@ interface PersonalInfo { ...@@ -9,20 +10,51 @@ interface PersonalInfo {
} }
interface Props extends PersonalInfo { interface Props extends PersonalInfo {
subtitle: string subtitle?: string
title?: string title?: string
onSubmit?: () => PersonalInfo onClose: () => void
visible: boolean
validate: () => void
onSubmit: (values: PersonalInfo, formikHelpers: FormikHelpers<PersonalInfo>) => void
onError: (errors: FormikErrors<PersonalInfo>) => void
} }
class Address extends Component<Props> { const Address: React.FC<Props> = ({name, phone, address, title, subtitle, visible, onClose, validate, onSubmit, onError}) => {
render() { return (
return <MaskCover> visible ?
<div className="address-container"> <MaskCover>
<div className="title"></div> <div className="common-address-container">
<div className="subtitle"></div> <div className="title">{title}</div>
</div> <div className="subtitle">{subtitle}</div>
</MaskCover> <Formik initialValues={{name, phone, address}}
} enableReinitialize={true}
onSubmit={onSubmit}
validate={validate}
>
{
(props) => {
if (props.errors) {
onError(props.errors)
}
return <Form className={'form'}>
<Field placeholder={'姓名'} name='name'></Field>
<Field placeholder={'手机号'} name='phone'></Field>
<Field placeholder={'地址'} name='address'></Field>
<button type={'submit'} className={'submit'}>提交</button>
</Form>
}
}
</Formik>
<i className={'iconfont iconiconfront-2 close'} onClick={onClose}></i>
</div>
</MaskCover>
: null
)
}
Address.defaultProps = {
title: '收货信息',
subtitle: '获奖用户(以最终榜单为准)请及时填写收货信息'
} }
export default Address export default Address
@import "src/assets/css/variable"; @import 'src/assets/css/variable';
.search-result { .search-result {
padding-top: 44px; padding-top: 44px;
.search-head { .search-head {
// position: absolute; // position: absolute;
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
z-index: 10; z-index: 10;
transition: top 0.5 ease; transition: top 0.5 ease;
&.hide { &.hide {
top: -44px; top: -44px;
}
} }
}
ul { .result-count {
list-style: none; width: 375px;
border-top:1px solid #ddd; height: 30px;
} background: #f7f7fb;
border-top: 1px solid #ddd;
color: #333;
font-size: 12px;
text-align: center;
line-height: 30px;
}
.v-list-item{ ul {
.content{ list-style: none;
width: 100%; }
}
}
.info { .v-list-item {
width: 50%; .content {
position: relative; width: 100%;
display: block; }
.title{ }
font-size: $font_16;
color:#525C65;
}
.des { .info {
font-size: $font_14; width: 50%;
color:#777; position: relative;
margin-top: 10px; display: block;
} .title {
font-size: $font_16;
color: #525c65;
em {
color: #09f;
}
}
.price { .des {
color: $red; font-size: $font_14;
font-size: $font_16; color: #777;
margin-right: 14px; margin-top: 10px;
} }
.stale-price { .price {
text-decoration: line-through; color: $red;
color: $color_999; font-size: $font_16;
font-size: $font_12; margin-right: 14px;
} }
.bottom { .stale-price {
position: absolute; text-decoration: line-through;
bottom: 0; color: $color_999;
} font-size: $font_12;
} }
.empty { .bottom {
font-size: 12px; position: absolute;
color: #777; bottom: 0;
padding: 50px 0 30px 0;
text-align: center;
background-color: #fff;
border-top: 1px solid #ddd;
img {
width: 100px;
height: 81px;
display: block;
margin: 0 auto 15px auto;
}
} }
}
.status { .empty {
width: 100%; font-size: 12px;
position: absolute; color: #777;
bottom: -2px; padding: 50px 0 30px 0;
left: 0; text-align: center;
height: 24px; background-color: #fff;
text-align: center; border-top: 1px solid #ddd;
line-height: 24px; img {
font-size: 13px; width: 100px;
color: $white; height: 81px;
background-color: rgba(224, 46, 36, 0.6); display: block;
border-radius: 0 0 4px 4px; margin: 0 auto 15px auto;
} }
} }
\ No newline at end of file
.status {
width: 100%;
position: absolute;
bottom: -2px;
left: 0;
height: 24px;
text-align: center;
line-height: 24px;
font-size: 13px;
color: $white;
background-color: rgba(224, 46, 36, 0.6);
border-radius: 0 0 4px 4px;
}
}
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 to comment