活动欢迎页编写

This commit is contained in:
dy 2021-04-15 15:25:49 +08:00
parent a4a1c87e89
commit 0c0a2a89a5
3 changed files with 212 additions and 5 deletions

View File

@ -1,17 +1,20 @@
package com.ruoyi.web.controller.draw; package com.ruoyi.web.controller.draw;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.web.vo.Const; import com.ruoyi.web.vo.Const;
import com.ruoyi.web.vo.Result; import com.ruoyi.web.vo.Result;
import com.ruoyi.web.vo.draw.*; import com.ruoyi.web.vo.draw.*;
import com.sinosoft.activity.domain.ActConfig;
import com.sinosoft.activity.domain.ActPageConfigGuide;
import com.sinosoft.activity.domain.DrawConfig; import com.sinosoft.activity.domain.DrawConfig;
import com.sinosoft.activity.domain.DrawInfo; import com.sinosoft.activity.domain.DrawInfo;
import com.sinosoft.activity.service.IDrawConfigService; import com.sinosoft.activity.service.*;
import com.sinosoft.activity.service.IDrawInfoService; import io.swagger.annotations.Api;
import com.sinosoft.activity.service.IDrawTaskNotifyService; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import me.chanjar.weixin.common.bean.WxOAuth2UserInfo; import me.chanjar.weixin.common.bean.WxOAuth2UserInfo;
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken; import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.WxMpService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -26,13 +29,13 @@ import javax.servlet.http.HttpSession;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 抽奖Controller * 抽奖Controller
* @author huayue * @author huayue
* @since 2020-08-13 * @since 2020-08-13
*/ */
@Api("活动管理")
@Controller @Controller
@RequestMapping("/draw") @RequestMapping("/draw")
public class DrawController { public class DrawController {
@ -46,6 +49,10 @@ public class DrawController {
private IDrawInfoService drawInfoService; private IDrawInfoService drawInfoService;
@Autowired @Autowired
private WxMpService wxService; private WxMpService wxService;
@Autowired
private IActPageConfigGuideService actPageConfigGuideService;
@Autowired
private IActConfigService actConfigService;
private WxOAuth2UserInfo getUserInfo(HttpServletRequest request, String code) throws Exception { private WxOAuth2UserInfo getUserInfo(HttpServletRequest request, String code) throws Exception {
// if (!this.wxService.switchover(appid)) { // if (!this.wxService.switchover(appid)) {
@ -341,4 +348,40 @@ public class DrawController {
return result; return result;
} }
/**
* 获取活动配置展示信息根据活动编码
* todo 判断活动状态
* @param request
* @param actCode
* @return
*/
@ApiOperation("获取活动配置展示信息")
@ApiImplicitParam(name = "actCode", value = "活动编码", required = true, dataType = "string", paramType = "path")
@RequestMapping(value="/guide", method = RequestMethod.POST)
@ResponseBody
public Result getActGuide(HttpServletRequest request, String actCode) {
ActGuideResult result = new ActGuideResult();
try {
//查询活动内容
DrawInfo drawInfo = new DrawInfo();
drawInfo.setDRAWCODE(actCode);
drawInfo.setSTATUS("1");
List<DrawInfo> drawInfos = drawInfoService.selectDrawInfoList(drawInfo);
result.setDrawInfo(drawInfos.get(0));
//查询获取风格
ActConfig actConfig = actConfigService.selectActConfigByCode(actCode);
result.setPageStyle(actConfig.getPageStyle());
result.setActType(actConfig.getActType());
//获取页面展示内容配置
ActPageConfigGuide actPageConfigGuide = actPageConfigGuideService.selectActPageConfigGuideByCode(actCode);
result.setActPageConfigGuide(actPageConfigGuide);
}catch (Exception e){
result.setRespCode("-1");
result.setRespMsg("系统异常,请稍后再试");
logger.error("DrawController.saveAddress ex: ", e);
}
return result;
}
} }

View File

@ -0,0 +1,25 @@
package com.ruoyi.web.vo.draw;
import com.ruoyi.web.vo.Result;
import com.sinosoft.activity.domain.ActPageConfigGuide;
import com.sinosoft.activity.domain.DrawInfo;
import lombok.Data;
/**
* TODO
*
* @author dy
* @version 1.0
* @date 2021/4/14 14:38
*/
@Data
public class ActGuideResult extends Result {
private ActPageConfigGuide actPageConfigGuide;
private DrawInfo drawInfo;
private Integer pageStyle;
private Integer actType;
}

View File

@ -0,0 +1,139 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta name="viewport"
content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
<meta charset="UTF-8">
<meta name="format-detection" content="telephone=no"/>
<title>活动</title>
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/popup.css"/>
<link rel="stylesheet" type="text/css" href="css/myPrize.css"/>
<link rel="stylesheet" type="text/css" href="css/register.css"/>
<link rel="stylesheet" type="text/css" href="css/winPrize.css"/>
<link rel="stylesheet" type="text/css" href="css/goods.css"/>
<link rel="stylesheet" type="text/css" href="css/rule.css"/>
<script src="/js/config.js"></script>
<style type="text/css">
.button { /* 按钮美化 */
width: 200px; /* 宽度 */
height: 40px; /* 高度 */
border-width: 0px; /* 边框宽度 */
border-radius: 3px; /* 边框半径 */
background: #1E90FF; /* 背景颜色 */
cursor: pointer; /* 鼠标移入按钮范围时出现手势 */
outline: none; /* 不显示轮廓线 */
font-family: Microsoft YaHei; /* 设置字体 */
color: white; /* 字体颜色 */
font-size: 17px; /* 字体大小 */
}
.button:hover { /* 鼠标移入按钮范围时改变颜色 */
background: #5599FF;
}
p {
clear: both;
padding-bottom: 2em;
}
.title {
text-align: center;
position: absolute;
top: 20%;
font-size: 37px;
left: 0px;
color: #fef6e1;
width: 100%;
}
.desc {
text-align: center;
position: absolute;
top: 30%;
font-size: 22px;
left: 0px;
color: #fef6e1;
width: 100%;
}
.btntext {
text-align: center;
position: absolute;
top: 60%;
font-size: 22px;
left: 0px;
color: #fef6e1;
width: 100%;
}
.btntext2 {
text-align: center;
position: absolute;
top: 70%;
font-size: 22px;
left: 0px;
color: #fef6e1;
width: 100%;
}
</style>
<link rel="stylesheet" href="css/main.css">
<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/awardRotate.js"></script>
<script src="js/util.js"></script>
<script src="js/draw.js"></script>
<script>
var num = 0;
var prizeImgs = [];
$(document).ready(function () {
$.ajax({
type: "POST",
async: false,
url: contextRootPath + "/draw/guide",
data: {actCode: drawCode},
dataType: "json",
success: function (data) {
//todo 根据风格改变css样式
$('title').html(data.drawInfo.drawname);
$(".act_guide").attr("background",data.actPageConfigGuide.bgImg);
$("#title").text(data.actPageConfigGuide.actTitle);
$("#desc").text(data.actPageConfigGuide.actDesc);
$("#btntext").val(data.actPageConfigGuide.btnText);
$("#btntext2").val(data.actPageConfigGuide.btnText2);
$("#flag").val(data.actType);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log('网络异常', textStatus, errorThrown);
}
});
});
</script>
</head>
<body class="template_bg popupBox act_guide" style="background-color: #fbdaaf;
background-repeat:no-repeat;
background-attachment:fixed;
background-size:100% 100%;">
<div>
<h1 class="title" id="title"></h1>
<h2 class="desc" id="desc"></h2>
<!-- <p><a href="#" class="button" id="btntext" ></a></p>-->
<p class="btntext"><input class="button" id="btntext" type="button" onclick="jump()"/></p>
<p class="btntext2"><input class="button" id="btntext2" type="button"/></p>
<input id="flag" type="hidden" value=""/>
</div>
<script src="js/main.js"></script>
<script src="js/scroll.js"></script>
<script src="js/common.js"></script>
</body>
<script>
function jump(){
var flag = $("#flag").val;
//根据不同玩法跳转不同页面
if (flag == "0"){
window.location.href='turntable.html';
}else{
window.location.href='scratchcard.html';
}
}
</script>
</html>