|
|
@@ -2,13 +2,13 @@
|
|
|
* Created by yangck on 2017/3/30.
|
|
|
*/
|
|
|
define(['app/app'], function(app) {
|
|
|
- app.register.controller('MessagePersonalCtrl', ['$scope', '$rootScope', 'InternalMessage', 'toaster', '$sce', function($scope, $rootScope, InternalMessage, toaster, $sce) {
|
|
|
+ app.register.controller('MessagePersonalCtrl', ['$scope', '$rootScope', 'InternalMessage', 'toaster', '$sce', '$http', function($scope, $rootScope, InternalMessage, toaster, $sce, $http) {
|
|
|
$rootScope.active = 'message';
|
|
|
$scope.message = {};
|
|
|
$scope.params = {
|
|
|
page: 1,
|
|
|
count: 10,
|
|
|
- timeSorting: 'DESC',
|
|
|
+ timeSorting: '{\"createTime\":\"DESC\"}',
|
|
|
classes: '',
|
|
|
recRole: 'SELLER'
|
|
|
};
|
|
|
@@ -197,8 +197,9 @@ define(['app/app'], function(app) {
|
|
|
|
|
|
// 时间排序
|
|
|
$scope.orderTime = function () {
|
|
|
- $scope.params.timeSorting = $scope.params.timeSorting == 'DESC' ? 'ASC' : 'DESC'
|
|
|
- $scope.params.sorting = {createTime: $scope.params.timeSorting};
|
|
|
+ /*$scope.params.timeSorting = $scope.params.timeSorting == 'DESC' ? 'ASC' : 'DESC'
|
|
|
+ $scope.params.sorting = {createTime: $scope.params.timeSorting};*/
|
|
|
+ $scope.params.timeSorting = $scope.params.timeSorting == '{\"createTime\":\"DESC\"}' ? '{\"createTime\":\"ASC\"}' : '{\"createTime\":\"DESC\"}';
|
|
|
getData();
|
|
|
};
|
|
|
|
|
|
@@ -220,11 +221,11 @@ define(['app/app'], function(app) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- $scope.unReadMessCount = $rootScope.unReadMessCount;
|
|
|
+ /*$scope.unReadMessCount = $rootScope.unReadMessCount;
|
|
|
$scope.isReadMessCount = 0;
|
|
|
var getData = function () {
|
|
|
- /*InternalMessage.getUnread({isRead: 0}, function (data) {
|
|
|
- $scope.unReadMessCount = data.toRead;*/
|
|
|
+ /!*InternalMessage.getUnread({isRead: 0}, function (data) {
|
|
|
+ $scope.unReadMessCount = data.toRead;*!/
|
|
|
InternalMessage.getUnread({}, function (data) {
|
|
|
$scope.allReadMessCount = data.toRead;
|
|
|
}, function (err) {
|
|
|
@@ -240,9 +241,9 @@ define(['app/app'], function(app) {
|
|
|
});
|
|
|
$scope.params.currentPage = data.number;
|
|
|
$scope.acculatePages(data.number, data.totalPages);
|
|
|
- /* if ($scope.tab == 'all') {
|
|
|
+ /!* if ($scope.tab == 'all') {
|
|
|
$scope.isReadMessCount = data.totalElements;
|
|
|
- }*/
|
|
|
+ }*!/
|
|
|
var params = {
|
|
|
page: 1,
|
|
|
count: 10,
|
|
|
@@ -278,7 +279,119 @@ define(['app/app'], function(app) {
|
|
|
}, function(response) {
|
|
|
toaster.pop('error', '获取消息失败,请重新刷新界面,');
|
|
|
});
|
|
|
+ };*/
|
|
|
+ $scope.unReadMessCount = $rootScope.unReadMessCount;
|
|
|
+ $scope.allReadMessCount = 0;
|
|
|
+ var getData = function () {
|
|
|
+ InternalMessage.getUrl({}, function(data) {
|
|
|
+
|
|
|
+ var url = data.url;
|
|
|
+ if (url == "http://218.17.158.219:24000/message") {
|
|
|
+ url = 'http://192.168.253.6:24000/message';
|
|
|
+ }
|
|
|
+ var param = {
|
|
|
+ 'receiverUu': data.userUU,
|
|
|
+ 'receiverEnuu': data.enUU,
|
|
|
+ 'consumerApp': 'MALL',
|
|
|
+ isRead: null
|
|
|
+ };
|
|
|
+ $http({
|
|
|
+ method: 'get',
|
|
|
+ dataType: 'json',
|
|
|
+ url: url + '/messages/count',
|
|
|
+ params: param
|
|
|
+ }).success(function (data) {
|
|
|
+ $scope.allReadMessCount = data.count;
|
|
|
+ }).error(function (err) {
|
|
|
+ toaster.pop('error', err || '获取未读消息数量失败');
|
|
|
+ });
|
|
|
+ })
|
|
|
+ InternalMessage.getUrl({}, function(info) {
|
|
|
+ if (info) {
|
|
|
+ var url = info.url;
|
|
|
+ if (url == "http://218.17.158.219:24000/message") {
|
|
|
+ url = 'http://192.168.253.6:24000/message';
|
|
|
+ }
|
|
|
+ var param = {
|
|
|
+ 'receiverUu': info.userUU,
|
|
|
+ 'receiverEnuu': info.enUU,
|
|
|
+ 'consumerApp': 'MALL',
|
|
|
+ isRead : $scope.params.isRead,
|
|
|
+ page: $scope.params.page,
|
|
|
+ count: 10,
|
|
|
+ sorting: $scope.params.timeSorting ,
|
|
|
+ classes: '',
|
|
|
+ recRole: 'SELLER',
|
|
|
+ }
|
|
|
+ $http({
|
|
|
+ method: 'get',
|
|
|
+ dataType: 'json',
|
|
|
+ url: url + '/messages',
|
|
|
+ params: param
|
|
|
+ }).success(function (data) {
|
|
|
+ $scope.messageAllData = data;
|
|
|
+ $scope.messageCurrent = data.content;
|
|
|
+
|
|
|
+ var mess = new Array();
|
|
|
+ var b = '';
|
|
|
+ angular.forEach($scope.messageCurrent, function (message) {
|
|
|
+ message.content = $sce.trustAsHtml(message.content);
|
|
|
+ if(message.type =="MALL跳转卖家待报价页面"){
|
|
|
+ message.url='/vendor#/seekPurchase';
|
|
|
+ }else if (message.type =="MALL公共询价"){
|
|
|
+ message.url='/user#/seekPurchase';
|
|
|
+ }else if (message.type =="商城公共询价采纳结果"){
|
|
|
+ message.url='/vendor#/vendorPurchaseOffer';
|
|
|
+ }
|
|
|
+
|
|
|
+ if(message.isRead != 1){
|
|
|
+ b += message.id +",";
|
|
|
+ }
|
|
|
+ })
|
|
|
+ mess = b.substring(0, b.length - 1);
|
|
|
+ var param = {
|
|
|
+ 'receiverUu': info.userUU,
|
|
|
+ 'receiverEnuu': info.enUU,
|
|
|
+ 'messageId': mess,
|
|
|
+ 'consumerApp': 'MALL'
|
|
|
+
|
|
|
+ };
|
|
|
+ $http({
|
|
|
+ method: 'post',
|
|
|
+ dataType: 'json',
|
|
|
+ url: url + '/messages/read',
|
|
|
+ data:param
|
|
|
+ });
|
|
|
+ $scope.params.currentPage = data.number;
|
|
|
+ $scope.acculatePages(data.number, data.totalPages);
|
|
|
+ }).error(function (err) {
|
|
|
+ toaster.pop('error', err || '获取未读消息数量失败');
|
|
|
+ })
|
|
|
+ if ($scope.tab == 'no') {
|
|
|
+ // $rootScope.unReadMessCount = data.totalElements;
|
|
|
+ } else {
|
|
|
+ var param = {
|
|
|
+ page: 1,
|
|
|
+ count: 10,
|
|
|
+ timeSorting: 'DESC',
|
|
|
+ classes: '',
|
|
|
+ recRole: 'SELLER',
|
|
|
+ 'isRead': 0
|
|
|
+ };
|
|
|
+ InternalMessage.getUrl({}, function(data) {
|
|
|
+ /*InternalMessage.getUnread({isRead: 0}, function (data) {*/
|
|
|
+ InternalMessage.getUrl({isRead: 0}, function (data) {
|
|
|
+ $rootScope.unReadMessCount = data.count;
|
|
|
+ $scope.unReadMessCount = data.count;
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '获取消息失败,请重新刷新界面,');
|
|
|
+ });
|
|
|
};
|
|
|
+
|
|
|
// 批量删除
|
|
|
$scope.deleteBatch = function () {
|
|
|
var hasDelete = false;
|