index.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <script setup lang="ts">
  2. import { ElMessage } from 'element-plus'
  3. const props = defineProps<{ d: any }>()
  4. const router = useRouter()
  5. function handleClickConsult() {
  6. if (!props.d.user_id) {
  7. console.error('用户未认证')
  8. return ElMessage({ message: '老师正忙,请稍后再试', type: 'warning' })
  9. }
  10. sessionStorage.setItem('consult_teacher', JSON.stringify(props.d))
  11. router.push({ name: 'student_consult' })
  12. }
  13. </script>
  14. <template>
  15. <div class="bg-white w-370px h-160px rounded-md box_shadow flex flex-col justify-between p-4">
  16. <div class="flex items-center justify-between">
  17. <div class="flex space-x-4 items-center">
  18. <el-avatar :size="48" :src="d.dxp_user_avatar"></el-avatar>
  19. <div class="text-lg max-w-24 truncate">{{ d.dxp_user_realname }}</div>
  20. </div>
  21. <slot>
  22. <el-button type="primary" round @click="handleClickConsult">咨询</el-button>
  23. </slot>
  24. </div>
  25. <div class="text-hex-5B9FF0">联系电话:{{ d.dxp_user_phone }}</div>
  26. <div class="line-clamp-2 overflow-ellipsis text-hex-00000041 h-10 leading-5">
  27. {{ d.dxp_jj }}
  28. </div>
  29. </div>
  30. </template>
  31. <style scoped>
  32. .box_shadow {
  33. box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.04);
  34. }
  35. </style>