Переглянути джерело

Merge branch 'master' of https://matrix.niimei.com/szustar/szugift-fe

StephenArk30 6 роки тому
батько
коміт
ad7a45459f

+ 36 - 2
sourcecode/h5app/vue/src/connector/basic-service.js

@@ -57,7 +57,6 @@ var BasicFunction = new (function () {
         console.assert(cond, why);
     };
 
-
     this.goajax = function (jqObject) {
         if(typeof jqObject.data !== "string"){
             if (typeof jqObject.data === "object" && jqObject.data.toString().indexOf("FormData") !== -1) {
@@ -208,8 +207,20 @@ var BasicFunction = new (function () {
     };
 
     function request_data(url, callback, data, scope) {
+        var vurl = "";
+
+        if(url.indexOf("http://") !== -1 || url.indexOf("https://") !== -1){
+            vurl = url;
+        } else {
+            if(url.length > 2 && url.substring(0,2) === "!!"){
+                vurl = url.substring(2);
+            } else {
+                vurl = BasicFunction.Queue.SVR_URL + url;
+            }
+        }
+
         BasicFunction.goajax({
-            url: BasicFunction.Queue.SVR_URL + url,
+            url: vurl,
             apiName: url,
             data: data,
             scope: scope,
@@ -420,6 +431,29 @@ var BasicFunction = new (function () {
         return "";
     };
 
+    this.getSigned = function(apilist, func) {
+        let that = func;
+        this.get_data("!!/wxjs/signed.php?purl=" + encodeURIComponent(location.href),
+        function(ret){
+            wx.config({
+                debug: false,
+                appId: ret.appId,
+                timestamp: ret.timestamp,
+                nonceStr: ret.nonceStr,
+                signature: ret.signature,
+                jsApiList: apilist
+            });
+            that();
+        }, "");
+    };
+
+    this.gotoJsLogin = function() {
+        var APPID = "wx47691e7aabf77631";
+        var re_uri = "https://gift.fogice.com/wxjs/oauth.php?otp=" + this.utils_get_parm("otp");
+        var redir = encodeURIComponent(re_uri);
+        location.href="https://open.weixin.qq.com/connect/oauth2/authorize?appid="+ APPID+ "&redirect_uri=" +redir+  "&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
+    };
+
     /*this.userId = utils_get_param("userId");
 
     this.getUserId = function() {

+ 5 - 0
sourcecode/h5app/vue/src/connector/simple-demo.js

@@ -293,5 +293,10 @@ function fileServerDeal(lst, fileServerURL, lstId) {
     }).always(fileServerRet);
 }
 
+
+BasicFunction.getSigned(['checkJsApi', '...', '...'], function(){
+    wx.ready(.......);
+});
+
  */