TallItem.vue 7.6 KB

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