├── 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.

AdBanner.vue 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <view class="ad-container">
  3. <block v-for="(ad, index) in ads" :key="index">
  4. <image
  5. :src="ad.imageUrl"
  6. mode="widthFix"
  7. @click="handleAdClick(ad)"
  8. />
  9. <text v-if="ad.title" class="ad-title">{{ ad.title }}</text>
  10. </block>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. props: {
  16. ads: {
  17. type: Array,
  18. default: () => []
  19. }
  20. },
  21. methods: {
  22. handleAdClick(ad) {
  23. // 广告点击统计
  24. this.$http.post('/java-api/ad/click', { adId: ad.id });
  25. // 处理跳转
  26. if (ad.linkType === 'NOVEL') {
  27. uni.navigateTo({ url: `/pages/novel/detail?id=${ad.linkTarget}` });
  28. } else if (ad.linkType === 'URL') {
  29. uni.navigateTo({ url: `/pages/webview?url=${encodeURIComponent(ad.linkTarget)}` });
  30. }
  31. }
  32. }
  33. }
  34. </script>
  35. <style>
  36. .ad-container {
  37. padding: 10px;
  38. background: #f5f5f5;
  39. margin: 15px 0;
  40. border-radius: 8px;
  41. }
  42. .ad-title {
  43. display: block;
  44. text-align: center;
  45. font-size: 14px;
  46. color: #666;
  47. }
  48. </style>