Skip to content

Commit

Permalink
Merge pull request #48 from lsqy/dev
Browse files Browse the repository at this point in the history
feat(home): 首页新增搜索
  • Loading branch information
lsqy committed Nov 10, 2019
2 parents 423c9c5 + cbedaeb commit ddbbd8f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
26 changes: 21 additions & 5 deletions src/pages/index/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ComponentClass } from 'react'
import Taro, { Component, Config } from '@tarojs/taro'
import { View, Image, Text, Swiper, SwiperItem } from '@tarojs/components'
import { AtTabBar } from 'taro-ui'
import { AtTabBar, AtSearchBar } from 'taro-ui'
import { connect } from '@tarojs/redux'
import classnames from 'classnames'
import CLoading from '../../components/CLoading'
Expand Down Expand Up @@ -65,7 +65,8 @@ type PageState = {
bannerList: Array<{
typeTitle: string,
pic: string
}>
}>,
searchValue: string
}

type IProps = PageStateProps & PageDispatchProps & PageOwnProps
Expand Down Expand Up @@ -119,7 +120,8 @@ class Index extends Component<IProps, PageState> {
this.state = {
current: 0,
showLoading: true,
bannerList: []
bannerList: [],
searchValue: ''
}
}

Expand Down Expand Up @@ -196,6 +198,12 @@ class Index extends Component<IProps, PageState> {
})
}

goSearch() {
Taro.navigateTo({
url: `/pages/search/index`
})
}

goDetail(item) {
Taro.navigateTo({
url: `/pages/playListDetail/index?id=${item.id}&name=${item.name}`
Expand All @@ -222,8 +230,8 @@ class Index extends Component<IProps, PageState> {
}

render () {
const { recommendPlayList, recommendDj, song } = this.props
const { showLoading, bannerList } = this.state
const { recommendPlayList, song } = this.props
const { showLoading, bannerList, searchValue } = this.state
return (
<View className={
classnames({
Expand All @@ -233,6 +241,14 @@ class Index extends Component<IProps, PageState> {
}>
<CLoading fullPage={true} hide={!showLoading} />
<CMusic songInfo={ this.props.song } isHome={true} onUpdatePlayStatus={this.props.updatePlayStatus.bind(this)} />
<View onClick={this.goSearch.bind(this)}>
<AtSearchBar
actionName='搜一下'
disabled={true}
value={searchValue}
onChange={this.goSearch.bind(this)}
/>
</View>
<Swiper
className='banner_list'
indicatorColor='#999'
Expand Down
4 changes: 0 additions & 4 deletions src/pages/my/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,6 @@ class Page extends Component<IProps, PageState> {
}

goSearch() {
// Taro.showToast({
// title: '正在开发,敬请期待',
// icon: 'none'
// })
Taro.navigateTo({
url: `/pages/search/index`
})
Expand Down

0 comments on commit ddbbd8f

Please sign in to comment.