123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- <template>
- <view class="wrapper">
- <view class="container">
- <view class="jump">
- <text class="textSty" @click="send">{{i18n('CloseAD')}} {{date}}</text>
- </view>
- <view class="img">
- <image @click="toShow" :src="'http://172.16.1.159:9200/api/file/pub/' + url" mode="widthFix" alt="" width="100%"></image>
- <!-- <image src="@/static/img/index/guideAD.png" v-else mode="widthFix" alt="" width="100%"></image> -->
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- date:5,
- countDown:'',
- url:'',
- advertisiment:{},
- linkTo:'',
- lan:getApp().$i18n.locale,
- adverId:'',
- }
- },
- onReady() {
- // this.getAdver()
- this.insdate()
- },
- async onLoad(option) {
- await this.getAdver()
- },
- watch: {
- date(n,o) {
- if(n == 0){
- clearInterval(this.countDown)
- this.date = ''
- this.send()
- }
- }
- },
- beforeDestroy() {
- uni.$off('photo')
- },
- methods: {
- insdate(){
- if(this.date){
- this.countDown = setInterval(()=>{
- this.date -- ;
- },1000)
- }
- },
- send(){
- //获取当前子窗体的唯一id
- const subNVue = uni.getCurrentSubNVue()
- subNVue.hide()
- },
- async getAdver(){
- let res = await getApp().$myRequest({
- url:'/op/advertisementLocations/getAppAdvert',
- data:{
- position:'mobile_send',
- language:getApp().$i18n.locale
- }
- })
- let addver = res.data[0].list
- for(let i = 0;i < addver.length ;i++){
- if(getApp().$i18n.locale == addver[i].languageDict){
- this.url = addver[i].advPicUrl
- this.linkTo = addver[i].advPicLink;
- this.adverId = addver[i].id
-
- }
- }
- console.log(this.url)
- },
- i18n (data) {
- return getApp().$t('common.'+data);
- },
- toShow(){
- this.getClickNumber()
- if(this.linkTo){
- plus.runtime.openURL(this.linkTo)
- }else{
- return
- }
-
- },
- async getClickNumber(){
- let res = await getApp().$myRequest({
- url:'/op/advertisementLocations/getAppAdvert',
- data:{
- position:'mobile_send',
- advId:this.adverId
- }
- })
-
-
- }
- }
- }
- </script>
- <style scoped>
- .wrapper {
- /* width: 100%;
- margin: auto; */
- left: 0;
- right: 0;
- /* top: 0; */
- bottom: 0;
- position: relative;
- /* height: 90upx;
- padding: 0 28upx; */
- padding: 60% 50% 0 50%;
- }
- .container{
- margin-top: 50%;
- /* background-color: #ffff7f; */
- }
- .jump{
- width:240upx;
- height: 50upx;
- border-radius: 30upx;
- background-color:rgba(0,0,0,0.3) ;
- font-size: 24upx;
- text-align: center;
- color: #FFFFFF;
- position: absolute;
- top: 0;
- right: 0;
- }
- .img{
- position: relative;
- top:50upx;
- /* width: 100%; */
- /* height: calc(100% - 40upx); */
- }
- .textSty{
- color: #ffffff;
- text-align: center;
- line-height:50upx;
- }
- </style>
|