index.tsx 1.59 KB
Newer Older
hank committed
1 2 3 4 5 6 7 8 9 10 11 12 13
// import { ITempItem } from '../..'
import { ComponentClass } from 'react'
import Taro, { Component } from '@tarojs/taro'
import { View, Text, ScrollView } from '@tarojs/components'
import TempItem from '../temp_item'

import './index.scss'

type IProps = {
  templateInfo: [any]
  typeName?: string
  typeId: string
  clickItem?: () => void
hank committed
14
  templateShow: string
hank committed
15 16 17 18 19 20 21 22 23 24 25 26
}

interface PageState {}
interface PageOwnProps {}

interface HomeItem {
  props: IProps
  state: PageState
}

class HomeItem extends Component {
  goAll = () => {
hank committed
27
    const { typeId, typeName, templateShow } = this.props
hank committed
28 29 30
    // Taro.navigateTo({ url: '/pages/home/device/my_film/index' })
    if (typeId) {
      Taro.navigateTo({
hank committed
31
        url: `/pages/home/tempaltes/template_type_detail?typeId=${typeId}&typeName=${typeName}&templateShow=${templateShow}`
hank committed
32 33 34 35 36 37
      })
      // Taro.navigateTo({ url: `/pages/home/device/my_film/index` })
    }
  }

  render() {
hank committed
38 39
    let { templateInfo, typeName } = this.props
    templateInfo = templateInfo || []
hank committed
40 41 42 43 44 45
    return (
      <View className="home-item">
        <ScrollView scrollY>
          <View className="home-item-title">
            <Text className="title-name">{typeName ? typeName : ''}</Text>
            <Text className="btn-all" onClick={this.goAll}>
hank committed
46
              更多>
hank committed
47 48 49 50 51 52 53 54 55 56 57 58 59
            </Text>
          </View>
          <View className="home-item-list">
            {templateInfo.map(item => {
              return <TempItem {...item} key={item.templateId} />
            })}
          </View>
        </ScrollView>
      </View>
    )
  }
}
export default HomeItem as ComponentClass<PageOwnProps, PageState>