WorkbenchTaskSection.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <view class="workbench-task-section">
  3. <view class="workbench-task-section-header" @click="onTakePhoto">
  4. <view class="workbench-task-section-title">任务实施</view>
  5. <view class="workbench-task-section-action">
  6. <wd-icon name="camera-fill" color="#fff" size="40rpx"></wd-icon>
  7. <text class="workbench-task-section-action-text">拍照留存</text>
  8. </view>
  9. </view>
  10. <view class="workbench-task-list">
  11. <view
  12. v-for="item in currentTaskList"
  13. :key="item.key"
  14. class="workbench-task-item"
  15. :style="{
  16. backgroundImage: 'url(' + item.backgroundImage + ')',
  17. }"
  18. @click="onSelectTask(item)"
  19. />
  20. </view>
  21. </view>
  22. </template>
  23. <script setup lang="ts">
  24. import { computed, ref } from 'vue'
  25. import { useUserStore } from '@/stores/modules/user'
  26. import { DEFAULT_WORKBENCH_TASKS, INVESTMENT_MANAGER_TASKS } from '../workbench/workbench.config'
  27. const emit = defineEmits<{
  28. (e: 'select-task', item: (typeof currentTaskList.value)[number]): void
  29. }>()
  30. const userStore = useUserStore()
  31. const isInvestmentManager = computed(() => {
  32. const user = userStore.currentUserInfo
  33. return Boolean(user?.roles?.includes(31))
  34. })
  35. const currentTaskList = computed(() => {
  36. return isInvestmentManager.value ? INVESTMENT_MANAGER_TASKS : DEFAULT_WORKBENCH_TASKS
  37. })
  38. const onSelectTask = (item: (typeof currentTaskList.value)[number]) => {
  39. emit('select-task', item)
  40. }
  41. const navigatingToPhoto = ref(false)
  42. const onTakePhoto = () => {
  43. if (navigatingToPhoto.value) return
  44. navigatingToPhoto.value = true
  45. uni.navigateTo({
  46. url: '/pages/index/photo/index',
  47. complete: () => {
  48. navigatingToPhoto.value = false
  49. },
  50. })
  51. }
  52. </script>
  53. <style lang="scss" scoped>
  54. .workbench-task-section {
  55. padding: 0 30rpx;
  56. margin-top: 30rpx;
  57. .workbench-task-section-header {
  58. display: flex;
  59. align-items: center;
  60. justify-content: space-between;
  61. height: 80rpx;
  62. margin-bottom: 30rpx;
  63. .workbench-task-section-title {
  64. color: var(--font-color-333);
  65. font-size: 36rpx;
  66. font-weight: 600;
  67. }
  68. .workbench-task-section-action {
  69. display: flex;
  70. align-items: center;
  71. justify-content: space-between;
  72. width: 185rpx;
  73. height: 60rpx;
  74. padding: 10rpx 20rpx;
  75. border-radius: 30rpx;
  76. background-color: var(--main-color);
  77. font-size: 24rpx;
  78. }
  79. .workbench-task-section-action-text {
  80. color: #fff;
  81. }
  82. }
  83. .workbench-task-list {
  84. display: flex;
  85. flex-flow: row wrap;
  86. justify-content: space-between;
  87. .workbench-task-item {
  88. width: 328rpx;
  89. height: 224rpx;
  90. margin-bottom: 30rpx;
  91. background-size: 100% 100%;
  92. }
  93. }
  94. }
  95. </style>