admin
2019-03-13 69bee82b81626b82b7f39f0e459e4f56b1699b51
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
<!DOCTYPE html>
<html lang="zh-cn">
 
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>短连接</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/maincontent.css" rel="stylesheet">
<link href="css/tablestyle.css" rel="stylesheet">
</head>
 
<body>
    <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
    </nav>
    <div id="mainbody">
        <div id="sidebar">
            <dl>
            </dl>
        </div>
        <div id="neirong">
            <div class="header">
                <h4 class="shujutitle">链接转换</h4>
                <div class="fenge"></div>
            </div>
            
            <table class="table">
                <tbody>
                    <tr>
                        <td><form class="form-horizontal" role="form">
                                <div class="form-group">
                                    <label for="input10" class="changdu3 control-label">长链接</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control longurl" placeholder="">
                                    </div>
                                </div>
                            </form></td>
                    </tr>
                </tbody>
            </table>
            <table class="table">
                <tbody>
                    <tr>
                        <td><form class="form-horizontal" role="form">
                                <div class="form-group">
                                    <label for="input10" class="changdu3 control-label">短连接</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control shorturl" placeholder="">
                                    </div>
                                </div>
                            </form></td>
                    </tr>
                </tbody>
            </table>
            
            
            <table class="table">
                <tbody>
                    <tr>
                        <td>
                            <form class="form-horizontal" role="form">
                                <div class="form-group">
                                    <div class="button0">
                                        <div class="button">
                                            <button type="button" name="convert"
                                                class="btn btn-primary convertLink">转换短连接
                                            </button>
                                        </div>
                                        <div class="button">
                                                <button type="button" name="open" 
                                                    class="btn btn-primary open">查看链接
                                                </button>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
 
 
    <script src="//cdn.bootcss.com/jquery/1.10.1/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/page.js"></script>
    <script src="js/nav.js"></script>
    <script src="layer/layer.js"></script>
    <script>
        $(function(){
            
            $(".convertLink").click(function(){
                    var url = $(".longurl").val();
                    $.post("api/v1/push/convertLink",{"url":url},function(data){
                        if(data.code==0){
                            layer.msg("转换成功!");
                             $(".shorturl").val(data.data.shortLink);
                             $(".open").attr("onclick","window.open('"+ data.data.shortLink + "')");
                        }
                    },'json')
            });
            
            /* $(".open").click(function(){
                var accesskey  = $(this).attr("accesskey");
                window.location.href=accesskey;
            }); */
            
        });
            
    </script>
</body>
 
</html>