zhaojs
2023-06-27 5f4967d154f9c633b74744d3b1aafd2cf401a196
no message
已添加2个文件
已修改1个文件
461 ■■■■■ 文件已修改
application/index/controller/User.php 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
application/index/view/user/registersms.html 127 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/assets/index/js/xiguazhu5.js 322 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
application/index/controller/User.php
@@ -20,7 +20,7 @@
class User extends Frontend
{
    protected $layout = '';
    protected $noNeedLogin = ['login', 'register','register1', 'getInvitationInfo','phoneIsRegister'];
    protected $noNeedLogin = ['login', 'registersms','register','register1', 'getInvitationInfo','phoneIsRegister'];
    protected $noNeedRight = ['*'];
    public function _initialize()
@@ -44,6 +44,16 @@
        return $this->view->fetch();
    }
    /**
     * æ³¨å†Œä¼šå‘˜
     */
    public function registersms()
    {
        $this->assign('appName',config('site.name'));
        return $this->view->fetch();
    }
    public function getInvitationInfo()
    {
        $invite_code = request()->param('code','','trim');
application/index/view/user/registersms.html
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,127 @@
<!doctype HTML>
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <meta content="telephone=no" name="format-detection" />
        <meta name="viewport"
            content="width=device-width,initial-scale=1,maximum-scale=1.0,user-scalable=no,viewport-fit=cover" />
        <title>{$appName}</title>
        <!-- å¼•å…¥vuejs框架 -->
        <script src="__CDN__/assets/index/js/vue.js"></script>
        <script type="text/javascript" src="https://public.ffquan.cn/lib/clipboard.min.js"></script>
        <script src="__CDN__/assets/index/js/axios.min.js"></script>
        <script src="__CDN__/assets/index/js/md5.js"></script>
        <script src="__CDN__/assets/index/js/xiguazhu.js"></script>
        <script src="__CDN__/assets/index/js/xiguazhu2.js"></script>
        <link rel="stylesheet" href="__CDN__/assets/index/css/index.css">
    </head>
    <body>
        <div class="g-doc">
            <div id="app" v-cloak>
                <div class="hander">
                    <img src="https://yanfeiobpub.obs.cn-east-3.myhuaweicloud.com/dfg/reg_2.png">
                </div>
                <div class="user">
                    <div class="user-name">
                        <div class="userimg">
                            <img :src="invitationInfo.avatar" style="border-radius: 1rem;">
                        </div>
                        <div>
                            <div><span class="telPhon">{{invitationInfo.nickname}} </span></div>
                            <div class="remck">正在邀请您下载{{appName}} </div>
                        </div>
                    </div>
                    <div class="yqm" style="margin: 20px 0;" @click="handleClipboard"><span style="display:block ;text-align:center;font-size:21px;">邀请码:
                        {{invitationInfo.invitation_code}}</span><span style="display: block; text-align:center;font-size:12px;color:#999999;">(点击复制邀请码)</span></div>
                    <div class="btn"  @click="goDownload">
                        ç«‹å³ä¸‹è½½
                    </div>
                </div>
                <div class="btnList">
                    <div class="iconStyle">
                        <div class="iconStyleImg">
                            <img src="__CDN__/assets/index/img/img1.png" alt="">
                        </div>
                        <div style="text-align: center;">
                            é¢†åˆ¸ä¸‹å•不止省百元
                        </div>
                    </div>
                    <div class="iconStyle">
                        <div class="iconStyleImg">
                            <img src="__CDN__/assets/index/img/img2.png" alt="">
                        </div>
                        <div style="text-align: center;">
                            è´­ç‰©è¿”佣最高100%
                        </div>
                    </div>
                    <div class="iconStyle">
                        <div class="iconStyleImg">
                            <img src="__CDN__/assets/index/img/img3.png" alt="">
                        </div>
                        <div style="text-align: center;">
                            é‚€è¯·æ–°äººåŠ å…¥å¥–åŠ±
                        </div>
                    </div>
                    <div class="iconStyle">
                        <div class="iconStyleImg">
                            <img src="__CDN__/assets/index/img/img4.png" alt="">
                        </div>
                        <div style="text-align: center;">
                            å®˜æ–¹æ‰¶æŒ0成本赚钱
                        </div>
                    </div>
                </div>
                <div class="goodsList">
<img class="goodsList" src="https://yanfeiobpub.obs.cn-east-3.myhuaweicloud.com/dfg/reg_1.png"/>
                </div>
<!--     <div style="margin-top: 100px;"></div> -->
            <!--     <div class="goodsList">
                    <div class="henderTitle">
                        <img src="__CDN__/assets/index/img/titleimg.png" />
                    </div>
                    <div class="goodsListCen">
                        <div class="goods" v-for="(item,index) in goodslist" :key="index">
                            <img class="goodsImg" :src="item.image" alt="">
                            <div class="goodsTitle">{{item.title}}</div>
                            <div class="goodsBtn">免费领取</div>
                        </div>
                    </div>
                </div>-->
                <div class="footer">
                    <div>{{beian}}</div>
                </div>
                <!-- å¼¹çª— -->
                <div v-if="showType" class="shadow">
                    <div class="popup">
                        <div class="logo">
                            <img :src="appLogo" />
                        </div>
                        <div class="popupCongratulate"> {{tips}} </div>
                        <div class="popupSon">{{tips2}}</div>
                        <div class="btnApp" @click="goDownload">
                            ç«‹å³ä¸‹è½½App
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
    <script>
        const apiUrl = "你的域名";
        const appName2 = "";
    </script>
    <!-- è¯·æ±‚域名如果不想直接暴露出来 -->
    <script src="__CDN__/assets/index/js/xiguazhu5.js?v=1.0.1"></script>
</html>
public/assets/index/js/xiguazhu5.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,322 @@
new Vue({
    el: '#app', // é€‰æ‹©å™¨
    data: {
        show: 0,
        count: '',
        timer: null,
        agreeType: true, //
        tel: "", //手机号
        verification: '', //验证码
        showType: false,
        invitationInfo: "",
        privacyAgreement:"",
        userAgreement:"",
        appName: "",
        appLogo:"",
        beian:"",
        iosUrl:"",
        androidUrl:"",
        tips: "恭喜你,注册成功~",
        tips2: "欢迎您加入,赶紧下载APP,领取您的新人免单专属福利吧~",
        goodslist: [
        {"image": "https://img.alicdn.com/i3/880734502/O1CN01eDKk7i1j7xhJ5c7jV_!!880734502.jpg_310x310.jpg_.webp",
            "title": "手撕面包2斤"
        },
        {"image": "https://img.alicdn.com/imgextra/i2/2201188731272/O1CN01sR96eg1LGcSFr2aTK_!!2201188731272.jpg_310x310.jpg_.webp",
            "title": "Unifree洗脸巾"
        },
        {"image": "https://img.alicdn.com/imgextra/i4/2479240580/O1CN01g1cwOs1G9gTFkXFGZ_!!2479240580.png_310x310.jpg_.webp",
            "title": "手持小风扇"
        },
        {"image": "https://img.alicdn.com/i4/2203738468138/O1CN01glAoIC29zFvNJAGhW_!!2203738468138.jpg_310x310.jpg_.webp",
            "title": "牛油果沐浴露"
        },
        {"image": "https://img.alicdn.com/imgextra/i4/438927567/O1CN01vaRzJN25ljmb0wxZR_!!438927567.jpg_310x310.jpg_.webp",
            "title": "无糖薄荷糖"
        },
        {"image": "https://img.alicdn.com/imgextra/i1/503512336/O1CN01wTeXWv1T7vxTSWEr2_!!503512336.jpg_310x310.jpg_.webp",
            "title": "高蛋白鸡胸肉"
        },
        {"image": "https://img.alicdn.com/imgextra/i4/441512085/O1CN017tZRxE1RGyY2vgJF2_!!441512085.jpg_310x310.jpg_.webp",
            "title": "4只鲜肉粽子"
        },
        {"image": "https://img.alicdn.com/imgextra/i1/1952819637/O1CN01rQrJu32L3nddEPV0l_!!1952819637.jpg_310x310.jpg_.webp",
            "title": "加厚无芯卷纸"
        },
        {"image": "https://img.alicdn.com/i1/54801414/O1CN01jaEMbE1MJemh7RYJK_!!54801414.jpg_310x310.jpg_.webp",
            "title": "大樱桃车厘子"
        }],
    },
    created() {
        this.getInvitationInfo();
        this. judgeWeb();
        this.goDownload();
    },
    mounted() {
        //  è®¿é—®vm1 data的数据
    },
    methods: {
        getcode() {
            const times = 60; // å€’计时时间
            if (!this.timer) {
                this.count = times;
                this.show = 1;
                this.timer = setInterval(() => {
                    if (this.count > 0 && this.count <= times) {
                        this.count--;
                    } else {
                        this.show = 2;
                        clearInterval(this.timer);
                        this.timer = null;
                    }
                }, 1000)
            }
        },
        //立即下载
        download() {
            this.showType = true;
        },
        //注册即同意
        agreeCen() {
            this.agreeType = !this.agreeType
        },
        //复制
        handleClipboard() {
            var _this = this;
            var clipboardImg = new Clipboard('.yqm', {
                text: function() {
                    return _this.invitationInfo.invitation_code;
                },
            });
            clipboardImg.on('success', function(e) {
               alert("邀请码复制成功,赶快下载APP,尽享优惠吧~")
            });
            clipboardImg.on('error', function(e) {
                alert("邀请码复制失败,您可直接至APP中注册后填写此邀请码")
            });
        },
        getInvitationInfo() {
            var code = vmRequest("code");
            //alert(code);
            //以param属性的形式来传递参数
            axios({
                method: "post", //请求方式
                url: "/index/user/getInvitationInfo", //请求路径
                params: {
                    "code": code
                } //传递参数
                //使用 ç®­å¤´è¡¨è¾¾å¼=> åœ¨ä»£æ›¿åŽŸæœ‰çš„function来做回调函数
            }).then(result => {
                if (result.data.code == 1) {
                    alert(result.data.msg);
                } else {
                    this.invitationInfo = result.data.info.user;
                    this.appName = result.data.info.appName;
                    this.privacyAgreement = result.data.info.privacyAgreement;
                    this.userAgreement = result.data.info.userAgreement;
                    this.appLogo = result.data.info.logo;
                    this.beian = result.data.info.beian;
                    this.iosUrl = result.data.info.appIosDownUrl;
                    this.androidUrl = result.data.info.appAndroidDownUrl;
                }
            })
        },
        phoneIsRegister() {
            if (!this.tel) {
                alert("手机号不能为空")
                return false;
            }
            axios({
                method: "post", //请求方式
                url: "/index/user/phoneIsRegister", //请求路径
                params: {
                    "phone": this.tel
                } //传递参数
                //使用 ç®­å¤´è¡¨è¾¾å¼=> åœ¨ä»£æ›¿åŽŸæœ‰çš„function来做回调函数
            }).then(result => {
                if (result.data.code == 1) {
                    alert(result.data.msg);
                } else {
                    // å·ç æœªæ³¨å†Œ å‘送验证码请求
                    // å·ç å·²ç»æ³¨å†Œ
                    console.log(result.data)
                    if(result.data.is_registered == 1){
                        this.tips = "您的帐号已经注册";
                        this.tips2 = "欢迎您加入"+this.appName+",赶紧下载APP,赚取佣金吧~";
                        this.showType = true;
                        this.show = 1 //结束验证码
                        //alert(result.data.message);
                    }else{
                        this.sendCode();
                    }
                }
            })
        },
        // å‘送验证码
        sendCode() {
            console.log("发送验证码")
            var timerChuo = new Date().getTime()
            // æ‹¼å‡‘数据
            var sendInfo = {
                event: 'register',
                mobile: this.tel,
            };
            axios({
                method: "post", //请求方式
                url: "/api/sms/send", //请求路径
                data: sendInfo
                // headers: {
                //     'Content-Type': 'application/json;charset=UTF-8'
                // },
                //传递参数
                //使用 ç®­å¤´è¡¨è¾¾å¼=> åœ¨ä»£æ›¿åŽŸæœ‰çš„function来做回调函数
            }).then(result => {
                if (result.data.code == 1) {
                    // å·ç å·²ç»æ³¨å†Œ
                    alert( result.data.msg);
                } else {
                    // å·ç æœªæ³¨å†Œ å‘送验证码请求
                    //alert("验证码发送成功" + result.data.message);
                    this.getcode();
                }
            })
        },
        goDownload() {
            // åˆ¤æ–­æ˜¯IOS还是安卓? è·³è½¬å¯¹åº”下载页面
            /* var u = navigator.userAgent;
            var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
            var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
            if (isiOS) {
                //window.location = this.iosUrl;
                window.location="https://apps.apple.com/cn/app/id6449449829"
            } else if (isAndroid) {
                window.location = this.androidUrl;
            } */
            var agen=this.verifyBrand();
            var marketUrl=this.androidUrl;
                    switch(agen)
                    {
                        case'iphone':
                         marketUrl="https://apps.apple.com/cn/app/id6449449829";
                            break;
                        case'xiaomi':
                        marketUrl="mimarket://details?id=com.dafanguan.app";
                            break;
                        case'huawei':
                        marketUrl="appmarket://details?id=com.dafanguan.app";
                            break;
                        case'oppo':
                        marketUrl="oppomarket://details?packagename=com.dafanguan.app";
                            break;
                        case'vivo':
                        marketUrl="vivomarket://details?id=com.dafanguan.app";
                            break;
                        default:
                            marketUrl = this.androidUrl;
                    }
                    window.location = marketUrl;
             },
            verifyBrand()
            {//判断机子类型
                const userAgent = navigator.userAgent.toLowerCase()
                const isIphone = userAgent.match(/(iphone|ipad|ipod)/i);
                const isHuawei = userAgent.match(/huawei/i);
                const isHonor = userAgent.match(/honor/i);
                const isOppo = userAgent.match(/oppo/i);
                const isOppoR15 = userAgent.match(/PACM00/i);
                const isVivo = userAgent.match(/vivo/i);
                const isXiaomi = userAgent.match(/mi\s/i);
                const isXIAOMI = userAgent.match(/xiaomi/i);
                const isXiaomi2s = userAgent.match(/mix\s/i);
                const isRedmi = userAgent.match(/redmi/i);
                if (isIphone) {
                    return 'iphone'
                } else if (isHuawei || isHonor) {
                    return 'huawei';
                } else if (isOppo || isOppoR15) {
                    return 'oppo';
                } else if (isVivo) {
                    return 'vivo';
                } else if (isXiaomi || isRedmi || isXiaomi2s || isXIAOMI) {
                    return 'xiaomi';
                } else {
                    return 'other';
                }
            },
            judgeWeb()
            {
                var webName=this.isNeizhi();
                if(webName=='weixin')
                {
                    alert("请点击右上角,选择'在浏览器打开'~");
                }
                else if(webName=='QQ')
                {
                    alert("请点击右上角,选择'浏览器',打开本网址~");
                }
            },
            isNeizhi()
            {//判断是否内置浏览器
                var ua = navigator.userAgent.toLowerCase();
                // var browserName = "unknow";
                if (ua.match(/MicroMessenger/i) == "micromessenger") {
                    return "weixin";
                } else if (ua.match(/QQ/i) == "qq") {
                    return "QQ";
                } else if (ua.match(/Alipay/i) == "alipay" && payway == 2) {
                    return "alipay";
                }
            },
        /* ç”¨æˆ·æ³¨å†Œ */
        userRegist() {
            if (!this.tel) {
                alert("手机号不能为空")
                return false;
            }
            if (!this.verification) {
                alert("验证码不能为空")
                return false;
            }
            if (this.agreeType) {
                alert("请先阅读并同意《"+this.appName+"用户协议》《隐私政策》")
                return false;
            }
            // æ‹¼å‡‘数据
            var sendInfo = {
                mobile: this.tel,
                captcha: this.verification,
                invitation_code: this.invitationInfo.invitation_code
            };
            axios({
                method: "post", //请求方式
                url: "/api/user/register", //请求路径
                data: sendInfo,
                headers: {
                    'Content-Type': 'application/json;charset=UTF-8'
                },
                //传递参数
                //使用 ç®­å¤´è¡¨è¾¾å¼=> åœ¨ä»£æ›¿åŽŸæœ‰çš„function来做回调函数
            }).then(result => {
                if (result.data.code == 0) {
                    // æ³¨å†ŒæˆåŠŸ
                    this.tips2 = "欢迎您加入"+this.appName+",赶紧下载APP,赚取佣金吧~";
                    this.showType = true;
                } else {
                    //失败
                    alert("注册失败" + result.data.message);
                }
            })
        },
    }
})