TallItem.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <div>
  3. <div>
  4. <div style="display: flex; margin-left: 10px; margin-right: 10px">
  5. <div style="width: 40px; height: 40px; background: #1e90ff; border-radius: 50%; margin-right: 10px"></div>
  6. <div style="width: 100%">
  7. <div style="display: flex; flex-direction: column; margin-bottom: 0px">
  8. <span style="display: block; font-size: 14px; font-weight: bold; margin-bottom: 0px">{{
  9. props.item.userName
  10. }}</span>
  11. <span style="display: block; font-size: 12px">{{ props.item.commentName }}</span>
  12. </div>
  13. <div style="width: 100%; display: flex; justify-content: space-between">
  14. <div>
  15. <span style="font-size: 10px">{{ props.item.commentTime }}</span>
  16. </div>
  17. <div style="display: flex">
  18. <div>
  19. <MessageOutlined style="cursor: pointer" @click="handerMessage" />
  20. <span style="margin-left: 5px">{{ props.item.childSize }}</span>
  21. </div>
  22. <div style="margin-left: 15px">
  23. <!-- <LikeFilled /> -->
  24. <LikeOutlined style="cursor: pointer" @click="handerfollw" />
  25. <span style="margin-left: 5px">{{ props.item.giveNum }}</span>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. <div v-show="props.item.child.length > 0" v-for="(item, index) in props.item.child" :key="index">
  32. <div style="display: flex; margin-left: 50px; margin-right: 0px">
  33. <div style="width: 40px; height: 40px; background: #1e90ff; border-radius: 50%; margin-right: 10px"></div>
  34. <div style="width: 100%">
  35. <div style="display: flex; flex-direction: column; margin-bottom: 0px">
  36. <span style="display: block; font-size: 14px; font-weight: bold; margin-bottom: 5px">{{
  37. item.userName
  38. }}</span>
  39. <span style="display: block; font-size: 12px">{{ item.commentName }}</span>
  40. </div>
  41. <div style="width: 100%; display: flex; justify-content: space-between">
  42. <div>
  43. <span style="font-size: 10px">{{ item.commentTime }}</span>
  44. </div>
  45. <div style="display: flex">
  46. <!-- <div>
  47. <MessageOutlined @click="handerMessage" />
  48. <span style="margin-left: 5px">10</span>
  49. </div> -->
  50. <div style="margin-left: 15px">
  51. <!-- <LikeFilled /> -->
  52. <LikeOutlined style="cursor: pointer" @click="handerfollwChild(item)" />
  53. <span style="margin-left: 5px">{{ item.giveNum }}</span>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. <div v-if="tallTag">
  61. <div>
  62. <a-textarea placeholder="" v-model:value="talk" :rows="4" style="margin-top: 5px" />
  63. <div style="display: flex; justify-content: flex-end; margin-top: 10px">
  64. <a-button style="width: 100px" @click="handerPublish">回复</a-button>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </template>
  71. <script setup>
  72. import { ref } from 'vue'
  73. import TabSwitcher from './TabSwitcher.vue'
  74. import EventBus from '@/utils/EventBus'
  75. import { addViewCount, detail, add, cancel, queryList, pageComment, addComment, giveComment } from '@/api/portal'
  76. const emit = defineEmits(['selectTab'])
  77. // id: 1,
  78. // name: '张三',
  79. // talk: '今天,我被你给打赏了1000元,请给我一个好评,谢谢',
  80. // follw: 0,
  81. const props = defineProps({
  82. item: {
  83. type: Object,
  84. default: () => {}
  85. },
  86. id: {
  87. type: String,
  88. default: () => ''
  89. }
  90. // talk: {
  91. // type: String,
  92. // default: () => ''
  93. // },
  94. // follw: {
  95. // type: Number,
  96. // default: () => 0
  97. // },
  98. // callBackTalk: {
  99. // type: Array,
  100. // default: () => []
  101. // }
  102. })
  103. const listUnpublishedView = ref(null)
  104. const tallTag = ref(false)
  105. const talk = ref('')
  106. const handerMessage = (form) => {
  107. console.log('查询内容', form)
  108. tallTag.value == true ? (tallTag.value = false) : (tallTag.value = true)
  109. EventBus.emit('closeInput', null, props.item.id)
  110. //....
  111. // listUnpublishedView.value.setData(tableData.value)
  112. }
  113. watch(
  114. () => props.item,
  115. (val) => {
  116. console.log('item有变化吗', val)
  117. }
  118. )
  119. const handerfollw = async () => {
  120. await giveComment({ id: props.item.id })
  121. EventBus.emit('onGetPageComment')
  122. }
  123. const handerfollwChild = async (item) => {
  124. await giveComment({ id: item.id })
  125. EventBus.emit('onGetPageComment')
  126. }
  127. const handerPublish = () => {
  128. tallTag.value = false
  129. emit('publish', { resourceId: props.id, id: props.item.id, talk: talk.value })
  130. //....
  131. // listUnpublishedView.value.setData(tableData.value)
  132. }
  133. const handleCloseInput = (data, tag) => {
  134. if (props.item.id != tag) {
  135. talk.value = ''
  136. tallTag.value = false
  137. }
  138. }
  139. onMounted(() => {
  140. // getList()
  141. })
  142. EventBus.off('closeInput', handleCloseInput)
  143. EventBus.on('closeInput', handleCloseInput)
  144. </script>
  145. <style scoped>
  146. .tab-switcher {
  147. display: flex;
  148. border-radius: 20px;
  149. border: 1px solid #1e90ff;
  150. overflow: hidden;
  151. }
  152. .tab-switcher div {
  153. padding: 2px 20px;
  154. background-color: #f5f5f5;
  155. cursor: pointer;
  156. }
  157. .tab-switcher div.active {
  158. background-color: #1e90ff;
  159. color: white;
  160. }
  161. .tab-switcher div:not(:last-child) {
  162. }
  163. .user-info {
  164. display: flex;
  165. align-items: center;
  166. width: 100%;
  167. height: 200px;
  168. border: 1px solid #dfe2e5;
  169. padding: 20px;
  170. }
  171. .resource-container {
  172. width: 850px;
  173. margin: 0 auto;
  174. padding: 20px;
  175. border: 1px solid #dfe2e5;
  176. }
  177. .user-avatar {
  178. width: 40px;
  179. height: 40px;
  180. background: #1e90ff;
  181. border-radius: 50%;
  182. margin-right: 10px;
  183. }
  184. .user-details {
  185. flex: 1;
  186. }
  187. .user-name {
  188. font-size: 13px;
  189. font-weight: bold;
  190. }
  191. .publish-time {
  192. font-size: 12px;
  193. color: #999;
  194. margin-top: 5px;
  195. }
  196. .metrics {
  197. display: flex;
  198. align-items: center;
  199. justify-content: center;
  200. }
  201. .metric-item {
  202. display: flex;
  203. flex-direction: column;
  204. align-items: center;
  205. padding-left: 10px;
  206. padding-right: 10px;
  207. }
  208. .metric-item span:first-child {
  209. font-size: 18px;
  210. font-weight: bold;
  211. }
  212. .metric-item span:last-child {
  213. font-size: 12px;
  214. color: #666;
  215. }
  216. .actions {
  217. display: flex;
  218. }
  219. .share-btn,
  220. .favorite-btn {
  221. background-color: transparent;
  222. border: none;
  223. cursor: pointer;
  224. }
  225. .course-info {
  226. margin-top: 20px;
  227. line-height: 1.6;
  228. }
  229. .liene {
  230. height: 35px;
  231. width: 1px;
  232. background: #00000018;
  233. }
  234. .resource-container {
  235. width: 850px;
  236. margin: 0 auto;
  237. padding: 20px;
  238. border: 1px solid #dfe2e5;
  239. }
  240. h1 {
  241. text-align: center;
  242. margin-bottom: 20px;
  243. }
  244. .ant-descriptions {
  245. margin-top: 20px;
  246. }
  247. .ant-typography-title {
  248. margin-top: 20px;
  249. }
  250. .ant-typography-paragraph {
  251. margin-top: 10px;
  252. }
  253. .ant-space {
  254. margin-top: 10px;
  255. }
  256. .video-info {
  257. height: 100%; /* 确保填满容器高度 */
  258. }
  259. .resInfo {
  260. margin-left: 10px;
  261. width: 350px;
  262. height: 570px;
  263. border: 1px solid #dfe2e5;
  264. padding: 10px;
  265. }
  266. .user-info-container {
  267. display: flex;
  268. }
  269. .resInfoTitile {
  270. width: 5px;
  271. height: 14px;
  272. background-color: cadetblue;
  273. margin-right: 5px;
  274. }
  275. .tallList {
  276. display: flex;
  277. flex-direction: column;
  278. width: 850px;
  279. border: 1px solid #dfe2e5;
  280. padding: 20px;
  281. margin-top: 10px;
  282. }
  283. .tallListInfo {
  284. color: rgba(0, 0, 0, 0.116);
  285. font-size: 12px;
  286. }
  287. .line {
  288. width: 100%;
  289. height: 0.5px;
  290. background-color: rgba(0, 0, 0, 0.075);
  291. margin-top: 10px;
  292. margin-bottom: 10px;
  293. }
  294. </style>