zhaojs
2023-07-19 a66073e2a5c7c424d8bebc09066395d69621d5e2
public/html/activity/invite2308.html
@@ -7,6 +7,7 @@
    <meta content="yes" name="apple-mobile-web-app-capable"><meta content="yes" name="apple-touch-fullscreen">
    <meta content="telephone=no,email=no" name="format-detection">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">
    <script type="text/javascript" src="../js/vue.js"></script>
    <script type="text/javascript" src="https://public.ffquan.cn/lib/jquery-1.12.4.min.js"></script>
    <script type="text/javascript" src="https://public.ffquan.cn/lib/vue-lazyload.js"></script>
    <script type="text/javascript" src="https://public.ffquan.cn/lib/swiper/js/swiper.min.js"></script>
@@ -144,7 +145,7 @@
                position: absolute;
                font-size: 0.25rem;
                border-radius: 0.2rem;
                top: 0.4rem;
                top: 0.65rem;
                right: 0.4rem;
                width: 1.3rem;
                text-align: center;
@@ -174,13 +175,37 @@
        font-size: .35rem;
        color: #fff;
        }
        .appback-img
{
    position: absolute;
    top: 0.6rem;
    z-index: 999;
    width: 0.6rem;
    left: 0.3rem;
}
.box
        {
            position:absolute;
            width: 100%;
            height: 100%;
            background: url(https://yanfeiobpub.obs.cn-east-3.myhuaweicloud.com/dfg/h5loading.gif) no-repeat fixed top;
            background-size: 70px 70px;
        }
        .list{
            position: relative;
            top: 0;
            width: 100%;
        }
    </style>
</head>
<body style="background: #f5f5f9; margin: 0px;font-size: 0;">
    <div class="box">
        <div class="list">
    <div id="inviteact">
        <div v-if="loading" class="loading">{{loadingTxt}}</div>
        <image v-on:click="topBack()" class="appback-img" src="https://yanfeiobpub.obs.cn-east-3.myhuaweicloud.com/dfg/h5return_backIcon.png"></image>
        <div class="act_po">
            <div class="gzbtn" v-on:click="showgz()">活动规则</div>
            <image class="com_img" src="https://yanfeiobpub.obs.cn-east-3.myhuaweicloud.com/dfg/act_invite_230717_01.png"></image>
@@ -232,6 +257,7 @@
                </p>
                <p>2、活动奖励会在结算后直接发放到用户【我的】-【余额】中</p>
                <p>3、有效粉丝定义:指活动期间,报名该活动后邀请注册并填写您邀请码的用户</p>
               <!--  <p class="share" v-on:click="copyBtn('.share')">邀请好友</p> -->
            </div>
        </div>
@@ -265,11 +291,16 @@
        <div v-if="isShowcj" class="btngo" v-on:click="joinAct()">
            <image style="width: 70%;" src="https://yanfeiobpub.obs.cn-east-3.myhuaweicloud.com/dfg/invite_btn.png"></image>
        </div>
        <div v-else class="btngo share" v-on:click="copyBtn('.share')">
            <image style="width: 70%;" src="https://yanfeiobpub.obs.cn-east-3.myhuaweicloud.com/dfg/invit_pic.png"></image>
        </div>
    </div>
    </div>
    </div>
</body>
</html>
<script type="text/javascript" src="https://cdn.staticfile.org/vue/2.6.11/vue.min.js"></script>
<script>
(function () {
@@ -298,9 +329,18 @@
          showType:false,
          isShowcj:false,
          joinInfo:{},
          ranklist:[]
          ranklist:[],
          inviteUrl:'',
        },
        methods:{
            topBack:function()
            {
                uni.postMessage({
                      data: {
                         action: 'back'
                      }
                });
            },
            closegz:function()
            {
                this.showType=false;
@@ -385,6 +425,8 @@
            joinAct:function()
            {
                var _this = this;
                _this.loadingTxt="加载中...";
                _this.loading=true;
                $.ajax({
                        headers:{
                            "token":_this.getUrlPar("token")
@@ -396,15 +438,38 @@
                            actid:_this.activityid
                        }
                    }).done(function(res){
                        _this.loading=false;
                       if(res.code==0)
                       {
                        alert("参加成功!");
                        _this.msgFun("活动参加成功!");
                        _this.isShowcj=false;
                        _this.getActMember();
                       }
                       else
                       {
                        alert("活动参加失败,请联系客服");
                        _this.msgFun("活动参加失败,请联系客服");
                       }
                    })
            },
            getInviteCode()
            {//获取邀请码
                var _this = this;
                $.ajax({
                        headers:{
                            "token":_this.getUrlPar("token")
                        },
                        url:_this.posturl+'/api/Activity/getInviteUrl',
                        type:"post",
                        dataType:"json",
                        data:{
                        }
                    }).done(function(res){
                       if(res.code==0)
                       {
                        _this.inviteUrl='http://dfgapp.ushopvip.com/index/user/register?code='+res.data;
                       }
                    })
            },
            getPaiHang:function()
@@ -427,10 +492,103 @@
                       }
                       
                    })
            }
            },
            touch:function()
            {
                const box = document.querySelector('.box')
                const list = document.querySelector('.list');
                // 按下屏幕的位置
                let touchStartPosition = 0
                // touchstart事件
                box.addEventListener('touchstart', function (e) {
                    let touch = e.touches[0]
                    touchStartPosition = touch.pageY
                })
                // touchmove事件
                box.addEventListener('touchmove', function (e) {
                    let touch = e.touches[0]
                    // 列表的top值等于列表相对于box的偏移量+滑动的距离
                    let pySize= list.offsetTop + touch.pageY - touchStartPosition;
                    if(pySize>=110)
                    {
                      return;
                    }
                    if(pySize<0)
                    {
                        return;
                    }
                    var scroll = document.getElementsByClassName('contscore')
                        var srollPos = $('.contscore').scrollTop(); //滚动条距顶部距离(页面超出窗口的高度)
                    if(srollPos>0)
                    {
                        return;
                    }
                    list.style.top =pySize + 'px';
                    // 实现平滑的滑动
                    touchStartPosition = touch.pageY
                })
                // touchend事件
                box.addEventListener('touchend', function (e) {
                    let top = list.offsetTop
                    if (top > 70) {
                        // 在此处调用刷新后的回调
                        location.reload();
                    }
                    if(top<0)
                    {
                        list.style.top=0;
                    }
                    if (top > 0) {
                        // 通过定时器平滑的将list的top = 0
                        let timer = setInterval(() => {
                            top=top-5;
                        list.style.top = top + 'px'
                        if (top <= 0) {
                            list.style.top=0;
                            clearInterval(timer)
                        }
                        },1)
                    }
                })
            },
            copyBtn: function(dom) { //复制公共方法
                var that = this;
                var clipboard = new ClipboardJS(dom, {
                    text: function(target) {
                    return that.inviteUrl;
                    }
                });
                clipboard.on("success", function(e) {
                    layer.closeAll();
                    that.msgFun("邀请链接已复制~快去分享给好友吧!");
                    e.clearSelection();
                    clipboard.destroy();
                });
                clipboard.on("error", function(e) {
                    layer.msg("邀请链接复制失败!请到APP中 [我的]-[实用功能]-[分享app] 复制", {
                    shade: 0.4,
                    time: 1000,
                    shadeClose: false
                    }, function() {
                    });
                });
            },
            msgFun: function(val) {
      layer.msg(val, {
        time: 2000,
        shade: 0.1,
        shadeClose: true
      });
    },
        },
        mounted:function(){
           this.getActivity();
           this.getInviteCode();
           this.touch();
        }
    })
</script>