index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <div @touchend="touchCountWxAd" class="bg">
  3. <button open-type="share" class="share1">
  4. <div style="position: relative; width: 100%">
  5. <image
  6. v-for="(item, index) in 9"
  7. :style="{
  8. left: item * 34 + 'rpx',
  9. }"
  10. :key="index"
  11. class="headImg"
  12. :src="
  13. 'https://ndata.zzxcx.net/ctjk/mp-wx/textCheatsList/headImg' +
  14. (item + 1) +
  15. '@2x.png'
  16. "
  17. ></image>
  18. <view
  19. style="
  20. color: #8a9099;
  21. font-size: 28rpx;
  22. left: 340rpx;
  23. position: absolute;
  24. width: 90rpx;
  25. top: 6rpx;
  26. "
  27. class=""
  28. >已参与</view
  29. >
  30. <view
  31. style="
  32. color: #fff;
  33. position: absolute;
  34. top: 6rpx;
  35. width: 182rpx;
  36. line-height: 52rpx;
  37. background: #498ef5;
  38. border-radius: 30rpx;
  39. background: #498ef5;
  40. right: 0;
  41. text-align: center;
  42. font-size: 28rpx;
  43. "
  44. >
  45. 分享给好友
  46. </view>
  47. </div>
  48. </button>
  49. <view style="padding: 0 15rpx">
  50. 以下是科目{{ subjectMap[query.subject] }}的“<text style="color: red"
  51. >考试知识点</text
  52. >”和“<text style="color: red">答题技巧</text
  53. >”,考试知识点可以直接学习,答题技巧需配合《财仝驾助》软件中的语音技巧同步学习,建议先使用软件学完所有技巧考试前1-2天再将以下知识点和文字技巧快速过一遍加以巩固!
  54. </view>
  55. <view style="font-weight: bold; padding: 0 15rpx"
  56. >祝所有学员逢考必过 早日取得驾照</view
  57. >
  58. <div style="text-align: center">
  59. <div :key="index" v-for="(item, index) in imgList">
  60. <img style="width: 750rpx" mode="widthFix" :src="item.url" />
  61. <ad
  62. v-if="index > 1 && index % 5 == 0"
  63. ad-type="video"
  64. :ad-intervals="100"
  65. unit-id="adunit-173f2958099a2b25"
  66. ></ad>
  67. </div>
  68. </div>
  69. </div>
  70. </template>
  71. <script>
  72. import api from "@/api";
  73. import request from "@/api/request";
  74. export default {
  75. data() {
  76. return {
  77. imgList: [],
  78. touchCount: 0,
  79. query: {
  80. subject: "1",
  81. },
  82. subjectMap: ["科目零", "科目一", "科目二", "科目三", "科目四"],
  83. };
  84. },
  85. onLoad(query) {
  86. this.query = query;
  87. },
  88. methods: {
  89. touchCountWxAd(e) {
  90. let that = this;
  91. this.touchCount = this.touchCount + 1;
  92. if (this.touchCount % 5 == 0 && this.touchCount !== 0) {
  93. // 在页面中定义插屏广告
  94. let interstitialAd = null;
  95. // 在页面onLoad回调事件中创建插屏广告实例
  96. if (uni.createInterstitialAd) {
  97. interstitialAd = uni.createInterstitialAd({
  98. adUnitId: "adunit-cb696895e6fdcfb7",
  99. });
  100. interstitialAd.onLoad(() => {
  101. console.log("ad load");
  102. });
  103. interstitialAd.onError((err) => {
  104. console.error(err);
  105. that.touchCount = 0;
  106. });
  107. interstitialAd.onClose(() => {
  108. that.touchCount = 0;
  109. });
  110. }
  111. // 在适合的场景显示插屏广告
  112. if (interstitialAd) {
  113. interstitialAd
  114. .show()
  115. .then(() => {
  116. that.touchCount = 0;
  117. })
  118. .catch((err) => {
  119. that.touchCount = 0;
  120. console.log(err);
  121. });
  122. }
  123. }
  124. },
  125. },
  126. onShareAppMessage(res) {
  127. if (res.from === "button") {
  128. // 来自页面内分享按钮
  129. console.log(res.target);
  130. }
  131. return {
  132. title: "科目一四宝典",
  133. imageUrl: "https://ndata.zzxcx.net/ctjk/mp-wx/textCheatsList/share_cover@2x.jpg",
  134. path: `/pages/textCheatsList/index`,
  135. };
  136. },
  137. mounted() {
  138. request({
  139. url: "https://nbjk1.zzxcx.net/nbjk-admin/open-api/wx/material/list",
  140. method: "GET",
  141. headers: {
  142. isLogin: "1",
  143. },
  144. params: {
  145. subject: this.query.subject,
  146. status: 1,
  147. },
  148. }).then((res) => {
  149. this.imgList = res.rows;
  150. // console.log(res)
  151. });
  152. },
  153. };
  154. </script>
  155. <style lang="scss" scoped>
  156. .bg {
  157. background-color: #fff;
  158. width: 100vw;
  159. min-height: 100vh;
  160. .share1 {
  161. display: flex;
  162. flex-wrap: wrap;
  163. width: 720rpx;
  164. margin: 0 auto;
  165. height: 108rpx;
  166. padding-left: 30rpx;
  167. padding-right: 30rpx;
  168. padding-top: 20rpx;
  169. padding-bottom: 20rpx;
  170. border: 2rpx solid #e8e8e8;
  171. background-color: #fff;
  172. position: relative;
  173. .headImg {
  174. width: 68rpx;
  175. height: 68rpx;
  176. position: absolute;
  177. left: 0;
  178. }
  179. }
  180. }
  181. </style>