Commit d7258b48 by xuzhenghua

pull

parent b6aff81e
......@@ -209,7 +209,7 @@ module.exports = function(webpackEnv) {
// https://github.com/facebook/create-react-app/issues/5250
// Pending futher investigation:
// https://github.com/terser-js/terser/issues/120
inline: 2,
inline: 2
},
mangle: {
safari10: true,
......
......@@ -80,6 +80,7 @@
"terser-webpack-plugin": "1.2.2",
"url-loader": "1.1.2",
"video.js": "^7.6.0",
"web-launch-app": "^2.1.9",
"webpack": "4.28.3",
"webpack-dev-server": "3.1.14",
"webpack-manifest-plugin": "2.0.4",
......
.captcha-container {
position: relative;
width: 100%;
height: 40px;
}
.captcha-animation {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
\ No newline at end of file
......@@ -36,11 +36,17 @@ class Loading extends Component {
})
}, fake)
}else {
if(prevProps.isLoading != isLoading){
this.setState({
isLoading
})
if(prevProps.isLoading) {
this.setState(()=>({
isLoading: false
}))
}
}
}else{
if(prevProps.isLoading !== isLoading) {
this.setState(()=>({
isLoading: true
}))
}
}
}
......
.bargain-bind-phone {
display: flex;
flex-flow: column;
.bargain-phone-popup {
width: 300px;
height: 195px;
margin: 200px auto 20px;
padding: 20px;
background: $white;
border-radius: 3px;
margin: 200px auto 20px auto;
background-color: $white;
}
.title {
.bargain-phone-popup__title {
margin: 0 0 12px;
font-size: 15px;
font-weight: normal;
text-align: center;
font-size: $font_16;
margin-bottom: 12px;
}
line-height: 1;
}
button, .button {
display: inline-block;
width: 260px;
.bargain-phone-popup__item {
display: flex;
align-items: center;
width: 100%;
height: 30px;
background: $bg_999;
line-height: 28px;
text-align: center;
-webkit-appearance: none;
border: none;
font-size: $font_16;
color: $white;
margin-top: 15px;
border: 1px solid #ddd;
box-sizing: border-box;
&.active {
background-color: #FADD29;
color: #FF4000;
}
border: 1px solid $active;
color: $active;
}
input {
width: 100%;
height: 30px;
-webkit-appearance: none;
outline: 0;
border: 1px solid #DDDDDD;
margin-bottom: 15px;
padding-left: 10px;
border-style: none;
outline: 0;
-webkit-appearance: none;
&::-webkit-input-placeholder {
color: $color_999;
}
&:focus {
border: 1px solid $active;
color: $active;
&.bargain-phone-popup__ipt {
border-left: 1px solid #ddd;
}
}
}
label {
display: block;
position: relative;
}
.send-code {
position: absolute;
right: 15px;
top: 8px;
.bargain-phone-popup__button--num {
display: inline-flex;
align-items: center;
padding: 0 5px;
color: $color_999;
}
.bargain-phone-popup__button--send {
width: 136px;
border-style: none;
font-size: 13px;
color: $color_999;
text-align: right;
background-color: transparent;
cursor: pointer;
outline: none;
&.active {
color: $active;
}
}
.bargain-phone-popup__button--bargain {
display: block;
width: 100%;
height: 30px;
margin-top: 20px;
border-style: none;
font-size: 15px;
color: $white;
line-height: 30px;
text-align: center;
background-color: $bg_999;
outline: none;
-webkit-appearance: none;
&.active {
color: #FF4000;
background-color: #FADD29;
}
}
.popup-bind--bargain {
.popup-bind__content {
width: 300px;
margin: 200px auto 20px;
padding: 20px;
border-radius: 3px;
}
.popup-bind__title {
margin: 0 0 12px;
font-size: 15px;
font-weight: normal;
}
.popup-bind__desc {
padding: 0;
font-size: 12px;
}
.popup-bind__button {
padding: 0;
}
}
\ No newline at end of file
......@@ -3,8 +3,9 @@ import {InputItem, List} from "antd-mobile";
import './bargain-info.scss'
import {validateTel} from "@/utils";
import {Toast} from 'antd-mobile'
import { http } from "@/utils";
import { http, getParam } from "@/utils";
import {Link} from "react-router-dom";
import classnames from 'classnames';
class BargainInfo extends Component {
......@@ -12,7 +13,13 @@ class BargainInfo extends Component {
state = {
mobile: '',
code: '',
isBargain: true
num: '86',
isBargain: true,
isFocus: false,
bindInfo: {},
isTip: false,
seconds: 60,
isTimer: false, // 是否开始倒计时
}
handleChange = e => {
......@@ -24,77 +31,272 @@ class BargainInfo extends Component {
})
}
// 获取短信验证码
sendCode = () => {
console.log(validateTel(this.state.mobile));
if (!validateTel(this.state.mobile)) {
Toast.info('请输入正确的手机号')
return
const { country } = this.props;
let { mobile, isTimer, seconds } = this.state;
if(!isTimer) {
if(!/^\d+$/.test(mobile)){
Toast.info('请输入正确的手机号');
return;
}
// 获取验证码
http.post(
`${API['passport-api']}/m/personal/bindPhoneSendCode`,
{
area_code: `00${country}`,
phone_num: mobile
}
).then(res => {
const { errno, msg } = res.data;
if(errno === 200) {
Toast.info('验证码发送成功', 2, null, false);
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.timer = window.setInterval(() => {
console.log(seconds);
if (seconds <= 0) {
window.clearInterval(this.timer);
this.setState({
isBargain: false
})
} else {
Toast.info(res.data.msg)
isTimer: false,
seconds: 60
});
}else {
this.setState({
isTimer: true,
seconds: --seconds
});
}
})
}, 1000);
}else {
Toast.info(msg);
}
});
}
// 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
// 绑定手机号
handleClick = (isValid = 1) => {
const { country, iWantBargain } = this.props;
const { code, mobile } = this.state;
if (!mobile) {
Toast.info('请填手机号码');
return;
}
if (!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)
// is_valid 是否验证 1:验证(默认),0不验证
http.post(
`${API['passport-api']}/m/personal/bindPhone`,
{
area_code: `00${country}`,
phone_num: mobile,
code: code,
type: 1,
is_valid: isValid
}
).then(res => {
const { errno, data, msg } = res.data;
if(errno === 200) {
if(isValid) {
if(data.tip_info) {
this.setState({
isTip: true,
bindInfo: data.tip_info
})
}else {
iWantBargain();
}
}else {
iWantBargain();
}
}else {
Toast.info(msg);
}
});
// 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
const { country, toClose } = this.props;
const { mobile, code, isBargain, isFocus, bindInfo, isTip, isTimer, seconds } = this.state;
const bool = /^\d+$/.test(mobile);
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>
isTip &&
<div className="popup-bind popup-bind--bargain">
<div className="popup-bind__content">
<h4 className="popup-bind__title">绑定确认</h4>
<p className="popup-bind__desc">该手机号已绑定到以下账号,继续绑定将解除以下绑定状态</p>
<ul className="popup-bind__list">
{
bindInfo['email'] &&
<li className="popup-bind__account">
{/* 邮箱 */}
<i className="iconfont iconduanxin"></i>
<p className="popup-bind__account--name">{bindInfo['email']}</p>
</li>
}
{
!this.state.isBargain &&
<Link className='button active' to={`/passport/login`}>去登录</Link>
bindInfo['wechat_nickname'] &&
<li className="popup-bind__account">
{/* wechat */}
<i className="icon-wachat"></i>
<p className="popup-bind__account--name">{bindInfo['wechat_nickname']}</p>
</li>
}
{
bindInfo['qq_nickname'] &&
<li className="popup-bind__account">
{/* qq */}
<i className="icon-qq"></i>
<p className="popup-bind__account--name">{bindInfo['qq_nickname']}</p>
</li>
}
{
bindInfo['sina_nickname'] &&
<li className="popup-bind__account">
{/* 微博 */}
<i className="icon-sina"></i>
<p className="popup-bind__account--name">{bindInfo['sina_nickname']}</p>
</li>
}
</ul>
<div className="popup-bind__button">
<button
className="popup-bind__button--cancle"
onClick={toClose}>取消</button>
<button
className="popup-bind__button--confirm"
onClick={() => this.handleClick(0)}>继续绑定</button>
</div>
</div>
</div>
}
{
!isTip &&
<div className="bargain-phone-popup">
<h2 className="bargain-phone-popup__title">绑定手机,先砍一刀</h2>
<div
className={classnames(
"bargain-phone-popup__item",
{
'active': isFocus
}
)}
>
<Link
className="bargain-phone-popup__button--num"
to={`/country?id=${getParam('id')}&from=bargain`}
>
+{country}
<i className="iconfont iconiconfront-69"></i>
</Link>
<input
className="bargain-phone-popup__ipt"
type="tel"
onChange={this.handleChange}
onFocus={() => {
this.setState({
isFocus: true
});
}}
onBlur={() => {
this.setState({
isFocus: false
});
}}
name='mobile'
placeholder='手机号'
maxLength={11}
/>
</div>
<div className="bargain-phone-popup__item">
<input
type="tel"
id='code'
onChange={this.handleChange}
name='code'
placeholder='验证码'
maxLength={6}
/>
<button
type="button"
className={classnames(
'bargain-phone-popup__button--send',
{
'active': bool
}
)}
onClick={this.sendCode}
>
{isTimer? `重新发送${seconds}s` : '发送验证码'}
</button>
</div>
{
isBargain
? (
<button
type="button"
onClick={() => this.handleClick()}
className={classnames(
'bargain-phone-popup__button--bargain',
{
'active': bool && code
}
)}
>先砍一刀</button>
)
: (
<Link
className='bargain-phone-popup__button--bargain active'
to={`/passport/login`}
>去登录</Link>
)
}
</div>
}
</>
);
}
}
export default BargainInfo
\ No newline at end of file
export default BargainInfo;
\ No newline at end of file
......@@ -332,7 +332,7 @@ class BtnStatus extends Component {
<span onClick={this.tobuy}>直接购买</span>
</button>
{
(barInfo.bargain_status === 2 || !uid) &&
(barInfo.bargain_status === 2|| (getParam('id') === '139' && barInfo.bargain_status === 3) || !uid) &&
<button className='btn btn-s bg-E02E24' onClick={this.toKanjia}>
我要砍价
</button>
......
......@@ -93,9 +93,9 @@ class OutLine extends Component {
6-可试听但无试听权限
*/}
{ // 试听
!introduce.is_aist && item.class_status === 6 &&
!introduce.is_aist && (item.class_status === 6 || item.class_status === 5) &&
<span className='btn-right-10 audition'
onClick={this.props.toAudition}>试听
onClick={e => this.props.toAudition(introduce.v_course_id, item.video_id)}>试听
<i className='iconfont iconcelluar'></i>
</span>
}
......
......@@ -340,6 +340,11 @@ class Single extends Component {
</div>
<div className='payment-type'>
<label>支付方式:</label>
<p onClick={this.check.bind(this, '0')}>
<i className='iconfont iconweixinzhifu buy'></i>
<span>微信支付</span>
<i className={`iconfont icondanseshixintubiao-5 redio ${this.state.payType === '0' ? 'redioed' : ''}`}></i>
</p>
{
!browser.isWeixin &&
<p onClick={this.check.bind(this, '1')}>
......@@ -349,11 +354,6 @@ class Single extends Component {
</p>
}
<p onClick={this.check.bind(this, '0')}>
<i className='iconfont iconweixinzhifu buy'></i>
<span>微信支付</span>
<i className={`iconfont icondanseshixintubiao-5 redio ${this.state.payType === '0' ? 'redioed' : ''}`}></i>
</p>
</div>
<div className='btn btn-18B4ED' onClick={this.toBuy}>确认购买</div>
</div>
......
......@@ -18,8 +18,8 @@ if (browser.isWeixin) {
];
} else {
mockData = [
{value: 0, label: '支付宝', icon: 'iconalipay'},
{value: 1, label: '微信支付', icon: 'iconweixinzhifu'},
{value: 0, label: '支付宝', icon: 'iconalipay'},
// { value: 2, label: '花呗分期', icon: 'iconhuabei' },
];
}
......@@ -30,7 +30,7 @@ export default class PayOrder extends Component {
super(props);
this.state = {
pay_amount: 0,
payType: 0,
payType: 1,
stageNumber: 0,
checkPeriod: false,
singleMoney: 0,
......
......@@ -76,34 +76,47 @@ class SearchResult extends PureComponent {
}
handleScroll = throttle(() => {
let y = window.scrollY, headY = this.searchHead.current.offsetTop
if (y < this.prevScrollY) {
let y = window.scrollY,
headY = this.searchHead.current.offsetTop;
console.log(headY,'headY');
console.log(document.querySelector('body').offsetHeight);
// 向上滑动
if (y < this.prevScrollY && y > 0) {
console.log(0);
console.log(this.state.swipeDirection);
if (this.state.swipeDirection === this.swipeDown) {
console.log(1);
y <= headY && this.state.searchHeadStyle.position !== 'fixed' && this.setState({
y <= headY && this.state.searchHeadStyle.position !== 'fixed' &&
this.setState({
searchHeadStyle: {
top: `0`,
position: 'fixed'
}
})
} else {
console.log(2);
this.setState({
swipeDirection: this.swipeDown
}, () => {
if (this.state.swipeDirection === this.swipeDown) {
let h = y > document.querySelector('body').offsetHeight? document.querySelector('body').offsetHeight: y;
let h1 = this.searchHead.current.offsetHeight
this.setState({
searchHeadStyle: {
top: `${y > headY ? y - 44 : y}px`
// top: `${h > headY ? h - h1 : h}px`
top: `${y}px`
}
})
}
})
}
} else {
console.log(3);
this.state.swipeDirection !== this.swipeUp &&
this.setState({
swipeDirection: this.swipeUp,
......@@ -112,9 +125,8 @@ class SearchResult extends PureComponent {
top: `${y}px`
}
})
}
this.prevScrollY = y
this.prevScrollY = y;
}, 0)
render() {
......
......@@ -756,7 +756,11 @@ class Video extends Component {
}}/>
<Loading isLoading={this.state.isLoading}>
<div className="video">
<video className={'video-js'} ref={el => this.video = el}>
<video className={'video-js'} ref={el => this.video = el}
webkit-playsinline="true"
playsInline={true}
x-webkit-airplay="allow"
x5-video-player-type="h5">
<source src={'/'} type='application/x-mpegURL'/>
</video>
{
......
......@@ -2772,11 +2772,6 @@ cli-width@^2.0.0:
resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639"
integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=
clipboard-copy@^3.1.0:
version "3.1.0"
resolved "https://registry.npm.taobao.org/clipboard-copy/download/clipboard-copy-3.1.0.tgz#4c59030a43d4988990564a664baeafba99f78ca4"
integrity sha1-TFkDCkPUmImQVkpmS66vupn3jKQ=
cliui@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d"
......@@ -11598,6 +11593,11 @@ wbuf@^1.1.0, wbuf@^1.7.3:
dependencies:
minimalistic-assert "^1.0.0"
web-launch-app@^2.1.9:
version "2.1.9"
resolved "https://registry.npm.taobao.org/web-launch-app/download/web-launch-app-2.1.9.tgz#8da6e2b53331881d00e4ee3a8c2d630c29fc4550"
integrity sha1-jabitTMxiB0A5O46jC1jDCn8RVA=
web-namespaces@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/web-namespaces/-/web-namespaces-1.1.2.tgz#c8dc267ab639505276bae19e129dbd6ae72b22b4"
......
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