|
|
@@ -4,7 +4,7 @@ import {Query} from "react-apollo"
|
|
|
import gql from "graphql-tag"
|
|
|
import {Grid, Carousel, WhiteSpace, ActivityIndicator} from 'antd-mobile'
|
|
|
import Logo from '../../../components/logo'
|
|
|
-import {category_by_props, productbyprops} from "../../../utils/gql"
|
|
|
+import {slideshow_by_props, category_by_props, productbyprops} from "../../../utils/gql"
|
|
|
import './index.css'
|
|
|
|
|
|
class All extends Component {
|
|
|
@@ -28,29 +28,6 @@ class All extends Component {
|
|
|
"sort_by": {"order": "asc"}
|
|
|
}
|
|
|
|
|
|
- const demo = [
|
|
|
- {
|
|
|
- icon: 'https://green-1258802564.cos.ap-beijing.myqcloud.com/plant.png',
|
|
|
- text: '松柏',
|
|
|
- id: 'more'
|
|
|
- },
|
|
|
- {
|
|
|
- icon: 'https://green-1258802564.cos.ap-beijing.myqcloud.com/plant.png',
|
|
|
- text: '花果',
|
|
|
- id: 'more'
|
|
|
- },
|
|
|
- {
|
|
|
- icon: 'https://green-1258802564.cos.ap-beijing.myqcloud.com/plant.png',
|
|
|
- text: '杂木',
|
|
|
- id: 'more'
|
|
|
- },
|
|
|
- {
|
|
|
- icon: 'https://green-1258802564.cos.ap-beijing.myqcloud.com/plant.png',
|
|
|
- text: '藤本',
|
|
|
- id: 'more'
|
|
|
- }
|
|
|
- ]
|
|
|
-
|
|
|
const more = {
|
|
|
icon: 'https://ece-img-1254337200.cos.ap-chengdu.myqcloud.com/icon/more.png',
|
|
|
text: '更多',
|
|
|
@@ -59,31 +36,52 @@ class All extends Component {
|
|
|
|
|
|
return (
|
|
|
<div>
|
|
|
- <Carousel
|
|
|
- autoplay={true}
|
|
|
- infinite
|
|
|
- style={{minHeight: 200}}
|
|
|
- >
|
|
|
- {this.state.data.map(val => (
|
|
|
- <a
|
|
|
- key={val}
|
|
|
- href="http://www.alipay.com"
|
|
|
- style={{
|
|
|
- display: 'inline-block',
|
|
|
- width: '100%',
|
|
|
- height: 'auto',
|
|
|
- maxHeight: '200px',
|
|
|
- overflow: 'hidden'
|
|
|
- }}
|
|
|
- >
|
|
|
- <img
|
|
|
- src={val}
|
|
|
- alt=""
|
|
|
- style={{width: '100%', verticalAlign: 'top'}}
|
|
|
- />
|
|
|
- </a>
|
|
|
- ))}
|
|
|
- </Carousel>
|
|
|
+ <Query query={gql(slideshow_by_props)} >
|
|
|
+ {
|
|
|
+ ({loading, error, data}) => {
|
|
|
+ if (loading) {
|
|
|
+ return (
|
|
|
+ <div className="loading-center">
|
|
|
+ <ActivityIndicator text="加载中..." size="large"/>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ if (error) {
|
|
|
+ return 'error!'
|
|
|
+ }
|
|
|
+
|
|
|
+ let slideshow = data.slideshowbyprops || []
|
|
|
+
|
|
|
+ return (
|
|
|
+ <Carousel
|
|
|
+ autoplay={true}
|
|
|
+ infinite
|
|
|
+ style={{minHeight: 200}}
|
|
|
+ >
|
|
|
+ {slideshow.map(val => (
|
|
|
+ <a
|
|
|
+ key={val.id}
|
|
|
+ href="http://www.alipay.com"
|
|
|
+ style={{
|
|
|
+ display: 'inline-block',
|
|
|
+ width: '100%',
|
|
|
+ height: 'auto',
|
|
|
+ maxHeight: '200px',
|
|
|
+ overflow: 'hidden'
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ src={val.img}
|
|
|
+ alt=""
|
|
|
+ style={{width: '100%', verticalAlign: 'top'}}
|
|
|
+ />
|
|
|
+ </a>
|
|
|
+ ))}
|
|
|
+ </Carousel>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ </Query>
|
|
|
<Query query={gql(category_by_props)} variables={categoryFilter}>
|
|
|
{
|
|
|
({loading, error, data}) => {
|
|
|
@@ -101,14 +99,9 @@ class All extends Component {
|
|
|
let categoryList = data.categorybyprops
|
|
|
let dataList = categoryList.concat(more)
|
|
|
|
|
|
- let demoDataList = demo.concat(more)
|
|
|
-
|
|
|
return (
|
|
|
<Grid
|
|
|
data={dataList}
|
|
|
- dataOther={demoDataList}
|
|
|
- // data={demoDataList}
|
|
|
- // dataOther={dataList}
|
|
|
hasLine={false}
|
|
|
onClick={(kind) => {
|
|
|
this.props.history.push({
|
|
|
@@ -160,44 +153,11 @@ class Recommend extends Component {
|
|
|
|
|
|
render() {
|
|
|
let {data} = this.props
|
|
|
- let demoData = [
|
|
|
- {
|
|
|
- id: '1',
|
|
|
- name: '北欧仿真植物装饰龟背竹绿植盆栽旅人蕉假树天堂鸟室内网红大型',
|
|
|
- price: 100,
|
|
|
- discountRate: 80,
|
|
|
- img: 'https://green-1258802564.cos.ap-beijing.myqcloud.com/pfzd1.jpeg'
|
|
|
- },
|
|
|
- {
|
|
|
- id: '2',
|
|
|
- name: '北欧仿真植物装饰龟背竹绿植盆栽旅人蕉假树天堂鸟室内网红大型',
|
|
|
- price: 200,
|
|
|
- discountRate: 80,
|
|
|
- img: 'https://green-1258802564.cos.ap-beijing.myqcloud.com/pfzd2.jpg'
|
|
|
- },
|
|
|
- {
|
|
|
- id: '3',
|
|
|
- name: '北欧仿真植物装饰龟背竹绿植盆栽旅人蕉假树天堂鸟室内网红大型',
|
|
|
- price: 300,
|
|
|
- discountRate: 80,
|
|
|
- img: 'https://green-1258802564.cos.ap-beijing.myqcloud.com/pfzd1.jpeg'
|
|
|
- },
|
|
|
- {
|
|
|
- id: '4',
|
|
|
- name: '北欧仿真植物装饰龟背竹绿植盆栽旅人蕉假树天堂鸟室内网红大型',
|
|
|
- price: 200,
|
|
|
- discountRate: 80,
|
|
|
- img: 'https://green-1258802564.cos.ap-beijing.myqcloud.com/pfzd2.jpg'
|
|
|
- }
|
|
|
- ]
|
|
|
return (
|
|
|
<div className='guess-wrapper'>
|
|
|
<div className='guess-title'>- 店长推荐 -</div>
|
|
|
<Grid
|
|
|
data={data}
|
|
|
- demoData={demoData}
|
|
|
- // data={demoData}
|
|
|
- // demoData={data}
|
|
|
columnNum={2}
|
|
|
hasLine={false}
|
|
|
onClick={(recommend) => {
|