diff --git a/form/form.html b/form/form.html index 6d88945..7747ea3 100644 --- a/form/form.html +++ b/form/form.html @@ -53,17 +53,17 @@
-
+
- +
- +
@@ -114,7 +114,7 @@
- +
@@ -170,4 +170,64 @@ function CheckJob() } + $('body').on('click','#submit',function(){ + var company = $('#company').val(); + var product = $('#product').val(); + var num = $('#number').val(); + var name = $('#username').val(); + var address = $('#address').val(); + var phone = $('#phone').val(); + var fax = $('#fax').val(); + var email = $('#email').val(); + var detail = $('#detail').val(); + $.ajax({ + type: 'post', + dataType: 'text', + // dataType: 'json', + url: 'https://suzhou.njrenzhou.cn/api.php/apply/apply', + data: { + 'product': product, + 'num': num, + 'name': name, + 'company': company, + 'address': address, + 'phone': phone, + 'fax': fax, + 'email': email, + 'detail': detail + }, + beforeSend:function(){ + if (!product) { + alert('内容不能为空'); + return false; + } + else if (name == '') { + alert('姓名不能为空'); + return false; + } + else if (phone == '') { + alert('手机号码不能为空'); + return false; + } + else if(!phone.match(/^1(3|4|5|8)\d{1}[-]?\d{4}[-]?\d{4}$/)){ + alert('手机号码格式错误'); + return false; + } + else return true; + }, + success:function(data){ + console.log(data); + if (data.msg = 'success') { + alert('提交成功'); + window.location.reload(); + }else{ + alert('提交失败'); + } + }, + error:function(){ + alert('error'); + } + }) + }) + \ No newline at end of file diff --git a/news/news01.html b/news/news01.html index 075f0eb..2249d47 100644 --- a/news/news01.html +++ b/news/news01.html @@ -127,65 +127,73 @@ // 新闻列表-集团要闻 function news01_render(pageCurrent){ console.log(pageCurrent); - $.ajax({ - type: 'post', - url: 'https://suzhou.njrenzhou.cn/api.php/news/articleList', - data:{ - category_id:11, - page:pageCurrent, - order:'desc', - sort:'publish_time', - search:searchContent - }, - dataType: 'json', - - success: function (res) { - if(res.code==200){ - let item = res.data.data; - let html = ''; - let page = ''; - console.log(item); - $('.news_wrap').empty(); - $('.pageNum_wrap').empty(); - - $.each(item,function(index){ - var title = item[index].title; - var subtitle = item[index].subtitle; - var time = item[index].publish_time_text.substr(0,11); - var thumb = item[index].thumb; - var id = item[index].id; - - html += "
  • "; - html += "
    "; - html += "
    " + title + "

    " + time + "

    "; - html += "

    " + subtitle + "

  • "; - }) - $('.news_wrap').append(html); - - newsNum = res.data.total; - pageNum = Math.ceil(newsNum/10); - - page += "
  • <
  • "; - - for (let index = 1; index <= pageNum; index++) { - if (index == pageCurrent) { - page += "
  • " + index + "
  • "; + if (pageCurrent < 1) { + alert('第一页'); + }else{ + $.ajax({ + type: 'post', + url: 'https://suzhou.njrenzhou.cn/api.php/news/articleList', + data:{ + category_id:11, + page:pageCurrent, + order:'desc', + sort:'publish_time', + search:searchContent + }, + dataType: 'json', + + success: function (res) { + if(res.code==200){ + let item = res.data.data; + let html = ''; + let page = ''; + console.log(item); + newsNum = res.data.total; + pageNum = Math.ceil(newsNum/10); + + if(pageCurrent > pageNum){ + alert('最后一页'); }else{ - page += "
  • " + index + "
  • "; + // 内容渲染 + $('.news_wrap').empty(); + $('.pageNum_wrap').empty(); + $.each(item,function(index){ + var title = item[index].title; + var subtitle = item[index].subtitle; + var time = item[index].publish_time_text.substr(0,11); + var thumb = item[index].thumb; + var id = item[index].id; + + html += "
  • "; + html += "
    "; + html += "
    " + title + "

    " + time + "

    "; + html += "

    " + subtitle + "

  • "; + }) + $('.news_wrap').append(html); + + // 页码渲染 + page += "
  • <
  • "; + for (let index = 1; index <= pageNum; index++) { + if (index == pageCurrent) { + page += "
  • " + index + "
  • "; + }else{ + page += "
  • " + index + "
  • "; + } + } + page += "
  • >
  • "; + $('.pageNum_wrap').append(page); + } - - } - - page += "
  • >
  • "; - $('.pageNum_wrap').append(page); - - } - }, - error: function (err) { - console.log(err); - } - - }); + + } + }, + error: function (err) { + console.log(err); + } + + }); + + } } diff --git a/news/news02.html b/news/news02.html index 58d01f3..39883d6 100644 --- a/news/news02.html +++ b/news/news02.html @@ -121,71 +121,82 @@ news02_render(pageCurrent); } + // 新闻列表-企业动态 function news02_render(pageCurrent){ console.log(pageCurrent); - $.ajax({ - type: 'post', - url: 'https://suzhou.njrenzhou.cn/api.php/news/articleList', - data:{ - category_id:13, - page:pageCurrent, - order:'desc', - sort:'publish_time', - search:searchContent - }, - dataType: 'json', - - success: function (res) { - if(res.code==200){ - let item = res.data.data; - let html = ''; - let page = ''; - console.log(item); - $('.news_wrap').empty(); - $('.pageNum_wrap').empty(); + if (pageCurrent < 1) { + alert('第一页'); + }else{ + $.ajax({ + type: 'post', + url: 'https://suzhou.njrenzhou.cn/api.php/news/articleList', + data:{ + category_id:13, + page:pageCurrent, + order:'desc', + sort:'publish_time', + search:searchContent + }, + dataType: 'json', + + success: function (res) { + if(res.code==200){ + let item = res.data.data; + let html = ''; + let page = ''; + console.log(item); + newsNum = res.data.total; + pageNum = Math.ceil(newsNum/10); - $.each(item,function(index){ - var title = item[index].title; - var subtitle = item[index].subtitle; - var time = item[index].publish_time_text.substr(0,11); - var thumb = item[index].thumb; - var id = item[index].id; - - html += "
  • "; - html += "
    " + time.substr(0,4) + "
    " + time.substr(5,10) + "
    "; - html += "
    " + title + "

    " + subtitle + "

    "; - html += "了解更多 >"; - html += "
    "; - - }) - $('.news_wrap').append(html); + if (pageCurrent > pageNum) { + alert('最后一页'); + }else{ + // 内容渲染 + $('.news_wrap').empty(); + $('.pageNum_wrap').empty(); + $.each(item,function(index){ + var title = item[index].title; + var subtitle = item[index].subtitle; + var time = item[index].publish_time_text.substr(0,11); + var thumb = item[index].thumb; + var id = item[index].id; + + html += "
  • "; + html += "
    " + time.substr(0,4) + "
    " + time.substr(5,10) + "
    "; + html += "
    " + title + "

    " + subtitle + "

    "; + html += "了解更多 >"; + html += "
    "; + + }) + $('.news_wrap').append(html); - newsNum = res.data.total; - pageNum = Math.ceil(newsNum/10); + // 页码渲染 + page += "
  • <
  • "; + for (let index = 1; index <= pageNum; index++) { + if (index == pageCurrent) { + page += "
  • " + index + "
  • "; + }else{ + page += "
  • " + index + "
  • "; + } + } + page += "
  • >
  • "; + $('.pageNum_wrap').append(page); - page += "
  • <
  • "; - - for (let index = 1; index <= pageNum; index++) { - if (index == pageCurrent) { - page += "
  • " + index + "
  • "; - }else{ - page += "
  • " + index + "
  • "; } - - } - - page += "
  • >
  • "; - $('.pageNum_wrap').append(page); - - } - }, - error: function (err) { - console.log(err); - } - - }); - + + + + } + }, + error: function (err) { + console.log(err); + } + + }); + + } + } news02_render(pageCurrent); diff --git a/news/news03.html b/news/news03.html index 16aaa4c..ed8dfcc 100644 --- a/news/news03.html +++ b/news/news03.html @@ -115,66 +115,73 @@ // 新闻列表-媒体聚集35 function news03_render(pageCurrent){ console.log(pageCurrent); - $.ajax({ - type: 'post', - url: 'https://suzhou.njrenzhou.cn/api.php/news/articleList', - data:{ - category_id:35, - page:pageCurrent, - order:'desc', - sort:'publish_time', - search:searchContent - }, - dataType: 'json', - - success: function (res) { - if(res.code==200){ - let item = res.data.data; - let html = ''; - let page = ''; - console.log(item); - $('.news_wrap').empty(); - $('.pageNum_wrap').empty(); - - $.each(item,function(index){ - var title = item[index].title; - var subtitle = item[index].subtitle; - var time = item[index].publish_time_text.substr(0,11); - var thumb = item[index].thumb; - var id = item[index].id; - - html += "
  • "; - html += ""; - html += "
    " + title + "

    " + time + "

    "; - html += "
  • "; - - }) - $('.news_wrap').append(html); - - newsNum = res.data.total; - pageNum = Math.ceil(newsNum/10); - - page += "
  • <
  • "; - - for (let index = 1; index <= pageNum; index++) { - if (index == pageCurrent) { - page += "
  • " + index + "
  • "; - }else{ - page += "
  • " + index + "
  • "; + if (pageCurrent < 1) { + alert('第一页'); + }else{ + $.ajax({ + type: 'post', + url: 'https://suzhou.njrenzhou.cn/api.php/news/articleList', + data:{ + category_id:35, + page:pageCurrent, + order:'desc', + sort:'publish_time', + search:searchContent + }, + dataType: 'json', + + success: function (res) { + if(res.code==200){ + let item = res.data.data; + let html = ''; + let page = ''; + console.log(item); + newsNum = res.data.total; + pageNum = Math.ceil(newsNum/10); + + if (pageCurrent > pageNum) { + alert('最后一页'); + } else { + // 内容渲染 + $('.news_wrap').empty(); + $('.pageNum_wrap').empty(); + $.each(item,function(index){ + var title = item[index].title; + var subtitle = item[index].subtitle; + var time = item[index].publish_time_text.substr(0,11); + var thumb = item[index].thumb; + var id = item[index].id; + + html += "
  • "; + html += ""; + html += "
    " + title + "

    " + time + "

    "; + html += "
  • "; + + }) + $('.news_wrap').append(html); + + // 页码渲染 + page += "
  • <
  • "; + for (let index = 1; index <= pageNum; index++) { + if (index == pageCurrent) { + page += "
  • " + index + "
  • "; + }else{ + page += "
  • " + index + "
  • "; + } + } + page += "
  • >
  • "; + $('.pageNum_wrap').append(page); } - - } - - page += "
  • >
  • "; - $('.pageNum_wrap').append(page); - - } - }, - error: function (err) { - console.log(err); - } - - }); + + } + }, + error: function (err) { + console.log(err); + } + + }); + + } } diff --git a/work/work.html b/work/work.html index aca288c..bb9615d 100644 --- a/work/work.html +++ b/work/work.html @@ -153,79 +153,86 @@ // 新闻列表-党建工作 function work_render(pageCurrent){ console.log(pageCurrent); - - // 获取列表 - $.ajax({ - type: 'post', - url: 'https://suzhou.njrenzhou.cn/api.php/news/articleList', - data:{ - category_id:37, - page:pageCurrent, - limit:4, - order:'desc', - sort:'flags', - // flags:'desc' - }, - dataType: 'json', - // async:false, - - success: function (res) { - if(res.code==200){ - var item = res.data.data; - var html = ''; - var page = ''; - console.log(item); - $('.news_wrap').empty(); - $('.pageNum_wrap').empty(); - - $.each(item,function(index){ - var title = item[index].title; - var subtitle = item[index].subtitle; - var time = item[index].publish_time_text.substr(0,11); - var thumb = item[index].thumb; - var id = item[index].id; - var flags = item[index].flags; - - if (flags) { - html += "
    "; - html += "
    "; - html += "
    " + title + "
    " + time + "

    "+ subtitle + "

    "; - html += "
    置顶
    "; - html += "
    "; + if (pageCurrent < 1) { + alert('第一页'); + } else { + // 获取列表 + $.ajax({ + type: 'post', + url: 'https://suzhou.njrenzhou.cn/api.php/news/articleList', + data:{ + category_id:37, + page:pageCurrent, + limit:4, + order:'desc', + sort:'flags', + // flags:'desc' + }, + dataType: 'json', + // async:false, + + success: function (res) { + if(res.code==200){ + var item = res.data.data; + var html = ''; + var page = ''; + console.log(item); + newsNum = res.data.total; + pageNum = Math.ceil(newsNum/4); + + if (pageCurrent > pageNum) { + alert('最后一页'); } else { - html += "
    "; + // 页面渲染 + $('.news_wrap').empty(); + $('.pageNum_wrap').empty(); + + $.each(item,function(index){ + var title = item[index].title; + var subtitle = item[index].subtitle; + var time = item[index].publish_time_text.substr(0,11); + var thumb = item[index].thumb; + var id = item[index].id; + var flags = item[index].flags; + + if (flags) { + html += "
    "; html += "
    "; html += "
    " + title + "
    " + time + "

    "+ subtitle + "

    "; + html += "
    置顶
    "; html += "
    "; - - } - }) - $('.news_wrap').append(html); - - newsNum = res.data.total; - pageNum = Math.ceil(newsNum/4); - - page += "
  • <
  • "; - - for (var index = 1; index <= pageNum; index++) { - if (index == pageCurrent) { - page += "
  • " + index + "
  • "; - }else{ - page += "
  • " + index + "
  • "; + } else { + html += "
    "; + html += "
    "; + html += "
    " + title + "
    " + time + "

    "+ subtitle + "

    "; + html += "
    "; + + } + }) + $('.news_wrap').append(html); + + // 页码渲染 + page += "
  • <
  • "; + for (var index = 1; index <= pageNum; index++) { + if (index == pageCurrent) { + page += "
  • " + index + "
  • "; + }else{ + page += "
  • " + index + "
  • "; + } + } + page += "
  • >
  • "; + $('.pageNum_wrap').append(page); } - - } - - page += "
  • >
  • "; - $('.pageNum_wrap').append(page); - - } - }, - error: function (err) { - console.log(err); - } - - }); + + } + }, + error: function (err) { + console.log(err); + } + + }); + + } }