From d9a57ead5b7289164a95a22b87389daf50afd257 Mon Sep 17 00:00:00 2001
From: dy <1197793912@qq.com>
Date: Tue, 20 Apr 2021 11:21:53 +0800
Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E7=BC=96=E8=BE=91=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E6=B4=BB=E5=8A=A8=E8=A7=84=E5=88=99=E6=8F=8F=E8=BF=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../web/controller/draw/DrawController.java | 18 +++++++++++
.../com/ruoyi/web/vo/draw/RuleResult.java | 17 +++++++++++
.../src/main/resources/public/act/guide.html | 2 +-
.../src/main/resources/public/draw/js/draw.js | 28 +++++++++++++++++
.../resources/public/draw/scratchcard.html | 24 +++++++--------
.../main/resources/public/draw/turntable.html | 30 +++++++++----------
.../templates/activity/info/edit.html | 2 +-
7 files changed, 92 insertions(+), 29 deletions(-)
create mode 100644 sino-act-web/src/main/java/com/ruoyi/web/vo/draw/RuleResult.java
diff --git a/sino-act-web/src/main/java/com/ruoyi/web/controller/draw/DrawController.java b/sino-act-web/src/main/java/com/ruoyi/web/controller/draw/DrawController.java
index 690abb9a5..078860a57 100644
--- a/sino-act-web/src/main/java/com/ruoyi/web/controller/draw/DrawController.java
+++ b/sino-act-web/src/main/java/com/ruoyi/web/controller/draw/DrawController.java
@@ -64,6 +64,8 @@ public class DrawController {
private IActPageConfigUserinfoService iActPageConfigUserinfoService;
@Autowired
private IDrawTaskNotifyService taskNotifyService;
+ @Autowired
+ private IDrawRuleService drawRuleService;
private WxOAuth2UserInfo getUserInfo(HttpServletRequest request, String code) throws Exception {
// if (!this.wxService.switchover(appid)) {
@@ -412,6 +414,22 @@ public class DrawController {
}
return result;
}
+ @ApiOperation("获取活动规则描述")
+ @ApiImplicitParam(name = "actCode", value = "活动编码", required = true, dataType = "string", paramType = "path")
+ @RequestMapping(value="/describe", method = RequestMethod.POST)
+ @ResponseBody
+ public Result findDescribe(HttpServletRequest request, String actCode){
+ RuleResult result = new RuleResult();
+ try {
+ DrawRule drawRule = drawRuleService.selectDrawRuleByCode(actCode);
+ result.setDrawRule(drawRule);
+ }catch (Exception e){
+ result.setRespCode("-1");
+ result.setRespMsg("系统异常,请稍后再试");
+ logger.error("DrawController.saveAddress ex: ", e);
+ }
+ return result;
+ }
}
diff --git a/sino-act-web/src/main/java/com/ruoyi/web/vo/draw/RuleResult.java b/sino-act-web/src/main/java/com/ruoyi/web/vo/draw/RuleResult.java
new file mode 100644
index 000000000..0ce08ef18
--- /dev/null
+++ b/sino-act-web/src/main/java/com/ruoyi/web/vo/draw/RuleResult.java
@@ -0,0 +1,17 @@
+package com.ruoyi.web.vo.draw;
+
+import com.ruoyi.web.vo.Result;
+import com.sinosoft.activity.domain.DrawRule;
+import lombok.Data;
+
+/**
+ * TODO
+ *
+ * @author dy
+ * @version 1.0
+ * @date 2021/4/20 10:16
+ */
+@Data
+public class RuleResult extends Result {
+ private DrawRule drawRule;
+}
diff --git a/sino-act-web/src/main/resources/public/act/guide.html b/sino-act-web/src/main/resources/public/act/guide.html
index 1747c83f9..cd14fa25b 100644
--- a/sino-act-web/src/main/resources/public/act/guide.html
+++ b/sino-act-web/src/main/resources/public/act/guide.html
@@ -95,7 +95,7 @@
$("#btntext2").val(data.actPageConfigGuide.btnText2);
$("#btn2textshow").text(data.actPageConfigGuide.btnText2);
$("#flag").val(data.actType);
- $(".contBox").text(data.actPageConfigGuide.btnLink2);
+ $(".contBox").append(data.actPageConfigGuide.btnLink2);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log('网络异常', textStatus, errorThrown);
diff --git a/sino-act-web/src/main/resources/public/draw/js/draw.js b/sino-act-web/src/main/resources/public/draw/js/draw.js
index 05a9b1fd2..c96af1073 100644
--- a/sino-act-web/src/main/resources/public/draw/js/draw.js
+++ b/sino-act-web/src/main/resources/public/draw/js/draw.js
@@ -11,8 +11,36 @@ function rtn() {
}
function drawrule() {
console.log('rule');
+ $.ajax({
+ type: "POST",
+ url: contextRootPath+"/draw/describe",
+ data: {actCode: drawCode},
+ dataType: "json",
+ success: function(data){
+ var desc = removeHTMLTag(data.drawRule.drawdescribe);
+ var desc1 = escape2Html(desc);
+ console.log(desc1);
+ $(".contBox").append(desc1);
+ },
+ error: function (XMLHttpRequest, textStatus, errorThrown) {
+ console.log('网络异常', textStatus, errorThrown);
+ }
+ });
$('.rule').show();
}
+//转义替换
+/*移除HTML标签代码*/
+function removeHTMLTag(str) {
+ str = str.replace(/<\/?[^>]*>/g,''); //去除HTML tag
+ str = str.replace(/[ | ]*\n/g,'\n'); //去除行尾空白
+ //str = str.replace(/\n[\s| | ]*\r/g,'\n'); //去除多余空行
+ //str=str.replace(/ /ig,'');//去掉
+ return str;
+}
+function escape2Html(str) {
+ var arrEntities={'lt':'<','gt':'>','nbsp':' ','amp':'&','quot':'"'};
+ return str.replace(/&(|lt|gt|nbsp|amp|quot);/ig,function(all,t){return arrEntities[t];});
+}
function tip(msg) {
$('.tip_copy>p').text(msg);
$('.tip_copy').show();
diff --git a/sino-act-web/src/main/resources/public/draw/scratchcard.html b/sino-act-web/src/main/resources/public/draw/scratchcard.html
index 2d54ec75a..29a3274ba 100644
--- a/sino-act-web/src/main/resources/public/draw/scratchcard.html
+++ b/sino-act-web/src/main/resources/public/draw/scratchcard.html
@@ -124,18 +124,18 @@