From 89e1b3074bc2bb0e7902569312f8a792ce194e15 Mon Sep 17 00:00:00 2001 From: unknown <zoechai229@gmail.com> Date: Sun, 12 May 2019 23:03:07 +1000 Subject: [PATCH] edited --- web_app_django/tweet/static/css/img.css | 20 ++++ web_app_django/tweet/static/img.js | 13 +++ web_app_django/tweet/static/js/img.js | 0 web_app_django/tweet/templates/index.html | 115 ++++++++++++++++++---- web_app_django/tweet/views.py | 1 + 5 files changed, 129 insertions(+), 20 deletions(-) create mode 100644 web_app_django/tweet/static/css/img.css create mode 100644 web_app_django/tweet/static/img.js create mode 100644 web_app_django/tweet/static/js/img.js diff --git a/web_app_django/tweet/static/css/img.css b/web_app_django/tweet/static/css/img.css new file mode 100644 index 0000000..9affde1 --- /dev/null +++ b/web_app_django/tweet/static/css/img.css @@ -0,0 +1,20 @@ + +a.snapchat{ + position: relative; + background: lightgrey; + } + + a.snapchat img { + position: absolute; + opacity: 0; + width: 100px; + height: 100px; + left: 0; + top: -20px; + transition: opacity .5s, top .5s; + } + + a.snapchat:hover img { + opacity: 1; + top: 20px; + } \ No newline at end of file diff --git a/web_app_django/tweet/static/img.js b/web_app_django/tweet/static/img.js new file mode 100644 index 0000000..365ba8f --- /dev/null +++ b/web_app_django/tweet/static/img.js @@ -0,0 +1,13 @@ + +<script> + + $(document).ready(function(){ + $("#Image").mouseover(function(){ + $("#Image").show(); + }); + $("#Image").mouseout(function(){ + $("#Image").hide(); + }); + }); + +</script> diff --git a/web_app_django/tweet/static/js/img.js b/web_app_django/tweet/static/js/img.js new file mode 100644 index 0000000..e69de29 diff --git a/web_app_django/tweet/templates/index.html b/web_app_django/tweet/templates/index.html index 8dc9394..92f7a04 100644 --- a/web_app_django/tweet/templates/index.html +++ b/web_app_django/tweet/templates/index.html @@ -1,26 +1,90 @@ {% load static %} -<html> <head> - <title>Comfy Django</title> - </head> - <body> - <h1>CouchDB in Django</h1> - <form method="post" action="."> - <script> - var valmel = "{{city.value}}"; - - </script> - <img src="https://www.teachingtreasures.com.au/teaching-tools/gknowledgeK-3/major-cities/aussiemap.gif" - style='position:absolute;left:15px;top:35px;z-index:0;'width="745" height="586" alt="MapTest" usemap="#ausmap"> - <img src="{% static 'images/circle.png'%}" - style='position:absolute;left:520px;top:455px;z-index:1;'width= height="150"alt="circlemel"> - - <map name="ausmap"> - <area shape="circle" coords="567,483,25" alt="Melbourne" href="sun.htm"> - - </map> +<!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="http://a.amap.com/Loca/static/manual/example/style/demo.css" rel="stylesheet"> + <style> + html, + body, + #container { + margin: 0; + padding: 0; + width: 100%; + height: 100%; + } + </style> +</head> +<body> +<div id="container" class="container"> +</div> +<!--<script src="./script/loca.js"></script>--> +<script src="http://webapi.amap.com/loca?v=1.2.0&key=393144ee0738b91f3e93b0c6d0c36562"></script> +<script src="http://a.amap.com/Loca/static/manual/example/script/demo.js"></script> +<!-- <script src=".\infoshow.js"></script> --> +<script src="./district.js"></script> +<script> + var map = Loca.create('container', { + mapStyle: 'amap://styles/e32987d0e34dadd472724015bb64a0f8', + zoom: 4, + center: [135, -28] + }); + + var layer = Loca.visualLayer({ + eventSupport: true, // selectStyle 配置需要开启 eventSupport: true + container: map, + type: 'point', + shape: 'circle' + }); + + layer.on('mousemove', function (ev) { + // 事件类型 + var type = ev.type; + // 当前元素的原始数据 + var rawData = ev.rawData; + + // 原始鼠标事件 + var originalEvent = ev.originalEvent; + + openInfoWin(map.getMap(), originalEvent, { + 'City': rawData.name, + 'Location': rawData.center + }); + }); + + layer.on('mouseleave', function (ev) { + closeInfoWin(); + }); + + layer.setData(districts, { + lnglat: 'center' + }); + + layer.setOptions({ + style: { + radius: 5, + color: '#4fc2ff', + borderColor: '#ffffff', + borderWidth: 1.5, + opacity: 0.8 + }, + selectStyle: { + radius: 14, + color: '#ffe30a' + } + }); + + layer.render(); + - + +</script> + + <hr> {% if cityInfo %} @@ -32,6 +96,17 @@ {%else%} <hr>NO DATA</hr> {% endif %} + + <td>{{melbourne}}</td> + <td>{{sydney}}</td> + <td>{{adelaide}}</td> + <td>{{perth}}</td> + <td>{{brisbane}}</td> + <td>{{NswCount}}</td> + <td>{{VicCount}}</td> + <td>{{SacCount}}</td> + + diff --git a/web_app_django/tweet/views.py b/web_app_django/tweet/views.py index 30b18fe..eeff1aa 100644 --- a/web_app_django/tweet/views.py +++ b/web_app_django/tweet/views.py @@ -52,6 +52,7 @@ def index(request): #print(docs) #print(docs.view('city/city-view',key = "melbourne")) countId = [] + countDomesitc = 0 #print(docs['f6376ce946ac201c045408615e00d502']) for doc in docsNsw: features = docsNsw[doc]['features'] -- GitLab