Browse Source

地图完成

layui
yirenyishi 6 years ago
parent
commit
96ac2d44e4
  1. 1
      controllers/IndexController.go
  2. 12
      controllers/MapController.go
  3. 3
      routers/router.go
  4. 9
      static/css/common.css
  5. 13
      static/css/map.css
  6. 93
      static/css/reset.css
  7. 22
      views/T.header.tpl
  8. 22
      views/T.nav.tpl
  9. 7
      views/index.html
  10. 57
      views/map.html

1
controllers/IndexController.go

@ -9,5 +9,6 @@ type IndexController struct {
}
func (c *IndexController) Get() {
c.Data["IsHome"] = true
c.TplName = "index.html"
}

12
controllers/MapController.go

@ -0,0 +1,12 @@
package controllers
import "github.com/astaxie/beego"
type MapController struct {
beego.Controller
}
func (this *MapController) Get() {
this.Data["IsMap"] = true
this.TplName = "map.html"
}

3
routers/router.go

@ -6,8 +6,7 @@ import (
)
func init() {
//beego.Router("/login", &controllers.UserController{}, "get:LoginPage")
beego.Router("/", &controllers.IndexController{})
//beego.Router("/login", &controllers.UserController{}, "post:Login")
beego.Router("/map", &controllers.MapController{})
}

9
static/css/common.css

@ -0,0 +1,9 @@
.nav-container{
position: fixed;
width: 100%;
z-index: 1000;
}
.nav-container .sui-navbar .navbar-inner{
padding: 0 50px;
}

13
static/css/map.css

@ -0,0 +1,13 @@
.map-root {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
.map-root .map-container {
width: 100%;
height: 100%;
}

93
static/css/reset.css

@ -0,0 +1,93 @@
/**
* Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)
* http://cssreset.com
*/
html, body, div, span, applet, object, iframe, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header,
menu, nav, output, ruby, section, summary,
time, mark, audio, video, input {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font-weight: normal;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/* custom */
a {
color: #7e8c8d;
text-decoration: none;
-webkit-backface-visibility: hidden;
}
li {
list-style: none;
}
::-webkit-scrollbar {
width: 5px;
height: 5px;
}
::-webkit-scrollbar-track-piece {
background-color: rgba(0, 0, 0, 0.2);
-webkit-border-radius: 6px;
}
::-webkit-scrollbar-thumb:vertical {
height: 5px;
background-color: rgba(125, 125, 125, 0.7);
-webkit-border-radius: 6px;
}
::-webkit-scrollbar-thumb:horizontal {
width: 5px;
background-color: rgba(125, 125, 125, 0.7);
-webkit-border-radius: 6px;
}
html, body {
width: 100%;
height: 100%;
}
body {
-webkit-text-size-adjust: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
.cursor{
cursor: pointer
}

22
views/T.header.tpl

@ -4,27 +4,9 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<title>个人随笔</title>
<meta name="description" content="个人随笔是一个面向IT技术人员,提供个人平时工作总结和在线记录学习笔记,个人技术博客,在线云笔记,码农笔录,最新的技术博客,www.aiprose.com">
<meta name="keywords" content="个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,www.aiprose.com,aiprose.com,aiprose">
<link href="http://g.alicdn.com/sj/dpl/1.5.1/css/sui.min.css" rel="stylesheet">
<script type="text/javascript" src="http://g.alicdn.com/sj/lib/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="http://g.alicdn.com/sj/dpl/1.5.1/js/sui.min.js"></script>
</head>
<body>
<div class='container'>
<div class="sui-navbar">
<div class="navbar-inner">
<a href="/" class="sui-brand">个人随笔</a>
<ul class="sui-nav">
<li class="active"><a href="/">首页</a></li>
<li><a href="#">笔记</a></li>
<li><a href="#">地图</a></li>
</ul>
<form class="sui-form sui-form pull-right">
<input type="text" placeholder="宝贝/店铺名称...">
<button class="sui-btn">搜索</button>
</form>
</div>
</div>
</div>
{{end}}

22
views/T.nav.tpl

@ -0,0 +1,22 @@
{{define "nav"}}
<div class='nav-container'>
<div class="sui-navbar">
<div class="navbar-inner">
<a href="/" class="sui-brand">个人随笔</a>
<ul class="sui-nav">
<li {{if .IsHome}}class="active"{{end}}><a href="/">首页</a></li>
<li {{if .IsNote}}class="active"{{end}}><a href="/note">笔记</a></li>
<li {{if .IsMap}}class="active"{{end}}><a href="/map">地图</a></li>
</ul>
<form class="sui-form sui-form pull-left">
<input type="text" placeholder="宝贝/店铺名称...">
<button class="sui-btn">搜索</button>
</form>
<ul class="sui-nav pull-right">
<li><a href="#">个人中心</a></li>
<li><a href="#">帮助</a></li>
</ul>
</div>
</div>
</div>
{{end}}

7
views/index.html

@ -1,4 +1,9 @@
{{template "header"}}
<title>首页 - 个人随笔</title>
</head>
<body>
<div class='container'>
{{template "nav" .}}
</div>
</body>
</html>

57
views/map.html

@ -0,0 +1,57 @@
{{template "header"}}
<title>谷歌影像图 - 个人随笔</title>
<script type="text/javascript"
src="https://webapi.amap.com/maps?v=1.4.10&key=74c9586333eaf8d6191c576cf59739fa"></script>
<script src="https://webapi.amap.com/ui/1.0/main.js"></script>
<link type="text/css" rel="styleSheet" href="/static/css/common.css"/>
<link type="text/css" rel="styleSheet" href="/static/css/map.css" />
</head>
<body>
{{template "nav" .}}
<div class="map-root">
<div id="map-container" class="map-container"></div>
</div>
</body>
<script>
var googleLayerimage = new AMap.TileLayer({
getTileUrl: 'https://mt{1,2,3,0}.google.cn/maps/vt?lyrs=s@194&hl=zh-CN&gl=cn&x=[x]&y=[y]&z=[z]',
zIndex: 2
})
var googleLayervector = new AMap.TileLayer()
// var roadNet = new AMap.TileLayer.RoadNet()
var mapObj = new AMap.Map('map-container', {
layers: [googleLayervector, googleLayerimage],
center: [108.963148, 34.232709],
zoom: 11
})
var marker = new AMap.Marker({
position: new AMap.LngLat(108.963148, 34.232709),
map: mapObj
})
AMap.event.addListener(marker, 'click', function () {
AMapUI.loadUI(['overlay/SimpleInfoWindow'], function (SimpleInfoWindow) {
var infoWindow = new SimpleInfoWindow({
infoTitle: '<strong>我的位置</strong>',
infoBody: '<p>我在这里、看我</p>',
offset: new AMap.Pixel(0, -30),
autoMove: true
})
infoWindow.open(mapObj, e.target.getPosition())
})
})
AMapUI.loadUI(['overlay/SimpleInfoWindow'], function (SimpleInfoWindow) {
var infoWindow = new SimpleInfoWindow({
infoTitle: '<strong>我的位置</strong>',
infoBody: '<p>我在这里、看我</p>',
offset: new AMap.Pixel(0, -30),
autoMove: true
})
infoWindow.open(mapObj, new AMap.LngLat(108.963148, 34.232709))
})
</script>
</html>
Loading…
Cancel
Save