| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672 |
- <!DOCTYPE html>
- <html lang="en"
- xmlns:th="http://www.thymeleaf.org"
- xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
- layout:decorate="~{home/common/common}">
- <head>
- <meta charset="UTF-8">
- <title th:text="${navigation_name}"></title>
- <style>
- .bFind-wrapper-top {
- background: #fff;
- border-color: #ccc #aaa #aaa #ccc;
- border-style: solid;
- border-width: 1px;
- height: 25px !important;
- padding: 4px;
- margin: 0;
- }
- .bsBox {
- width: auto !important;
- height: auto !important;
- }
- .text-overflow {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- </style>
- </head>
- <body layout:fragment="content">
- <!-- 头部导航 -->
- <div th:replace="~{home/common/header :: header}"></div>
- <!--nav-->
- <div class="center_nav">
- <div th:replace="~{home/common/header :: nav}"></div>
- </div>
- <!-- 主体内容 -->
- <div class="main">
- <div class="container projects">
- <div class="row">
- <div class="hidden-xs" style="padding-left: 0;">
- <ol class="breadcrumbFixed clearfix"
- style="margin-top: 40px;border-bottom: 0px solid #fff;margin-bottom: 0;">
- <li>
- <a th:href="@{/home}">首页</a>
- </li>
- <li th:if="${navigation_id!=2}" class="active"><a th:href="@{'/home/informList/'+${navigation_id}}">[[${navigation_name}]]</a>
- </li>
- <li th:if="${navigation_id==2}" class="active"><a th:href="@{/home/unionCompany}">[[${navigation_name}]]</a>
- </li>
- <li class="active"><a><cite>内容详情</cite></a></li>
- </ol>
- </div>
- </div>
- </div>
- <div class="container projects" style="margin-top: 20px;">
- <div id="news_top" class="row">
- <div class="col-sm-12 col-md-12 col-lg-12">
- <div>
- <h2 style="text-align: center;">
- [[${content.title}]]
- </h2>
- </div>
- <div class="post_meta">
- <ul>
- <li>发布时间: <span th:text="${content.create_time}"></span></li>
- <li>浏览: <span>[[${content.browse_count}]]</span></li>
- <li>来源: <span th:text="${content.resource}"></span></li>
- <li>发布人: <span th:text="${content.create_name}"></span></li>
- <li><span id="" style="vertical-align: middle;">分享:</span>
- <div class="bshare-custom" style="display: inline-block">
- <!--<div class="bsPromo bsPromo2"></div>-->
- <a title="分享到QQ空间" class="bshare-qzone" href="javascript:void(0);"></a>
- <a title="分享到微信" class="bshare-weixin" href="javascript:void(0);"></a>
- <a title="分享到新浪微博" class="bshare-sinaminiblog"></a>
- <a title="更多平台" class="bshare-more bshare-more-icon more-style-addthis"></a>
- <!--<span class="BSHARE_COUNT bshare-share-count" style="float: none;">41K</span>-->
- </div>
- </li>
- </ul>
- </div>
- </div>
- </div>
- <div id="activity_top" class="row">
- <input hidden id="activityId" th:value="${content.title}"/>
- <div class="col-sm-5 col-md-5 col-lg-5">
- <!--<img src="http://172.18.1.101:81/images/2017/12/26/20171226171952%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20171226171936.jpg"
- class="notice-img"/>-->
- <!-- ${content.fileDown.download_uri} -->
- <img id="preImg" th:src="${fileUrl} +${content.fileDown.file_url}"
- class="notice-img"/>
- </div>
- <div class="col-sm-7 col-md-7 col-lg-7 home-activity-left">
- <span id="tag" hidden
- style="float:right;border: 1px solid transparent;border-radius: 4px;color: #fff;background-color: #FF9900; border-color: #FF9900;padding: 0px 12px;">重要</span>
- <h2 class="activity-title" id="activity_title">
- </h2>
- <p id="activity_time"><i class="iconfont"></i></p>
- <p id="activity_location"><i class="iconfont"></i></p>
- <p id="activity_quota"><i class="iconfont"></i></p>
- <p id="activity_remain"><i class="iconfont"></i></p>
- <div style="margin-bottom: 20px;">距离报名结束还剩 <span id="timer"></span></div>
- <div class="clearfix">
- <div class="pull-left" style="position: relative; margin-right: 10px;">
- <a class="btn btn-warning j-signup-btn" onclick="checkLogin()">我要报名</a>
- <div class="popup-signUp" style="display: none;">
- <p style="margin-bottom: 10px; font-size: 16px;">报名信息</p>
- <div>
- <table class="table table-border table-bordered table-bg table-hover"
- style="table-layout: fixed;width:100%;">
- <thead>
- <tr class="text-c">
- <th>姓名</th>
- <th>手机号</th>
- <th>邮箱</th>
- <th>职位</th>
- <th width="80">操作</th>
- </tr>
- </thead>
- <tbody id="infoList">
- </tbody>
- </table>
- </div>
- <p id="add-btn" style="text-align: center;"><span class="add-btn btn btn-default j-add-btn">+ 添加报名者</span>
- </p>
- <div id="add-mes" style="display: none">
- <p><label style="width: 60px;">姓名:</label><span
- style="width: 507px; display: inline-block;"><input placeholder="请输入姓名"
- id="info_name"></span></p>
- <p><label style="width: 60px;">手机号:</label><span
- style="width: 507px; display: inline-block;"><input placeholder="请输入手机号"
- id="info_phone"></span></p>
- <p><label style="width: 60px;">邮箱:</label><span
- style="width: 507px; display: inline-block;"><input placeholder="请输入邮箱"
- id="info_mail"></span></p>
- <p><label style="width: 60px;">职位:</label><span
- style="width: 507px; display: inline-block;"><input placeholder="请输入职位"
- id="info_position"></span>
- </p>
- <p style="text-align: center">
- <a class="btn btn-primary radius" id="add" onclick="addToList()">添加</a>
- <a class="btn btn-default radius j-back-btn">返回</a>
- </p>
- </div>
- <p id="submit_box" style="text-align: center; margin-top: 20px;">
- <a class="btn btn-primary radius" id="submit" onclick="submit()">提交</a>
- <a class="btn btn-default radius j-cancel-btn">取消</a>
- </p>
- </div>
- </div>
- <div id="favourite"><a class="btn btn-default"><i class="iconfont"></i>收藏</a></div>
- <span style="vertical-align: middle;">分享:</span>
- <div class="bshare-custom" style="display: inline-block">
- <a title="分享到QQ空间" class="bshare-qzone" href="javascript:void(0);"></a>
- <a title="分享到微信" class="bshare-weixin" href="javascript:void(0);"></a>
- <a title="分享到新浪微博" class="bshare-sinaminiblog"></a>
- <a title="更多平台" class="bshare-more bshare-more-icon more-style-addthis"></a>
- </div>
- <span style="vertical-align: middle;">阅读量:</span>
- <span id="reading_number" style="vertical-align: middle;"></span>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-12 col-md-12 col-lg-12">
- <div class="centerContent" style="padding-top: 20px;">
- <div th:utext="${content.content}">
- </div>
- </div>
- </div>
- </div>
- <div id="download_message" class="row" th:if="${content.addFileDown}" hidden>
- <div class="col-sm-12 col-md-12 col-lg-12">
- <div><label>附件(备注:如直接点击文件无法下载,请右击另存为。):</label>
- <a title="如直接点击文件无法下载,请右击另存为。" download target="_blank"
- th:href="${fileUrl} +${content.addFileDown.file_url}">[[${content.addFileDown.file_name}]]</a>
- </div>
- </div>
- </div>
- </div>
- <input type="hidden" id="navigation_id" th:value="${navigation_id}"/>
- </div>
- <!--页底-->
- <div th:replace="~{home/common/footer :: footer}"></div>
- <script type="text/javascript" charset="utf-8"
- src="http://static.bshare.cn/b/buttonLite.js#style=-1&uuid=&pophcol=2&lang=zh"></script>
- <script type="text/javascript" charset="utf-8"
- src="http://static.bshare.cn/b/bshareC0.js"></script>
- <script th:inline="javascript">
- var fileUrl = [[${fileUrl}]];
- $("li[role='presentation']").removeClass();
- var id = $("#navigation_id").val();
- var activityId = $("#activityId").val();
- var pagePath = $("meta[name='_ctx']").attr("content");
- pagePath = pagePath.substring(0, pagePath.length - 1);
- var infoList = new Array(), infoedList = new Array(), index = 0;
- var time = 0;//时间差
- var activity_quota = "", activity_remain = "";
- $("#" + id).parent().attr("class", "active");
- layui.use('element', function () {
- var element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块
- });
- $(function () {
- if ($("#navigation_id").val() == 1) {
- $("#news_top").hide();
- $("#activity_top").show();
- $("#download_message").hide();
- }
- else {
- $("#news_top").show();
- $("#download_message").show();
- $("#activity_top").hide();
- }
- ;
- if ($("#navigation_id").val() == 1) {
- $.ajax({
- url: pagePath + "/home/activityDetails/" + activityId,
- type: "get",
- dataType: "json",
- success: function (result) {
- if (result.success) {
- //console.log(result)
- var obj = result.obj;
- var activity_title = obj.activity_title
- var activity_starttime = obj.activity_starttime
- var activity_endtime = obj.activity_endtime
- var activity_location = obj.activity_location
- var push_level = obj.push_level
- activity_quota = obj.activity_quota
- activity_remain = obj.activity_remain
- var activity_deadline = obj.activity_deadline
- var reading_number = obj.reading_number
- var imgSrc = fileUrl + obj.fileDown.file_url
- /* var imgSrc = obj.fileDown.download_uri + obj.fileDown.file_url */
- $("#activity_title").text(activity_title)
- $("#activity_time").html('<i class="iconfont"></i>' + activity_starttime.substring(0, 4) + "年" + activity_starttime.substring(5, 7) + "月" + activity_starttime.substring(8, 10) + "日" + " " + activity_starttime.substring(10, 16) + "~" + activity_endtime.substring(0, 4) + "年" + activity_endtime.substring(5, 7) + "月" + activity_endtime.substring(8, 10) + "日" + " " + activity_endtime.substring(10, 16))
- $("#activity_location").html('<i class="iconfont"></i>' + activity_location)
- $("#reading_number").text(reading_number)
- if (activity_quota) {
- $("#activity_quota").html('<i class="iconfont"></i>限额' + activity_quota + "人")
- } else {
- $("#activity_quota").html('<i class="iconfont"></i>名额不限')
- }
- if (activity_quota) {
- $("#activity_remain").html('<i class="iconfont"></i>剩余' + activity_remain + "个名额")
- } else {
- $("#activity_remain").text("")
- }
- if (push_level == '1') {
- $("#tag").show()
- }
- $("#preImg").attr("src", imgSrc);
- //var d1 = new Date(activity_deadline)
- var d1 = new Date(Date.parse(activity_deadline.replace(/-/g, "/")))
- var d2 = new Date()
- time = parseInt((d1.getTime() - d2.getTime()) / 1000, 10)
- if (time <= 0) {
- $("#timer").html("<span>" + 0 + "天</span>:<span>" + 0 + "小时</span>:<span>" + 0 + "分</span>:<span>" + 0 + "秒</span>")
- } else {
- countDown(time)
- }
- checkIsFavourite(activityId)
- } else {
- errorMessage(result.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- }
- function checkIsFavourite(activityId) {
- $.ajax({
- url: pagePath + "/home/isFavourite/" + activityId,
- type: "get",
- dataType: "json",
- data: {
- timeStamp: new Date()
- },
- success: function (result) {
- if (result.success) {
- //console.log(result)
- var obj = result.obj;
- if (obj == 2) {
- //errorMessage("请登陆!");
- //未收藏
- $("#favourite").empty()
- var str = "<a class=\"btn btn-default\" onclick='addFavourite()'><i class=\"iconfont\"></i>收藏</a>"
- $("#favourite").append(str)
- } else if (obj == 0) {
- //已收藏
- $("#favourite").empty()
- var str = "<a class=\"btn btn-default\" onclick='removeFavourite()'><i class=\"iconfont\"></i>已收藏</a>"
- $("#favourite").append(str)
- } else if (obj == 1) {
- //未收藏
- $("#favourite").empty()
- var str = "<a class=\"btn btn-default\" onclick='addFavourite()'><i class=\"iconfont\"></i>收藏</a>"
- $("#favourite").append(str)
- }
- } else {
- errorMessage(result.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- }
- function countDown(times) {
- var timer = null;
- timer = setInterval(function () {
- var day = 0,
- hour = 0,
- minute = 0,
- second = 0;//时间默认值
- if (times > 0) {
- day = Math.floor(times / (60 * 60 * 24));
- hour = Math.floor(times / (60 * 60)) - (day * 24);
- minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);
- second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
- }
- if (day <= 9) day = '0' + day;
- if (hour <= 9) hour = '0' + hour;
- if (minute <= 9) minute = '0' + minute;
- if (second <= 9) second = '0' + second;
- //
- $("#timer").html("<span>" + day + "天</span>:<span>" + hour + "小时</span>:<span>" + minute + "分</span>:<span>" + second + "秒</span>")
- times--;
- }, 1000);
- if (times <= 0) {
- clearInterval(timer);
- }
- }
- });
- function addFavourite() {
- $.ajax({
- url: pagePath + "/home/addFavourite/" + activityId,
- type: "get",
- dataType: "json",
- data: {
- timeStamp: new Date()
- },
- success: function (result) {
- if (result.success) {
- //console.log(result)
- var obj = result.obj;
- if (obj == 2) {
- errorMessage("请登陆!");
- //未收藏
- } else {
- smileMessage(result.message);
- setTime();
- }
- } else {
- errorMessage(result.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- }
- function removeFavourite() {
- $.ajax({
- url: pagePath + "/home/removeFavourite/" + activityId,
- type: "get",
- dataType: "json",
- data: {
- timeStamp: new Date()
- },
- success: function (result) {
- if (result.success) {
- //console.log(result)
- var obj = result.obj;
- smileMessage(result.message);
- setTime();
- } else {
- errorMessage(result.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- }
- function checkLogin() {
- if (time <= 0) {
- errorMessage("报名时间已过!");
- return;
- }
- if (activity_quota) {
- if (parseInt(activity_remain) <= 0) {
- errorMessage("名额不足,无法报名!");
- return;
- }
- }
- $.ajax({
- url: pagePath + "/home/checkLogin/",
- type: "get",
- dataType: "json",
- data: {
- timeStamp: new Date()
- },
- success: function (result) {
- if (result.success) {
- var obj = result.obj;
- //console.log(result)
- if (obj.isLogin) {
- //渲染已报名用户
- getRegUsers()
- //绑定事件
- $(".popup-signUp").show();
- $(".j-signup-btn").on("click", function () {
- $(".popup-signUp").show();
- });
- $(".j-cancel-btn").on("click", function () {
- $(".popup-signUp").hide();
- });
- $(".j-add-btn").on("click", function () {
- $("#add-btn").hide();
- $("#add-mes").show();
- $("#submit_box").hide();
- });
- $(".j-back-btn").on("click", function () {
- $("#add-btn").show();
- $("#add-mes").hide();
- $("#submit_box").show();
- });
- } else {
- //errorMessage("请登陆!");
- location.href = pagePath + "/home/login"
- localStorage.setItem("activityUrl", pagePath + '/home/activityDetail/' + activityId);
- }
- } else {
- errorMessage(result.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- }
- function getRegUsers() {
- $.ajax({
- url: pagePath + "/home/getRegUsers",
- type: "get",
- dataType: "json",
- data: {
- timeStamp: new Date(),
- activity_id: activityId
- },
- success: function (result) {
- if (result.success) {
- var obj = result.obj;
- infoedList = obj;
- renderInfoList(infoList)
- /* $("#infoList").empty()
- if (obj && obj.length > 0) {
- var str = ''
- for (var i = 0; i < obj.length; i++) {
- str += '<tr>'
- str += '<td class="text-overflow" title="' + obj[i].name + '">' + obj[i].name + '</td>'
- str += '<td class="text-overflow" title="' + obj[i].phone + '">' + obj[i].phone + '</td>'
- str += '<td class="text-overflow" title="' + obj[i].mail + '">' + obj[i].mail + '</td>'
- str += '<td class="text-overflow" title="' + obj[i].position + '">' + obj[i].position + '</td>'
- str += '<td class="text-overflow" title="已报名">已报名</td>'
- str += '</tr>'
- }
- $("#infoList").prepend(str)
- }*/
- } else {
- errorMessage(result.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- }
- function addToList() {
- var reg1 = /^[0-9]+.?[0-9]*$/;
- var reg2 = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
- var reg3 = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
- var name = $("#info_name").val().trim()
- var phone = $("#info_phone").val().trim()
- var mail = $("#info_mail").val().trim()
- var position = $("#info_position").val().trim()
- if (name == null || name == "") {
- errorMessage("请输入姓名!");
- return
- } else if (reg1.test(name)) {
- errorMessage("姓名不能为数字!");
- return
- } else if (name.trim().length > 50) {
- errorMessage("姓名最多支持50个字符!");
- return
- }
- if (phone == null || phone == "") {
- errorMessage("请输入手机号!");
- return
- } else if (!reg2.test(phone)) {
- errorMessage("请输入正确的手机号!");
- return
- }
- if (mail == null || mail == "") {
- errorMessage("请输入邮箱!");
- return
- } else if (!reg3.test(mail)) {
- errorMessage("请输入正确的邮箱!");
- return
- } else if (mail.trim().length > 50) {
- errorMessage("邮箱最多支持50个字符!");
- return
- }
- if (position == null || position == "") {
- errorMessage("请输入职位!");
- return
- } else if (position.trim().length > 50) {
- errorMessage("职位最多支持50个字符!");
- return
- }
- if (infoedList.length > 0) {
- for (var i = 0; i < infoedList.length; i++) {
- if (infoedList[i].name == name && infoedList[i].phone == phone) {
- errorMessage("报名者重复!");
- return
- }
- }
- }
- if (infoList.length > 0) {
- for (var i = 0; i < infoList.length; i++) {
- if (infoList[i].name == name.trim() && infoList[i].phone == phone.trim()) {
- errorMessage("报名者重复!");
- return
- }
- }
- }
- var infoId = "info" + (++index)
- var info = {
- index: infoId,
- name: name.trim(),
- phone: phone.trim(),
- mail: mail.trim(),
- position: position.trim(),
- activity_id: activityId,
- registration_way: "0",
- }
- infoList.push(info)
- renderInfoList(infoList)
- $("#info_name").val("")
- $("#info_phone").val("")
- $("#info_mail").val("")
- $("#info_position").val("")
- }
- function removeFromList(index) {
- if (infoList) {
- for (var i = 0; i < infoList.length; i++) {
- if (infoList[i].id = index) {
- infoList.splice(index, 1);
- break;
- }
- }
- renderInfoList(infoList)
- }
- }
- function renderInfoList(infoList) {
- if (infoList) {
- var str = "";
- $("#infoList").empty()
- if (infoedList && infoedList.length > 0) {
- for (var i = 0; i < infoedList.length; i++) {
- str += '<tr>'
- str += '<td class="text-overflow" title="' + infoedList[i].name + '">' + infoedList[i].name + '</td>'
- str += '<td class="text-overflow" title="' + infoedList[i].phone + '">' + infoedList[i].phone + '</td>'
- str += '<td class="text-overflow" title="' + infoedList[i].mail + '">' + infoedList[i].mail + '</td>'
- str += '<td class="text-overflow" title="' + infoedList[i].position + '">' + infoedList[i].position + '</td>'
- str += '<td class="text-overflow" title="已报名">已报名</td>'
- str += '</tr>'
- }
- }
- for (var i = 0; i < infoList.length; i++) {
- str += '<tr>'
- str += '<td class="text-overflow" title="' + infoList[i].name + '">' + infoList[i].name + '</td>'
- str += '<td class="text-overflow" title="' + infoList[i].phone + '">' + infoList[i].phone + '</td>'
- str += '<td class="text-overflow" title="' + infoList[i].mail + '">' + infoList[i].mail + '</td>'
- str += '<td class="text-overflow" title="' + infoList[i].position + '">' + infoList[i].position + '</td>'
- str += '<td class="td-manage"><a onclick="removeFromList(\'' + infoList[i].index + '\')" style="color: #0c80fe">删除</a></td>'
- str += '</tr>'
- }
- $("#infoList").append(str)
- }
- }
- var submitFlag = true;
- function submit() {
- if (submitFlag) {
- submitFlag = false;
- if (infoList.length <= 0) {
- errorMessage("请添加报名信息!");
- return
- }
- var data = {}
- data.registrationList = infoList
- $.ajax({
- url: pagePath + "/home/joinActivity",
- type: "post",
- data: JSON.stringify(data),
- dataType: "json",
- contentType: "application/json;charset=utf-8",
- //contentType:"text/plain;charset=UTF-8",
- success: function (result) {
- if (result.success) {
- $(".popup-signUp").hide();
- var obj = result.obj;
- if (obj) {
- smileMessage(result.message);
- setTimeClose();
- } else {
- smileMessage(result.message);
- }
- } else {
- errorMessage(result.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- },
- complete: function (XMLHttpRequest, textStatus) {
- submitFlag = true;
- }
- });
- }
- }
- </script>
- </body>
- </html>
|