index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <route lang="yaml">
  2. layout: back
  3. style:
  4. navigationStyle: custom
  5. </route>
  6. <script setup lang="ts">
  7. import MomentItem from '@/components/moment-item.vue'
  8. import { getByDictType, getCircles } from '../../../core/libs/requests'
  9. import { useUserStore } from '../../../store'
  10. import { storeToRefs } from 'pinia'
  11. const userStore = useUserStore()
  12. const { userInfo } = storeToRefs(userStore)
  13. const tab = ref('2')
  14. const { data: circleTypes, run: getCircleType } = useRequest(() =>
  15. getByDictType('member_circle_type'),
  16. )
  17. const circlesData = ref({ list: [] })
  18. // const { data: circlesData, run } = useRequest(
  19. // () =>
  20. // getCircles({
  21. // circleType: tab.value,
  22. // // stylistName: userInfo.value.nickname,
  23. // stylistId: userInfo.value.userId,
  24. // }),
  25. // { initialData: { list: [] } },
  26. // )
  27. const setCirclesData = async (circleType) => {
  28. const { data } = await getCircles({
  29. circleType,
  30. stylistId: userInfo.value.userId,
  31. })
  32. circlesData.value = data
  33. }
  34. const tabs = ref([
  35. { label: '案例', value: '2' },
  36. { label: '动态', value: '1' },
  37. { label: '视频', value: '0' },
  38. ])
  39. const handleTabsChange = async ({ name }: any) => {
  40. if (['1', '2'].includes(name)) {
  41. await setCirclesData(name)
  42. }
  43. }
  44. onMounted(async () => {
  45. // await getCircleType()
  46. await setCirclesData(tab.value)
  47. console.log(circleTypes.value)
  48. // await run()
  49. })
  50. defineExpose({
  51. navBarFixed: false,
  52. })
  53. </script>
  54. <template>
  55. <div class="">
  56. <div class="relative">
  57. <wd-img
  58. width="100%"
  59. :src="'https://via.placeholder.com/375x329'"
  60. mode="widthFix"
  61. custom-class="aspect-[1.14/1]"
  62. />
  63. <div class="absolute bottom-0 left-0 right-0">
  64. <div class="h-[107px] bg-gradient-to-t from-black to-transparent">
  65. <div class="flex">
  66. <div
  67. class="w-18 h-18 border-white border border-solid mx-3.5 rounded-full overflow-hidden"
  68. >
  69. <wd-img width="100%" height="100%" :src="userInfo?.avatar"></wd-img>
  70. </div>
  71. <div>
  72. <div class="text-white text-2xl font-normal font-['PingFang SC'] leading-normal">
  73. {{ userInfo?.nickname }}
  74. </div>
  75. <div>
  76. <div
  77. class="h-6 px-2 bg-black/10 rounded-[30px] border border-white/60 justify-center items-center gap-2.5 inline-flex"
  78. >
  79. <div
  80. class="text-center text-white text-[10px] font-normal font-['PingFang SC'] leading-normal"
  81. >
  82. 创设空间事务所创始人
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. <div class="bg-white rounded-t-2xl relative bottom-4">
  92. <wd-tabs v-model="tab" @change="handleTabsChange">
  93. <template v-for="({ label, value }, index) in tabs" :key="index">
  94. <wd-tab :title="label" :name="value"></wd-tab>
  95. </template>
  96. </wd-tabs>
  97. <div class="p-3.5 flex flex-col bg-[#f6f6f6] gap-3.5">
  98. <template v-for="it of circlesData.list" :key="it.id">
  99. <view class="">
  100. <MomentItem :options="it"></MomentItem>
  101. </view>
  102. </template>
  103. </div>
  104. </div>
  105. </div>
  106. </template>