basicInfo.vue 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <view class="app-container pb-20">
  3. <TopBar title="基本信息" show-back />
  4. <view class="px-4 py-4 space-y-4">
  5. <!-- 头像区域 -->
  6. <uni-card :is-shadow="true">
  7. <view class="flex items-center py-2">
  8. <view class="w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mr-4">
  9. <text class="uni-icons uniui-person-filled text-blue-500 text-2xl"></text>
  10. </view>
  11. <view>
  12. <text class="text-lg font-semibold text-gray-800 block">{{ userInfo?.name || '-' }}</text>
  13. <text class="text-sm text-gray-500">{{ userInfo?.department || '销售部' }} · {{ roleText }}</text>
  14. </view>
  15. </view>
  16. </uni-card>
  17. <!-- 基本信息 -->
  18. <uni-card title="基本信息" icon="uniui-person-filled" :is-shadow="true">
  19. <uni-list border="false">
  20. <uni-list-item title="姓名" :note="userInfo?.name || '-'" />
  21. <uni-list-item title="工号" :note="userInfo?.id || '-'" />
  22. <uni-list-item title="部门" :note="userInfo?.department || '销售部'" />
  23. <uni-list-item title="职位" :note="roleText" />
  24. <uni-list-item title="电话" :note="maskedPhone" />
  25. <uni-list-item title="邮箱" :note="email" />
  26. <uni-list-item title="状态" :right-text="'在职'" right-color="#34c759" />
  27. </uni-list>
  28. </uni-card>
  29. <!-- 操作按钮 -->
  30. <view class="pt-2">
  31. <button
  32. class="w-full py-3 bg-blue-500 text-white rounded-xl font-medium flex items-center justify-center"
  33. @click="handleEdit"
  34. >
  35. <text class="uni-icons uniui-compose mr-2"></text>
  36. 编辑信息
  37. </button>
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script setup lang="ts">
  43. import { computed } from 'vue'
  44. import TopBar from '../../components/common/TopBar.vue'
  45. import UniCard from '../../components/uni-card/uni-card.vue'
  46. import UniList from '../../components/uni-list/uni-list.vue'
  47. import UniListItem from '../../components/uni-list/uni-list-item.vue'
  48. import { useAuthStore } from '../../stores/auth'
  49. const authStore = useAuthStore()
  50. const userInfo = computed(() => authStore.userInfo)
  51. const roleText = computed(() => {
  52. const roleMap: Record<string, string> = {
  53. sales: '销售经理',
  54. dispatch: '调度员',
  55. construction: '施工员'
  56. }
  57. return roleMap[authStore.userRole] || '销售经理'
  58. })
  59. const maskedPhone = computed(() => {
  60. const phone = userInfo.value?.phone || ''
  61. if (phone.length === 11) {
  62. return phone.slice(0, 3) + '****' + phone.slice(7)
  63. }
  64. return phone || '-'
  65. })
  66. const email = computed(() => {
  67. const name = userInfo.value?.name || 'user'
  68. return `${name.toLowerCase()}@qingdaofu.com`
  69. })
  70. function handleEdit() {
  71. uni.showToast({ title: '编辑功能开发中', icon: 'none' })
  72. }
  73. </script>