<template>
	<view class="content">
       <image src="../../static/img/banner1.png" mode="widthFix" />
	<view class="img-skip" @tap="goindex()" v-if="showtime">
        跳过{{time}}
      
    </view>
    <view class="modalhtml" v-if="showModal">
    <!-- <view class="modalhtml"> -->
                <view class="modal">
                    <view class="title">
                        个人信息保护指南
                    </view>
                    <view class="content">
                        请充分阅读并理解<br> 《<view class="rule" @tap="go_rule(0)">用户协议</view>》及《<view class="rule"
                            @tap="go_rule(1)">隐私条款</view>》<br>
                        <view>
                            1.在您使用本应用时，我们可能会申请系统设备权限收集设备信息、日志信息，用于推送和安全风控，并申请存储权限，用于下载及缓存相关文件<br>
                            2.您使用发布视频、语音、图片等功能时候，我们会请求您授权相机、照片、麦克风的权限。您如果拒绝授权提供，将无法使用此功能，但不影响您使用本应用的其他功能。 <br>
                            3.在您使用本应用网络服务，本应用自动接收并记录您的设备信息，包括但不限于您的IP地址、使用的语言、访问日期和时间、软硬件特征信息等数据；
                        </view>
                    </view>
                    <view class="btns" style="display: flex;">
                        <view class="" @tap="jujue()">
                            不同意
                        </view>
                        <view class="" @tap="readrule()">
                            同意并继续
                        </view>
                    </view>
                    
                </view>
    
            </view>
	</view>
</template>

<script>

		export default {
        data(){
          return {
              time:5,
              timer:null,
              showtime:false,
              showModal: false,
          }  
        },
      methods: {
          readrule() {
              try{
                 uni.setStorageSync('readrule', 1);
                 this.showModal = false; 
                 this.goindex()
              }catch(e){
                  console.log(e,'eeee');
              }
          
          },
          go_rule(type) {
              console.log(type)
              uni.navigateTo({
                  url: '/pages/login/rule?type=' + type
              })
          },
          jujue() {
              
                  if (uni.getSystemInfoSync().platform === 'ios') { 
                      plus.runtime.launchApplication({ action: 'QUIT' }); 
                  }else {
                     plus.runtime.quit(); 
                  }
          
          },
          daojishi(){
              var that=this 
            this.timer=  setInterval(function(){
                  that.time--;
                  if(that.time<=0){
                      clearInterval(that.timer);
                     // that.goindex();
                     
                  }
              },1000)
          } ,
           goindex(){
               clearInterval(this.timer);
               
            
              
                   var userid=uni.getStorageSync('access_token');
                   if(userid>0){
                 uni.reLaunch({
                     url:'/pages/index/index'
                 })      
                 
                   }
                   else{
                       uni.reLaunch({
                           url:'/pages/login/index'
                       })
                   }
               
             
           }
          
        },
        onLoad() {
            // #ifdef APP-PLUS
            this.$action.bindcid();
            if (!uni.getStorageSync('readrule')) {
                this.showModal = true;
            }else {
                // uni.removeStorageSync('readrule')
                this.goindex()
            }
                console.log(this.showModal,'this.showModal');
            // #endif
            // #ifdef H5
            this.goindex()
            // #endif
        },
        onShow() {
            this.$action.init();
            // this.goindex();
        //     // #ifdef APP-PLUS
        //     var that=this;
             
        //        plus.runtime.getProperty(plus.runtime.appid, function(info) {
              
        //          if(uni.getStorageSync('app_version')==info.version){
                    
        //              that.goindex();
        //          }else{
        //             that.showtime=true;
        //              that.daojishi();
        //           uni.setStorageSync('app_version', info.version);
                  
        //           if( uni.getStorageSync('access_token')){
        //               uni.setStorageSync('shownote',true);
        //           }
        //          }
                 
        //        });
            
        //        // #endif
        // // #ifndef APP-PLUS
        //    this.goindex()
        
        //    // #endif
     
        },
        
	}
</script>

<style lang="scss" scoped>
     @import '../../static/css/uni.css';
     .rule {
         color: #2da2fd;
         display: inline-block;
     }
	.img-skip{
        position: absolute;
        width: 60px;
        height: 30px;
        padding: 5px 5px;
     background-color: rgba(0,0,0,0.6);
     color:#fff;
        border-radius:5px;
		z-index: 100;
        top:30px;
        right: 10px;;
         text-align: center;
         line-height: 30px;
         font-size: 14px;
	}
	.img-skip > .title {
		color: #666;
        height: 18px;
	}
    	.img-skip > .title2{
            color: #999;
             height: 18px;
        }

    .content,,image {
        overflow: hidden;
        width: 100vw;
       vertical-align: middle;
    }
    .modalhtml {
        position: fixed;
        z-index: 999;
        top: 0px;
        width: 100%;
        left: 0px;
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.7);
    }
    
    .modalhtml .modal {
        background-color: #fff;
        border-radius: 10px;
        ;
        top: 30vh;
        width: 80vw;
        left: 10vw;
        position: fixed;
        border: 1px #ddd solid;
    }
    
    .modalhtml .modal .title {
        text-align: center;
        height: 35px;
        line-height: 35px;
        color: #000;
        font-size: 16px;
        font-weight: 600;
        margin-top: 5px;
    }
    
    .modalhtml .modal .content {
        padding: 5px 10px;
        max-height: 160px;
        min-height: 65px;
        line-height: 30px;
        overflow-y: scroll;
        font-size: 14px;
        // color: red;
        width: 90%;
    }
    
    .modalhtml .modal .btns {
        text-align: center;
        height: 35px;
        line-height: 35px;
        color: #000;
        font-size: 16px;
        font-weight: 600;
        border-top: #eee 1px solid;
        width: 100%;
        view {
            flex-grow: 1;
            width: 50%;
        }
    }
    .notehtml {
        position: fixed;
        z-index: 999;
        top: 0px;
        width: 100%;
        left: 0px;
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.7);
    }
</style>
