Commit 882b7d44 by FE

pull and solve conflict

parents 19b8e16b 0b413ef9
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import classnames from 'classnames';
import { getParam } from '@/utils'; import { getParam } from '@/utils';
import { addCountryNum } from './countryRedux'; import { addCountryNum } from './countryRedux';
import { HeaderBar } from '@/common' import { HeaderBar } from '@/common'
...@@ -9,6 +10,17 @@ import './index.scss'; ...@@ -9,6 +10,17 @@ import './index.scss';
class Country extends Component { class Country extends Component {
constructor(props) {
super(props);
this.state = {
currentNav: 'A'
}
}
componentDidMount() {
document.body.scrollIntoView();
}
toParentPage = (e, num) => { toParentPage = (e, num) => {
// console.log(this.props); // console.log(this.props);
const { history, addCountryNum } = this.props; const { history, addCountryNum } = this.props;
...@@ -20,10 +32,23 @@ class Country extends Component { ...@@ -20,10 +32,23 @@ class Country extends Component {
e.preventDefault(); e.preventDefault();
} }
scrollTo = (param) => {
const el = document.querySelector(`[data-type="${param}"]`)
if(el) {
this.setState({
currentNav: param
});
el.scrollIntoView({
behavior: 'smooth'
});
}
}
render() { render() {
const navs = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
const data = [ const data = [
{ {
type: '常用', type: '0',
list: [ list: [
{ {
name: '中国大陆', name: '中国大陆',
...@@ -1039,42 +1064,26 @@ class Country extends Component { ...@@ -1039,42 +1064,26 @@ class Country extends Component {
] ]
} }
]; ];
const { currentNav } = this.state;
return ( return (
<> <>
<HeaderBar title="选择国家和地区" /> <HeaderBar title="选择国家和地区" />
<ul className="letter-nav"> <ul className="letter-nav">
<li className="letter-nav__item">A</li> {navs.map((item, index) => {
<li className="letter-nav__item letter-nav__item--active">B</li> return (
<li className="letter-nav__item">C</li> <li
<li className="letter-nav__item">D</li> key={`nav-${index}`}
<li className="letter-nav__item">E</li> className={classnames("letter-nav__item", {"letter-nav__item--active": currentNav === item})}
<li className="letter-nav__item">F</li> onClick={() => this.scrollTo(item)}
<li className="letter-nav__item">G</li> >{item}</li>
<li className="letter-nav__item">H</li> )
<li className="letter-nav__item">I</li> })}
<li className="letter-nav__item">J</li>
<li className="letter-nav__item">K</li>
<li className="letter-nav__item">L</li>
<li className="letter-nav__item">M</li>
<li className="letter-nav__item">N</li>
<li className="letter-nav__item">O</li>
<li className="letter-nav__item">P</li>
<li className="letter-nav__item">Q</li>
<li className="letter-nav__item">R</li>
<li className="letter-nav__item">S</li>
<li className="letter-nav__item">T</li>
<li className="letter-nav__item">U</li>
<li className="letter-nav__item">V</li>
<li className="letter-nav__item">W</li>
<li className="letter-nav__item">X</li>
<li className="letter-nav__item">Y</li>
<li className="letter-nav__item">Z</li>
</ul> </ul>
<div className="page-body"> <div className="page-body">
{data.map(({type, list}, index) => { {data.map(({type, list}, index) => {
return ( return (
<div key={index}> <div key={index}>
<h2 className="country-header">{type}</h2> <h2 className="country-header" data-type={type}>{type === '0'? '常用' : type}</h2>
<ul className="country-list"> <ul className="country-list">
{list.map((val, key) => { {list.map((val, key) => {
return ( return (
......
...@@ -15,6 +15,7 @@ import { getCourses, addCourseToCart } from "./actions" ...@@ -15,6 +15,7 @@ import { getCourses, addCourseToCart } from "./actions"
import { getParam, http, browser, wxShare } from "@/utils" import { getParam, http, browser, wxShare } from "@/utils"
import { Toast } from 'antd-mobile' import { Toast } from 'antd-mobile'
import { bindActionCreators } from "redux"; import { bindActionCreators } from "redux";
import {delCountryNum} from './../country/countryRedux';
import RedPacket from './redPacket'; import RedPacket from './redPacket';
...@@ -572,15 +573,10 @@ class Detail extends Component { ...@@ -572,15 +573,10 @@ class Detail extends Component {
<RedPacket <RedPacket
history={this.props.history} history={this.props.history}
country={this.props.country} country={this.props.country}
delCountryNum={this.props.delCountryNum}
/> />
} }
{/*分享赚钱*/}
{
course_info.is_dist &&
<ShareRank courseInfo={course_info} />
}
{/** {/**
* 拼团 * 拼团
* is_aist: 是否AI特训营 * is_aist: 是否AI特训营
...@@ -598,6 +594,7 @@ class Detail extends Component { ...@@ -598,6 +594,7 @@ class Detail extends Component {
{/*砍价*/} {/*砍价*/}
{ {
course_info.is_baoming === 0 && (!course_info.is_aist) && course_info.is_bargain && course_info.is_baoming === 0 && (!course_info.is_aist) && course_info.is_bargain &&
...@@ -665,7 +662,8 @@ const mapDispatchToProps = (dispatch) => { ...@@ -665,7 +662,8 @@ const mapDispatchToProps = (dispatch) => {
return bindActionCreators( return bindActionCreators(
{ {
getCourses, getCourses,
addCourseToCart addCourseToCart,
delCountryNum
}, },
dispatch dispatch
) )
......
...@@ -53,9 +53,14 @@ class RedPacket extends PureComponent { ...@@ -53,9 +53,14 @@ class RedPacket extends PureComponent {
// console.log(this.props); // console.log(this.props);
const share_code = getParam('share_code'); const share_code = getParam('share_code');
const { country } = this.props; const { country } = this.props;
const { shareInfo } = this.state;
if(country.code) { if(country.code) {
this.setState({ this.setState({
country country,
shareInfo: {
...shareInfo,
share_code: country.code
}
}); });
// 检查收否领取过 // 检查收否领取过
http.post( http.post(
...@@ -68,6 +73,7 @@ class RedPacket extends PureComponent { ...@@ -68,6 +73,7 @@ class RedPacket extends PureComponent {
console.log(res); console.log(res);
const { code, data } = res.data; const { code, data } = res.data;
if(code === 200) { if(code === 200) {
// is_receive 是否领取过 0-否 1-是 // is_receive 是否领取过 0-否 1-是
if(data.is_receive) { if(data.is_receive) {
this.judgeReceiveStatus(data, 8); this.judgeReceiveStatus(data, 8);
...@@ -76,12 +82,12 @@ class RedPacket extends PureComponent { ...@@ -76,12 +82,12 @@ class RedPacket extends PureComponent {
type: 3 type: 3
}); });
} }
// 清除
this.props.delCountryNum();
} }
}) })
} }
// 分享链接进入 // 分享链接进入
const { shareInfo } = this.state;
if(share_code) { if(share_code) {
this.setState({ this.setState({
shareInfo: { shareInfo: {
...@@ -522,6 +528,7 @@ class RedPacket extends PureComponent { ...@@ -522,6 +528,7 @@ class RedPacket extends PureComponent {
bindInfo, bindInfo,
country country
} = this.state; } = this.state;
// console.log(share_code);
const cls = classnames('popup-mask',{ const cls = classnames('popup-mask',{
'popup-mask--no': type !== 2 'popup-mask--no': type !== 2
}); });
......
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