|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- /**
- * 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(/<img.*?>/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;
- });
|