/** * Created by Administrator on 2021/4/5. */ define(['jquery', "template", "Tools", "echarts", 'swiper'], function ($, template, Tools, echarts, swiper) { //数据存储 var module = { data: { //焦点图数据 focusList: [], //新闻资讯数据 newsInformationList: [], //政策法规数据 policiesRegulationsList: [], //交易规则数据 tradingRulesList: [] }, //柱状图参数 option: { xAxis: { type: 'category', axisLine: { show: true, lineStyle: { width: 1, type: "solid" } }, axisLabel: { //设置x轴的字 show: true, interval: 0,//使x轴横坐标全部显示 textStyle: {//x轴字体样式 margin: 15 } }, data: ['2014', '2015', '2016', '2017', '2018', '2019', '2020', '2021'] }, yAxis: { type: 'value', min: 400, max: 1000, splitNumber: 7, splitLine: { lineStyle: { type: 'dashed' } }, axisLine: { show: true, lineStyle: { width: 1, type: "solid" } }, }, series: [{ data: [490, 520, 650, 600, 700, 640, 680, 600, 660],//实际值减300 type: 'bar', itemStyle: { color: '#007b76' } }], grid: { height: 200, width: 280, top: '-5px' }, } }; var tools = new Tools(); module.init = function (page) { //获取焦点图信息 tools.doGet(websiteNew + '/1/4', {}, module.focusNews); //新闻资讯 tools.doGet(websiteNew + '/2/6', {}, module.NewsInformation); //政策法规 tools.doGet(websiteNew + '/3/6', {}, module.policiesRegulations); //交易规则 tools.doGet(websiteNew + '/4/6', {}, module.tradingRules); //竞价大厅-滚动 module.hallRolling(); // 柱状图绘制 var chartDom = document.getElementById('chart'); var myChart = echarts.init(chartDom); module.option && myChart.setOption(module.option); }; //焦点图数据 module.focusNews = function (data) { if (data.code == 200) { var content = data.data; var focusList = []; for (var i = 0; i < content.length; i++) { var imgStrs = content[i].content.match(//g) if (imgStrs != null && imgStrs != '') { focusList.push(imgStrs[0]) } } module.data.focusList = focusList; var bannerFocusData = template('bannerFocusData', module.data); $("#bannerFocusContent").html(bannerFocusData); new Swiper('#bannerFocusWrap', { pagination: '.page-pagination', paginationClickable: true }) } } //新闻资讯数据 module.NewsInformation = function (data) { if (data.code == 200) { var content = data.data; module.data.newsInformationList = content; var NewsInformationData = template('NewsInformationData', module.data); $("#NewsInformationContent").html(NewsInformationData); } } //政策法规 module.policiesRegulations = function (data) { if (data.code == 200) { var content = data.data; module.data.policiesRegulationsList = content; var policiesRegulationsData = template('policiesRegulationsData', module.data); $("#policiesRegulationsContent").html(policiesRegulationsData); } } //交易规则 module.tradingRules = function (data) { if (data.code == 200) { var content = data.data; module.data.tradingRulesList = content; var tradingRulesData = template('tradingRulesData', module.data); $("#tradingRulesContent").html(tradingRulesData); } } ///竞价大厅-滚动 module.hallRolling = function () { var divScroll = document.getElementById('tableList'); window.onmousewheel = divScroll.onmousewheel = function () { return false } module.timeInter(divScroll); divScroll.onmouseover = function () { clearInterval(time); } divScroll.onmouseout = function () { module.timeInter(divScroll); } module.tabCheck('supply'); } module.timeInter = function (divScroll) { time = setInterval(function () { var oldTop = divScroll.scrollTop; var newTop = oldTop + 1; divScroll.scrollTop = newTop; var counst = divScroll.scrollHeight - divScroll.scrollTop - divScroll.clientHeight; if (1 > counst) { divScroll.scrollTop = 0; } }, 30) } //切换 module.tabCheck = function (type) { document.getElementById('supply').style.display = 'none'; document.getElementById('demand').style.display = 'none'; document.getElementById(type).style.display = 'inline-table'; } return module; });