admin
2025-08-20 f318c9c7c127b00f353bf45f273096d1dc4b424f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
        <title>福利发放</title>
        <link rel="stylesheet" type="text/css" href="layui/css/layui.css" />
        <script>
            window.onresize = function () {
                document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + 'px';
            };
            window.onresize();
        </script>
        <script src="js/jquery.min.js"></script>
        <script src="layui/layui.js"></script>
        <style>
            body{
                background: #FFF;
            }
            .container{
                display: flex;
                 align-items: center;
                 flex-direction: column;
            }
            .edit{
                border-radius: 0.2rem;
                width: 80%;
                margin-top: 0.6rem;
            }
            .money {
                border-radius: 0.1rem;
                width: 80%;
                margin-top: 0.4rem;
                display: none;
            }
            
            .btn{
                background-color: #FF2B4B;
                border-radius: 0.1rem;
                width: 80%;
                margin-top: 0.4rem;
                font-size: 0.25rem;
            }
            
        </style>
    </head>
    <body>
        
        <div class="container">
            <img  src="img/icon.png" style="width: 40%;margin-top: 1rem;"/>
            
            <textarea class="layui-textarea edit" placeholder="长按粘贴口令"></textarea>
 
            <input class="layui-input money" placeholder="请输入付款金额" />
            
            <button class="layui-btn btn" >提交</button>
            
        </div>
 
        <!-- 新增底部菜单 -->
        <div class="footer-menu">
            <a href="/index3.html" class="menu-item">
                <img src="../img/command_fill.png" alt="口令" class="menu-icon">
                <span>口令</span>
            </a>
            <a href="/credit/index.html" class="menu-item active">
                <img src="../img/credit.png" alt="积分" class="menu-icon">
                <span>积分</span>
            </a>
        </div>
 
        <style>
            /* 新增样式:底部菜单 */
            .footer-menu {
                position: fixed;
                bottom: 0;
                left: 0;
                width: 100%;
                display: flex;
                justify-content: space-around;
                background-color: #fff;
                border-top: 1px solid #eee;
                padding: 0.5rem 0;
                box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
            }
 
            .menu-item {
                display: flex;
                flex-direction: column;
                align-items: center;
                text-decoration: none;
                color: #666;
                font-size: 0.24rem;
            }
 
            .menu-item.active {
                color: #000;
            }
 
            .menu-icon {
                width: 0.4rem;
                height: 0.4rem;
                margin-bottom: 0.1rem;
            }
        </style>
        
        <script>
            $(function(){
               function  getQueryString(name) {
                    console.log(window.location.search)
                    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
                    var r = window.location.search.substr(1).match(reg);
                    if (r != null)
                        return unescape(decodeURI(r[2]));
                    return null;
                }
                var state = getQueryString("state");
                var msg = getQueryString("msg");
                var a=getQueryString("a");
                if(state=="SUCCESS"){
                  layer.msg("提交成功");
                }else if(state =="FAIL"){
                    if(msg!=null&&msg!=undefined&&msg!=""){
                        layer.msg(msg);
                    }else {
                        layer.msg("提交失败");
                    }
                }
 
                $(".btn").click(function(){
                    var text = $(".edit").val();
                    var money = $(".money").val();
                    if (text.length <= 0) {
                        layer.msg("请输入口令");
                        return;
                    }
                    
                    if(a==null||a==undefined||a.length<=0){
                        layer.msg("非渠道链接");
                        return;
                    }
                    
                    // const moneyRegex = /^\d+(\.\d{1,2})?$/;
                    // if (!moneyRegex.test(money)) {
                    //     layer.msg("付款金额输入错误");
                    //     return;
                    // }
                    var index = layer.load();
                    // 上传口令
                    $.post("/webapi/submitKeyV4",{"key":text,"money": money},function(response){
                        layer.close(index);
                        if(response.code==0){
                            layer.msg("提交成功");
                             $(".edit").val("");
                             window.location.href ="result.html?id="+response.data.id;
                        } else if(response.code==1001){
                            window.location.replace(response.data.link);
                        }else{
                            layer.msg(response.msg);
                        }
                    },'json').fail(function(jqXHR, textStatus, errorThrown){
                        layer.close(index);
                        layer.msg("网络请求失败");
                    });
                });
                
                
            });
            
        </script>
        
    
    </body>
</html>