import { ComponentClass } from 'react'
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Image, Label } from '@tarojs/components'
import './index.scss'
interface DataInterface {
content: any,
divideTime: any,
avatar: any,
contentType: any,
isRead: any,
}
type PageOwnProps = {
className?: string
chat: DataInterface
selfSend: boolean
onCaseClick?: any
}
type IProps = PageOwnProps
interface Index {
props: IProps;
}
class Index extends Component {
static options = {
addGlobalClass: true
}
handleClick = () => {
this.props.onCaseClick(this.props.chat.content.caseId)
}
handleImageClick = () => {
Taro.previewImage({
urls: [this.props.chat.content]
})
}
render() {
const { chat: item, selfSend } = this.props
return (
{
item.divideTime &&
{item.divideTime}
}
{/* 头像 */}
{/* 内容 */}
{/* 文本 */}
{item.contentType === 0 &&
{item.content}
}
{/* 图片 */}
{item.contentType === 1 &&
}
{/* 案例 */}
{item.contentType === 2 &&
{item.content.title}
}
{/* 工地 */}
{item.contentType === 3 &&
{item.content.name}
}
{/* 已读 */}
{
selfSend &&
{item.isRead ? '已读' : '未读'}
}
)
}
}
export default Index as ComponentClass