|
|
@@ -1448,8 +1448,8 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
|
|
|
/**
|
|
|
* 新建项目
|
|
|
*/
|
|
|
- app.controller('ProjectNewCtrl', ['$scope', 'BaseService', 'Project', '$http', 'toaster', '$stateParams', '$rootScope', 'AuthenticationService', 'User',
|
|
|
- function($scope, BaseService, Project, $http, toaster, $stateParams, $rootScope, AuthenticationService, User) {
|
|
|
+ app.controller('ProjectNewCtrl', ['$scope', 'BaseService', 'Project', '$http', 'toaster', '$stateParams', '$rootScope', 'AuthenticationService', 'User', '$upload',
|
|
|
+ function($scope, BaseService, Project, $http, toaster, $stateParams, $rootScope, AuthenticationService, User, $upload) {
|
|
|
$scope.loading = true;
|
|
|
BaseService.scrollBackToTop();
|
|
|
$rootScope.tree = 'project';
|
|
|
@@ -1688,6 +1688,48 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ /**
|
|
|
+ * 编辑器上传图片
|
|
|
+ * @param files 图片
|
|
|
+ */
|
|
|
+ $scope.uploadEditorImg = function(files) {
|
|
|
+ // 清空输入框内容(不清空选同样的图片不会上传) note-image-input
|
|
|
+ var file=$('.note-image-input').get(0);
|
|
|
+ //IE,Safari,chrome
|
|
|
+ if(file.outerHTML){
|
|
|
+ file.outerHTML=file.outerHTML;
|
|
|
+ }
|
|
|
+ else{ //FF
|
|
|
+ file.value="";
|
|
|
+ }
|
|
|
+ $scope.loading = true;
|
|
|
+ $upload.upload({
|
|
|
+ url: 'base/upload',
|
|
|
+ method: 'POST',
|
|
|
+ file: files[0]
|
|
|
+ }).success(function (data) {
|
|
|
+ console.log(data);
|
|
|
+ $scope.project.introduction = $scope.project.introduction + '<img src="' + data + '">';
|
|
|
+ $scope.loading = false;
|
|
|
+ }).error(function (data) {
|
|
|
+ $scope.loading = false;
|
|
|
+ console.log(data);
|
|
|
+ toaster.pop('error', '上传图片失败');
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除编辑器图片
|
|
|
+ * @param path 路径
|
|
|
+ */
|
|
|
+ $scope.deleteEditorImg = function(path) {
|
|
|
+ if (!angular.isUndefined(path)) {
|
|
|
+ Project.deleteEditorImg({path: path}, {}, function(data) {
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
// 设置active
|
|
|
$scope.setActive = function(value) {
|
|
|
$rootScope.active = value;
|
|
|
@@ -2742,6 +2784,11 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ /**
|
|
|
+ * 上传奖品图片
|
|
|
+ * @param award 奖品
|
|
|
+ * @param index 序号
|
|
|
+ */
|
|
|
$scope.uploadPrizeImg = function(award, index) {
|
|
|
$scope.loading = true;
|
|
|
var files = award.prizeImgs, file = files && files.length > 0 ? files[0] : null;
|
|
|
@@ -2758,6 +2805,48 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ /**
|
|
|
+ * 编辑框上传图片
|
|
|
+ * @param files 图片
|
|
|
+ */
|
|
|
+ $scope.uploadEditorImg = function(files) {
|
|
|
+ // 清空输入框内容(不清空选同样的图片不会上传) note-image-input
|
|
|
+ var file=$('.note-image-input').get(0);
|
|
|
+ //IE,Safari,chrome
|
|
|
+ if(file.outerHTML){
|
|
|
+ file.outerHTML=file.outerHTML;
|
|
|
+ }
|
|
|
+ else{ //FF
|
|
|
+ file.value="";
|
|
|
+ }
|
|
|
+ $scope.loading = true;
|
|
|
+ $upload.upload({
|
|
|
+ url: 'base/upload',
|
|
|
+ method: 'POST',
|
|
|
+ file: files[0]
|
|
|
+ }).success(function (data) {
|
|
|
+ console.log(data);
|
|
|
+ $scope.activity.summary = $scope.activity.summary + '<img src="' + data + '">';
|
|
|
+ $scope.loading = false;
|
|
|
+ }).error(function (data) {
|
|
|
+ $scope.loading = false;
|
|
|
+ console.log(data);
|
|
|
+ toaster.pop('error', '上传图片失败');
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除编辑器图片
|
|
|
+ * @param path 路径
|
|
|
+ */
|
|
|
+ $scope.deleteEditorImg = function(path) {
|
|
|
+ if (!angular.isUndefined(path)) {
|
|
|
+ Activity.deletePrizeImg({path: path}, {}, function(data) {
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
// 保存 或 提交
|
|
|
$scope.submit = function(type, invalid) {
|
|
|
if (invalid == true) {
|