|
- /**
- * 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: [],
- //资料下载数据
- dataDownloadList: [],
- //标的物所在地
- deptLocationList:[],
- //标的物类型
- deptTypeList:[],
- //网站配置信息
- webConfigInformationList:[],
- //底部友情链接
- friendsLinksList:[]
- },
- //柱状图参数
- 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);
-
- //资料下载
- tools.doGet(websiteNew + '/5/6', {}, module.dataDownload);
-
- //标的物所在地
- tools.doGet(webDept + '/0', {}, module.deptLocation);
-
- //标的物类型
- tools.doGet(webDeptType, {}, module.deptType);
-
- //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
- tools.doGet(webConfig, {}, module.webConfigInformation);
-
- //底部友情链接
- tools.doGet(friendsLinks, {}, module.bottomFriendsLinks);
-
- //竞价大厅-滚动
- 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)
- var title = content[i].title
- if (imgStrs != null && imgStrs != '') {
- focusList.push({img:imgStrs[0],title:title})
- }
- }
- 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.dataDownload = function (data) {
- if (data.code == 200) {
- var content = data.data;
- module.data.dataDownloadList = content;
- var dataDownloadData = template('dataDownloadData', module.data);
- $("#dataDownloadContent").html(dataDownloadData);
- }
- }
-
- //标的物所在地
- module.deptLocation = function (data) {
- if (data.code == 200) {
- var content = [] ;
- for (var i = 0 ; i < 7 ; i++){
- content[i] = data.data[i];
- }
- module.data.deptLocationList = content;
- var deptLocationData = template('deptLocationData', module.data);
- $("#deptLocationContent").html(deptLocationData);
- }
- }
-
- //标的物类型
- module.deptType = function (data) {
- console.log(data)
- if (data.code == 200) {
- var content = [] ;
- console.log(data.data)
- for (var i = 0 ; i < 7 ; i++){
- content[i] = data.data[i];
- }
- module.data.deptTypeList = content;
- var deptTypeData = template('deptTypeData', module.data);
- $("#deptTypeContent").html(deptTypeData);
- }
- }
-
- //网站配置信息
- module.webConfigInformation = function (data) {
- if (data.code == 200) {
- var content = data.data;
- $("#webConfigName").html(content[0].configValue);
- $("#webConfigRecord").html(content[1].configValue + content[2].configValue);
- $("#webConfigAddress").html(content[0].configValue+' '+content[3].configValue);
- }
- }
-
- //底部友情链接
- module.bottomFriendsLinks = function (data) {
- if (data.code == 200) {
- var content = data.data;
- module.data.friendsLinksList = content;
- var friendsLinksData = template('friendsLinksData', module.data);
- $("#friendsLinksContent").html(friendsLinksData);
- }
- }
-
- ///竞价大厅-滚动
- 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;
- });
|