TallList.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. <template>
  2. <div style="display: flex">
  3. <div class="tallList">
  4. <div>
  5. <span style="font-weight: bold; font-size: 14px">发表评论</span>
  6. <span class="tallListInfo">文明上网理性发言,请遵守评论服务协议</span>
  7. </div>
  8. <!-- 切换 -->
  9. <div>
  10. <div style="display: flex">
  11. <div style="display: flex; flex-direction: column; margin-left: 10px; margin-right: 10px">
  12. <div
  13. style="
  14. width: 30px;
  15. height: 30px;
  16. background: #1e90ff;
  17. border-radius: 50%;
  18. margin-top: 15px;
  19. margin-right: 15px;
  20. "
  21. ></div>
  22. <span style="display: block; font-size: 10px">未登录</span>
  23. </div>
  24. <div style="width: 100%; height: 100%; display: flex; position: relative">
  25. <a-textarea placeholder="" :rows="4" disabled style="margin-top: 5px" />
  26. <div
  27. style="
  28. flex-direction: column;
  29. display: flex;
  30. justify-content: center;
  31. align-items: center;
  32. position: absolute;
  33. left: 50%;
  34. top: 50%;
  35. transform: translate(-50%, -50%);
  36. "
  37. >
  38. <span style="display: block; cursor: pointer; font-size: 12px">登陆后可以发表评论</span>
  39. <span style="display: block; cursor: pointer; font-size: 12px; color: #1e90ff">立即登录</span>
  40. </div>
  41. </div>
  42. </div>
  43. <div style="display: flex; justify-content: flex-end; margin-top: 10px">
  44. <a-button style="width: 100px" disabled>发布</a-button>
  45. </div>
  46. </div>
  47. <div>
  48. <div style="display: flex">
  49. <div style="display: flex; flex-direction: column; margin-left: 10px; margin-right: 10px">
  50. <div
  51. style="
  52. width: 30px;
  53. height: 30px;
  54. background: #1e90ff;
  55. border-radius: 50%;
  56. margin-top: 15px;
  57. margin-right: 15px;
  58. "
  59. ></div>
  60. <span style="display: block; font-size: 10px">未登录</span>
  61. </div>
  62. <div style="width: 100%; height: 100%; display: flex; position: relative">
  63. <a-textarea placeholder="" :rows="4" v-model:value="talk" style="margin-top: 5px" />
  64. </div>
  65. </div>
  66. <div style="display: flex; justify-content: flex-end; margin-top: 10px">
  67. <a-button style="width: 100px" @click="handerPublish">发布</a-button>
  68. </div>
  69. </div>
  70. <div style="display: flex; justify-content: space-between; margin-top: 40px">
  71. <div style="display: flex; align-items: center">
  72. <span style="font-weight: bold">全部评论</span>
  73. <span style="font-size: 10px; color: darkgray; margin-left: 5px">1000</span>
  74. </div>
  75. <TabSwitcher></TabSwitcher>
  76. </div>
  77. <div class="line"></div>
  78. <div>
  79. <TallItem v-for="(item, index) in list" :key="index" :item="item" @publish="publish"></TallItem>
  80. </div>
  81. </div>
  82. <div class="equalList">
  83. <div style="display: flex; align-items: center">
  84. <div class="resInfoTitile"></div>
  85. <span style="font-size: 14px; font-weight: bold">同类型资源</span>
  86. </div>
  87. <div style="display: flex; flex-direction: column; padding: 10px">
  88. <EqualItem v-for="(item, index) in equalList" :key="index" :item="item"></EqualItem>
  89. </div>
  90. </div>
  91. </div>
  92. </template>
  93. <script setup>
  94. import { ref } from 'vue'
  95. import TabSwitcher from './TabSwitcher.vue'
  96. import TallItem from './TallItem.vue'
  97. import EqualItem from './EqualItem.vue'
  98. import { addViewCount, detail, add, cancel, queryList, pageComment, addComment } from '@/api/portal'
  99. import { useRoute } from 'vue-router'
  100. const emit = defineEmits(['selectTab'])
  101. const listUnpublishedView = ref(null)
  102. const route = useRoute()
  103. const id = route.query.id
  104. const talk = ref('')
  105. const equalList = ref([
  106. {
  107. id: 1,
  108. name: '作者名称1',
  109. title: '视频名称1',
  110. follw: 1
  111. },
  112. {
  113. id: 2,
  114. name: '作者名称2',
  115. title: '视频名称2',
  116. follw: 2
  117. },
  118. {
  119. id: 3,
  120. name: '作者名称3',
  121. title: '视频名称3',
  122. follw: 3
  123. }
  124. ])
  125. // callBackTalk: [
  126. // {
  127. // id: 2,
  128. // name: '李四',
  129. // talk: '不给',
  130. // follw: 0
  131. // }
  132. // ]
  133. const list = ref([
  134. {
  135. id: 1,
  136. name: '张三',
  137. talk: '今天,我被你给打赏了1000元,请给我一个好评,谢谢',
  138. follw: 0,
  139. callBackTalk: []
  140. },
  141. {
  142. id: 2,
  143. name: '王五',
  144. talk: '今天,我被你给打赏了1000元,请给我一个好评,谢谢222222',
  145. follw: 0,
  146. callBackTalk: []
  147. }
  148. ])
  149. const publish = () => {
  150. list.value[0].callBackTalk.push({
  151. id: 1,
  152. name: '张三',
  153. talk: '今天,我被你给打赏了1000元,请给我一个好评,谢谢123123123',
  154. follw: 0
  155. })
  156. list.value = [...list.value]
  157. console.log('最后的', list.value)
  158. }
  159. const handerPublish = () => {
  160. addComment({ resourceId: id, commentName: talk.value })
  161. .then((res) => {})
  162. .catch((err) => {
  163. console.log(err)
  164. })
  165. //....
  166. // listUnpublishedView.value.setData(tableData.value)
  167. }
  168. const onQuery = (form) => {
  169. console.log('查询内容', form)
  170. //....
  171. // listUnpublishedView.value.setData(tableData.value)
  172. }
  173. const getList = () => {
  174. //....
  175. // listUnpublishedView.value.setData(tableData.value)
  176. }
  177. const getPageComment = () => {
  178. pageComment({ resourceId: id })
  179. .then((res) => {})
  180. .catch((err) => {
  181. console.log(err)
  182. })
  183. }
  184. onMounted(() => {
  185. getList()
  186. getPageComment()
  187. })
  188. </script>
  189. <style scoped>
  190. .tab-switcher {
  191. display: flex;
  192. border-radius: 20px;
  193. border: 1px solid #1e90ff;
  194. overflow: hidden;
  195. }
  196. .tab-switcher div {
  197. padding: 2px 20px;
  198. background-color: #f5f5f5;
  199. cursor: pointer;
  200. }
  201. .tab-switcher div.active {
  202. background-color: #1e90ff;
  203. color: white;
  204. }
  205. .tab-switcher div:not(:last-child) {
  206. }
  207. .user-info {
  208. display: flex;
  209. align-items: center;
  210. width: 100%;
  211. height: 200px;
  212. border: 1px solid #dfe2e5;
  213. padding: 20px;
  214. }
  215. .resource-container {
  216. width: 850px;
  217. margin: 0 auto;
  218. padding: 20px;
  219. border: 1px solid #dfe2e5;
  220. }
  221. .user-avatar {
  222. width: 40px;
  223. height: 40px;
  224. background: #1e90ff;
  225. border-radius: 50%;
  226. margin-right: 10px;
  227. }
  228. .user-details {
  229. flex: 1;
  230. }
  231. .user-name {
  232. font-size: 13px;
  233. font-weight: bold;
  234. }
  235. .publish-time {
  236. font-size: 12px;
  237. color: #999;
  238. margin-top: 5px;
  239. }
  240. .metrics {
  241. display: flex;
  242. align-items: center;
  243. justify-content: center;
  244. }
  245. .metric-item {
  246. display: flex;
  247. flex-direction: column;
  248. align-items: center;
  249. padding-left: 10px;
  250. padding-right: 10px;
  251. }
  252. .metric-item span:first-child {
  253. font-size: 18px;
  254. font-weight: bold;
  255. }
  256. .metric-item span:last-child {
  257. font-size: 12px;
  258. color: #666;
  259. }
  260. .actions {
  261. display: flex;
  262. }
  263. .share-btn,
  264. .favorite-btn {
  265. background-color: transparent;
  266. border: none;
  267. cursor: pointer;
  268. }
  269. .course-info {
  270. margin-top: 20px;
  271. line-height: 1.6;
  272. }
  273. .liene {
  274. height: 35px;
  275. width: 1px;
  276. background: #00000018;
  277. }
  278. .resource-container {
  279. width: 850px;
  280. margin: 0 auto;
  281. padding: 20px;
  282. border: 1px solid #dfe2e5;
  283. }
  284. h1 {
  285. text-align: center;
  286. margin-bottom: 20px;
  287. }
  288. .ant-descriptions {
  289. margin-top: 20px;
  290. }
  291. .ant-typography-title {
  292. margin-top: 20px;
  293. }
  294. .ant-typography-paragraph {
  295. margin-top: 10px;
  296. }
  297. .ant-space {
  298. margin-top: 10px;
  299. }
  300. .video-info {
  301. height: 100%; /* 确保填满容器高度 */
  302. }
  303. .resInfo {
  304. margin-left: 10px;
  305. width: 350px;
  306. height: 570px;
  307. border: 1px solid #dfe2e5;
  308. padding: 10px;
  309. }
  310. .user-info-container {
  311. display: flex;
  312. }
  313. .resInfoTitile {
  314. width: 5px;
  315. height: 14px;
  316. background-color: cadetblue;
  317. margin-right: 5px;
  318. }
  319. .tallList {
  320. display: flex;
  321. flex-direction: column;
  322. width: 850px;
  323. border: 1px solid #dfe2e5;
  324. padding: 20px;
  325. margin-top: 10px;
  326. }
  327. .tallListInfo {
  328. color: rgba(0, 0, 0, 0.116);
  329. font-size: 12px;
  330. }
  331. .line {
  332. width: 100%;
  333. height: 0.5px;
  334. background-color: rgba(0, 0, 0, 0.075);
  335. margin-top: 10px;
  336. margin-bottom: 10px;
  337. }
  338. .equalList {
  339. display: flex;
  340. flex-direction: column;
  341. width: 300px;
  342. border: 1px solid #dfe2e5;
  343. padding: 10px;
  344. margin-top: 10px;
  345. margin-left: 10px;
  346. }
  347. .resInfoTitile {
  348. width: 5px;
  349. height: 14px;
  350. background-color: #1e90ff;
  351. margin-right: 5px;
  352. }
  353. </style>