|
@@ -7,7 +7,7 @@ angular.module('appMessage').controller('SmsController', ['$scope', '$state', '$
|
|
|
$scope.nowDate = $filter("date")($scope.now, "yyyy/MM/dd HH:mm:ss");
|
|
|
$scope.selectDate = $scope.nowDate;
|
|
|
$scope.checkId = false;
|
|
|
- $scope.counts = 0;
|
|
|
+ $scope.activeData = '按Ctrl+Enter键发送消息';
|
|
|
|
|
|
$scope.disable = function($event) {
|
|
|
var dataForm = $($event.currentTarget.previousElementSibling.children);
|
|
@@ -22,23 +22,66 @@ angular.module('appMessage').controller('SmsController', ['$scope', '$state', '$
|
|
|
|
|
|
$scope.activeClick = function($event) {
|
|
|
var activeClick = $($event.target.firstElementChild);
|
|
|
- var activeData = $event.target.innerText;
|
|
|
- console.log(activeData);
|
|
|
+ $scope.activeData = $event.target.innerText;
|
|
|
+ console.log($scope.activeData);
|
|
|
angular.element(".active").addClass("hid");
|
|
|
activeClick.removeClass("hid");
|
|
|
};
|
|
|
|
|
|
- $scope.mobSet = function() {
|
|
|
- var mobLen = $scope.inputMob.length;
|
|
|
- if (mobLen < 12)
|
|
|
- $scope.counts = 0;
|
|
|
- else
|
|
|
- $scope.counts = Math.floor($scope.inputMob.length / 11);
|
|
|
- mobLen = mobLen - $scope.counts;
|
|
|
- console.log(mobLen);
|
|
|
- if (mobLen % 11 == 0 && mobLen !== 0) {
|
|
|
- $scope.inputMob = $scope.inputMob + ','
|
|
|
- $scope.counts = Math.floor($scope.inputMob.length / 11);
|
|
|
+ $scope.enKeyup = function(e) {
|
|
|
+ var sendmsg = $(e.target);
|
|
|
+ var mediamsg = $(e.target.parentElement.previousElementSibling);
|
|
|
+ var keycode = window.event ? e.keyCode : e.which;
|
|
|
+ var len = _.trim(sendmsg[0].textContent).length;
|
|
|
+ console.log(sendmsg);
|
|
|
+ var html = '<div class="feed-element"><div class="media-body "><p><span class="glyphicon glyphicon-menu-right"><span>15906422850</span>16:28:50</span><span class="glyphicon glyphicon-ok"></span></p>' +
|
|
|
+ '<div class = "well m-l-xs m-t-xs fit-content" >' +
|
|
|
+ '<span class = "text-message">' + sendmsg[0].textContent + '</span> </div></div></div>';
|
|
|
+ if (len !== 0 && $scope.activeData == '按Enter键发送消息') {
|
|
|
+ if (!e.ctrlKey && keycode == 13) {
|
|
|
+ mediamsg.append(html);
|
|
|
+ sendmsg[0].textContent = "";
|
|
|
+ } else if (e.ctrlKey && e.which == 13)
|
|
|
+ sendmsg.append('\r\n');
|
|
|
+ } else if (len !== 0 && $scope.activeData == '按Ctrl+Enter键发送消息') {
|
|
|
+ if (e.ctrlKey && e.which == 13) {
|
|
|
+ mediamsg.append(html);
|
|
|
+ sendmsg[0].textContent = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.sendMsg = function($event) {
|
|
|
+ var sendmsg = $($event.target.parentElement.previousElementSibling);
|
|
|
+ var mediamsg = $($event.target.parentElement.previousElementSibling.parentElement.previousElementSibling);
|
|
|
+ var len = _.trim(sendmsg[0].textContent).length;
|
|
|
+ console.log(sendmsg);
|
|
|
+ var html = '<div class="feed-element"><div class="media-body "><p><span class="glyphicon glyphicon-menu-right"><span>15906422850</span>16:28:50</span><span class="glyphicon glyphicon-ok"></span></p>' +
|
|
|
+ '<div class = "well m-l-xs m-t-xs fit-content" >' +
|
|
|
+ '<span class = "text-message">' + sendmsg[0].textContent + '</span> </div></div></div>';
|
|
|
+ if (len !== 0) {
|
|
|
+ mediamsg.append(html);
|
|
|
+ sendmsg[0].textContent = "";
|
|
|
+ }
|
|
|
+ };
|
|
|
+ // $scope.mobAdd = function() {
|
|
|
+ // var mobLen = $scope.inputMob.length;
|
|
|
+ // if (mobLen < 12)
|
|
|
+ // $scope.counts = 0;
|
|
|
+ // mobLen = mobLen - $scope.counts;
|
|
|
+ // console.log(mobLen);
|
|
|
+ // if (mobLen % 11 == 0 && mobLen !== 0) {
|
|
|
+ // $scope.inputMob = $scope.inputMob + ','
|
|
|
+ // $scope.counts = $scope.counts + 1;
|
|
|
+ // $scope.counts = Math.floor($scope.inputMob.length / 11);
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+ $scope.mobReset = function() {
|
|
|
+ if ($scope.inputMob) {
|
|
|
+ if ($scope.inputMob instanceof Array)
|
|
|
+ $scope.inputMob = $scope.inputMob.join(",");
|
|
|
+ console.log($scope.inputMob);
|
|
|
+ $scope.inputMob = $scope.inputMob.match(/\d{11}/ig);
|
|
|
}
|
|
|
};
|
|
|
}]);
|