+ add guest view

This commit is contained in:
tix 2018-02-02 16:36:47 +08:00
parent c7329d0fc7
commit f929657671
9 changed files with 1562 additions and 369 deletions

View File

@ -6,33 +6,32 @@ var models_eco_v1 = require('../model/sjy_eco_v1.js');
router.get('/', function (req, res, next) { router.get('/', function (req, res, next) {
res.render('login', { res.render('login', {
page_title: '登录' page_title: '登录'
}); });
}); });
router.post('/', function (req, res, next) { router.post('/', function (req, res, next) {
var username = req.body.username; var username = req.body.username;
var password = req.body.password; var password = req.body.password;
var hashedPassword = crypto.createHash('md5').update(password).digest('hex'); var hashedPassword = crypto.createHash('md5').update(password).digest('hex');
models_eco_v1.login(username).then(function (data) { models_eco_v1.login(username).then(function (data) {
console.log(data); if (data) {
if (data) { if (data.password === hashedPassword) {
if (data.password === hashedPassword) { req.session.user = data;
req.session.user = data; res.redirect('/');
res.redirect('/'); } else {
} else { res.flash('info', '用户名和密码不正确,请输入正确的用户名和密码!');
res.flash('info', '用户名和密码不正确,请输入正确的用户名和密码!'); res.redirect('/login');
res.redirect('/login'); }
} } else {
} else { res.flash('info', '用户名不存在,请输入正确的用户名!');
res.flash('info', '用户名不存在,请输入正确的用户名!'); res.redirect('/login');
res.redirect('/login'); }
}
}).catch(function (err) { }).catch(function (err) {
console.log(err); console.log(err);
}); });
}); });
module.exports = router; module.exports = router;

View File

@ -34,10 +34,10 @@
<img src="/images/logo.png" alt="三江源"> <img src="/images/logo.png" alt="三江源">
<img src="/images/title.png" alt="三江源"> <img src="/images/title.png" alt="三江源">
<% if(user) {%> <% if(user) {%>
<a href="/logout"><span><i class="anticon anticon-logout"></i></span></a> <a href="/logout" title="退出登录"><span><i class="anticon anticon-logout"></i> 退出</span></a>
<span style="float:right;"><%= user.realname %></span> <span style="float:right;"><%= user.realname %></span>
<% } else { %> <% } else { %>
<a href="/login"><span><i class="anticon anticon-login"></i></span></a> <a href="/login" title="用户登录"><span><i class="anticon anticon-user"></i> 登录</span></a>
<% } %> <% } %>
</div> </div>
<ul class="main-nav-menu navbar-nav"> <ul class="main-nav-menu navbar-nav">

File diff suppressed because one or more lines are too long

View File

@ -14388,39 +14388,68 @@
$.extend($.fn.bootstrapTable.columnDefaults, { $.extend($.fn.bootstrapTable.columnDefaults, {
sortable: true sortable: true
}); });
$('.bt_table_station_forest').bootstrapTable({
url: '/api/gis/sjy_station_forest',
search: 'true',
showRefresh: 'true',
showToggle: 'true',
showColumns: 'true',
pagination: 'true',
pageSize: '20',
columns: [{
field: 'sta_name',
title: '站(点)名称'
}, {
field: 'sta_code',
title: '站(点)代码'
}, {
field: 'obs_type',
title: '类型'
}, {
field: 'county',
title: '所属行政区域'
}, {
field: 'longitude',
title: '经度'
}, {
field: 'latitude',
title: '纬度'
}, {
field: 'alitude',
title: '海拔(米)'
}]
});
loadStationMap('sjy_station_forest'); loadStationMap('sjy_station_forest');
</script>
<script type="text/javascript">
var user = "<%= user %>";
if (user) {
$('.bt_table_station_forest').bootstrapTable({
url: '/api/gis/sjy_station_forest',
search: 'true',
showRefresh: 'true',
showToggle: 'true',
showColumns: 'true',
pagination: 'true',
pageSize: '20',
columns: [{
field: 'sta_name',
title: '站(点)名称'
}, {
field: 'sta_code',
title: '站(点)代码'
}, {
field: 'obs_type',
title: '类型'
}, {
field: 'county',
title: '所属行政区域'
}, {
field: 'longitude',
title: '经度'
}, {
field: 'latitude',
title: '纬度'
}, {
field: 'alitude',
title: '海拔(米)'
}]
});
}
else {
$('.bt_table_station_forest').bootstrapTable({
url: '/api/gis/sjy_station_forest',
search: 'true',
showRefresh: 'true',
showToggle: 'true',
showColumns: 'true',
pagination: 'true',
pageSize: '20',
columns: [{
field: 'sta_name',
title: '站(点)名称'
}, {
field: 'sta_code',
title: '站(点)代码'
}, {
field: 'obs_type',
title: '类型'
}, {
field: 'county',
title: '所属行政区域'
}]
});
}
</script> </script>

View File

@ -40033,6 +40033,13 @@
$.extend($.fn.bootstrapTable.columnDefaults, { $.extend($.fn.bootstrapTable.columnDefaults, {
sortable: true sortable: true
}); });
loadStationMap('sjy_station_grassland');
</script>
<script type="text/javascript">
var user = "<%= user %>";
if (user) {
$('.bt_table_sjy_station_grassland').bootstrapTable({ $('.bt_table_sjy_station_grassland').bootstrapTable({
url: '/api/gis/sjy_station_grassland', url: '/api/gis/sjy_station_grassland',
search: 'true', search: 'true',
@ -40064,7 +40071,30 @@
title: '海拔(米)' title: '海拔(米)'
}] }]
}); });
}
loadStationMap('sjy_station_grassland'); else {
$('.bt_table_sjy_station_grassland').bootstrapTable({
url: '/api/gis/sjy_station_grassland',
search: 'true',
showRefresh: 'true',
showToggle: 'true',
showColumns: 'true',
pagination: 'true',
pageSize: '20',
columns: [{
field: 'sta_name',
title: '站(点)名称'
}, {
field: 'sta_code',
title: '站(点)代码'
}, {
field: 'address',
title: '年份'
}, {
field: 'obs_type',
title: '类型'
}]
});
}
</script> </script>

View File

@ -22091,36 +22091,64 @@
title: '水位' title: '水位'
}] }]
}); });
$('.bt_table_sjy_station_hydrology').bootstrapTable({
url: '/api/gis/sjy_station_hydrology',
search: 'true',
showRefresh: 'true',
showToggle: 'true',
showColumns: 'true',
columns: [{
field: 'id',
title: '序号'
}, {
field: 'sta_name',
title: '站(点)名称'
}, {
field: 'sta_type',
title: '站(点)属性'
}, {
field: 'county',
title: '所属行政区域'
}, {
field: 'longitude',
title: '经度'
}, {
field: 'latitude',
title: '纬度'
}, {
field: 'altitude',
title: '海拔(米)'
}]
});
loadStationMap('sjy_station_hydrology'); loadStationMap('sjy_station_hydrology');
</script>
<script type="text/javascript">
var user = "<%= user %>";
if (user) {
$('.bt_table_sjy_station_hydrology').bootstrapTable({
url: '/api/gis/sjy_station_hydrology',
search: 'true',
showRefresh: 'true',
showToggle: 'true',
showColumns: 'true',
columns: [{
field: 'id',
title: '序号'
}, {
field: 'sta_name',
title: '站(点)名称'
}, {
field: 'sta_type',
title: '站(点)属性'
}, {
field: 'county',
title: '所属行政区域'
}, {
field: 'longitude',
title: '经度'
}, {
field: 'latitude',
title: '纬度'
}, {
field: 'altitude',
title: '海拔(米)'
}]
});
}
else {
$('.bt_table_sjy_station_hydrology').bootstrapTable({
url: '/api/gis/sjy_station_hydrology',
search: 'true',
showRefresh: 'true',
showToggle: 'true',
showColumns: 'true',
columns: [{
field: 'id',
title: '序号'
}, {
field: 'sta_name',
title: '站(点)名称'
}, {
field: 'sta_type',
title: '站(点)属性'
}, {
field: 'county',
title: '所属行政区域'
}]
});
}
</script> </script>

View File

@ -956,38 +956,6 @@
$.extend($.fn.bootstrapTable.columnDefaults, { $.extend($.fn.bootstrapTable.columnDefaults, {
sortable: true sortable: true
}); });
$('.bt_table').bootstrapTable({
url: '/api/gis/sjy_station_weather',
search: 'true',
showRefresh: 'true',
showToggle: 'true',
showColumns: 'true',
columns: [{
field: 'id',
title: '序号'
}, {
field: 'sta_name',
title: '站(点)名称'
}, {
field: 'sta_type',
title: '站(点)属性'
}, {
field: 'county',
title: '所属行政区域'
}, {
field: 'longitude',
title: '经度',
class: 'tc_100'
}, {
field: 'latitude',
title: '纬度',
class: 'tc_100'
}, {
field: 'altitude',
title: '海拔(米)',
class: 'tc_100'
}]
});
$('.bt_table_weather_month').bootstrapTable({ $('.bt_table_weather_month').bootstrapTable({
url: '/api/eco/sjy_weather_month', url: '/api/eco/sjy_weather_month',
@ -1041,3 +1009,64 @@
$('.fixed-table-toolbar').append('<div class="search pull-left">年份选择:</div>'); $('.fixed-table-toolbar').append('<div class="search pull-left">年份选择:</div>');
</script> </script>
<script type="text/javascript">
var user = "<%= user %>";
if (user) {
$('.bt_table').bootstrapTable({
url: '/api/gis/sjy_station_weather',
search: 'true',
showRefresh: 'true',
showToggle: 'true',
showColumns: 'true',
columns: [{
field: 'id',
title: '序号'
}, {
field: 'sta_name',
title: '站(点)名称'
}, {
field: 'sta_type',
title: '站(点)属性'
}, {
field: 'county',
title: '所属行政区域'
}, {
field: 'longitude',
title: '经度',
class: 'tc_100'
}, {
field: 'latitude',
title: '纬度',
class: 'tc_100'
}, {
field: 'altitude',
title: '海拔(米)',
class: 'tc_100'
}]
});
}
else {
$('.bt_table').bootstrapTable({
url: '/api/gis/sjy_station_weather',
search: 'true',
showRefresh: 'true',
showToggle: 'true',
showColumns: 'true',
columns: [{
field: 'id',
title: '序号'
}, {
field: 'sta_name',
title: '站(点)名称'
}, {
field: 'sta_type',
title: '站(点)属性'
}, {
field: 'county',
title: '所属行政区域'
}]
});
}
</script>

View File

@ -3931,37 +3931,65 @@
$.extend($.fn.bootstrapTable.columnDefaults, { $.extend($.fn.bootstrapTable.columnDefaults, {
sortable: true sortable: true
}); });
$('.bt_table_station_wetland').bootstrapTable({
url: '/api/gis/sjy_station_wetland',
search: 'true',
showRefresh: 'true',
showToggle: 'true',
showColumns: 'true',
columns: [{
field: 'sta_name',
title: '站(点)名称'
}, {
field: 'sta_code',
title: '站(点)代码'
}, {
field: 'obs_type',
title: '类型'
}, {
field: 'county',
title: '所属行政区域'
}, {
field: 'longitude',
title: '经度'
}, {
field: 'latitude',
title: '纬度'
}, {
field: 'alittude',
title: '海拔(米)'
}]
});
loadStationMap('sjy_station_water_soil_conservation'); loadStationMap('sjy_station_water_soil_conservation');
</script>
<script type="text/javascript">
var user = "<%= user %>";
if (user) {
$('.bt_table_station_wetland').bootstrapTable({
url: '/api/gis/sjy_station_wetland',
search: 'true',
showRefresh: 'true',
showToggle: 'true',
showColumns: 'true',
columns: [{
field: 'sta_name',
title: '站(点)名称'
}, {
field: 'sta_code',
title: '站(点)代码'
}, {
field: 'obs_type',
title: '类型'
}, {
field: 'county',
title: '所属行政区域'
}, {
field: 'longitude',
title: '经度'
}, {
field: 'latitude',
title: '纬度'
}, {
field: 'alittude',
title: '海拔(米)'
}]
});
}
else {
$('.bt_table_station_wetland').bootstrapTable({
url: '/api/gis/sjy_station_wetland',
search: 'true',
showRefresh: 'true',
showToggle: 'true',
showColumns: 'true',
columns: [{
field: 'sta_name',
title: '站(点)名称'
}, {
field: 'sta_code',
title: '站(点)代码'
}, {
field: 'obs_type',
title: '类型'
}, {
field: 'county',
title: '所属行政区域'
}]
});
}
</script> </script>

View File

@ -2822,36 +2822,64 @@
title: '长度比' title: '长度比'
}] }]
}); });
$('.bt_table_station_wetland').bootstrapTable({
url: '/api/gis/sjy_station_wetland',
search: 'true',
showRefresh: 'true',
showToggle: 'true',
showColumns: 'true',
columns: [{
field: 'sta_name',
title: '站(点)名称'
}, {
field: 'sta_code',
title: '站(点)代码'
}, {
field: 'obs_type',
title: '类型'
}, {
field: 'county',
title: '所属行政区域'
}, {
field: 'longitude',
title: '经度'
}, {
field: 'latitude',
title: '纬度'
}, {
field: 'alitude',
title: '海拔(米)'
}]
});
loadStationMap('sjy_station_wetland'); loadStationMap('sjy_station_wetland');
</script>
<script type="text/javascript">
var user = "<%= user %>";
if (user) {
$('.bt_table_station_wetland').bootstrapTable({
url: '/api/gis/sjy_station_wetland',
search: 'true',
showRefresh: 'true',
showToggle: 'true',
showColumns: 'true',
columns: [{
field: 'sta_name',
title: '站(点)名称'
}, {
field: 'sta_code',
title: '站(点)代码'
}, {
field: 'obs_type',
title: '类型'
}, {
field: 'county',
title: '所属行政区域'
}, {
field: 'longitude',
title: '经度'
}, {
field: 'latitude',
title: '纬度'
}, {
field: 'alitude',
title: '海拔(米)'
}]
});
}
else {
$('.bt_table_station_wetland').bootstrapTable({
url: '/api/gis/sjy_station_wetland',
search: 'true',
showRefresh: 'true',
showToggle: 'true',
showColumns: 'true',
columns: [{
field: 'sta_name',
title: '站(点)名称'
}, {
field: 'sta_code',
title: '站(点)代码'
}, {
field: 'obs_type',
title: '类型'
}, {
field: 'county',
title: '所属行政区域'
}]
});
}
</script> </script>