Authored by huangyi

stage2完成

This diff could not be displayed because it is too large.
@@ -25,10 +25,7 @@ @@ -25,10 +25,7 @@
25 // console.log(r) 25 // console.log(r)
26 // window.yo_sdk.wxShare(shareData) 26 // window.yo_sdk.wxShare(shareData)
27 // }) 27 // })
28 -  
29 - window.yo_sdk.wxSignature(window.yo_sdk.wxShare(shareData));  
30 -  
31 - 28 + window.yo_sdk.wxShare(shareData);
32 </script> 29 </script>
33 </body> 30 </body>
34 </html> 31 </html>
@@ -45,7 +45,6 @@ @@ -45,7 +45,6 @@
45 "eslint-loader": "^1.7.1", 45 "eslint-loader": "^1.7.1",
46 "eslint-plugin-html": "^2.0.3", 46 "eslint-plugin-html": "^2.0.3",
47 "extract-text-webpack-plugin": "^4.0.0-beta.0", 47 "extract-text-webpack-plugin": "^4.0.0-beta.0",
48 - "fetch-jsonp": "^1.1.3",  
49 "file-loader": "^1.1.11", 48 "file-loader": "^1.1.11",
50 "uglifyjs-webpack-plugin": "^2.0.1", 49 "uglifyjs-webpack-plugin": "^2.0.1",
51 "url-loader": "^1.0.1", 50 "url-loader": "^1.0.1",
@@ -2,11 +2,15 @@ @@ -2,11 +2,15 @@
2 var httpServer = require('../utils/jsonp'); 2 var httpServer = require('../utils/jsonp');
3 3
4 var _weChatInterface = '//action.yoho.cn/api/share/getSignPackage';//签名等相关配置,yoho公众号 4 var _weChatInterface = '//action.yoho.cn/api/share/getSignPackage';//签名等相关配置,yoho公众号
5 -function wx() { 5 +function wxCtrl() {
6 } 6 }
7 7
8 -wx.prototype.wxSignature = function (fun) {  
9 - httpServer(_weChatInterface + "?pageurl=" + encodeURIComponent(location.href.split('#')[0])).then(function (json) { 8 +wxCtrl.prototype.wxSignature = function (fun) {
  9 + httpServer({
  10 + url: _weChatInterface,
  11 + jsonp: 'callback',
  12 + data: {pageurl: location.href.split('#')[0]}
  13 + }).then(function (json) {
10 if (!json.appId) { 14 if (!json.appId) {
11 return false; 15 return false;
12 } else { 16 } else {
@@ -64,7 +68,7 @@ wx.prototype.wxSignature = function (fun) { @@ -64,7 +68,7 @@ wx.prototype.wxSignature = function (fun) {
64 }) 68 })
65 }; 69 };
66 70
67 -wx.prototype.wxShare = function (shareDate) { 71 +wxCtrl.prototype.wxShare = function (shareDate) {
68 this.wxSignature(function () { 72 this.wxSignature(function () {
69 var share_data = shareDate || { 73 var share_data = shareDate || {
70 title: '', 74 title: '',
@@ -88,4 +92,4 @@ wx.prototype.wxShare = function (shareDate) { @@ -88,4 +92,4 @@ wx.prototype.wxShare = function (shareDate) {
88 92
89 } 93 }
90 94
91 -module.exports = wx; 95 +module.exports = wxCtrl;