topicMessage.js
1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* Created by cjl on 2018/4/23.
*/
(function () {
"user strict";
var topicMessageController = function($scope,$modal,$http,$interval,dialogService,railwayService){
$scope.settingShow = 9;
$scope.topic = {
title : "",
content :""
}
$scope.doSave = function(){
if (!$scope.topic.title) {
dialogService.tip([{"message":"消息标题不能为空!" }]);
return;
}
if (!$scope.topic.content) {
dialogService.tip([{"message":"消息内容不能为空!" }]);
return;
}
var dialogDefaults = {
size: "sm"
};
var dialogOptions = {
closeButtonText: "取消",
actionButtonText: "确定",
headerText: "消息推送?",
bodyText: "确定推送该条消息到app?",
callback: function () {
railwayService.addTopicMessage($scope.topic).success(function(data){
if (data.errors == null || data.errors.length > 0){
dialogService.tip(data.errors);
}
else {
dialogService.tip([{message:"消息推送成功!"}],"/admin/topicMessage/index.htm",1000);
//清空数据
}
})
}
};
dialogService.confirm(dialogDefaults, dialogOptions);
};
}
angular.module("xn.page", ["xn.directive.form"])
.controller("TopicMessageController",["$scope","$modal","$http","$interval","dialogService","RailwayService",topicMessageController])
})();