Browse Source

PC报修和微信报修图片展示问题

seimin 3 years ago
parent
commit
a8a37a9057

+ 1 - 0
wechat/assets/js/controllers/weChat/myIncident/myIncidentDetailCtrl.js

@@ -86,6 +86,7 @@ app.controller('myIncidentDetailCtrl', ["$rootScope", "$scope", "$sce", '$stateP
86 86
         });
87 87
     };
88 88
     $scope.imagelist = [];
89
+    $scope.serverIp = $rootScope.serverIp;
89 90
     if ($scope.item.id) {
90 91
         api_wechatfile.listAttachments('wechatRequesterIncident', $scope.item.id).then(function(data) {
91 92
             var myData = Restangular.stripRestangular(data);

+ 3 - 1
wechat/assets/js/main.js

@@ -12,7 +12,9 @@ var callIp = "";
12 12
 app.config(function($httpProvider) {
13 13
     $httpProvider.interceptors.push('sessionInjector');
14 14
 });
15
-
15
+app.run(['$rootScope', function ($rootScope) {
16
+    $rootScope.serverIp = serverIp;
17
+}]);
16 18
 //拦截器
17 19
 //$httpProvider.interceptors 不能注入$http和引用了$http的服务,否则会报依赖注入错误。
18 20
 // app.factory('sessionInjector', ['$rootScope', '$q', ' $injector ', function($rootScope, $q, $injector) {

+ 1 - 1
wechat/assets/views/weChat/myIncident/myIncidentDetail.html

@@ -331,7 +331,7 @@
331 331
             <div class="normal-label-wrap">
332 332
                 <div class="normal-text  col col-70 col-xs-12">
333 333
                     <span class="ng-binding font-color-black pull-left">报修图片:<span class="font-color-gray"></span></span>
334
-                    <span ng-repeat="it in imagelist"><span><img ng-src='../file/{{it.token}}.{{it.suffix}}' class="pitt"></span></span>
334
+                    <span ng-repeat="it in imagelist"><span><img ng-src="{{serverIp}}/service/common/common/previewAttachmentImage/{{it.token}}" class="pitt"></span></span>
335 335
                     <!-- <span><img src="http://mxd.766.com/db/images/mob/9420543.png" class="pitt"></span> -->
336 336
                     <!-- <span> -->
337 337
                     <!-- <span class="pitt">

+ 13 - 1
wechat/pcreq/assets/js/controllers.js

@@ -916,7 +916,8 @@ app.controller('requesterDetailCtrl', [
916 916
     "api_solution",
917 917
     "FileUploader",
918 918
     "TipService",
919
-    function ($scope, $rootScope, $state, $timeout, $interval, $sce, Restangular, UserRestangular, BpmRestangular, api_bpm_domain, api_solution, FileUploader, TipService) {
919
+    "api_wechatfile",
920
+    function ($scope, $rootScope, $state, $timeout, $interval, $sce, Restangular, UserRestangular, BpmRestangular, api_bpm_domain, api_solution, FileUploader, TipService,api_wechatfile) {
920 921
         console.log('requesterDetailCtrl is load');
921 922
 
922 923
         // TipService.setMessage('报障提交', '提交成功');
@@ -953,6 +954,17 @@ app.controller('requesterDetailCtrl', [
953 954
         $scope.degreeRemark = '';
954 955
 
955 956
         $scope.requester = JSON.parse($state.params.data);
957
+        // 附件 start
958
+        $scope.imagelist = [];
959
+        $scope.serverIp = $rootScope.serverIp;
960
+        api_wechatfile.listAttachments('wechatRequesterIncident', $scope.requester.id).then(function (data) {
961
+            var myData = data;
962
+            angular.forEach(myData.data, function (item, index) {
963
+                myData.data[index].token = item.token;
964
+                $scope.imagelist.push(myData.data[index]);
965
+            })
966
+        });
967
+        // 附件 end
956 968
 
957 969
         $scope.goBack = function () {
958 970
             $state.go('tab.requesterList', {});

+ 25 - 1
wechat/pcreq/assets/js/main.js

@@ -109,6 +109,9 @@ app.config(['$httpProvider', '$stateProvider', '$urlRouterProvider', 'ADDRESS',
109 109
 app.config(function ($httpProvider) {
110 110
     $httpProvider.interceptors.push('sessionInjector');
111 111
 });
112
+app.run(['$rootScope', function ($rootScope) {
113
+    $rootScope.serverIp = serverIp;
114
+}]);
112 115
 
113 116
 //拦截器
114 117
 //$httpProvider.interceptors 不能注入$http和引用了$http的服务,否则会报依赖注入错误。
@@ -444,6 +447,27 @@ app.factory('api_bpm', ['BpmRestangular', function (BpmRestangular) {
444 447
 
445 448
     };
446 449
 }]);
450
+app.factory('WechatRestangularSeimin', ['Restangular', 'ADDRESS', function(Restangular, address) {
451
+    return Restangular.withConfig(function(RestangularConfigurer) {
452
+        // RestangularConfigurer.setBaseUrl(address.serverIp + address.serverIpPort + address.api + '/common/');
453
+        RestangularConfigurer.setBaseUrl(address.serverIp + address.serverIpPort + '/service' + '/common/');
454
+    });
455
+}]);
456
+app.factory('api_wechatfile', ['WechatRestangularSeimin', function(WechatRestangularSeimin) {
457
+    var dataService = WechatRestangularSeimin.all("common");
458
+    return {
459
+        listAttachments: function(type, model) {
460
+            return dataService.customGET('listAttachment/' + type + "/" + model, {});
461
+            // return dataService.one('listAttachment/' + type + "/" + model);
462
+        },
463
+        downloadAttachment: function(model) {
464
+            return dataService.one('downloadAttachment/' + model, {});
465
+        },
466
+        getDictionary: function(data) {
467
+            return dataService.customPOST(data, 'getDictionary', {});
468
+        }
469
+    };
470
+}]);
447 471
 
448 472
 app.factory('api_bpm_domain', ['BpmRestangular', 'CommonRestangular', 'WeChatRestangular', 'WeChatApply', function (BpmRestangular, CommonRestangular, WeChatRestangular, WeChatApply) {
449 473
     var bpmService = BpmRestangular.all("bpm");
@@ -501,7 +525,7 @@ app.factory('api_bpm_domain', ['BpmRestangular', 'CommonRestangular', 'WeChatRes
501 525
             return weChatService.one('saveAttachments/' + processId + '/' + taskId + '/' + userId);
502 526
         },
503 527
         uploadAttachment: function (processId, taskId, userId, data) {
504
-            return commonService.one('uploadAttachment/' + 'webRequesterIncident/' + processId);
528
+            return commonService.one('uploadAttachment/' + 'wechatRequesterIncident/' + processId);
505 529
         },
506 530
         download: function (attachmentId) {
507 531
             return bpmService.one('getAttachmentContent/' + attachmentId);

+ 3 - 3
wechat/pcreq/assets/views/requesterDetail.html

@@ -65,10 +65,10 @@
65 65
                                     <TD colspan="3" bgcolor="#ffffff">&nbsp;{{requester.description}}</TD>
66 66
                                 </TR>
67 67
 
68
-                                <!--<TR>
68
+                                <TR>
69 69
                                     <TD bgcolor="#e9f2f9">附件</TD>
70
-                                    <TD colspan="3" bgcolor="#ffffff"><img src="images/pic.jpg" width="90" height="90"></TD>
71
-                                </TR>-->
70
+                                    <TD colspan="3" bgcolor="#ffffff"><span ng-repeat="it in imagelist"><img ng-src="{{serverIp}}/service/common/common/previewAttachmentImage/{{it.token}}" width="90" height="90"></span></TD>
71
+                                </TR>
72 72
 
73 73
                             </TBODY>
74 74
                         </TABLE>