Commit e85cbfb3 by xuzhenghua

detail

parents f7866175 4fcf6337
.bargain-bind-iphone { .bargain-bind-phone {
position: absolute; display: flex;
top: 50%; flex-flow: column;
left: 50%; width: 300px;
transform: translate(-50%, -50%); height: 195px;
display: flex; padding: 20px;
flex-flow: column; background: $white;
width: 300px; border-radius: 3px;
height: 195px; margin: 200px auto 20px auto;
padding: 20px;
background: $white; .title {
border-radius: 3px; text-align: center;
font-size: $font_16;
.title { margin-bottom: 12px;
text-align: center; }
font-size: $font_16;
margin-bottom: 12px; button, .button {
} display: inline-block;
width: 260px;
height: 30px;
background: $bg_999;
line-height: 28px;
text-align: center;
-webkit-appearance: none;
border: none;
font-size: $font_16;
color: $white;
.list { &.active {
.am-list-item { background-color: #FADD29;
height: 30px; color: #FF4000;
min-height: 30px;
border: 1px solid $border_ddd;
input {
font-size: $font_12;
}
}
.am-list-item {
margin-bottom: 15px;
}
.am-list-line {
&::after {
display: none;
}
}
.am-list-body {
&::after {
display: none;
}
}
} }
}
button {
display: inline-block;
width: 260px;
height: 30px;
background: $bg_999;
-webkit-appearance: none; input {
border: none; width: 100%;
height: 30px;
-webkit-appearance: none;
outline: 0;
border: 1px solid #DDDDDD;
margin-bottom: 15px;
padding-left: 10px;
font-size: $font_16; &::-webkit-input-placeholder {
color: $white; color: $color_999;
text-align: center;
line-height: 30px;
} }
&:focus {
border: 1px solid $active;
color: $active;
}
}
label {
display: block;
position: relative;
}
.send-code {
position: absolute;
right: 15px;
top: 8px;
font-size: 13px;
color: $color_999;
}
} }
\ No newline at end of file
import React from 'react'; import React, {Component} from 'react';
import { InputItem, List } from "antd-mobile"; import {InputItem, List} from "antd-mobile";
import './bargain-info.scss' import './bargain-info.scss'
import {validateTel} from "@/utils";
import {Toast} from 'antd-mobile'
import {http, api} from "@/utils";
import {Link} from "react-router-dom";
const BargainInfo = () => { class BargainInfo extends Component {
return (
<div className={'bargain-info'}> state = {
<div className="title">绑定手机,先砍一刀</div> mobile: '',
<List className={'list'}> code: '',
<InputItem isBargain: true
placeholder={'手机号'} }
/>
<InputItem handleChange = e => {
placeholder={'验证码'}
/> let {name, value} = e.target
</List>
<button>先砍一刀</button> this.setState({
</div> [name]: value
); })
}; }
sendCode = () => {
console.log(validateTel(this.state.mobile));
if (!validateTel(this.state.mobile)) {
Toast.info('请输入正确的手机号')
return
}
http.post(`${api['base-api']}/sys/bind_send_sms`, {
phone_num: this.state.mobile
}).then(res => {
if (res.data.code == 200) {
Toast.info('验证码发送成功', 2, null, false)
} else if (res.data.errno === 410) {
Toast.info('该手机号已注册,请使用该手机号登录,发起砍价。', 3, null, false)
this.setState({
isBargain: false
})
} else {
Toast.info(res.data.msg)
}
})
}
handleClick = () => {
if (!this.state.code) {
Toast.info('请填写验证码')
return
}
http.post(`${api.home}/m/user/bindMobile`, {
...this.state
}).then(res => {
if (res.data.code == 200) {
Toast.info('绑定手机号成功', 2, null, false)
this.props.iWantBargain()
} else {
Toast.info(res.data.msg)
}
})
}
render() {
let {mobile, code} = this.state
return (
<div className={'bargain-bind-phone'}>
<div className="title">绑定手机,先砍一刀</div>
<List className={'list'}>
<input type="tel" onChange={this.handleChange} name='mobile' placeholder='手机号' maxLength={11}/>
<label htmlFor="code">
<input type="tel" id='code' onChange={this.handleChange} name='code' placeholder='验证码'
maxLength={6}/>
<div className={'send-code'} onClick={this.sendCode}>发送验证码</div>
</label>
</List>
{
this.state.isBargain &&
<button onClick={this.handleClick}
className={validateTel(mobile) && code ? 'active' : ''}>先砍一刀</button>
}
{
!this.state.isBargain &&
<Link className='button active' to={`/passport/login`}>去登录</Link>
}
</div>
);
}
}
export default BargainInfo export default BargainInfo
\ No newline at end of file
import React, {Component, useState} from 'react' import React, { Component, useState } from 'react'
import './bargain.scss' import './bargain.scss'
import {Flex, Toast} from "antd-mobile" import { Flex, Toast } from "antd-mobile"
import Overlay from '../overlay' import Overlay from '../overlay'
import BargainInfo from './bargainInfo' import BargainInfo from './bargainInfo'
import {differenceInSeconds, differenceInMinutes, differenceInHours, differenceInDays} from "date-fns" import {differenceInSeconds, differenceInMinutes, differenceInHours, differenceInDays} from "date-fns"
import {api, getParam, http} from "@/utils" import { api, getParam, http } from "@/utils"
import Ranking from "@/components/bargainMiddlePage/ranking" import Ranking from "@/components/bargainMiddlePage/ranking"
import {compose} from "redux" import { compose } from "redux"
import {withRouter} from 'react-router-dom' import { withRouter } from 'react-router-dom'
class Bargain extends Component { class Bargain extends Component {
...@@ -70,7 +70,6 @@ class Bargain extends Component { ...@@ -70,7 +70,6 @@ class Bargain extends Component {
}) })
} }
// 查看更多 // 查看更多
getMore = () => { getMore = () => {
this.setState({ this.setState({
...@@ -197,8 +196,7 @@ class Bargain extends Component { ...@@ -197,8 +196,7 @@ class Bargain extends Component {
{/*绑定手机号*/} {/*绑定手机号*/}
{ {
this.state.status === 3 && this.state.status === 3 &&
<BargainInfo/> <BargainInfo iWantBargain={this.iWantBargain}/>
} }
......
...@@ -16,9 +16,9 @@ class Carouselw extends Component { ...@@ -16,9 +16,9 @@ class Carouselw extends Component {
componentDidMount() { componentDidMount() {
const _this = this const _this = this
_this.getList() _this.getList()
// this.timer = setInterval(function () { this.timer = setInterval(function () {
// _this.getList() _this.getList()
// },10000); },10000);
} }
......
...@@ -5,5 +5,5 @@ ...@@ -5,5 +5,5 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
background: rgba(0, 0, 0, 0.6); background: rgba(0, 0, 0, 0.6);
z-index: 9999; z-index: 999;
} }
\ No newline at end of file
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