12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import Taro, { Component } from '@tarojs/taro'
- import { View, Image } from '@tarojs/components'
- import { arrToObj } from '@utils'
- import './index.scss'
- export default class List extends Component {
- constructor (props) {
- super(props)
- this.state = {
- curList: [],
- }
- }
- componentWillMount () {
- this.props.onRef(this)
- }
- getData = (curList) => {
- this.setState({
- curList
- })
- }
- viewHandle (cObj) {
- Taro.api.other.apichannelsclick({id: cObj.id}).then((res) => {
- wx.openChannelsActivity({
- finderUserName: 'sphlZcWrHXeeW4s',
- feedId: cObj.feed_id,
- })
- }).catch(() => {
- wx.openChannelsActivity({
- finderUserName: 'sphlZcWrHXeeW4s',
- feedId: cObj.feed_id,
- })
- })
- }
- render () {
- const { curList } = this.state
- const curItems = curList.map((item, index) => {
- return (
- <View className="lhl-item col-1" key={index} onClick={this.viewHandle.bind(this, item)}>
- <View className="lhl-img">
- <Image src={item.cover} className="img" />
- </View>
- <View className="lhl-info">
- <View className="lhl-p1s">{item.title}</View>
- <View className="lhl-p3">{item.create_at}</View>
- </View>
- </View>
- )
- })
- return (
- <View className="l-house-list">
- {curItems}
- </View>
- )
- }
- }
|