index.jsx 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import { useState, useEffect } from 'react'
  2. import Taro from '@tarojs/taro'
  3. import withLayout from '@/layout'
  4. import { ScrollView, Image } from '@tarojs/components'
  5. import { getCardList } from '@/services/card'
  6. import { getImgURL } from '@/utils/image'
  7. import '@/assets/css/iconfont.css'
  8. import './index.scss'
  9. export default withLayout((props) => {
  10. const { router } = props
  11. const { buldingId } = router.params
  12. const [List, setList] = useState([])
  13. const handleChat = (item) => {
  14. Taro.navigateTo({
  15. url: `/pages/chat/chatDetail/index?friend=${item.id}`
  16. })
  17. }
  18. const handleCall = (item) => {
  19. if (item.phone) {
  20. Taro.makePhoneCall({ phoneNumber: item.phone })
  21. return
  22. }
  23. Taro.showToast({ title: '暂无联系电话', icon: 'none' })
  24. }
  25. const gotoDetail = (item) => {
  26. Taro.navigateTo({
  27. url: `/subpackages/pages/consultant/myHomepage/index?id=${item.id}`
  28. })
  29. }
  30. useEffect(() => {
  31. if (!buldingId) {
  32. Taro.showToast({
  33. title: '没有楼盘信息',
  34. icon: 'none',
  35. })
  36. return
  37. }
  38. getCardList({ pageSize: 500, buildingId: buldingId }).then((res) => {
  39. const { records } = res || []
  40. setList(records)
  41. })
  42. }, [buldingId])
  43. return (
  44. <view className='Page buildingPropertyConsultant'>
  45. <ScrollView scroll-y>
  46. <text className='TopTips'>有任何买卖房屋的问题,欢迎随时咨询</text>
  47. <view className='List'>
  48. {
  49. List.map((item, index) => (
  50. <view key={`ListItem-${index}`}>
  51. <view className='flex-h'>
  52. <view className='Icon'>
  53. <Image mode='scaleToFill' src={getImgURL(item.photo || item.avatar)}></Image>
  54. </view>
  55. <view className='flex-item' onClick={() => gotoDetail(item)}>
  56. <view className='Name'>
  57. <text>{item.name}</text>
  58. <Image mode='heightFix' src={require('@/assets/index-icon17.png')}></Image>
  59. </view>
  60. <text>{item.phone}</text>
  61. </view>
  62. <text
  63. className='iconfont icon-liaotian'
  64. onClick={() => handleChat(item)}
  65. ></text>
  66. <text
  67. className='iconfont icon-dianhua'
  68. onClick={() => handleCall(item)}
  69. ></text>
  70. </view>
  71. <view className='Desc'>
  72. <text>{item.description || '暂无简介'}</text>
  73. </view>
  74. </view>
  75. ))
  76. }
  77. <text className='BottomTips'>已经到底了~</text>
  78. </view>
  79. </ScrollView>
  80. </view>
  81. )
  82. })