手机端购买页面更新&版本号更改

This commit is contained in:
xiongxiaoyang 2020-11-05 07:47:17 +08:00
parent a1adb2c7df
commit e343134ce2
6 changed files with 49 additions and 8 deletions

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>novel</artifactId>
<groupId>com.java2nb</groupId>
<version>2.6.5</version>
<version>2.7.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>novel</artifactId>
<groupId>com.java2nb</groupId>
<version>2.6.5</version>
<version>2.7.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>novel</artifactId>
<groupId>com.java2nb</groupId>
<version>2.6.5</version>
<version>2.7.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -140,6 +140,8 @@ public class PageController extends BaseController{
//查询内容
BookContent bookContent = bookService.queryBookContent(bookIndex.getId());
model.addAttribute("bookContent",bookContent);
boolean needBuy = false;
//判断该目录是否收费
if(bookIndex.getIsVip()!=null && bookIndex.getIsVip() == 1 ){
UserDetails user = getUserDetails(request);
@ -152,11 +154,10 @@ public class PageController extends BaseController{
if(!isBuy){
//没有购买过需要购买
bookContent.setContent(null);
model.addAttribute("needBuy",true);
return "book/book_content";
needBuy = true;
}
}
model.addAttribute("needBuy",false);
model.addAttribute("needBuy",needBuy);
return ThreadLocalUtil.getTemplateDir()+"book/book_content";
}

View File

@ -169,8 +169,12 @@
<input type="hidden" id="bookIdHidden" th:value="${book.id}"/>
<input type="hidden" id="bookNameHidden" th:value="${book.bookName}"/>
<input type="hidden" id="contentIdHidden" th:value="${bookIndex.id}"/>
<input type="hidden" id="indexNameHidden" th:value="${bookIndex.indexName}"/>
<input type="hidden" id="indexNumHidden" th:value="${bookIndex.indexNum}"/>
<script>
@ -226,11 +230,18 @@
<div th:replace="mobile/common/js :: js">
</div>
<div id="chaptercontent" class="Readarea ReadAjax_content screen_container"
style="color: rgb(0, 0, 0); font-size: 25px;">
style="color: rgb(0, 0, 0); font-size: 25px;" th:if="${!needBuy}">
<p style="width:100%;text-alight:center; overflow: auto;-webkit-overflow-scrolling:touch;" >&nbsp;&nbsp;&nbsp;&nbsp;
<span
th:utext="${bookContent.content}"></span></p>
</div>
<div class="Readarea ReadAjax_content screen_container"
style="color: rgb(0, 0, 0); font-size: 10px;background-color: #fff" th:if="${needBuy}">
<h5>此章为VIP章节需要订阅后才能继续阅读</h5>
价格<span style="color: red">10屋币(1元=100屋币)</span><br/>
<a href="javascript:buyBookIndex()" type="button" class="layui-btn layui-btn-sm layui-btn-radius">购买</a>
</div>
<div class="indexDiv" style="height: 42px;line-height: 42px;text-align:center;background: #f2f2f2">
<a th:href="${preBookIndexId!=0?'/book/'+book.id+'/'+preBookIndexId+'.html':'#'}">上一章</a>
@ -316,9 +327,38 @@
}
}
function buyBookIndex(){
$.ajax({
type: "POST",
url: "/user/buyBookIndex",
data: {'bookId':$("#bookIdHidden").val(),"bookName":$("#bookNameHidden").val(),
"bookIndexId":$("#contentIdHidden").val(),"bookIndexName":$("#indexNameHidden").val()},
dataType: "json",
success: function (data) {
if (data.code == 200) {
location.reload();
} else if(data.code == 1001){
//未登录
}else {
layer.alert(data.msg);
}
},
error: function () {
layer.alert('网络异常');
}
})
}
$.post("/book/addVisitCount", {"bookId": $("#bookIdHidden").val()}, function () {
});
</script>
</html>

View File

@ -5,7 +5,7 @@
<groupId>com.java2nb</groupId>
<artifactId>novel</artifactId>
<version>2.6.5</version>
<version>2.7.0</version>
<modules>
<module>novel-common</module>
<module>novel-front</module>