From bdb5651a65ef4c2b66896da044f68812e17f2df1 Mon Sep 17 00:00:00 2001 From: zyronon Date: Thu, 25 Apr 2024 17:46:13 +0800 Subject: [PATCH] refactor: optimize the code --- src/api/videos.ts | 4 + src/components/Comment.vue | 13 +-- src/components/ScrollList.vue | 2 - src/components/Share.vue | 3 +- src/components/dialog/FromBottomDialog.vue | 108 +++++++----------- src/components/slide/BaseVideo.vue | 10 +- src/components/slide/ItemToolbar.vue | 31 +++-- .../slide/SlideVerticalInfinite.vue | 1 - src/main.ts | 11 +- src/mock/index.ts | 14 +++ src/pages/home/slide/LongVideo.vue | 4 +- src/pages/me/Me.vue | 3 + src/pages/message/Message.vue | 12 +- src/pages/test/Test.vue | 49 ++------ src/utils/bus.ts | 2 +- src/utils/hooks/useClick.ts | 18 +++ src/utils/mixin.ts | 19 ++- src/utils/slide.ts | 12 +- 18 files changed, 149 insertions(+), 167 deletions(-) create mode 100644 src/utils/hooks/useClick.ts diff --git a/src/api/videos.ts b/src/api/videos.ts index bbbd06b..2b61958 100644 --- a/src/api/videos.ts +++ b/src/api/videos.ts @@ -12,6 +12,10 @@ export function recommendedVideo(params?: any, data?: any) { return request({ url: '/video/recommended', method: 'get', params, data }) } +export function recommendedLongVideo(params?: any, data?: any) { + return request({ url: '/video/long/recommended/', method: 'get', params, data }) +} + export function myVideo(params?: any, data?: any) { return request({ url: '/video/my', method: 'get', params, data }) } diff --git a/src/components/Comment.vue b/src/components/Comment.vue index 472f6eb..3e3adf8 100644 --- a/src/components/Comment.vue +++ b/src/components/Comment.vue @@ -16,7 +16,7 @@
{{ _formatNumber(comments.length) }}条评论
- +
@@ -328,10 +328,8 @@ export default { @import '../assets/less/index'; .title { - z-index: 2; - position: fixed; - left: 0; - right: 0; + box-sizing: border-box; + width: 100%; height: 40rem; padding: 0 15rem; background: white; @@ -371,15 +369,12 @@ export default { .comment { color: #000; width: 100%; - height: v-bind(height); background: #fff; z-index: 5; - border-radius: 10rem 10rem 0 0; .wrapper { width: 100%; position: relative; - padding-top: 40rem; padding-bottom: 60rem; } @@ -601,7 +596,7 @@ export default { } .auto-input { - width: calc(100% - 180rem); + width: calc(100% - 160rem); } } diff --git a/src/components/ScrollList.vue b/src/components/ScrollList.vue index 4615ef1..a66e1aa 100644 --- a/src/components/ScrollList.vue +++ b/src/components/ScrollList.vue @@ -61,5 +61,3 @@ async function getData(refresh = false) { onMounted(getData) - - diff --git a/src/components/Share.vue b/src/components/Share.vue index 4023878..bff3e81 100644 --- a/src/components/Share.vue +++ b/src/components/Share.vue @@ -7,7 +7,7 @@ :show-heng-gang="false" :touch-moved="false" maskMode="light" - height="370rem" + height="320rem" mode="dark" >
@@ -227,6 +227,7 @@ export default { .share { width: 100%; + height: 100%; background: black; border-radius: 10px 10px 0 0; color: white; diff --git a/src/components/dialog/FromBottomDialog.vue b/src/components/dialog/FromBottomDialog.vue index dd6f0d7..b058c9a 100644 --- a/src/components/dialog/FromBottomDialog.vue +++ b/src/components/dialog/FromBottomDialog.vue @@ -1,20 +1,11 @@