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

View File

@ -34,10 +34,10 @@
<img src="/images/logo.png" alt="三江源">
<img src="/images/title.png" alt="三江源">
<% 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>
<% } 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>
<ul class="main-nav-menu navbar-nav">
@ -48,4 +48,4 @@
<li><a aria-current="false" href="/ei/classification_area">生态评估</a></li>
</ul>
</div>
</div>
</div>

File diff suppressed because one or more lines are too long

View File

@ -14388,39 +14388,68 @@
$.extend($.fn.bootstrapTable.columnDefaults, {
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>

View File

@ -40033,6 +40033,13 @@
$.extend($.fn.bootstrapTable.columnDefaults, {
sortable: true
});
loadStationMap('sjy_station_grassland');
</script>
<script type="text/javascript">
var user = "<%= user %>";
if (user) {
$('.bt_table_sjy_station_grassland').bootstrapTable({
url: '/api/gis/sjy_station_grassland',
search: 'true',
@ -40064,7 +40071,30 @@
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>

View File

@ -22091,36 +22091,64 @@
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');
</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>

View File

@ -956,38 +956,6 @@
$.extend($.fn.bootstrapTable.columnDefaults, {
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({
url: '/api/eco/sjy_weather_month',
@ -1040,4 +1008,65 @@
$('.fixed-table-toolbar').append('<div class="search pull-left">年份选择:</div>');
</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, {
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');
</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>

View File

@ -2822,36 +2822,64 @@
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');
</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>