Skip to content

Commit

Permalink
enabled jssdk
Browse files Browse the repository at this point in the history
  • Loading branch information
calidion committed Jul 24, 2016
1 parent 7aa7e3a commit de7e6d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 6 additions & 4 deletions lib/views/jssdk.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,23 @@ <h2><a class="btn btn-success QRScan">测试扫码</a></h2>
<script>
$(document).ready(function() {
var url = "/weixin/api/jssdk/config";
alert(location.origin + location.pathname);
var weixinUrl = location.href.split('#')[0];
// alert(weixinUrl);
// alert(JSON.stringify(location));
$.ajax({
url: url, //这个地址是服务器配置JSSDK的地址
data: {
url: location.origin + location.pathname
url: weixinUrl
//这个地址是发生jssdk调用的url地址
}
}).success(function(json) {
alert(JSON.stringify(json.data));
// alert(JSON.stringify(json.data));
var data = json.data;
var config = {};
for (var k in json.data) {
config[k] = json.data[k];
}

// config.debug = true;
config.jsApiList = [
'checkJsApi',
'scanQRCode'
Expand Down
7 changes: 4 additions & 3 deletions test/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var pages = require('../lib/pages');
pages(app, config, settings, session);

var request = require('supertest');
console.log(config);

describe('pages', function () {
it('should get index', function (done) {
Expand All @@ -20,7 +21,7 @@ describe('pages', function () {
.expect(200)
.end(function (err, res) {
assert(!err);
console.log(res.text);
console.log(res.text.indexOf('点击下面的按钮选择测试内容') !== -1);
done();
});
});
Expand All @@ -30,7 +31,7 @@ describe('pages', function () {
.expect(200)
.end(function (err, res) {
assert(!err);
console.log(res.text);
console.log(res.text.indexOf('JSSDK测试页') !== -1);
done();
});
});
Expand All @@ -40,7 +41,7 @@ describe('pages', function () {
.expect(200)
.end(function (err, res) {
assert(!err);
console.log(res.text);
console.log(res.text.indexOf('JSSDK测试页') !== -1);
done();
});
});
Expand Down

0 comments on commit de7e6d3

Please sign in to comment.