Просмотр исходного кода

Merge branch 'master' of http://git.huaml.com/zhh/front-end

shish 4 лет назад
Родитель
Сommit
f764db2c5e
1 измененных файлов с 32 добавлено и 22 удалено
  1. 32 22
      hdApp/src/admin/home/workbench.vue

+ 32 - 22
hdApp/src/admin/home/workbench.vue

@@ -154,33 +154,43 @@ export default {
       // #endif
       // #endif
 
 
       // #ifdef APP-PLUS
       // #ifdef APP-PLUS
+      let that = this
       if(plus.runtime.isApplicationExist({pname:'com.tencent.mm',action:'weixin://'})){
       if(plus.runtime.isApplicationExist({pname:'com.tencent.mm',action:'weixin://'})){
-        var sweixin
+        uni.login({
+          provider: 'weixin',
+          success: function (loginRes) {
+            plus.share.getServices(function(s){
+              var sweixin
+              
+              for (var i = 0; i < s.length; i++) {
+                var t = s[i];
+                if (t.id == 'weixin') {
+                    sweixin = t;
+                }
+              }
 
 
-        plus.share.getServices(function(s){
-          for (var i = 0; i < s.length; i++) {
-            var t = s[i];
-            if (t.id == 'weixin') {
-                sweixin = t;
-            }
-          }
-
-          if (sweixin && sweixin.nativeClient) {
-            sweixin.launchMiniProgram({
-              id: 'gh_73b8b357d19a',
-              path: '/pagesPurchase/order',
-              type: 0
+              if (sweixin && sweixin.nativeClient) {
+                sweixin.launchMiniProgram({
+                  id: 'gh_73b8b357d19a',
+                  path: '/pagesPurchase/order',
+                  type: 0
+                });
+              } else {
+                that.$msg('请安装微信');
+                return false;
+              }
+            }, function(e){
+              that.$msg("获取微信失败:" + e.message)
+              console.log("获取微信失败:" + e.message);
             });
             });
-          } else {
-            this.$msg('请安装微信');
-            return false;
+          },
+          fail: function (res) {
+            that.$msg("微信登录失败:" + JSON.stringify(res))
+            console.log(res)
           }
           }
-        }, function(e){
-          this.$msg("获取微信失败:" + e.message)
-          console.log("获取微信失败:" + e.message);
-        });
+        })
       } else {
       } else {
-        this.$msg("微信应用未安装")
+        that.$msg("微信应用未安装")
 				return false
 				return false
       }
       }
 			// #endif
 			// #endif