Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
new demo
Browse files Browse the repository at this point in the history
  • Loading branch information
xfoxfu committed Jun 20, 2015
1 parent 02ff400 commit 60ac9ce
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 12 deletions.
6 changes: 4 additions & 2 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ server:
salt: rapid
// environment of server: [ debug, production ]
env: debug
base: http://rapid.cotr.me/
api: http://rapid.cotr.me/api/
database:
host: 127.0.0.1
port: 3306
Expand All @@ -11,11 +13,11 @@ database:
db: rapid
site:
front: Rap-ID
demo: Rap支付
demo: Rap身份
log:
level: error
content:
front:
banner: 快速安全实名认证算法
demo:
banner: Rap-ID支付演示
banner: 基于Rap-ID的电子身份证系统
14 changes: 9 additions & 5 deletions routes/demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,21 @@ router.get('/', function(req, res, next) {
res.render('demo/index', {
title: config.get('site.demo'),
banner: config.get('content.demo.banner'),
home_title: config.get('site.demo')
home_title: config.get('site.demo'),
uri: 'rapid://authorize/?callback=' + encodeURIComponent(config.get('server.base') + 'demo/callback?token=') +
'&app=916FA0569B0135402A84FF2506C3CEC553241D568A0796F9F08A603AFB6BCB036FDC4A61DE218540CFAD0A7A7D52AC1345EDAFDCC02CC5330311DC40CDB6B3F3E36540ED759398F89F8A913E469805C497FB6DEE0E7B95A4'
});
});
// GET /callback
router.get('/callback', function(req,res,next){
res.render('demo/index',{
router.get('/callback', function(req, res, next) {
res.render('demo/callback', {
title: config.get('site.demo'),
banner: config.get('content.demo.banner'),
home_title: config.get('site.demo'),
token: req.query.token
})
token: req.query.token,
demo_callback: true,
api: config.get('server.api')
});
});

module.exports = router;
9 changes: 9 additions & 0 deletions views/demo/callback.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<h1>{{banner}} - 用户信息</h1>
<div class="progress" id="loading">
<div class="indeterminate"></div>
</div>
<div id="data">
<p id="name">姓名:</p>
<p id="idnum">身份证号码:</p>
<p id="uname">Rap-ID用户名:</p>
</div>
3 changes: 2 additions & 1 deletion views/demo/index.hbs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
hi
<h1>{{banner}}</h1>
<a class="waves-effect waves-light btn" id="login" href="{{uri}}"><i class="mdi-file-cloud left" href=""></i>用Rap-ID登陆</a>
1 change: 0 additions & 1 deletion views/demo/layout.hbs

This file was deleted.

19 changes: 16 additions & 3 deletions views/layout.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>

<head>
<link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection" />
<link type="text/css" rel="stylesheet" href="/css/materialize.min.css" media="screen,projection" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>{{title}}</title>
<meta charset="utf-8">
Expand All @@ -14,8 +14,21 @@
{{{body}}}
</div>
{{>footer}}
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/materialize.min.js"></script>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/materialize.min.js"></script>
{{#if demo_callback}}
<script type="text/javascript">
var token = '{{token}}';
$('#data').hide();
$.get('{{api}}user?token=' + token, {}, function(data) {
$('#name').html($('#name').html() + data.data.identity.name);
$('#uname').html($('#uname').html() + data.data.username);
$('#idnum').html($('#idnum').html() + data.data.identity.identity);
$('#data').fadeIn();
$('#loading').fadeOut();
}, 'json');
</script>
{{/if}}
</body>

</html>

0 comments on commit 60ac9ce

Please sign in to comment.