├── php-api/ # 改造后的PHP接口层 ├── java-ad-service/ # 若依框架微服务(广告+VIP+分账) ├── uniapp-reader/ # UniApp前端项目 │ ├── pages/ # 各端页面 │ └──
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

list.vue 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <view>
  3. <!-- 顶部广告(来自Java后台) -->
  4. <ad-banner :ads="topAds" />
  5. <!-- 小说列表 -->
  6. <view class="novel-list">
  7. <view v-for="novel in novelList" :key="novel.id" @click="openNovel(novel)">
  8. <image :src="novel.cover" mode="aspectFill" />
  9. <text>{{ novel.title }}</text>
  10. </view>
  11. </view>
  12. <!-- 底部广告 -->
  13. <ad-banner :ads="bottomAds" />
  14. </view>
  15. </template>
  16. <script>
  17. import AdBanner from '@/components/AdBanner';
  18. export default {
  19. components: { AdBanner },
  20. data() {
  21. return {
  22. novelList: [], // 存储小说目录数据
  23. topAds: [],
  24. bottomAds: []
  25. }
  26. },
  27. async onLoad() {
  28. await this.loadAds();
  29. await this.loadNovels();
  30. },
  31. // onLoad() {
  32. // this.loadNovelList();
  33. // },
  34. methods: {
  35. // 从Java后台加载广告
  36. async loadAds() {
  37. const [topRes, bottomRes] = await Promise.all([
  38. this.$http.get('/java-api/ad/position?code=TOP_BANNER'),
  39. this.$http.get('/java-api/ad/position?code=BOTTOM_BANNER')
  40. ]);
  41. this.topAds = topRes.data;
  42. this.bottomAds = bottomRes.data;
  43. },
  44. // 从PHP系统加载小说目录
  45. async loadNovels() {
  46. const res = await this.$http.get('/php-api/novel/list');
  47. this.novelList = res.data;
  48. },
  49. // 打开小说详情页
  50. openNovel(novel) {
  51. uni.navigateTo({
  52. url: `/pages/novel/detail?id=${novel.id}&title=${encodeURIComponent(novel.title)}`
  53. });
  54. }
  55. }
  56. }
  57. </script>
  58. <style scoped>
  59. .novel-list-page {
  60. padding-bottom: 120rpx !important;
  61. }
  62. </style>