startPage.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <view class="startPage">
  3. <image v-if="adverPic" @click="toShow" :src="'http://172.16.1.159:9200/api/file/pub/' + adverPic " mode="" alt="" :style="{width: '100vw',height: '100vh'}"></image>
  4. <image v-if="!adverPic && lan == 'zh'" src="@/static/img/index/guideAD.png" mode="" alt="" :style="{width: '100vw',height: '100vh'}"></image>
  5. <image v-if="!adverPic && lan == 'en'" src="@/static/img/index/guideAD.png" mode="" alt="" :style="{width: '100vw',height: '100vh'}"></image>
  6. <!-- <image src="@/static/img/index/guideAD.png" mode="widthFix" alt="" width="100%"></image> -->
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. name:'startPage',
  12. data() {
  13. return {
  14. time:5,
  15. adverPic:'',
  16. QHeight:0,
  17. lan:this.$i18n.locale,
  18. linkTo:'',
  19. adverId:'',
  20. }
  21. },
  22. onLoad() {
  23. uni.getSystemInfo({
  24. success:(res)=>{
  25. let height = res.windowHeight - uni.upx2px(0);
  26. this.QHeight = height
  27. }
  28. })
  29. let timeS = this.time;
  30. this.QTime(timeS)
  31. this.getAdver()
  32. },
  33. methods: {
  34. QTime(timeS){
  35. let timeStart = setInterval(function(){
  36. timeS --;
  37. if(timeS == 0){
  38. clearInterval(timeStart);
  39. uni.switchTab({
  40. url:"./index"
  41. })
  42. }
  43. console.log(timeS);
  44. },1000,timeS)
  45. },
  46. async getAdver(){
  47. let params = {
  48. position:'mobile_open',
  49. language:this.$i18n.locale
  50. }
  51. const res = await this.$myRequest({
  52. url: '/op/advertisementLocations/getAppAdvert',
  53. data: {
  54. ...params
  55. }
  56. });
  57. let addver = res.data[0].list
  58. for(let i = 0;i < addver.length ;i++){
  59. if(this.$i18n.locale == addver[i].languageDict){
  60. this.adverPic = addver[i].advPicUrl;
  61. this.linkTo = addver[i].advPicLink;
  62. this.adverId = addver[i].id
  63. break
  64. }else{
  65. this.adverPic = '';
  66. this.linkTo = '';
  67. }
  68. }
  69. },
  70. toShow(){
  71. this.getClickNumber()
  72. if(this.linkTo){
  73. plus.runtime.openURL(this.linkTo)
  74. }else{
  75. return
  76. }
  77. },
  78. //点击广告次数记录增加
  79. async getClickNumber(){
  80. let res = await getApp().$myRequest({
  81. url:'/op/advertisementLocations/getAppAdvert',
  82. data:{
  83. position:'mobile_send',
  84. advId:this.adverId
  85. }
  86. })
  87. }
  88. }
  89. }
  90. </script>
  91. <style scoped>
  92. body{
  93. width: 100%;
  94. height: 100%;
  95. }
  96. .startPage{
  97. width: 100%;
  98. height: 100%;
  99. position: absolute;
  100. z-index: 999;
  101. top: 0;
  102. bottom: 0;
  103. left: 0;
  104. right: 0;
  105. }
  106. </style>