guideAD.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <view>
  3. <u-popup v-model="show" mode="center" class="adPopup">
  4. <view>
  5. <view class="close" @click="closeAD">
  6. {{$i18n.locale == 'zh' ? '跳过广告' : 'Close the AD'}}
  7. <text style="margin-left: 10upx;" v-if="date">{{date}}</text>
  8. </view>
  9. </view>
  10. <view style="width: 100%;" class="img">
  11. <!-- <img src="../static/img/index/guideAD.png" alt="" style="width: 100%;">-->
  12. <u-image src="../static/img/index/guideAD.png" mode="widthFix" alt="" width="100%"></u-image>
  13. </view>
  14. </u-popup>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. name: "guideAD",
  20. props:{
  21. show:{
  22. type:Boolean,
  23. default:false
  24. },
  25. time:{
  26. type:Number,
  27. default: 0
  28. },
  29. },
  30. data(){
  31. return{
  32. date:this.time,
  33. countDown:''
  34. }
  35. },
  36. mounted(){
  37. if(this.date){
  38. this.countDown = setInterval(()=>{
  39. this.date--;
  40. },1000)
  41. }
  42. },
  43. watch: {
  44. date(n,o) {
  45. console.log(n,o)
  46. if(n==0){
  47. this.closeAD()
  48. }
  49. }
  50. },
  51. methods:{
  52. closeAD(){
  53. this.show = false
  54. this.$emit('close',false)
  55. clearInterval(this.countDown)
  56. }
  57. }
  58. }
  59. </script>
  60. <style scoped>
  61. .adPopup {
  62. width: 530upx;
  63. margin: auto;
  64. }
  65. .adPopup .close{
  66. float: right;
  67. color: rgba(255,255,255,.8);
  68. display: inline-block;
  69. padding: 2upx 20upx;
  70. background-color: rgba(0,0,0,.3);
  71. margin-bottom: 10upx;
  72. border-radius: 80upx;
  73. }
  74. .adPopup /deep/ .u-mode-center-box{
  75. width: 100%!important;
  76. background-color: transparent;
  77. }
  78. .adPopup /deep/ .u-mode-center-box .u-drawer__scroll-view{
  79. background-color: transparent;
  80. }
  81. </style>