ソースを参照

发起项目和活动添加图片预览和数据完整性验证

dongbw 8 年 前
コミット
ef1fd52df1

+ 1 - 11
donate-console/src/main/java/com/uas/console/donate/controller/ActivityController.java

@@ -112,7 +112,6 @@ public class ActivityController {
         return activityService.submit(activity);
     }
 
-
     /**
      * 活动置顶
      */
@@ -275,15 +274,6 @@ public class ActivityController {
         return activityService.findOne(id);
     }
 
-    /**
-     * 查询某活动已关联的项目
-     */
-    @RequestMapping(value = "/getRelatedProject", method = RequestMethod.GET)
-    @ResponseBody
-    public List<ProjectQualification> getRelatedProject(Long activityId){
-        return activityService.getRelatedProject(activityId);
-    }
-
     /**
      * 开奖
      */
@@ -297,7 +287,7 @@ public class ActivityController {
     }
 
     /**
-     * 活动发起页面获取关联项目
+     * 活动发起页面获取关联项目(去掉已被选中的和已被活动关联的)
      * @param keyword
      * @param selectedIds
      * @return

+ 8 - 1
donate-console/src/main/java/com/uas/console/donate/dao/ProjectDao.java

@@ -22,7 +22,7 @@ public interface ProjectDao extends JpaRepository<Project,Long>,JpaSpecification
     /**
      * 获取所有未被活动关联的项目
      */
-    @Query("from Project as p where p.id not in (select pq.proId from  ProjectQualification as pq) ")
+    @Query(value = "select * from donate$project pro where pro.pro_id not in (select distinct(pro_id) from donate$activityproject)", nativeQuery = true)
     List<Project> getProjects();
 
     /**
@@ -67,4 +67,11 @@ public interface ProjectDao extends JpaRepository<Project,Long>,JpaSpecification
      * @return
      */
     List<Project> findByPublishAndUserUU(Integer publish, Long userUU);
+
+    /**
+     * 获取所有已被关联的项目id
+     * @return
+     */
+    @Query(value = "select p.pro_id from donate$project p where p.pro_id in (select distinct(pa.pro_id) from donate$activityproject pa)", nativeQuery = true)
+    List<Long> getProjectIdsRelated();
 }

+ 4 - 0
donate-console/src/main/java/com/uas/console/donate/model/Activity.java

@@ -1,6 +1,8 @@
 package com.uas.console.donate.model;
 
 
+import com.alibaba.fastjson.annotation.JSONField;
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.uas.console.donate.util.CollectionUtils;
 
 import javax.persistence.*;
@@ -375,6 +377,8 @@ public class Activity implements Serializable{
         this.awardAmount = awardAmount;
     }
 
+    @JsonIgnore
+    @JSONField(serialize = false)
     public Set<ActivityRecode> getActivityRecords() {
         return activityRecords;
     }

+ 1 - 15
donate-console/src/main/java/com/uas/console/donate/model/Award.java

@@ -17,17 +17,11 @@ public class Award implements Serializable{
     @Column(name="aw_id")
     private  Long id;
 
-    /**
-     * 活动编号
-     */
-    @Column(name="aw_act_id")
-    private Long activityId;
-
     /**
      * 活动
      */
     @ManyToOne(cascade = CascadeType.REFRESH)
-    @JoinColumn(name="aw_act_id", insertable = false, updatable = false)
+    @JoinColumn(name="aw_act_id")
     private Activity activity;
 
     /**
@@ -77,14 +71,6 @@ public class Award implements Serializable{
         this.id = id;
     }
 
-    public Long getActivityId() {
-        return activityId;
-    }
-
-    public void setActivityId(Long activityId) {
-        this.activityId = activityId;
-    }
-
     public String getAwardLevel() {
         return awardLevel;
     }

+ 2 - 4
donate-console/src/main/java/com/uas/console/donate/model/Org.java

@@ -3,7 +3,6 @@ package com.uas.console.donate.model;
 
 import javax.persistence.*;
 import java.io.Serializable;
-import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
@@ -318,9 +317,8 @@ public class Org implements Serializable{
         this.person = person;
     }
 
-    public String getSubmitTime() {
-        Date date=this.submitTime;
-        return date!=null?sdf.format(this.submitTime):null;
+    public Date getSubmitTime() {
+        return submitTime;
     }
 
     public void setSubmitTime(Date submitTime) {

+ 0 - 2
donate-console/src/main/java/com/uas/console/donate/service/ActivityService.java

@@ -50,8 +50,6 @@ public interface ActivityService {
 
     ModelMap getActivitiesNum();
 
-    List<ProjectQualification> getRelatedProject(Long activityId);
-
     Activity openAward(Long activityId);
 
 

+ 7 - 13
donate-console/src/main/java/com/uas/console/donate/service/impl/ActivityServiceImpl.java

@@ -42,9 +42,6 @@ public class ActivityServiceImpl implements ActivityService{
     @Autowired
     private ProjectDao projectDao;
 
-    @Autowired
-    private ProjectQualificationDao projectQualificationDao;
-
     @Autowired
     private AttachService attachService;
 
@@ -95,10 +92,10 @@ public class ActivityServiceImpl implements ActivityService{
         activity.setSubmitTime(date);
         //设置活动编号
         activity.setCode(codesdf.format(date));
-        Set<Award> awards = activity.getAwards();
-        for (Award award : awards) {
-            award.setActivity(activity);
-        }
+//        Set<Award> awards = activity.getAwards();
+//        for (Award award : awards) {
+//            award.setActivity(activity);
+//        }
         return activityDao.save(activity);
     }
 
@@ -196,11 +193,6 @@ public class ActivityServiceImpl implements ActivityService{
         return map;
     }
 
-    @Override
-    public List<ProjectQualification> getRelatedProject(Long activityId) {
-        return projectQualificationDao.hasConnected(activityId);
-    }
-
     @Override
     public Activity openAward(Long activityId) {
         Activity activity = activityDao.findOne(activityId);
@@ -210,6 +202,9 @@ public class ActivityServiceImpl implements ActivityService{
 
     @Override
     public List<Project> getActivityRelatedProjects(final String keyword, final List<Long> proIds) {
+        // 获取所有已被关联的项目id
+        List<Long> relatedIds = projectDao.getProjectIdsRelated();
+        proIds.addAll(relatedIds);
         // 默认返回100条
         final PageInfo pageInfo = new PageInfo(1, 100);
         return projectDao.findAll(new Specification<Project>() {
@@ -221,7 +216,6 @@ public class ActivityServiceImpl implements ActivityService{
                             PredicateUtils.like("proSummary", keyword, false),
                             PredicateUtils.like("orgName", keyword, false)));
                 }
-                // 默认全部分类设置值为0
                 if (!CollectionUtils.isEmpty(proIds)) {
                     for (Long proId : proIds) {
                         pageInfo.expression(PredicateUtils.ne("id", proId, false));

+ 2 - 0
donate-console/src/main/java/com/uas/console/donate/service/impl/ProjectServiceImpl.java

@@ -51,6 +51,8 @@ public class ProjectServiceImpl implements ProjectService {
 
     //保存项目草稿
     public Project save(Project project){
+        //TODO 登录session获取机构id
+        project.setOrgId(15L);
         if(project.getOrgId()!=null){
             Org org= orgDao.findOne(project.getOrgId());
             //得到机构名

+ 1 - 1
donate-console/src/main/webapp/WEB-INF/views/index.html

@@ -10,7 +10,6 @@
     <meta name="renderer" content="webkit">
     <!--css begin-->
     <link href="static/images/icon/u.png" rel="icon" type="image/x-icon" />
-    <link rel="stylesheet" href="static/css/base.css">
     <link rel="stylesheet" href="static/css/common.css">
     <link rel="stylesheet" href="static/css/AdminLTE.css">
     <link rel="stylesheet" href="static/css/skins/_all-skins.css">
@@ -19,6 +18,7 @@
     <link rel="stylesheet" href="static/lib/jquery/themes/summernote/css/summernote.css">
     <link rel="stylesheet" href="static/lib/jquery/themes/summernote/css/monokai.css">
     <link rel="stylesheet" href="static/lib/angular/toaster.css" />
+    <link rel="stylesheet" href="static/css/base.css">
     <style>
         a {
             cursor: pointer;

+ 64 - 0
donate-console/src/main/webapp/resources/css/base.css

@@ -162,4 +162,68 @@ input,button,select,textarea{outline:none}
 	background: #ef613b;
 	border: 1px solid transparent ;
 	color: #fff;
+}
+
+/* 预览 */
+#image-box .x-floating-wrap {
+	position: fixed;
+	z-index: 99998;
+	background: #000;
+	top: 0;
+	left: 0;
+	width: 100%;
+	height: 100%;
+	opacity: 0.5;
+}
+#image-box .x-floating {
+	position: fixed;
+	z-index: 99999;
+	width: 1200px;
+	height: 600px;
+	top: 50%;
+	left: 50%;
+	margin-left: -600px;
+	margin-top: -300px;
+	line-height: 560px;
+	text-align: center;
+	vertical-align: middle;
+}
+#image-box .x-floating img {
+	margin: auto auto;
+	max-width: 100% !important;
+	max-height: 600px !important;
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none
+}
+
+#image-box .x-close-wrap {
+	position: fixed;
+	top: 0;
+	right: 0;
+	z-index: 100000;
+	width: 120px;
+	height: 120px;
+	margin: -60px -60px 0 0;
+	border-radius: 100%;
+	background: #000;
+	opacity: .3
+}
+
+#image-box .x-close-wrap a {
+	position: absolute;
+	left: 25px;
+	bottom: 25px;
+	font-size: 42px;
+	color: #fff
+}
+
+#image-box .x-close-wrap:hover {
+	opacity: .7
+}
+
+button[disabled] {
+	cursor: not-allowed;
+	background-color: #a0a0a0;
 }

+ 188 - 32
donate-console/src/main/webapp/resources/js/index/app.js

@@ -600,7 +600,7 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
                     $scope.org.branchMessage = "";
                 } else {
                     bankCard = bankCard.toString();
-                    $.getJSON("static/jsondata/bank.json", {}, function (data) {
+                    $.getJSON("resources/jsondata/bank.json", {}, function (data) {
                         var bankBin = 0;
                         var isFind = false;
                         for (var key = 10; key >= 2; key--) {
@@ -799,14 +799,22 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
             Project.getSavedProject({}, {}, function(data) {
                 if(!angular.isObject(data)) {
                     $scope.project = data;
+                    $scope.pcImgUrl = data.pcImg;
+                    $scope.mobileImgUrl = data.mobileImg;
+                    $scope.mobileListImgUrl = data.listImg;
+                    $scope.logoUrl = data.logo;
                 }
             });
 
             if (!angular.isUndefined($stateParams.id)) {
               Project.getDetailById({id : $stateParams.id}, {}, function(data) {
                   $scope.project = data;
+                  $scope.pcImgUrl = data.pcImg;
+                  $scope.mobileImgUrl = data.mobileImg;
+                  $scope.mobileListImgUrl = data.listImg;
+                  $scope.logoUrl = data.logo;
               });
-            };
+            }
         };
         getSavedProject();
 
@@ -857,7 +865,6 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
         };
 
         //建立一个可存取到该file的url
-        var imgurl = null;
         var getObjectURL = function (file) {
             var url = null;
             if (window.createObjectURL != undefined) { // basic
@@ -867,51 +874,103 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
             } else if (window.webkitURL != undefined) { // webkit or chrome
                 url = window.webkitURL.createObjectURL(file);
             }
-            imgurl = url;
             return url;
         };
 
-        $scope.previewShow = false;
-        $scope.uploadPcImg = function() {
-            if ($scope.pcImg) {
-                $scope.noneFileShow = false;
-                var file = $scope.pcImg;
-                if (file.name.indexOf('.pdf') != -1 || file.name.indexOf('.PDF') != -1) {//pdf文件
-                    $scope.pdfShow = true;
-                    $scope.previewShow = false;
-                    $scope.imgPreviewName = file.name;
-                } else {
-                    if (typeof(Worker) !== "undefined") {//支持HTML5
-                        $scope.imgPreview = getObjectURL(file);
-                        $scope.imgPreviewName = file.name;
-                    } else {//不支持HTML5
-                        $scope.imgPreview = 'static/img/all/preview-error.jpg';
-                        $scope.imgPreviewName = file.name;
-                    }
-                    $scope.previewShow = true;
-                    $scope.pdfShow = false;
-                }
-            } else {
-                $scope.noneFileShow = true;
-                $scope.previewShow = false;
-                $scope.pdfShow = false;
-            }
-        };
-
         // 图片上传
         $scope.fileChanged = function(ele, order){
             if (order == 0) {
                 $scope.pcImg = ele.files[0];
+                $scope.pcImgUrl = getObjectURL($scope.pcImg);
             } else if (order == 1) {
                 $scope.mobileImg = ele.files[0];
+                $scope.mobileImgUrl = getObjectURL($scope.mobileImg);
             } if (order == 2) {
                 $scope.mobileListImg = ele.files[0];
+                $scope.mobileListImgUrl = getObjectURL($scope.mobileListImg);
             } if (order == 3) {
                 $scope.logo = ele.files[0];
+                $scope.logoUrl = getObjectURL($scope.logo);
             }
             $scope.$apply();
         };
 
+        // 查看范例
+        $scope.showImg = function (type) {
+            var img = null;
+            var imgUrl = null;
+            switch (type) {
+                case 'pcImg':
+                    img = $scope.project.pcImg;
+                    imgUrl = $scope.pcImgUrl;
+                    break;
+                case 'mobileImg':
+                    img = $scope.project.mobileImg;
+                    imgUrl = $scope.mobileImgUrl;
+                    break;
+                case 'mobileListImg':
+                    img = $scope.project.mobileListImg;
+                    imgUrl = $scope.mobileListImgUrl;
+                    break;
+                case 'logo':
+                    img = $scope.project.logo;
+                    imgUrl = $scope.logoUrl;
+                    break;
+            }
+            if (img) {
+                var src = img, box = $('#image-box');
+                box.show();
+                box.find('img').attr('src', src);
+                box.find('a').click(function () {
+                    box.hide();
+                });
+                box.dblclick(function () {
+                    box.hide();
+                });
+            } else if (imgUrl != null) {
+                var src = imgUrl, box = $('#image-box');
+                box.show();
+                box.find('img').attr('src', src);
+                box.find('a').click(function () {
+                    box.hide();
+                });
+                box.dblclick(function () {
+                    box.hide();
+                });
+            }
+        };
+
+        // 删除
+        $scope.clearFile = function (type) {
+            switch (type) {
+                case 'pcImg':
+                    $scope.pcImg = null;
+                    $scope.pcImgUrl = null;
+                    break;
+                case 'mobileImg':
+                    $scope.mobileImg = null;
+                    $scope.mobileImgUrl = null;
+                    break;
+                case 'mobileListImg':
+                    $scope.mobileListImg = null;
+                    $scope.mobileListImgUrl = null;
+                    break;
+                case 'logo':
+                    $scope.logo = null;
+                    $scope.logoUrl = null;
+                    break;
+            }
+            // 清空input框的内容
+            var file=document.getElementById(type);
+            //IE,Safari,chrome
+            if(file.outerHTML){
+                file.outerHTML=file.outerHTML;
+            }
+            else{      //FF
+                file.value="";
+            }
+        };
+
         //提交 或 保存
         $scope.saveDetail = function (project, type) {
             var data = new FormData();      //以下为像后台提交图片数据
@@ -1540,6 +1599,8 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
             Activity.getSavedActivity({}, function(data) {
                 if (null !== data) {
                     $scope.activity = data;
+                    $scope.awards = data.awards;
+                    $scope.selectedProjects = data.projects;
                 }
             });
         };
@@ -1678,8 +1739,10 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
         $scope.fileChanged = function(ele, value){
             if (value == 0) {
                 $scope.actImg = ele.files[0];
+                $scope.actImgUrl = getObjectURL($scope.actImg);
             } else if (value == 1) {
                 $scope.banner = ele.files[0];
+                $scope.bannerUrl = getObjectURL($scope.banner);
             // } else if (value == 2) {
             //     $scope.award1 = ele.files[0];
             // } else if (value == 3) {
@@ -1692,10 +1755,103 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
             $scope.$apply();
         };
 
+        //建立一个可存取到该file的url
+        var getObjectURL = function (file) {
+            var url = null;
+            if (window.createObjectURL != undefined) { // basic
+                url = window.createObjectURL(file);
+            } else if (window.URL != undefined) { // mozilla(firefox)
+                url = window.URL.createObjectURL(file);
+            } else if (window.webkitURL != undefined) { // webkit or chrome
+                url = window.webkitURL.createObjectURL(file);
+            }
+            return url;
+        };
+
+        // 查看范例
+        $scope.showImg = function (type) {
+            var img = type;
+            var imgUrl = null;
+            switch (type) {
+                case 'actImg':
+                    img = $scope.activity.actImg;
+                    imgUrl = $scope.actImgUrl;
+                    break;
+                case 'banner':
+                    img = $scope.activity.banner;
+                    imgUrl = $scope.bannerUrl;
+                    break;
+
+            }
+            if (img) {
+                var src = img, box = $('#image-box');
+                box.show();
+                box.find('img').attr('src', src);
+                box.find('a').click(function () {
+                    box.hide();
+                });
+                box.dblclick(function () {
+                    box.hide();
+                });
+            } else if (imgUrl != null) {
+                var src = imgUrl, box = $('#image-box');
+                box.show();
+                box.find('img').attr('src', src);
+                box.find('a').click(function () {
+                    box.hide();
+                });
+                box.dblclick(function () {
+                    box.hide();
+                });
+            }
+        };
+
+        // 删除活动图或banner
+        $scope.clearFile = function (type) {
+            switch (type) {
+                case 'actImg':
+                    $scope.actImg = null;
+                    $scope.actImgUrl = null;
+                    break;
+                case 'banner':
+                    $scope.banner = null;
+                    $scope.bannerUrl = null;
+                    break;
+            }
+            // 清空input框的内容
+            var file=document.getElementById(type);
+            //IE,Safari,chrome
+            if(file.outerHTML){
+                file.outerHTML=file.outerHTML;
+            }
+            else{      //FF
+                file.value="";
+            }
+        };
+
+        // 删除奖品图片
+        $scope.deletePrizeImg = function(path, index) {
+            $scope.awards[index].img = null;
+            var type = 'award' + index;
+            // 清空input框的内容
+            var file=document.getElementById(type);
+            //IE,Safari,chrome
+            if(file.outerHTML){
+                file.outerHTML=file.outerHTML;
+            }
+            else{      //FF
+                file.value="";
+            }
+            if (!angular.isUndefined(path)) {
+                Activity.deletePrizeImg({path: path}, {}, function(data) {
+
+                });
+            }
+        };
+
         $scope.uploadPrizeImg = function(award, index) {
             $scope.loading = true;
             var files = award.prizeImgs, file = files && files.length > 0 ? files[0] : null;
-            console.log(file);
             $upload.upload({
                 url: 'activity/upload/prizeImg',
                 method: 'POST',

+ 48 - 23
donate-console/src/main/webapp/resources/view/activity/activity_launch.html

@@ -156,7 +156,7 @@
         outline: none;
     }
     .content-setting .form-group .prise .add-price{
-        margin: -16px 0 36px 0;
+        margin: 16px 0 36px 0;
         font-family: 'SimHei'!important;
         font-size: 14px;
         color: #1b71c9;
@@ -522,13 +522,13 @@
             <form class="form-horizontal" name="activityForm">
                 <div class="content-setting">
                     <div class="form-group clearfix">
-                        <label for="" class="control-label fl">活动标题</label>
-                        <input type="text" class="form-control fl" ng-model="activity.name"/>
+                        <label class="control-label fl">活动标题</label>
+                        <input type="text" class="form-control fl" ng-model="activity.name" required/>
                     </div>
                     <div class="form-group clearfix">
-                        <label for="" class="control-label fl">活动时间</label>
+                        <label class="control-label fl">活动时间</label>
                         <div class="active-time fl">
-                            <input type="text" ng-model="activity.startTime" readonly style="float:left"
+                            <input type="text" ng-model="activity.startTime" readonly style="float:left" required
                                    class="date-choose f1 form-control" placeholder="开始时间"
                                    datepicker-popup="yyyy-MM-dd" is-open="activity.$startTimeOpened"
                                    ng-required="true" max-date="activity.endTime"
@@ -536,7 +536,7 @@
                                    datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
                                    ng-click="openDatePicker($event, activity, '$startTimeOpened')">
                             <span class="fl">至</span>
-                            <input type="text" ng-model="activity.endTime" readonly
+                            <input type="text" ng-model="activity.endTime" readonly required
                                    class="date-choose f1 form-control" placeholder="结束时间"
                                    datepicker-popup="yyyy-MM-dd" is-open="activity.$endTimeOpened" min-date="activity.startTime"
                                    ng-required="true"
@@ -546,9 +546,9 @@
                         </div>
                     </div>
                     <div class="form-group clearfix">
-                        <label for="" class="control-label fl">兑奖时间</label>
+                        <label class="control-label fl">兑奖时间</label>
                         <div class="active-time fl">
-                            <input type="text" ng-model="activity.receiveStartTime" readonly style="float:left"
+                            <input type="text" ng-model="activity.receiveStartTime" readonly style="float:left" required
                                    class="date-choose f1 form-control" placeholder="开始兑奖时间"
                                    datepicker-popup="yyyy-MM-dd" is-open="activity.$receiveStartTimeOpened"
                                    ng-required="true" min-date="activity.startTime" max-date="activity.endTime"
@@ -556,7 +556,7 @@
                                    datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
                                    ng-click="openDatePicker($event, activity, '$receiveStartTimeOpened')">
                             <span class="fl">至</span>
-                            <input type="text" ng-model="activity.receiveEndTime" readonly
+                            <input type="text" ng-model="activity.receiveEndTime" readonly required
                                    class="date-choose f1 form-control" placeholder="截止兑奖时间"
                                    datepicker-popup="yyyy-MM-dd" is-open="activity.$receiveEndTimeOpened"
                                    ng-required="true" min-date="activity.receiveStartTime" max-date="activity.endTime"
@@ -577,23 +577,31 @@
                         <div class="fl uploadImage">
                             <div><button>上传图片</button><span>(160*160)</span></div>
                             <input type="file" ng-multiple="false" onchange='angular.element(this).scope().fileChanged(this, 0)'>
-                            <div class="img-show">
-                                <img src="static/images/reward.png" alt="预览" title="预览"/>
+                            <div ng-if="null != actImgUrl" style="max-height: 100px; max-width: 300px">
+                                <img style="max-height: 100px; max-width: 100px" src="{{actImgUrl}}">
+                                <span class="hover-show">
+                                    <em style="cursor: pointer;" class="delete" title="删除" ng-click="clearFile('actImg')"><em class="fa fa-2x fa-trash"></em></em>
+                                    <a ng-click="showImg('actImg')" title="点击查看大图"><em class="fa fa-search"></em>查看</a>
+                                </span>
                             </div>
                         </div>
                     </div>
                     <div class="form-group clearfix">
-                        <label for="" class="control-label fl">Banner</label>
+                        <label class="control-label fl">Banner</label>
                         <div class="fl uploadImage">
                             <div><button>上传图片</button><span>(1140*140)</span></div>
                             <input type="file" ng-multiple="false" onchange='angular.element(this).scope().fileChanged(this, 1)'>
-                            <div class="img-show img-shows">
-                                <img src="static/images/active01.png" alt=""/>
+                            <div ng-if="null != bannerUrl" style="max-height: 100px; max-width: 300px">
+                                <img style="max-height: 100px; max-width: 100px" src="{{bannerUrl}}">
+                                <span class="hover-show">
+                                    <em style="cursor: pointer;" class="delete" title="删除" ng-click="clearFile('banner')"><em class="fa fa-2x fa-trash"></em></em>
+                                    <a ng-click="showImg('banner')" title="点击查看大图"><em class="fa fa-search"></em>查看</a>
+                                </span>
                             </div>
                         </div>
                     </div>
                     <div class="form-group clearfix">
-                        <label for="" class="control-label fl">活动奖品</label>
+                        <label class="control-label fl">活动奖品</label>
                         <div class="prise fl">
                             <div class="prise-list" ng-repeat="award in awards">
                                 <div class="prise-detail">
@@ -603,11 +611,11 @@
                                 </div>
                                 <div class="award-detail clearfix">
                                     <span class="fl">数量</span>
-                                    <input type="text" ng-model="award.amount" class="fl form-control">
+                                    <input type="text" ng-model="award.amount" class="fl form-control" required>
                                 </div>
                                 <div class="award-detail clearfix">
                                     <span class="fl">奖品等级</span>
-                                    <input type="text" ng-model="award.awardLevel" class="fl form-control">
+                                    <input type="text" ng-model="award.awardLevel" class="fl form-control" required>
                                 </div>
                                 <div class="award-detail clearfix">
                                     <span class="fl">赠送方式</span>
@@ -619,7 +627,14 @@
                                 </div>
                                 <div class="uploadImg">
                                     上传图片
-                                    <input type="file" ng-multiple="false" ng-model="award.prizeImgs" ng-file-select ng-change="uploadPrizeImg(award, $index)">
+                                    <input type="file" ng-multiple="false" id="award{{$index}}" ng-model="award.prizeImgs" ng-file-select ng-change="uploadPrizeImg(award, $index)" required>
+                                </div>
+                                <div ng-if="null != award.img" style="max-height: 100px; max-width: 300px">
+                                    <img style="max-height: 100px; max-width: 100px" src="{{award.img}}">
+                                    <span class="hover-show">
+                                        <em style="cursor: pointer;" class="delete" title="删除" ng-click="deletePrizeImg(award.img, $index)"><em class="fa fa-2x fa-trash"></em></em>
+                                        <a ng-click="showImg(award.img)" title="点击查看大图"><em class="fa fa-search"></em>查看</a>
+                                    </span>
                                 </div>
                             </div>
                             <div class="add-price">
@@ -639,8 +654,8 @@
                                 <span>+选择项目</span>
                             </div>
                             <div class="button">
-                                <a ng-click="submit(true)" class="launch">发布</a>
-                                <a ng-click="submit(false)" class="draft">存为草稿</a>
+                                <button ng-click="submit(true)" ng-disabled="activityForm.$invalid || !activity.summary || !actImgUrl || !bannerUrl" class="launch">发布</button>
+                                <button ng-click="submit(false)" class="draft">存为草稿</button>
                                 <span class="clear" ng-click="refresh()">清空内容</span>
                             </div>
                         </div>
@@ -661,7 +676,7 @@
             <div class="modal-body body">
                 <div class="chooseUser">
                     <div class="search">
-                        <input type="text" ng-model="keyword" ng-change="onSearch()" placeholder="请输入关键字" class="form-control">
+                        <input type="text" ng-model="keyword" ng-change="onSearch()" placeholder="请输入关键字" class="form-control" required>
                         <button ng-click="onSearch()">搜索</button>
                     </div>
                     <div class="choose-body">
@@ -669,7 +684,7 @@
                             <div class="top">全部项目</div>
                             <div class="bottom">
                                 <div class="item-list" ng-repeat="project in projects">
-                                    <input ng-model="project.checked" ng-click="checkSelected(project)" type="checkbox"/>
+                                    <input ng-model="project.checked" ng-click="checkSelected(project)" type="checkbox" required/>
                                     <label>{{project.name}}</label>
                                 </div>
                             </div>
@@ -682,7 +697,7 @@
                             <div class="top">已选项目</div>
                             <div class="bottom">
                                 <div class="item-list" ng-repeat="project in selectedProjects">
-                                    <input ng-model="project.checked" type="checkbox"/>
+                                    <input ng-model="project.checked" type="checkbox" required/>
                                     <label>{{project.name}}</label>
                                 </div>
                             </div>
@@ -697,6 +712,16 @@
         </div>
     </div>
 </div>
+<!--查看大图-->
+<div id="image-box" style="display: none;">
+    <div class="x-close-wrap" title="关闭">
+        <a href="javascript:void(0);">&times;</a>
+    </div>
+    <div class="x-floating-wrap"></div>
+    <div class="x-floating">
+        <img/>
+    </div>
+</div>
 <script type="text/javascript">
     $(document).ready(function() {
         var btn = document.getElementsByClassName('dropdown-toggle');

+ 44 - 11
donate-console/src/main/webapp/resources/view/project/project_launch_2.html

@@ -531,17 +531,28 @@
                                     <div class="computer">
                                         <span>PC端主图</span>
                                         <button>上传图片</button>
-                                        <input type="file" ng-multiple="false" onchange='angular.element(this).scope().fileChanged(this, 0)' required>
+                                        <input type="file" ng-multiple="false" id="pcImg" onchange='angular.element(this).scope().fileChanged(this, 0)'>
                                         <em>(最能代表项目的焦点图,图片尺寸不小于500*280px,支持jpg,gif,png格式,不超过10MB)</em>
-                                        <!--<div ng-show="previewShow">-->
-                                        <!--<img ng-show="previewShow" alt="PC端主图" src="{{imgPreview}}" width="200px" height="100px">-->
-                                        <!--</div>-->
+                                        <div ng-if="null != pcImgUrl" style="max-height: 100px; max-width: 300px">
+                                            <img style="max-height: 100px; max-width: 100px" src="{{pcImgUrl}}">
+                                            <span class="hover-show">
+                                                <em style="cursor: pointer;" class="delete" title="删除" ng-click="clearFile('pcImg')"><em class="fa fa-2x fa-trash"></em></em>
+                                                <a ng-click="showImg('pcImg')" title="点击查看大图"><em class="fa fa-search"></em>查看</a>
+                                            </span>
+                                        </div>
                                     </div>
-                                    <div class="computer phone">
+                                    <div class="computer">
                                         <span>手机端主图</span>
                                         <button>上传图片</button>
-                                        <input type="file" ng-multiple="false" onchange='angular.element(this).scope().fileChanged(this, 1)' required>
+                                        <input type="file" ng-multiple="false" id="mobileImg" onchange='angular.element(this).scope().fileChanged(this, 1)'>
                                         <em>(最能代表项目的焦点图,图片尺寸不小于500*280px,支持jpg,gif,png格式,不超过10MB)</em>
+                                        <div ng-if="null != mobileImgUrl" style="max-height: 100px; max-width: 300px">
+                                            <img style="max-height: 100px; max-width: 100px" src="{{mobileImgUrl}}">
+                                            <span class="hover-show">
+                                                <em style="cursor: pointer;" class="delete" title="删除" ng-click="clearFile('mobileImg')"><em class="fa fa-2x fa-trash"></em></em>
+                                                <a ng-click="showImg('mobileImg')" title="点击查看大图"><em class="fa fa-search"></em>查看</a>
+                                            </span>
+                                        </div>
                                     </div>
                                 </div>
                             </div>
@@ -550,9 +561,15 @@
                                 <div class="fl">
                                     <div class="computer uploadImg">
                                         <button>上传图片</button>
-                                        <input type="file" ng-multiple="false" onchange='angular.element(this).scope().fileChanged(this, 2)' required>
+                                        <input type="file" ng-multiple="false" id="mobileListImg" onchange='angular.element(this).scope().fileChanged(this, 2)'>
                                         <em>(最能代表项目的焦点图,图片尺寸不小于500*375像素以上,支持jpg,gif,png格式,不超过10MB)</em>
-                                        <!--<img src="{{mobileListImg.url}}">-->
+                                        <div ng-if="null != mobileListImgUrl" style="max-height: 100px; max-width: 300px">
+                                            <img style="max-height: 100px; max-width: 100px" src="{{mobileListImgUrl}}">
+                                            <span class="hover-show">
+                                                <em style="cursor: pointer;" class="delete" title="删除" ng-click="clearFile('mobileListImg')"><em class="fa fa-2x fa-trash"></em></em>
+                                                <a ng-click="showImg('mobileListImg')" title="点击查看大图"><em class="fa fa-search"></em>查看</a>
+                                            </span>
+                                        </div>
                                     </div>
                                 </div>
                             </div>
@@ -568,9 +585,15 @@
                                         <span class="fl">头像</span>
                                         <div class="button fl">
                                             <button>上传图片</button>
-                                            <input type="file" ng-multiple="false" onchange='angular.element(this).scope().fileChanged(this, 3)' required>
+                                            <input type="file" ng-multiple="false" id="logo" onchange='angular.element(this).scope().fileChanged(this, 3)'>
                                             <em>(图片尺寸不小于500*500px,支持jpg,gif,png格式,不超过2MB)</em>
-                                            <!--<img src="{{logo.url}}">-->
+                                            <div ng-if="null != logoUrl" style="max-height: 100px; max-width: 300px">
+                                                <img style="max-height: 100px; max-width: 100px" src="{{logoUrl}}">
+                                                <span class="hover-show">
+                                                    <em style="cursor: pointer;" class="delete" title="删除" ng-click="clearFile('logo')"><em class="fa fa-2x fa-trash"></em></em>
+                                                    <a ng-click="showImg('logo')" title="点击查看大图"><em class="fa fa-search"></em>查看</a>
+                                                </span>
+                                            </div>
                                         </div>
                                     </div>
                                     <div class="item clearfix">
@@ -599,7 +622,7 @@
                                 </div>
                                 <div class="fl submitButton">
                                     <div class="sub">
-                                        <a type="button" style="cursor: pointer;" ng-disabled="detailForm.$invalid" ng-click="saveDetail(project, true)">提交</a>
+                                        <button ng-disabled="detailForm.$invalid || !project.introduction || !pcImg || !mobileImg || !mobileListImg || !logo" ng-click="saveDetail(project, true)">提交</button>
                                         <button ng-click="saveDetail(project, false)">保存草稿</button></div>
                                     <a ui-sref="launchProject1">返回上一页</a>
                                 </div>
@@ -611,6 +634,16 @@
         </div>
     </section>
 </div>
+<!--查看大图-->
+<div id="image-box" style="display: none;">
+    <div class="x-close-wrap" title="关闭">
+        <a href="javascript:void(0);">&times;</a>
+    </div>
+    <div class="x-floating-wrap"></div>
+    <div class="x-floating">
+        <img/>
+    </div>
+</div>
 <script>
     $('.dropdown-toggle').click(function(){
         $(this).next('.dropdown-menu').toggle();