diff --git a/src/api/api.js b/src/api/api.js
new file mode 100644
index 0000000..4d2f4e8
--- /dev/null
+++ b/src/api/api.js
@@ -0,0 +1,102 @@
+/**
+ * 获取H5帖子列表
+ * @param {Object} data - 请求参数
+ * @returns {Promise} uni.request返回的Promise对象
+ */
+export const getPostList = data => {
+ return uni.request({
+ url: '/api/v1/h5-posts',
+ method: 'get',
+ data: data,
+ header: {
+ 'Content-Type': 'application/json',
+ 'platform': 'H5'
+ }
+ })
+}
+
+export const getPostLImage = filename => {
+ return uni.request({
+ url: '/api/v1/h5-content/' + filename,
+ method: 'get',
+ header: {
+ 'Content-Type': 'application/json',
+ 'platform': 'H5'
+ },
+ responseType: 'arraybuffer',
+ timeout: 60000 // 添加超时设置
+ })
+}
+
+export const getPostVideo = filename => {
+ // 如果filename已经是完整路径,直接使用;否则拼接路径
+ let url = filename
+ if (!filename.startsWith('/')) {
+ url = '/api/v1/h5-video/' + filename
+ }
+ return uni.request({
+ url: url,
+ method: 'get',
+ header: {
+ 'Content-Type': 'application/json',
+ 'platform': 'H5'
+ },
+ responseType: 'arraybuffer',
+ timeout: 60000 // 添加超时设置
+ })
+}
+
+
+/**
+ * 获取用户头像图片
+ * @param {string} filename - 图片文件名或完整路径
+ * @returns {Promise} uni.request返回的Promise对象
+ */
+export const getUserImg = filename => {
+ // 处理filename,只保留default_avatar.png字段
+ let processedFilename = filename
+
+ // 如果传入的是完整路径,提取文件名
+ if (filename.includes('/')) {
+ const parts = filename.split('/')
+ processedFilename = parts[parts.length - 1]
+ }
+ const url = '/api/v1/h5-avatar/' + processedFilename
+ // console.log(url)
+ return uni.request({
+ url: url,
+ method: 'GET',
+ header: {
+ 'Content-Type': 'application/json',
+ 'platform': 'H5'
+ },
+ responseType: 'arraybuffer',
+ timeout: 60000 // 添加超时设置
+ })
+}
+
+/**
+ * 获取H5评论列表
+ * @param {Object} params - 请求参数
+ * @returns {Promise} uni.request返回的Promise对象
+ */
+export const getCommentList = params => {
+ return uni.request({
+ url: '/api/v1/h5-comments?postId=' + params.postId,
+ method: 'get',
+ header: {
+ 'Content-Type': 'application/json',
+ 'platform': 'H5'
+ },
+ timeout: 60000 // 添加超时设置
+ })
+}
+
+// 默认导出所有接口
+export default {
+ getPostList,
+ getCommentList,
+ getPostLImage,
+ getPostVideo,
+ getUserImg
+}
\ No newline at end of file
diff --git a/src/pages.json b/src/pages.json
index 2a0d857..c76fcd5 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -9,13 +9,13 @@
{
"path": "pages/post",
"style": {
- "navigationBarTitleText": "帖子"
+ "navigationBarTitleText": ""
}
},
{
"path": "pages/video",
"style": {
- "navigationBarTitleText": "视频"
+ "navigationBarTitleText": ""
}
},
{
@@ -39,7 +39,13 @@
{
"path": "pages/news",
"style": {
- "navigationBarTitleText": "新闻"
+ "navigationBarTitleText": ""
+ }
+ },
+ {
+ "path": "pages/intereact/intereact",
+ "style": {
+ "navigationBarTitleText": ""
}
}
],
diff --git a/src/pages/comments/comments.vue b/src/pages/comments/comments.vue
index 6ad9e3d..e7d1f61 100644
--- a/src/pages/comments/comments.vue
+++ b/src/pages/comments/comments.vue
@@ -1,129 +1,131 @@
-
@@ -175,11 +292,16 @@ const totalCommentCount = computed(() =>
.comment {
width: 100%;
max-width: 430px;
- padding: 16px;
+ height: 50vh;
display: flex;
flex-direction: column;
margin: 0 auto;
box-sizing: border-box;
+ position: relative;
+}
+
+main {
+ padding: 16px;
}
.commenthead {
@@ -354,13 +476,12 @@ const totalCommentCount = computed(() =>
width: 100%;
display: flex;
flex-direction: column;
- margin: 14px 0 0;
}
.commentchild {
display: flex;
flex-direction: row;
- margin-bottom: 8px;
+ /* margin-bottom: 8px; */
}
.commentchildleft {
@@ -388,6 +509,8 @@ const totalCommentCount = computed(() =>
align-items: center;
flex-direction: row;
gap: 8px;
+ transition: all 0.5s ease;
+ cursor: pointer;
}
.expandcommenttext {
@@ -402,83 +525,25 @@ const totalCommentCount = computed(() =>
color: #110c13;
}
-.interaction {
- width: 100%;
- max-width: 430px;
- border: solid 1px #faf9fb;
- background-color: #faf9fb;
+.nocomments {
display: flex;
- align-items: center;
- padding: 11.5px 16px;
- flex-direction: row;
- box-sizing: border-box;
+ flex-direction: column;
+ text-align: center;
margin: 0 auto;
-}
-
-.editarea {
- flex: 1;
- height: 40px;
- background-color: #fff;
- border-radius: 24px;
+ max-width: 100%;
gap: 12px;
- padding: 0 20px;
- box-sizing: border-box;
- display: flex;
- align-items: center;
- cursor: pointer;
+ padding: 12px;
}
-.editicon {
- width: 13.3px;
- height: 14.6px;
- flex-shrink: 0;
- align-self: center;
-}
-
-.edittext {
- flex: 1;
- flex-grow: 0;
+.nocommentstext {
font-size: 14px;
+ font-family: 'PingFangSC';
font-weight: normal;
font-stretch: normal;
font-style: normal;
- line-height: 40px;
- letter-spacing: normal;
- text-align: left;
- color: #918e93;
- white-space: nowrap;
-}
-
-.collection,
-.like {
- height: 40px;
- display: flex;
- flex-direction: row;
- align-items: center;
- gap: 5px;
-}
-
-.collectionicon,
-.likeicon {
- width: 24px;
- height: 24px;
- display: flex;
- justify-content: center;
- align-items: center;
- cursor: pointer;
-}
-
-.collectioncount,
-.likecount {
- height: 17px;
- font-family: 'SFPro';
- font-size: 14px;
- font-weight: 500;
- font-stretch: normal;
- font-style: normal;
line-height: normal;
letter-spacing: normal;
- text-align: left;
- color: #000;
+ text-align: center;
+ color: #918e93;
}
\ No newline at end of file
diff --git a/src/pages/intereact/intereact.vue b/src/pages/intereact/intereact.vue
new file mode 100644
index 0000000..d9b65b2
--- /dev/null
+++ b/src/pages/intereact/intereact.vue
@@ -0,0 +1,141 @@
+
+
+
+
+
+ 快来互动吧…
+
+
+
+
+ {{ formatCount(collectsum) }}
+
+
+
+
+ {{ formatCount(countLike) }}
+
+
+
+
+
+
+
diff --git a/src/pages/news.vue b/src/pages/news.vue
index 877247c..cb17258 100644
--- a/src/pages/news.vue
+++ b/src/pages/news.vue
@@ -1,22 +1,30 @@
-
+
-
+
-
+
-
-
-
+
+
+
+
+ 图片加载中...
+
+
+ 图片加载失败
+
@@ -31,16 +39,14 @@
{{ post.title }}
-
+
{{ post.copywriting }}
{{ post.source }}
·
-
- {{ post.time }}
+ {{ common.formatDate(post.time) }}
@@ -51,16 +57,26 @@
-
+
-
+
-
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/post.vue b/src/pages/post.vue
index 19be60a..cf005bb 100644
--- a/src/pages/post.vue
+++ b/src/pages/post.vue
@@ -1,5 +1,5 @@
-
+
@@ -8,8 +8,10 @@
-
- {{ post.userName }}
+
+
+ {{ post.user ? post.user.nickName : '未知用户' }}
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -47,21 +62,30 @@
-
+
+
+
+
+
+
+ 页面加载中...
+
+
@@ -253,7 +378,8 @@ swiper-item {
height: 100%;
display: flex;
align-items: center;
- justify-content: center
+ justify-content: center;
+ position: relative;
}
.swiper-item {
@@ -261,17 +387,63 @@ swiper-item {
height: 100%
}
-.swiper-center {
- position: relative;
+::v-deep .uni-video-cover {
+ background-color: transparent;
}
-.swiper-mask {
+::v-deep .uni-video-cover-play-button {
+ width: 100% !important;
+ height: 100% !important;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.uni-video-cover {
position: absolute;
- left: 0;
top: 0;
- right: 0;
+ left: 0;
bottom: 0;
- background: transparent;
+ width: 100%;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ z-index: 1;
+}
+
+.uni-video-icon {
+ font-family: 'uni-video-icon';
+ text-align: center;
+}
+
+.uni-video-cover-play-button {
+ width: 100% !important;
+ height: 100% !important;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ line-height: 75px;
+ font-size: 56px;
+ color: rgba(255, 255, 255, 0.5);
+ cursor: pointer;
+}
+
+.uni-video-cover-play-button::after {
+ content: '\ea24';
+}
+
+.uni-video-cover {
+ position: absolute;
+ top: 0;
+ left: 0;
+ bottom: 0;
+ width: 100%;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ z-index: 1;
}
.dots-bar {
@@ -319,4 +491,11 @@ swiper-item {
font-size: 12px;
color: #b1aeb2;
}
+
+.loading-container {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ height: 100vh;
+}
diff --git a/src/pages/video.vue b/src/pages/video.vue
index d9ad404..9b6cd50 100644
--- a/src/pages/video.vue
+++ b/src/pages/video.vue
@@ -1,191 +1,152 @@
-
+
-
-
-
-
-
-
+
+
-
-
-
- @{{ videoData.userName }}
- {{ formatDate(videoData.date) }}
-
+
-
- {{ videoData.copywriting }}
-
-
+
+
+
+
+
+
+
+ handleInteraction('follow')">
+
+
-
-
-
-
-
-
-
- handleInteraction('follow')">
-
+
+ handleInteraction('like')">
+
+ {{ formatCount(videoData.likesum) }}
+
+
+ handleInteraction('comment')">
+
+ {{ formatCount(videoData.commentsum) }}
+
+
+
+ handleInteraction('share')">
+
+ {{ formatCount(videoData.sharesum) }}
+
+
+
+
+
-
- handleInteraction('like')">
-
- {{ formatCount(videoData.likesum) }}
-
+
+
+ handleInteraction('user')">
+ {{ '@' + videoData.userName }}
+
+
-
- handleInteraction('comment')">
-
- {{ formatCount(videoData.commentsum) }}
-
+
+ {{ isExpanded ? videoData.copywriting :
+ truncatedText }}
+
+
+
+
+
-
- handleInteraction('share')">
-
- {{ formatCount(videoData.sharesum) }}
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+