PreviewModal.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <div>
  3. <el-dialog
  4. v-model="visible"
  5. title="游记预览"
  6. width="1000"
  7. :z-index="9999"
  8. destroy-on-close
  9. >
  10. <div class="max-h-[600px] overflow-auto">
  11. <img
  12. v-if="data.travelNotesBanner"
  13. :src="data.travelNotesBanner"
  14. class="h-auto w-full"
  15. />
  16. <img
  17. v-else
  18. src="~/assets/img/note-create/note_create_banner_bg.png"
  19. class="h-auto w-full"
  20. />
  21. <div
  22. class="mx-auto flex flex-1 items-center px-30 py-15 shadow-[0_15px_30px_0px_rgba(102,102,102,0.2)]"
  23. >
  24. <img
  25. src="~/assets/img/travel_notes_detail/travel_note_icon.jpg"
  26. class="h-50 w-50 shrink-0 object-cover"
  27. alt=""
  28. srcset=""
  29. />
  30. <div class="ml-10 flex-1">
  31. <div class="text-3xl font-bold text-black-3">
  32. {{ data.title ?? '游记标题' }}
  33. </div>
  34. </div>
  35. </div>
  36. <!-- <div
  37. v-if="baseInfos.length"
  38. class="mt-20 grid grid-cols-4 gap-y-15 rounded-xl border border-dashed border-black-9 px-15 py-15"
  39. >
  40. <div
  41. v-for="item in baseInfos"
  42. class="flex items-center space-x-2 text-base"
  43. >
  44. <img :src="item.icon" class="h-44 w-44 shrink-0" alt="" />
  45. <span class="flex w-0 flex-1" :style="{ color: item.color }">
  46. <span class="shrink-0 font-semibold">{{ item.lable }}/</span>
  47. <span class="flex-1 truncate">{{ item.value }}</span>
  48. </span>
  49. </div>
  50. </div> -->
  51. <div class="mt-20">
  52. <template v-for="item in data.travelNotesContent">
  53. <div v-if="item.type === 'sectionTitle'">
  54. <div class="py-10 text-3xl text-black-3">
  55. {{ item.content }}
  56. </div>
  57. </div>
  58. <div v-if="item.type === 'sectionContent'">
  59. <div class="py-10 text-base leading-[28px] text-black-6">
  60. {{ item.content }}
  61. </div>
  62. </div>
  63. <div v-if="item.type === 'image'">
  64. <el-image class="h-auto w-full py-10" :src="item.content" />
  65. </div>
  66. </template>
  67. </div>
  68. </div>
  69. <template #footer>
  70. <div class="flex items-center justify-center">
  71. <el-button type="primary" @click="visible = false"> 确定 </el-button>
  72. </div>
  73. </template>
  74. </el-dialog>
  75. </div>
  76. </template>
  77. <script setup>
  78. import travel_notes_detail_startdate from '~/assets/img/travel_notes_detail/travel_notes_detail_startdate.png'
  79. import travel_notes_detail_days from '~/assets/img/travel_notes_detail/travel_notes_detail_days.png'
  80. import travel_notes_detail_relation from '~/assets/img/travel_notes_detail/travel_notes_detail_relation.png'
  81. import travel_notes_detail_fee from '~/assets/img/travel_notes_detail/travel_notes_detail_fee.png'
  82. import travel_notes_detail_star from '~/assets/img/travel_notes_detail/travel_notes_detail_star.png'
  83. import travel_notes_detail_traffic from '~/assets/img/travel_notes_detail/travel_notes_detail_traffic.png'
  84. import travel_notes_detail_endplace from '~/assets/img/travel_notes_detail/travel_notes_detail_endplace.png'
  85. const visible = defineModel('visible', false)
  86. const props = defineProps({
  87. data: {
  88. type: Object,
  89. default: () => ({})
  90. },
  91. travelModeLabel: String,
  92. endPlace: String
  93. })
  94. const baseInfos = computed(() => {
  95. const tmpList = []
  96. if (props.data?.departureTime)
  97. tmpList.push({
  98. lable: '出发时间',
  99. value: props.data?.departureTime,
  100. color: '#4B99EA',
  101. icon: travel_notes_detail_startdate
  102. })
  103. if (props.data?.countTimes)
  104. tmpList.push({
  105. lable: '出发天数',
  106. value: props.data?.countTimes,
  107. color: '#4B99EA',
  108. icon: travel_notes_detail_days
  109. })
  110. if (props.data?.role)
  111. tmpList.push({
  112. lable: '人物关系',
  113. value: props.data?.role,
  114. color: '#4B99EA',
  115. icon: travel_notes_detail_relation
  116. })
  117. if (props.data?.averageCost)
  118. tmpList.push({
  119. lable: '人均费用',
  120. value: props.data?.averageCost,
  121. color: '#4B99EA',
  122. icon: travel_notes_detail_fee
  123. })
  124. if (props.travelModeLabel)
  125. tmpList.push({
  126. lable: '出行方式',
  127. value: props.travelModeLabel,
  128. color: '#4B99EA',
  129. icon: travel_notes_detail_traffic
  130. })
  131. if (props.endPlace)
  132. tmpList.push({
  133. lable: '目的地',
  134. value: props.data.endPlace,
  135. color: '#4B99EA',
  136. icon: travel_notes_detail_endplace
  137. })
  138. if (props.data?.recommendationRate)
  139. tmpList.push({
  140. lable: '推荐指数',
  141. value: props.data?.recommendationRate,
  142. color: '#facc58',
  143. icon: travel_notes_detail_star
  144. })
  145. return tmpList
  146. })
  147. </script>
  148. <style lang="scss" scoped></style>