//components var components = { header: { data: function () { return {}; }, mounted: function () { }, methods: { }, template: '\
\
\ \
\
\
\ \
\
\ \
\
\
\  \ 中文\ |\ EN\
\
\ \
\
\ ' }, footer: { data: function () { return { link: "http://www.huangshan.gov.cn/" }; }, mounted: function () { }, methods: { openWin: function () { if (this.link) { var u = navigator.userAgent, app = navigator.appVersion; if (!!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) { location.href = this.link; } else { var winRef = window.open("", "_blank");//打开一个新的页面 var _this = this; setTimeout(function () { winRef.location = _this.link }, 800); } } } }, template: '\ \ ' } }; //格式化时间 //dateFormat("yyyy/MM/dd") 结果 2017/07/19 //dateFormat("yyyy/MM/dd HH:mm:ss") 结果 2017/07/19 10:09:11 //dateFormat("yyyy/MM/dd EE HH:mm:ss") 结果 2017/07/19 周三 10:09:11 function dateFormat(dateObj, fmt) { var date; if (typeof (dateObj) == "string") { date = this.strToDate(dateObj) } else if (typeof (dateObj) == "object") { date = dateObj } else { return "" } var o = { "M+": date.getMonth() + 1, //月份 "d+": date.getDate(), //日 "h+": date.getHours() % 12 == 0 ? 12 : date.getHours() % 12, //小时 "H+": date.getHours(), //小时 "m+": date.getMinutes(), //分 "s+": date.getSeconds(), //秒 "q+": Math.floor((date.getMonth() + 3) / 3), //季度 "S": date.getMilliseconds() //毫秒 }; var week = { "0": "日", "1": "一", "2": "二", "3": "三", "4": "四", "5": "五", "6": "六" }; if (!fmt) { fmt = "yyyy-MM-dd HH:mm:ss"; } if (/(y+)/.test(fmt)) { fmt = fmt.replace(RegExp.$1, (date.getFullYear().toString() + "").substr(4 - RegExp.$1.length)); } if (/(E+)/.test(fmt)) { fmt = fmt.replace(RegExp.$1, ((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? "星期" : "周") : "") + week[date.getDay().toString() + ""]); } for (var k in o) { if (new RegExp("(" + k + ")").test(fmt)) { fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k].toString()) : (("00" + o[k].toString()).substr(("" + o[k].toString()).length))); } } return fmt; } function strToDate(dateObj) { if (typeof (dateObj) == "object") { return dateObj; } dateObj = dateObj.replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '').replace(/(-)/g, '/') if (dateObj.indexOf(".") > 0) dateObj = dateObj.slice(0, dateObj.indexOf(".")) return new Date(dateObj) } //格式化星期 function formatWeek(week) { switch (week) { case 0: return "周日"; break; case 1: return "周一"; break; case 2: return "周二"; break; case 3: return "周三"; break; case 4: return "周四"; break; case 5: return "周五"; break; case 6: return "周六"; break; } } function formatWeek2(week) { switch (week) { case 0: return "星期日"; break; case 1: return "星期一"; break; case 2: return "星期二"; break; case 3: return "星期三"; break; case 4: return "星期四"; break; case 5: return "星期五"; break; case 6: return "星期六"; break; } } $(function () { $("header dl dd ul li>a").on("mouseover", function () { $(this).parent().addClass("active").siblings().removeClass("active"); $(".search-box").removeClass("active"); }); $("header dl dd ul li .sub").on("mouseleave", function (event) { if (event.clientY > $("header").outerHeight()) { $(this).removeClass("active"); $("header dl dd ul li").removeClass("active"); } }); $("header").on("mouseleave", function () { $("header dl dd ul li").removeClass("active"); }); $(window).on("scroll", function () { var scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop; if (scrollTop > 0) { $("header,.header-mobile").addClass("active"); } else { $("header,.header-mobile").removeClass("active"); } }); $(".header-mobile .nav ul li i").on("click", function () { $(this).parent().toggleClass("active"); }); //打开菜单 $(".header-mobile .left").on("click", function () { if ($(this).parents(".header-mobile").hasClass("open")) { $(".header-mobile").removeClass("open"); } else { $(".header-mobile").addClass("open"); } }); //搜索 $(".lang a.search").on("click", function () { $(this).parent().siblings(".search-box").addClass("active"); $(".search-box .input .box input").val('').focus(); }); $(".search-box .input .close").on("click", function () { $(".search-box").removeClass("active"); }); $(".search-box .input .box input").on("keyup", function (e) { if (e.keyCode == '13') { if ($(this).val().trim()) { location.href = "/html/search_result.html?k=" + encodeURIComponent($(this).val().trim()); } } }); //footer $('.footer-main-item .item-title').on('click', function () { if (!isPc()) { if ($(this).hasClass('active')) { $(this).removeClass('active').siblings('.item-list').hide(); } else { $(this).addClass('active').siblings('.item-list').show(); } } }); //wx_code $(".footer-main-media .media-list .wechat").on("click", function () { var html = '
'; $("body").append(html); }); //totop if ($("meta[name=toTop]").attr("content") == "true") { $("
").appendTo('body'); $("#toTop").css({ width: '50px', height: '50px', bottom: '150px', right: '25px', position: 'fixed', cursor: 'pointer', zIndex: '999999' }); if ($(this).scrollTop() == 0) { $("#toTop").hide(); } $(window).scroll(function (event) { if ($(this).scrollTop() == 0) { $("#toTop").hide(); } if ($(this).scrollTop() != 0) { $("#toTop").show(); } }); $("#toTop").click(function (event) { $("html,body").animate({ scrollTop: "0px" }, 666); }); } }); function isPc() { if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) { return false; } else { return true; } } function getStock() { $.ajax({ // url: "http://yunhq.sse.com.cn:32041/v1/sh1/snap/600054?callback=showStock&select=name%2Clast%2Cchg_rate%2Cchange%2Camount%2Cvolume%2Copen%2Cprev_close%2Cask%2Cbid%2Chigh%2Clow%2Ctradephase&_=1548998699817", url: "https://hstd.com/sse/v1/sh1/snap/600054?callback=showStock&select=name%2Clast%2Cchg_rate%2Cchange%2Camount%2Cvolume%2Copen%2Cprev_close%2Cask%2Cbid%2Chigh%2Clow%2Ctradephase&_=1548998699817", type: "GET", dataType: "jsonp", success: function (data) { } }); $.ajax({ // url: "http://yunhq.sse.com.cn:32041/v1/sh1/snap/900942?callback=showStock&select=name%2Clast%2Cchg_rate%2Cchange%2Camount%2Cvolume%2Copen%2Cprev_close%2Cask%2Cbid%2Chigh%2Clow%2Ctradephase&_=1548998699817", url: "https://hstd.com/sse/v1/sh1/snap/900942?callback=showStock&select=name%2Clast%2Cchg_rate%2Cchange%2Camount%2Cvolume%2Copen%2Cprev_close%2Cask%2Cbid%2Chigh%2Clow%2Ctradephase&_=1548998699817", type: "GET", dataType: "jsonp", success: function (data) { } }); //var data = [ // { "code": "600054", "date": 20190201, "time": 141742, "snap": ["奥门威奥门威斯人网站注册平台", 9.21, 2.33, 0.21, 27384041, 3001473, 9.05, 9.00, [9.21, 29200, 9.22, 22900, 9.23, 38400, 9.24, 21600, 9.25, 18600], [9.20, 6600, 9.19, 19200, 9.18, 31000, 9.17, 33387, 9.16, 11500], 9.21, 9.02, "T111"] }, // { "code": "900942", "date": 20190201, "time": 141757, "snap": ["黄山B股", 1.202, 0.75, 0.009, 190425, 158701, 1.188, 1.193, [1.203, 36000, 1.204, 29500, 1.205, 28700, 1.206, 62200, 1.207, 29000], [1.202, 900, 1.201, 1100, 1.20, 6600, 1.199, 7700, 1.198, 10400], 1.207, 1.182, "T111"] } //]; } function showStock(data) { if (data.code == "600054") { //设置首页股票 if ($(".shares-main").length > 0) { $(".shares-main .shares-item:eq(0)").find(".num span:eq(0)").html(data.snap[1]); $(".shares-main .shares-item:eq(0)").find(".num span:eq(1)").html((data.snap[3] >= 0 ? "+" : "") + data.snap[3] + "(" + (data.snap[3] >= 0 ? "+" : "") + "" + (data.snap[2]) + "%)"); if (data.snap[3] < 0) { $(".shares-main .shares-item:eq(0)").find(".num span:eq(1)").addClass("fall"); } else { $(".shares-main .shares-item:eq(0)").find(".num span:eq(1)").addClass("rise"); } $(".shares-main .shares-item:eq(0)").find(".time").html(formateStockDate(data.date) + " " + formateStockDate(data.time) + " (北京时间)"); } //子页面股票 if ($(".investors-stock").length > 0) { $(".investors-stock .investors-stock-content>div:eq(0)").find(".investors-stock-content-price").html(data.snap[1] + "" + (data.snap[3] < 0 ? "↓" : "↑") + " " + (data.snap[3] >= 0 ? "+" : "") + (data.snap[3]) + "(" + (data.snap[3] >= 0 ? "+" : "") + (data.snap[2]) + "%)").addClass((data.snap[3] < 0 ? "down" : "")); $(".investors-stock .investors-stock-content>div:eq(0)").find(".investors-stock-content-time").html(formateStockDate(data.date) + " " + formateStockDate(data.time) + " (北京时间)"); } } else { //设置首页股票 if ($(".shares-main").length > 0) { $(".shares-main .shares-item:eq(1)").find(".num span:eq(0)").html(data.snap[1]); $(".shares-main .shares-item:eq(1)").find(".num span:eq(1)").html((data.snap[3] >= 0 ? "+" : "") + data.snap[3] + "(" + (data.snap[3] >= 0 ? "+" : "") + "" + (data.snap[2]) + "%)"); if (data.snap[3] < 0) { $(".shares-main .shares-item:eq(1)").find(".num span:eq(1)").addClass("fall"); } else { $(".shares-main .shares-item:eq(1)").find(".num span:eq(1)").addClass("rise"); } $(".shares-main .shares-item:eq(1)").find(".time").html(formateStockDate(data.date) + " " + formateStockDate(data.time) + " (北京时间)"); } //子页面股票 if ($(".investors-stock").length > 0) { $(".investors-stock .investors-stock-content>div:eq(1)").find(".investors-stock-content-price").html(data.snap[1] + "" + (data.snap[3] < 0 ? "↓" : "↑") + " " + (data.snap[3] >= 0 ? "+" : "") + (data.snap[3]) + "(" + (data.snap[3] >= 0 ? "+" : "") + (data.snap[2]) + "%)").addClass((data.snap[3] < 0 ? "down" : "")); $(".investors-stock .investors-stock-content>div:eq(1)").find(".investors-stock-content-time").html(formateStockDate(data.date) + " " + formateStockDate(data.time) + " (北京时间)"); } } } function formateStockDate(str) { str = str.toString(); if (str.length == 8) { return str.substring(0, 4) + " / " + str.substring(4, 6) + " / " + str.substring(6, 8); } else if (str.length == 6) { return str.substring(0, 2) + ":" + str.substring(2, 4) + ":" + str.substring(4, 6); } else if (str.length == 5) { return "0" + str.substring(0, 1) + ":" + str.substring(1, 3) + ":" + str.substring(3, 5); } } getStock(); function playVideo(title, video_url) { var ww = $(window).width(); var aw = (ww > 1280 ? 1280 : ww) * 0.9; layer.open({ title: title, type: 1, skin: 'layui-layer-rim', area: [aw + 'px', (aw * 9 / 16) + 'px'], content: '' }); } function initGalleryModal(galleryModel, type, index) { var html = ""; html += "
"; html += "
"; html += "
"; html += " "; html += " "; html += "
"; html += "
"; if (type == 0) { for (var i = 0; i < galleryModel.img.length; i++) { html += "
"; } } else { for (var i = 0; i < galleryModel.video.length; i++) { html += "
"; } } html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; if (type == 0) { for (var i = 0; i < galleryModel.img.length; i++) { html += " "; } } else { for (var i = 0; i < galleryModel.video.length; i++) { html += " "; } } html += "
"; html += "
"; html += " "; html += " "; html += "
"; html += "
"; if (type == 0) { for (var i = 0; i < galleryModel.img.length; i++) { html += "
"; } } else { for (var i = 0; i < galleryModel.video.length; i++) { html += "
"; } } html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; html += " "; html += " 图片" + (galleryModel.img.length) + ""; html += "
"; html += "
"; html += " "; html += " 视频" + (galleryModel.video.length) + ""; html += "
"; html += "
"; html += "
"; html += "
"; $("body").append(html); var galleryThumbs = new Swiper('.gallery-thumbs', { spaceBetween: 10, slidesPerView: 7, freeMode: true, centeredSlides: false, watchSlidesVisibility: true, watchSlidesProgress: true, pagination: { el: '.swiper-pagination', type: 'progressbar' }, breakpoints: { 1440: { slidesPerView: 5 }, 1366: { slidesPerView: 4 }, 1024: { slidesPerView: 3 }, 640: { slidesPerView: 2 }, 320: { slidesPerView: 1 } } }); var galleryTop = new Swiper('.gallery-top', { spaceBetween: 10, initialSlide: index || 0, navigation: { nextEl: '.layui-layer-viewGroup .viewGroup-main .next-btn,.viewGroup-select-list .next-btn', prevEl: '.layui-layer-viewGroup .viewGroup-main .last-btn,.viewGroup-select-list .last-btn' }, thumbs: { swiper: galleryThumbs }, on: { slideChange: function () { $(".viewGroup-select-bar span").removeClass("bg-skyblue"); $(".viewGroup-select-bar span:lt(" + (this.activeIndex + 1) + ")").addClass("bg-skyblue"); var activeIndex = this.activeIndex; $(".swiper-slide video").each(function (i) { if (i == activeIndex) { $(this)[0].play(); } else { $(this)[0].pause(); } }); } } }); if (type == 1) { $(".swiper-slide-active video")[0].play(); } $(".layui-layer-viewGroup .viewGroup-footer .viewGroup-nav .viewGroup-nav-item").on("click", function () { var _swiper_slide = ""; var __item = ""; var _span = ""; if ($(this).index() == 0) {//图片 for (var i = 0; i < galleryModel.img.length; i++) { _swiper_slide += "
"; __item += "
"; _span += " "; } } else {//视频 for (var i = 0; i < galleryModel.video.length; i++) { _swiper_slide += "
"; __item += "
"; _span += " "; } } $(".gallery-top .swiper-wrapper").html(_swiper_slide); $(".gallery-thumbs .swiper-wrapper").html(__item); $(".viewGroup-select-bar").html(_span); galleryThumbs.update(); galleryTop.update(); $(this).addClass("bg-skyblue").siblings().removeClass("bg-skyblue"); if ($(this).index() == 1) { $(".swiper-slide-active video")[0].play(); } }); } /* * urlHelper */ var urlHelper = { getQueryString: function (name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(decodeURIComponent(r[2])); return null; } }; /* * CookieHelper */ var cookieHelper = { //获取Cookie get: function (name) { if (document.cookie.length > 0) { c_start = document.cookie.indexOf(name + "=") if (c_start != -1) { c_start = c_start + name.length + 1 c_end = document.cookie.indexOf(";", c_start) if (c_end == -1) c_end = document.cookie.length return unescape(decodeURIComponent(document.cookie.substring(c_start, c_end))) } } return ""; }, //获取所有Cookie getAll: function () { var cookies = document.cookie.split(/;\s/g); var cookieObj = {}; cookies.forEach(function (item) { var key = item.split('=')[0]; cookieObj[key] = item.split('=')[1]; }); return cookieObj; }, //设置Cookie set: function (name, value, minutes) { var expdate = new Date(); expdate.setTime(expdate.getTime() + (minutes || 480) * 60 * 1000); document.cookie = name + "=" + encodeURIComponent(value) + ";expires=" + expdate.toGMTString() + ";path=/"; }, //删除Cookie remove: function (name) { cookieHelper.set(name, "", -1); }, //删除所有Cookie removeAll: function () { var keys = Object.keys(cookieHelper.getAll()); keys.forEach(function (item) { cookieHelper.remove(item); }); } }; try { //axios.defaults.baseURL = 'https://api.hstd.com'; //axios.defaults.baseURL = 'http://localhost:9000'; axios.defaults.baseURL = 'https://hstd.com/serv'; } catch (e) { }