Browse Source

企业状态

wangchuanjin 9 years ago
parent
commit
480e83b0a3
3 changed files with 34 additions and 26 deletions
  1. 1 1
      core/src/qfw/active/active.go
  2. 6 4
      core/src/qfw/active/flop.go
  3. 27 21
      core/src/web/templates/active/flop.html

+ 1 - 1
core/src/qfw/active/active.go

@@ -10,7 +10,7 @@ var se util.SimpleEncrypt = util.SimpleEncrypt{Key: "topnet2015topnet2015"}
 
 type Active struct {
 	*xweb.Action
-	flop     xweb.Mapper `xweb:"/active/flop/(.*)/(.*)"`
+	flop     xweb.Mapper `xweb:"/active/flop/(\\w+)/([^.]*)"`
 	flopAjax xweb.Mapper `xweb:"/active/flopAjax"`
 }
 

+ 6 - 4
core/src/qfw/active/flop.go

@@ -20,10 +20,12 @@ var flopEncrypt util.SimpleEncrypt = util.SimpleEncrypt{Key: "flopActive"}
 func (a *Active) FlopAjax() error {
 	if a.GetSession("flopData") != nil {
 		data := a.GetSession("flopData").(bson.M)
-		if updateCredit(data["s_userid"].(string), util.IntAll(data["i_oldcredit"]), util.IntAll(data["i_newcredit"]), a.Action) {
-			mongodb.Save("flop", data)
-		} else {
-			log.Println("翻牌的时候", data["s_openid"].(string), "的积分修改失败!")
+		if mongodb.Count("flop", bson.M{"s_openid": data["s_openid"].(string)}) == 0 {
+			if updateCredit(data["s_userid"].(string), util.IntAll(data["i_oldcredit"]), util.IntAll(data["i_newcredit"]), a.Action) {
+				mongodb.Save("flop", data)
+			} else {
+				log.Println("翻牌的时候", data["s_openid"].(string), "的积分修改失败!")
+			}
 		}
 	}
 	return nil

+ 27 - 21
core/src/web/templates/active/flop.html

@@ -91,24 +91,23 @@ img{
 	display: none;
 }
 .cards>img{
-	width: 212.5px;
-	height: 240px;
+	width: 250px;
+	height: 282.4;
 }
 .flop-tip{
 	color: #a52f2e;
 	background-image: url("{{Msg "seo" "cdn"}}/images/flop/tip-bg.png");
 	background-size: 100% 100%;
 	position: absolute;
-	width: 280px;
-	line-height: 22px;
-	left: 50%;
-	margin-left: -145px;
+	left: 20px;
+	right: 20px;
+	max-width: 600px;
+	line-height: 20px;
 	display: none;
 	font-size:0.875em;
 	font-weight: bold;
 	text-align: center;
 	padding: 5px;
-	margin-bottom: 10px;
 	display: none;
 }
 .flop-tip>span{
@@ -134,13 +133,14 @@ img{
 	background-size: 100% 100%;
 	position: absolute;
 	top: 30px;
-	width: 280px;
-	left: 50%;
-	margin-left: -140px;
+	left: 20px;
+	right: 20px;
+	max-width: 600px;
 	text-align: center;
 	padding-top: 7px;
 	padding-bottom: 7px;
 	display: none;
+	font-size: 0.875em;
 }
 .flop-notice>span{
 	display: inline-block;
@@ -217,8 +217,9 @@ ul{
 		</div>
 	</div>
 	{{end}}
+	{{if eq .T.flag 1 2}}
 	<div class="flop-tip">
-		恭喜!你的企明星积分翻
+		恭喜!您的企明星积分翻了
 		<span class="multiple">
 		{{if eq .T.flag 1}}
 		<ul class="random">
@@ -237,6 +238,7 @@ ul{
 		您的积分已从{{.T.oldCredit}}分涨到{{.T.newCredit}}分。<br>
 		<font>积分明细请到企明星(www.qmx.top)查询!</font>
 	</div>
+	{{end}}
 </div>
 <script type="text/javascript">
 if({{.T.IsOver}}){
@@ -247,18 +249,22 @@ $(function(){
 	var windowHeight = $(window).height();
 	var defaultWidth = 320;
 	var defaultHeight = 416;
-	var width = 212.5;
-	var height = 240;
+	var width = 250; // 625 706
+	var height = 282.4;
 	var cardTop = 110;
 	var noticeTop = 70;
 	if(windowHeight > defaultHeight){
 		cardTop = cardTop / defaultHeight * windowHeight;
 		noticeTop = noticeTop / defaultHeight * windowHeight;
 	}
-	if(windowWidth > defaultWidth && windowHeight > defaultHeight){
-		width = width / defaultWidth * windowWidth;
-		if(width > 350){//最大宽度350
-			width = 350
+	if(windowHeight <= 460){
+		height = 240;
+		width = height / 706 * 625;
+		$(".cards>img").css({width: width,height: height});
+	}else if(windowHeight > defaultHeight){
+		width = windowWidth * 2 / 3;
+		if(width > 300){//最大宽度350
+			width = 300
 		}
 		height = width / 625 * 706;
 		$(".cards>img").css({width: width,height: height});
@@ -267,9 +273,9 @@ $(function(){
 	$(".flop-notice").css({top: noticeTop});
 	var flopTipTop = windowHeight - $(".cards").height()  - cardTop - $(".flop-tip").height();
 	if(flopTipTop > 30 && flopTipTop < 40){
-		$(".flop-tip").css({"line-height": "30px",top: $(".cards").height() + cardTop - 20});
+		$(".flop-tip").css({"line-height": "25px",top: $(".cards").height() + cardTop - 20});
 	}else if(flopTipTop > 40){
-		$(".flop-tip").css({"line-height": "30px",top: $(".cards").height() + cardTop - 10});
+		$(".flop-tip").css({"line-height": "25px",top: $(".cards").height() + cardTop});
 	}else{
 		$(".flop-tip").css({top: $(".cards").height()+cardTop-20});
 	}
@@ -293,10 +299,10 @@ $(function(){
 			setTimeout(function(){
 				clearInterval(randomInterval);
 				$(".multiple").html({{.T.multiple}});
-			},1000);
+			},3000);
 			setTimeout(function(){
 				$(".bubble").fadeIn();
-			},3000);
+			},6000);
 			$('.cards').children('img:first').stop().animate({'width':0},500,function(){
 				$(this).hide().next().show();
 				$(this).next().animate({'width':width+'px'},200);