import { ComponentClass } from 'react'
import Taro, { Component } from '@tarojs/taro'
import { View, Input, Image } from '@tarojs/components'
import './index.scss'
import { AtIcon } from 'taro-ui';
import SdFormid from '../sdFormid';
type PageOwnProps = {
className?: string
onChooseCaseClick?: any
onChooseBuildingClick?: any
onChangePhoneClick?: any
onImageSelect?: any
onSendClick?: any
type?: 'luwu' | 'wzs'
}
type IProps = PageOwnProps
interface Index {
props: IProps;
}
class Index extends Component {
static options = {
addGlobalClass: true
}
state = {
value: '',
showMulti: false
}
handleChange = value => {
this.setState({
value: value.detail.value
})
}
sendMessage() {
this.props.onSendClick({
content: this.state.value,
contentType: 0
})
this.setState({
value: ''
})
}
openMulti = () => {
this.setState({
showMulti: !this.state.showMulti
})
}
chooseCase = (type) => {
this.props.onChooseCaseClick(type)
}
chooseBuilding = () => {
this.props.onChooseBuildingClick()
}
changePhone = () => {
this.props.onChangePhoneClick()
}
handleAlbum = async () => {
const data = await Taro.chooseImage({
sourceType: ['album'],
count: 9
})
data.tempFilePaths.map(path => {
this.props.onImageSelect(path)
})
}
handleCamera = async () => {
const data = await Taro.chooseImage({
sourceType: ['camera'],
count: 1
})
const path = data.tempFilePaths[0]
this.props.onImageSelect(path)
}
render() {
const { className, type } = this.props
return (
{
this.state.showMulti &&
{
type !== 'wzs' &&
收藏案例
}
{(type === 'wzs') ? '案例' : '他家案例'}
相册
拍照
工地
交换电话
}
)
}
}
export default Index as ComponentClass