|
@ -35,14 +35,14 @@ |
|
|
<div class="video-info"> |
|
|
<div class="video-info"> |
|
|
<div class="video-title"> |
|
|
<div class="video-title"> |
|
|
<span class="gold-icon">🏆</span> |
|
|
<span class="gold-icon">🏆</span> |
|
|
{{ video.title }} |
|
|
|
|
|
|
|
|
{{ videos.title }} |
|
|
</div> |
|
|
</div> |
|
|
<div class="video-meta"> |
|
|
<div class="video-meta"> |
|
|
<span class="author">博股俱乐部</span> |
|
|
<span class="author">博股俱乐部</span> |
|
|
<div class="video-stats"> |
|
|
<div class="video-stats"> |
|
|
<div class="stat-item"> |
|
|
<div class="stat-item"> |
|
|
<img src="../pic/link.jpg" alt="HomilyLink" class="homily-icon" /> |
|
|
|
|
|
<span class="homily-text">HomilyLink</span> |
|
|
|
|
|
|
|
|
<img src="../pic/link.jpg" alt="HomilyLink666" class="homily-icon" /> |
|
|
|
|
|
<span class="homily-text">{{ videos.publisherName }}</span> |
|
|
</div> |
|
|
</div> |
|
|
<div class="stat-item"> |
|
|
<div class="stat-item"> |
|
|
<span class="date">{{ videos.publishTime }}</span> |
|
|
<span class="date">{{ videos.publishTime }}</span> |
|
@ -57,7 +57,7 @@ |
|
|
</div> |
|
|
</div> |
|
|
<div class="stat-item"> |
|
|
<div class="stat-item"> |
|
|
<img src="../pic/dianzan.png" alt="Likes" class="likes-icon" @click.stop="toggleLikes(index)" /> |
|
|
<img src="../pic/dianzan.png" alt="Likes" class="likes-icon" @click.stop="toggleLikes(index)" /> |
|
|
<span class="likes">{{ videos.likeCount}}</span> |
|
|
|
|
|
|
|
|
<span class="likes">{{ videos.likeCount }}</span> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
@ -77,158 +77,83 @@ |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script setup> |
|
|
<script setup> |
|
|
|
|
|
|
|
|
// import { ref, onMounted } from 'vue'; |
|
|
|
|
|
// import axios from 'axios'; |
|
|
|
|
|
|
|
|
|
|
|
// // 定义接口地址常量 |
|
|
|
|
|
// const API_URL = 'http://192.168.8.235:8000/api/show/getShowList'; |
|
|
|
|
|
|
|
|
|
|
|
// // 定义接口调用函数 |
|
|
|
|
|
// const fetchShowList = async () => { |
|
|
|
|
|
// try { |
|
|
|
|
|
// // 发送 POST 请求 |
|
|
|
|
|
// const response = await axios.post(API_URL); |
|
|
|
|
|
// // 处理响应数据 |
|
|
|
|
|
// console.log('接口返回数据:', response.data); |
|
|
|
|
|
|
|
|
|
|
|
// // 这里可以根据返回的数据更新页面状态 |
|
|
|
|
|
// } catch (error) { |
|
|
|
|
|
// // 处理错误 |
|
|
|
|
|
// console.error('接口请求出错:', error); |
|
|
|
|
|
// } |
|
|
|
|
|
// }; |
|
|
|
|
|
|
|
|
|
|
|
// const videos = ref([ |
|
|
|
|
|
// { |
|
|
|
|
|
// thumbnail: 'src/pic/1.jpg', |
|
|
|
|
|
// title: '第一节《影形结构同现》', |
|
|
|
|
|
// date: '05-26 11:42', |
|
|
|
|
|
// views: 643, |
|
|
|
|
|
// comments: 5, |
|
|
|
|
|
// likes: 3, |
|
|
|
|
|
// isLiked: false, |
|
|
|
|
|
// isCommented: false |
|
|
|
|
|
// }, |
|
|
|
|
|
// { |
|
|
|
|
|
// thumbnail: 'src/pic/2.jpg', |
|
|
|
|
|
// title: '第二节《强势结构形态》', |
|
|
|
|
|
// date: '01-11 09:55', |
|
|
|
|
|
// views: 498, |
|
|
|
|
|
// comments: 10, |
|
|
|
|
|
// likes: 12, |
|
|
|
|
|
// isLiked: false, |
|
|
|
|
|
// isCommented: false |
|
|
|
|
|
// }, |
|
|
|
|
|
// ]); |
|
|
|
|
|
|
|
|
|
|
|
// // 弹出框相关 |
|
|
|
|
|
// const showModal = ref(false); |
|
|
|
|
|
// const modalTitle = ref(''); |
|
|
|
|
|
// const modalContent = ref(''); |
|
|
|
|
|
|
|
|
|
|
|
// // 增加播放量 |
|
|
|
|
|
// const incrementViews = (index) => { |
|
|
|
|
|
// videos.value[index].views += 1; |
|
|
|
|
|
// saveToLocalStorage(); |
|
|
|
|
|
// }; |
|
|
|
|
|
|
|
|
|
|
|
// // 切换评论状态 |
|
|
|
|
|
// const toggleComments = (index) => { |
|
|
|
|
|
// if (videos.value[index].isCommented) { |
|
|
|
|
|
// videos.value[index].comments -= 1; |
|
|
|
|
|
// videos.value[index].isCommented = false; |
|
|
|
|
|
// } else { |
|
|
|
|
|
// videos.value[index].comments += 1; |
|
|
|
|
|
// videos.value[index].isCommented = true; |
|
|
|
|
|
// } |
|
|
|
|
|
// saveToLocalStorage(); |
|
|
|
|
|
// }; |
|
|
|
|
|
|
|
|
|
|
|
// // 切换点赞状态 |
|
|
|
|
|
// const toggleLikes = (index) => { |
|
|
|
|
|
// if (videos.value[index].isLiked) { |
|
|
|
|
|
// videos.value[index].likes -= 1; |
|
|
|
|
|
// videos.value[index].isLiked = false; |
|
|
|
|
|
// } else { |
|
|
|
|
|
// videos.value[index].likes += 1; |
|
|
|
|
|
// videos.value[index].isLiked = true; |
|
|
|
|
|
// } |
|
|
|
|
|
// saveToLocalStorage(); |
|
|
|
|
|
// }; |
|
|
|
|
|
|
|
|
|
|
|
// // 查看更多的动态效果 |
|
|
|
|
|
// const showMore = () => { |
|
|
|
|
|
// modalTitle.value = '查看更多内容'; |
|
|
|
|
|
// modalContent.value = '正在加载更多内容...'; |
|
|
|
|
|
// showModal.value = true; |
|
|
|
|
|
// }; |
|
|
|
|
|
|
|
|
|
|
|
// // 查看更多专题的动态效果 |
|
|
|
|
|
// const showMoreTopics = () => { |
|
|
|
|
|
// modalTitle.value = '查看更多专题'; |
|
|
|
|
|
// modalContent.value = '正在加载更多专题...'; |
|
|
|
|
|
// showModal.value = true; |
|
|
|
|
|
// }; |
|
|
|
|
|
|
|
|
|
|
|
// // 关闭弹出框 |
|
|
|
|
|
// const closeModal = () => { |
|
|
|
|
|
// showModal.value = false; |
|
|
|
|
|
// }; |
|
|
|
|
|
|
|
|
|
|
|
// // 保存到本地存储 |
|
|
|
|
|
// const saveToLocalStorage = () => { |
|
|
|
|
|
// localStorage.setItem('videos', JSON.stringify(videos.value)); |
|
|
|
|
|
// }; |
|
|
|
|
|
|
|
|
|
|
|
// // 从本地存储加载 |
|
|
|
|
|
// const loadFromLocalStorage = () => { |
|
|
|
|
|
// const savedVideos = localStorage.getItem('videos'); |
|
|
|
|
|
// if (savedVideos) { |
|
|
|
|
|
// videos.value = JSON.parse(savedVideos); |
|
|
|
|
|
// } |
|
|
|
|
|
// }; |
|
|
|
|
|
|
|
|
|
|
|
// // 清除本地存储(调试用) |
|
|
|
|
|
// localStorage.removeItem('videos'); |
|
|
|
|
|
|
|
|
|
|
|
// // 合并 onMounted 逻辑 |
|
|
|
|
|
// onMounted(() => { |
|
|
|
|
|
// fetchShowList(); |
|
|
|
|
|
// loadFromLocalStorage(); |
|
|
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import boguApi from '@/api/boguApi'; |
|
|
import boguApi from '@/api/boguApi'; |
|
|
import { ref } from 'vue'; |
|
|
|
|
|
const videos = ref([]); |
|
|
|
|
|
|
|
|
import { ref, onMounted } from 'vue'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function formatTime(queryType) { |
|
|
|
|
|
boguApi.selectBogu(queryType).then(resp => { |
|
|
|
|
|
if(resp.data){ |
|
|
|
|
|
|
|
|
// 定义响应式变量 |
|
|
|
|
|
const videos = ref([]); |
|
|
|
|
|
const showModal = ref(false); |
|
|
|
|
|
const modalTitle = ref(''); |
|
|
|
|
|
const modalContent = ref(''); |
|
|
|
|
|
|
|
|
|
|
|
// 获取视频列表 |
|
|
|
|
|
function getbohuhuiyuan(queryType) { |
|
|
|
|
|
boguApi.selectBogu(queryType).then((resp) => { |
|
|
|
|
|
if (resp.data) { |
|
|
videos.value = resp.data.list; |
|
|
videos.value = resp.data.list; |
|
|
console.log(videos.value); |
|
|
console.log(videos.value); |
|
|
|
|
|
} else { |
|
|
|
|
|
console.log('获取视频列表失败'); |
|
|
} |
|
|
} |
|
|
}).catch(error => { |
|
|
|
|
|
// 处理请求错误 |
|
|
|
|
|
console.error('获取视频列表失败:', error); |
|
|
|
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
formatTime(); |
|
|
|
|
|
|
|
|
getbohuhuiyuan(3); |
|
|
|
|
|
|
|
|
|
|
|
// 增加播放量 |
|
|
|
|
|
const incrementViews = (index) => { |
|
|
|
|
|
videos.value[index].viewCount += 1; |
|
|
|
|
|
saveToLocalStorage(); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 切换评论状态 |
|
|
|
|
|
const toggleComments = (index) => { |
|
|
|
|
|
if (videos.value[index].isCommented) { |
|
|
|
|
|
videos.value[index].commentCount -= 1; |
|
|
|
|
|
videos.value[index].isCommented = false; |
|
|
|
|
|
} else { |
|
|
|
|
|
videos.value[index].commentCount += 1; |
|
|
|
|
|
videos.value[index].isCommented = true; |
|
|
|
|
|
} |
|
|
|
|
|
saveToLocalStorage(); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 切换点赞状态 |
|
|
|
|
|
const toggleLikes = (index) => { |
|
|
|
|
|
if (videos.value[index].isLiked) { |
|
|
|
|
|
videos.value[index].likeCount -= 1; |
|
|
|
|
|
videos.value[index].isLiked = false; |
|
|
|
|
|
} else { |
|
|
|
|
|
videos.value[index].likeCount += 1; |
|
|
|
|
|
videos.value[index].isLiked = true; |
|
|
|
|
|
} |
|
|
|
|
|
saveToLocalStorage(); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 查看更多的动态效果 |
|
|
|
|
|
const showMore = () => { |
|
|
|
|
|
modalTitle.value = '查看更多内容'; |
|
|
|
|
|
modalContent.value = '正在加载更多内容...'; |
|
|
|
|
|
showModal.value = true; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 查看更多专题的动态效果 |
|
|
|
|
|
const showMoreTopics = () => { |
|
|
|
|
|
modalTitle.value = '查看更多专题'; |
|
|
|
|
|
modalContent.value = '正在加载更多专题...'; |
|
|
|
|
|
showModal.value = true; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 关闭弹出框 |
|
|
|
|
|
const closeModal = () => { |
|
|
|
|
|
showModal.value = false; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped> |
|
|
<style scoped> |
|
|
|
|
|
|
|
|
|
|
|
/* 样式部分保持不变 */ |
|
|
.header-content p { |
|
|
.header-content p { |
|
|
font-size: 20px; |
|
|
font-size: 20px; |
|
|
text-align: left; |
|
|
text-align: left; |
|
@ -318,7 +243,7 @@ formatTime(); |
|
|
.video-list { |
|
|
.video-list { |
|
|
display: flex; |
|
|
display: flex; |
|
|
flex-direction: column; |
|
|
flex-direction: column; |
|
|
gap: 20px; |
|
|
|
|
|
|
|
|
gap: 10px; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.video-card { |
|
|
.video-card { |
|
|