YanaDH 7 tahun lalu
induk
melakukan
c5dc37a003

+ 4 - 4
miaomiao/www/js/config/config.js

xqd
@@ -1,11 +1,11 @@
 (function (app) {
     //全局配置 
     app.constant("config", {
-        // server: 'http://q8.9026.com/',
-        // imgServer: 'http://q8.9026.com/attachment/'
+        server: 'http://q8.9026.com/',
+        imgServer: 'http://q8.9026.com/attachment/'
         //server: 'http://localhost:8092/',
         //imgServer: 'http://localhost:8092/attachment/',
-        server: 'http://miao.beiyuesi.com/',
-        imgServer: 'http://miao.beiyuesi.com/attachment/'
+        // server: 'http://miao.beiyuesi.com/',
+        // imgServer: 'http://miao.beiyuesi.com/attachment/'
     });
 })(angular.module('app'));

+ 20 - 1
miaomiao/www/js/services/jpushservice.js

xqd xqd
@@ -1,6 +1,6 @@
 (function (app) {
     //工具类服务
-    app.factory("jpushService", ['$http', '$window', '$document', function ($http, $window, $document) {
+    app.factory("jpushService", ['$http','$state', '$window', '$document', function ($http,$state, $window, $document) {
         var jpushServiceFactory = {};
         //var jpushapi=$window.plugins.jPushPlugin;
         //启动极光推送
@@ -21,6 +21,25 @@
 
             //点击推送通知
             document.addEventListener("jpush.openNotification", config.notify, false);
+            window.plugins.jPushPlugin.openNotificationInAndroidCallback = function(res){
+                var obj = JSON.parse(res);
+                console.log(obj);
+                var id = obj.extras['cn.jpush.android.EXTRA'].id;
+                var type = obj.extras['cn.jpush.android.EXTRA'].type;
+                if(type == 1){
+                    $state.go('app.home_dreamdetail',{id: id, type: 1});
+                }
+                else if(type == 2){
+                    $state.go('app.home_dreamdetail',{id: id, type: 2});
+                }
+                else if(type == 3){
+                    $state.go('app.letterDetail');
+                }
+                else if(type == 4){
+                    $state.go('app.home_dreamdetail',{id: id, type: 3});
+                }
+
+            }
             //前台收到推送
             document.addEventListener("jpush.receiveNotification", config.notify, false);
             //后台收到推送