浏览器上输入URL地址可以正常显示,但是微信Web开发工具输入url地址后没反应?求解答!
来源:5-9 第五天 微信 JS-SDK-使用微信官方的WEB调试工具
星辰Iron
2016-11-27
之前微信Web开发工具是可以正常显示的,但是最近又不行了
如下图,啥反应都没有
浏览器上输入地址后如下图
写回答
3回答
-
Scott
2016-11-28
没看出什么问题,是不是端口代理挂了,请求送递不过来
00 -
阿探
2017-02-13
我和你一样的情况,请问你解决了吗?求告知方法
00 -
星辰Iron
提问者
2016-11-27
//app.js的代码是这样的,有啥问题吗? 'use strict' var Koa = require('koa') var path = require('path') var wechat = require('./wechat/g') var util = require('./libs/util') var config = require('./config') var reply = require('./wx/reply') var Wechat = require('./wechat/wechat') // var wechat_file = path.join(__dirname,'./config/wechat.txt') var app = new Koa() var ejs = require('ejs') var crypto = require('crypto') var heredoc = require('heredoc') var tpl = heredoc(function(){/* <!DOCTYPE html> <html> <head> <title>搜电影111</title> <meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1"> </head> <body> <h1>点击标题,开始录音翻译</h1> <p id="title"></p> <p id="director"></p> <p id="year"></p> <p id="poster"></p> <script src="http://zeptojs.com/zepto-docs.min.js"></script> <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> <script> wx.config({ debug: true, appId: 'wxfeac53b7ad50b5dc', timestamp: '<%= timestamp%>', nonceStr: '<%= noncestr%>', signature: '<%= signature%>', jsApiList: [ 'startRecord', 'stopRecord', 'onVoiceRecordEnd', 'translateVoice' ] }) </script> </body> </html> */}) var createNonce = function(){ return Math.random().toString(36).substr(2,15) } var createTimestamp = function(){ return parseInt(new Date().getTime() / 1000, 10) + '' } var _sign = function(noncestr, ticket, timestamp, url){ var params = [ 'noncestr=' + noncestr, 'jsapi_ticket=' + ticket, 'timestamp=' + timestamp, 'url=' + url ] var str = params.sort().join('&') var shasum = crypto.createHash('sha1') shasum.update(str) return shasum.digest('hex') } function sign(ticket, url){ var noncestr = createNonce() var timestamp = createTimestamp() var signature = _sign(noncestr, ticket, timestamp, url) console.log(ticket) console.log(url) return { noncestr: noncestr, timestamp: timestamp, signature: signature } } app.use(function *(next){ if (this.url.indexOf('/movie') > -1){ // this.body = '<h1>Hi there!</h1>' var wechatApi = new Wechat(config.wechat) var data = yield wechatApi.fetchAccessToken() var access_token = data.access_token var ticketData = yield wechatApi.fetchTicket(access_token) var ticket = ticketData.ticket var url = this.href var params = sign(ticket,url) console.log(params) this.body = ejs.render(tpl,params) return next } yield next }) app.use(wechat(config.wechat, reply.reply)) app.listen(1234) console.log('Listening : 1234')
00
相似问题