$(document).ready(function(){
let Focus = new Swiper('#focus', {
autoplay: true,//可选选项Q自动滑? loop:true,
pagination: {
el: '.swiper-pagination',
},
navigation: {
nextEl: '.leftButtonFoucs',
prevEl: '.rightButtonFoucs',
}
})
//hot list
$('.hotList ul li').each(function(i){
$(this).prepend('0'+(i+1)+'')
})
$('.messageList h4 span').on('click',function(){
let index = $(this).index();
$('.messageList h4 span').removeClass('active');
$(this).addClass('active');
$('.messageList ul').hide();
$('.messageList ul').eq(index).show();
})
//new object
function loadData(){
//this.messageurl = "https://testxbfront.peopletech.cn/pro-dfbbs-front/cms/getStats";
this.replayurl = 'http://www.mxglobal.cn/cms/getFidByRequestIP?callback=getFid&callback=getFid&_=1653621537926';
this.mapUrl = "https://messageboard.people.cn/provinceAnswerRate.jsonp"
// this.newReplay = "https://testxbfront.peopletech.cn/pro-dfbbs-front/cms/getStats"
this.newReplay = 'https://messageboard.people.cn/newIndex_stat.jsonp'
this.ipurl = 'http://www.mxglobal.cn/cms/getFidByRequestIP?callback=getFid'
}
loadData.prototype.Message = function(id){
let htmlBox = "";
var localUrl = "https://messageboard.people.cn/new_threads_"+ id +".jsonp"
$.ajax({
type: 'GET',
url: localUrl,
dataType: 'jsonp',
jsonpCallback:"IndexThreads",
success: function(res) {
//console.log('留言数据获取:',res)
let data = res;
for (let index = 0; index < 8; index++) {
htmlBox += "
"+data[index].subject+''+data[index].forumName+' '+data[index].dateline+'
'
}
$('#hotMessage').html(htmlBox)
}
})
}
//历史数据
loadData.prototype.lishi = function(){
//新版数据
$.ajax({
type: 'GET',
url:this.newReplay,
dataType: 'jsonp',
jsonpCallback:"IndexStat",
success: function(res) {
console.log('历史数据:',res)
$('#totalThreadsNum').html(res.totalAnswersNum)
$('#yearThreadsNum').html(res.yearAnswersNum)
$('#totalThreadsNum1').html(res.totalAnswersNum)
$('#yearThreadsNum1').html(res.yearAnswersNum)
}
})
}
//ip判断
loadData.prototype.ipLoad = function(){
console.log('ip获取')
//新版数据
$.ajax({
type: 'GET',
url:this.ipurl,
cache: false,
dataType: "jsonp",
jsonp: "callback",
jsonpCallback: "getFid",
async : false,
success: function(res) {
console.log('q回id:',res)
load.Message(res.fid);
if(res.fid == "13"){
$('#ipload').show();
}
}
})
}
//地图数据
loadData.prototype.mapData = function(){
//新版数据
$.ajax({
type: 'GET',
url:"https://messageboard.people.cn/provinceAnswerRate.jsonp",
dataType: 'jsonp',
jsonpCallback:"answerRate",
success: function(res) {
console.log('地图数据:',res)
}
})
}
//_N回? loadData.prototype.Replay = function(){
let htmlBox = "";
$.ajax({
type: 'GET',
url: this.replayurl,
dataType: 'json',
contentType:'application/json',
//data:JSON.stringify({'limit':7}),
success: function(res) {
console.log('数据获取:',res)
if(res.code == 0){
// let data = res.data.list;
// for (let index = 0; index < data.length; index++) {
// console.log(index)
// htmlBox += ''+data[index].subject+'
x '+data[index].focusCount+' 阅读?nbsp;'+data[index].clicks+'
'
// }
// $('#hotMessage').html(htmlBox)
}
}
})
}
//最新留a
$(".messageReplay .hotBox h3 span.choose").mouseover(function() {
$(".province").show();
$(".messageReplay .hotBox h3 span.choose").attr('id','active');
}).mouseout(function() {
$(".messageReplay .hotBox h3 span.choose").attr('id','active');
});
$("div.province").mouseover(function(){
$("div.province").show();
$(".messageReplay .hotBox h3 span.choose").attr('id','active');
}).mouseout(function() {
$("div.province").hide();
$(".messageReplay .hotBox h3 span.choose").attr('id','');
});
$("div.province a").click(function(){
var localIp = $(this).attr('value');
var localName = $(this).html();
$("div.province").hide();
load.Message(localIp);
$(".messageReplay .hotBox h3 span.choose").html(localName);
})
//l束最新留a
let load = new loadData();
load.lishi();
load.ipLoad();
//load.mapData();
$(".login-method h4").click(function(){
var index = $(this).index()
$(".login-method h4").eq(index).addClass("active").siblings().removeClass("active")
$(".login-main div").eq(index).show().siblings().hide()
})
$('.mes1').on('click',function(){
window.open('http://www.mxglobal.cn/login','_blank')
})
$('.mes2').on('click',function(){
window.open('http://www.mxglobal.cn/login','_blank')
})
//地图数据加蝲
function initHomeBar (id, chartData) {
var getname = chartData.xAxisData
var getvalue = chartData.seriesData
console.log('数据:',getvalue)
var option = {
title: {
subtext: '回复率: 留言中被回复的数量占留言数的癑ֈ?,
subtextStyle: {
color: '#888888',
fontSize: 14
},
itemGap: 20,
right: '1%',
top: 'top'
},
grid: {
top: '20%',
right: '5%',
left: '5%',
bottom: '10%'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'none'
},
extraCssText: 'background:#ffffff;color:#666666'
},
xAxis: [{
data: getname.reverse(),
axisLabel: {
interval: 0,
margin: 10,
color: 'rgba(0,0,0,0.45)',
textStyle: {
fontSize: 14,
color: '#8C8C8C'
}
},
axisLine: {
lineStyle: {
color: '#EFF0F2'
}
},
axisTick: {
show: false
}
}],
yAxis: [{
name: '',
max:100,
nameTextStyle: {
color: 'rgba(0,0,0,0.45)',
fontSize: 13,
padding: [20, 20, 0, 0]
},
axisLabel: {
color: 'rgba(0,0,0,0.45)',
textStyle: {
fontSize: 12,
color: '#8C8C8C'
}
},
axisLine: {
show: false,
lineStyle: {
color: '#EFF0F2'
}
},
axisTick: {
show: false
},
splitLine: {
lineStyle: {
color: '#EFF0F2'
// opacity: 0.2
}
}
}],
animation: false,
series: [{
name: '',
type: 'bar',
data: getvalue.reverse(),
barWidth: '12px',
itemStyle: {
normal: {
color: '#EB3B2F',
barBorderRadius: [100, 100, 100, 100],
label:{
formatter: '{c}%',
show:true,
position:"top",
textStyle:{
fontSize:12
}
}
}
}
}],
tooltip:{
formatter: ' : {c}%'
}
}
var myCharts = echarts.init(document.getElementById(id))
// 1、清除画? myCharts.clear()
myCharts.setOption(option)
return myCharts
}
$.ajax({
type: 'GET',
//url: "https://testxbfront.peopletech.cn/pro-dfbbs-front/cms/getProvinceRanks",
url:"https://messageboard.people.cn/provinceAnswerRate.jsonp",
dataType: 'jsonp',
scriptCharset:'utf-8',
jsonpCallback:"answerRate",
success: function(res) {
//console.log('地图数据1:',res)
var chartData = {
xAxisData: [],
seriesData: []
}
res.forEach(item => {
let nums = item.num.split('%')
chartData.seriesData.push(Math.ceil(nums[0]))
chartData.xAxisData.push(item.name)
})
initHomeBar('replyChart', chartData)
}
})
//l束地图数据加蝲
//留言入口加蝲
$(".login-method h4").click(function(){
var index = $(this).index()
$(".login-method h4").eq(index).addClass("active").siblings().removeClass("active")
$(".login-main div").eq(index).show().siblings().hide()
})
$('#loginShow').on('click',function(){
$('#loginBox').show();
})
$('#closeLogin').on('click',function(){
$('.login-mask').hide();
})
$('#yaoButton').on('click',function(){
$('.popup').css({'display':"flex"})
})
$('.popupClose').on('click',function(){
$('.popup').css({'display':"none"})
})
//l束留言入口加蝲
//vue代码加蝲
let vm1 = new Vue({
el: "#app1",
data() {
return {
username:"",
userStatus:0,
navStatus:0,
userType: ""
}
},
components: {
},
mounted() {
let that = this;
//that.loadUser()
},
methods: {
shownav(){
let that = this;
that.navStatus = 1;
},
hiddennav(){
let that = this;
that.navStatus = 0;
},
loadUser(){
let that = this;
let token = Cookies.get('token');
axios.get('http://liuyanuat.peopletech.cn:8006/admin/sys/user/info',{
headers:{
token: token
}
}).then(({ data: res }) => {
if(res.code == 0){
that.userStatus = 1;
that.userType = res.data.userType;
that.username = res.data.nickName
let loginqian = document.getElementById('loginqian');
let loginhou = document.getElementById('loginhou');
if(/Android|iPhone|BlackBerry/i.test(navigator.userAgent)) {
loginhou.style.display = "none"
loginqian.style.display = "none"
}else{
loginhou.style.display = "block"
loginqian.style.display = "none"
}
}
})
},
loginout(){
let that = this;
that.userStatus = 0;
Cookies.remove('token');
Cookies.remove('userType')
let loginqian = document.getElementById('loginqian');
let loginhou = document.getElementById('loginhou');
loginhou.style.display = "none"
loginqian.style.display = "block"
}
}
})
})
//# sourceMappingURL=app.js.map Ļڵɾ