ソースを参照

H5活动详情页修改

dongbw 8 年 前
コミット
2478fbce74

+ 5 - 0
donate-service/src/main/java/com/uas/service/donate/service/impl/UserServiceImpl.java

@@ -56,6 +56,11 @@ public class UserServiceImpl implements UserService {
                 User user = userDao.findOne(Long.valueOf(accountUser.getDialectUID()));
                 if (null == user) {
                     user = new User(accountUser);
+                    user.setUserIMId(imId);
+                    user = userDao.save(user);
+                }
+                if (null == user.getUserIMId()) {
+                    user.setUserIMId(imId);
                     user = userDao.save(user);
                 }
                 return user;

+ 2 - 2
donate-service/src/main/webapp/resources/js/mobile/app.js

@@ -1,6 +1,6 @@
-define([ 'angularAMD', 'ngRoute', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', '../common/services', 'angular-toaster', 'ngSanitize', 'common/query/Activity', 'common/query/Project', 'common/query/User'], function(angularAMD) {
+define([ 'angularAMD', 'ngRoute', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', '../common/services', 'angular-toaster', 'ngSanitize', 'common/query/Activity', 'common/query/Project', 'common/query/User', 'common/query/Public'], function(angularAMD) {
     'use strict';
-    var app = angular.module('myApp', [ 'ngRoute', 'ui.router', 'ui.bootstrap', 'ng.local', 'ngTable', 'common.services', 'toaster', 'ngSanitize', 'ActivityService', 'ProjectService', 'UserService']);
+    var app = angular.module('myApp', [ 'ngRoute', 'ui.router', 'ui.bootstrap', 'ng.local', 'ngTable', 'common.services', 'toaster', 'ngSanitize', 'ActivityService', 'ProjectService', 'UserService', 'PublicService']);
     app.init = function() {
         angularAMD.bootstrap(app);
     };

+ 24 - 2
donate-service/src/main/webapp/resources/js/mobile/controllers/MobileActivityDetailCtrl.js

@@ -1,12 +1,16 @@
 define([ 'app/app' ], function(app) {
     'use strict';
 
-    app.register.controller('MobileActivityDetailCtrl', ['$scope', 'Activity', '$stateParams', '$http', 'toaster', 'User',
-        function ($scope, Activity, $stateParams, $http, toaster, User) {
+    app.register.controller('MobileActivityDetailCtrl', ['$scope', 'Activity', '$stateParams', '$http', 'toaster', 'User', 'Public',
+        function ($scope, Activity, $stateParams, $http, toaster, User, Public) {
 
         var id = $stateParams.id;
         var imId = $stateParams.imId;
         var init = function () {
+            // 获取服务器时间
+            Public.getServeTime({}, {}, function(data) {
+                $scope.serveTime = data.serveTime;
+            });
 
             // 获取活动详情
             Activity.getDetailById({id: id}, {}, function(data) {
@@ -15,6 +19,24 @@ define([ 'app/app' ], function(app) {
             }, function (error) {
                 console.log(error);
             });
+
+            if (null !== imId) {
+                var userUU = null;
+                User.getUserUUByImId({imId: imId}, {}, function(data) {
+                    userUU = data.userUU;
+                    Activity.getActivityRecord({id: id}, {}, function(data) {
+                        if (data && data.record) {
+                            if (userUU !== data.record.uuid) {
+                                toaster.pop('warning', '当前参与活动记录与im用户账号不一致');
+                            } else {
+                                $scope.activityRecord = data.record;
+                            }
+                        }
+                        $scope.inActivity = data !== null && !angular.isUndefined(data.record);
+                    });
+                });
+                $scope.isAuthed = null !== userUU;
+            }
         };
         init();
 

+ 2 - 2
donate-service/src/main/webapp/resources/js/mobile/controllers/MobileProjectDetailCtrl.js

@@ -23,9 +23,9 @@ define([ 'app/app' ], function(app) {
                 // 展开全文
                 var $showAll = $('#activityIntroduction');
                 $showAll.html(data.introduction);
-                alert('获取成功');
+                // alert('获取成功');
                 var $height = $showAll.height();
-                alert($showAll.height());
+                // alert($showAll.height());
                 if ($height > 700) {
                     $showAll.css({
                         'height': '6rem',

+ 58 - 10
donate-service/src/main/webapp/resources/view/mobile/mobile_activity_detail.html

@@ -222,11 +222,11 @@
             </div>
             <div class="detail">
                 <div class="title">
-                    <h4>{{activity.name}}</h4>
-                    <h6 class="state">{{activity.stage}}</h6>
+                    <h4 ng-bind="activity.name"></h4>
+                    <h6 class="state" ng-bind="activity.stage"></h6>
                 </div>
                 <div class="txt">
-                    <p>{{activity.summary}}</p>
+                    <p ng-bind-html="activity.summary"></p>
                 </div>
             </div>
             <div class="intro">
@@ -235,7 +235,9 @@
                 </div>
                 <div class="prize">
                     <div ng-repeat="award in activity.awards | orderBy: 'awardLevel'">
-                        <p>{{award.awardLevel}}{{award.awardName}} *{{award.amount}}</p>
+                        <p>奖品名称:<span ng-bind="award.awardName"></span></p>
+                        <p>奖品等级:<span ng-bind="award.awardLevel"></span></p>
+                        <p>奖品数量:<span ng-bind="award.amount"></span></p>
                     </div>
                 </div>
                 <div class="prize-img" ng-repeat="award in activity.awards | orderBy: 'awardLevel'">
@@ -248,18 +250,64 @@
             <div class="statistics">
                 <div class="statistics-list">
                     <p>活动参加人数:</p>
-                    <div><span ng-bind="activity.joinAmount | number"></span><b>人次</b></div>
+                    <div><span ng-bind="activity.joinAmount || 0 | number"></span><b>人次</b></div>
                 </div>
                 <div class="statistics-list">
                     <p>与活动相关的项目已筹得:</p>
-                    <div><span ng-bind="donationHistory | number:2"></span><b>元</b></div>
+                    <div><span ng-bind="activity.amount || 0 | number:2"></span><b>元</b></div>
                 </div>
             </div>
         </div>
-        <div class="footer">
-            <a class="attend" ng-if="qualification == 0">未参加活动</a>
-            <a class="attend doing" ng-if="qualification == 1 && activity.stage != '兑奖中'">{{activity.stage}}</a>
-            <a class="attend opening" ng-click="takeAward(activityRecord)" ng-if="qualification == 1 && activity.stage == '兑奖中'">领奖</a>
+        <!--<div class="footer">-->
+            <!--<a class="attend" ng-if="qualification == 0">未参加活动</a>-->
+            <!--<a class="attend doing" ng-if="qualification == 1 && activity.stage != '兑奖中'">{{activity.stage}}</a>-->
+            <!--<a class="attend opening" ng-click="takeAward(activityRecord)" ng-if="qualification == 1 && activity.stage == '兑奖中'">领奖</a>-->
+        <!--</div>-->
+        <!-- 1.未登录 -->
+        <div class="footer" ng-if="!isAuthed">
+            <span class="tip">暂未参加活动</span>
+        </div>
+        <!-- 2.已登录,未参加活动 -->
+        <div class="footer" ng-if="isAuthed && !inActivity">
+            <span class="tip" title="参加活动捐款且捐款超过一元即可参与活动">暂未参加活动</span>
+        </div>
+        <!-- 3.已登录,已参加活动 -->
+        <!-- 3.1 活动未到开始兑奖时间 -->
+        <div class="footer" ng-if="isAuthed && inActivity && serveTime < activity.receiveStartTime">
+            <span class="tip" title="已参与活动,等待开奖">待开奖</span>
+        </div>
+        <!-- 3.2 活动在开始兑奖奖时间到结束兑奖时间之间 -->
+        <!-- 3.2.1.1 活动在开始兑奖奖时间到结束兑奖时间之间,中奖 -->
+        <!-- 3.2.1.1 活动在开始兑奖奖时间到结束兑奖时间之间,中奖 -未领取 -->
+        <div class="footer" ng-if="isAuthed && inActivity &&  serveTime > activity.receiveStartTime
+                && serveTime < activity.receiveEndTime && activityRecord.isGetAward == 1 && activityRecord.status == 1">
+            <p>兑奖日期
+                <span ng-bind="activity.receiveStartTime | date:'yyyy-MM-dd'"></span>至
+                <span ng-bind="activity.receiveEndTime | date:'yyyy-MM-dd'"></span>
+            </p>
+            <a data-toggle="modal" data-target="#layer">领奖</a>
+        </div>
+        <!-- 3.2.1.2 活动在开始兑奖奖时间到结束兑奖时间之间,中奖 -已领取 -->
+        <div class="footer" ng-if="isAuthed && inActivity &&  serveTime > activity.receiveStartTime
+                && serveTime < activity.receiveEndTime && activityRecord.isGetAward == 1 && activityRecord.status == 2">
+            <p>兑奖日期
+                <span ng-bind="activity.receiveStartTime | date:'yyyy-MM-dd'"></span>至
+                <span ng-bind="activity.receiveEndTime | date:'yyyy-MM-dd'"></span>
+            </p>
+            <span class="tip hasGet" title="奖品已领取">已领奖</span>
+        </div>
+        <!-- 3.2.2 活动在开始兑奖奖时间到结束兑奖时间之间,未中奖 -->
+        <div class="footer" ng-if="isAuthed && inActivity && serveTime > activity.receiveStartTime
+                && serveTime < activity.receiveEndTime && activityRecord.isGetAward != 1">
+            <span class="tip" title="您未中奖,请期待下次活动">未中奖</span>
+        </div>
+        <!-- 3.3 活动在结束兑奖时间到结束时间之间 -->
+        <div class="footer" ng-if="isAuthed && inActivity && serveTime > activity.receiveEndTime && serveTime < activity.endTime">
+            <span class="tip" title="领奖已结束,请期待下次活动">领奖已结束</span>
+        </div>
+        <!-- 3.3 活动在结束时间之后 -->
+        <div class="footer" ng-if="isAuthed && inActivity && serveTime > activity.endTime">
+            <span class="tip" title="活动已结束,请期待下次活动">活动已结束</span>
         </div>
     </div>
 </div>