diff --git a/public/index.html b/public/index.html index dbda3a4..1412e84 100644 --- a/public/index.html +++ b/public/index.html @@ -5,12 +5,12 @@ - + <%= htmlWebpackPlugin.options.title %> @@ -20,5 +20,6 @@
+ diff --git a/public/static/kline/src/klineCharts.js b/public/static/kline/src/klineCharts.js index d692083..027acd6 100644 --- a/public/static/kline/src/klineCharts.js +++ b/public/static/kline/src/klineCharts.js @@ -89,7 +89,7 @@ function loadMoreKline(data, is_first, key){ } }) console.log(dataArr); - kcHistoryKeyId++; + // kcHistoryKeyId++; if (dataArr.length <= 0) { kcChart.applyMoreData(dataArr, false); } else { diff --git a/src/components/GqlUsdt.vue b/src/components/GqlUsdt.vue new file mode 100644 index 0000000..2ebb19b --- /dev/null +++ b/src/components/GqlUsdt.vue @@ -0,0 +1,37 @@ + + + + \ No newline at end of file diff --git a/src/components/OigeUsdt.vue b/src/components/OigeUsdt.vue new file mode 100644 index 0000000..714a452 --- /dev/null +++ b/src/components/OigeUsdt.vue @@ -0,0 +1,37 @@ + + + + \ No newline at end of file diff --git a/src/components/HelloWorld.vue b/src/components/PytnUsdt.vue similarity index 67% rename from src/components/HelloWorld.vue rename to src/components/PytnUsdt.vue index df28d88..27a16f4 100644 --- a/src/components/HelloWorld.vue +++ b/src/components/PytnUsdt.vue @@ -6,25 +6,14 @@ + \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index e868061..35811a5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -5,22 +5,45 @@ import HomeView from "../views/HomeView.vue"; Vue.use(VueRouter); const routes = [ - { - path: "/", - name: "home", - component: HomeView, - }, - { - path: "/about", - name: "about", - component: () => import("../views/AboutView.vue"), - }, + { + path: "", + redirect: "/PytnUsdt", + }, + { + path: "/", + // name: "home", + component: HomeView, + children: [ + // { + // path: '', + // name: 'PyttnUsdt', // 默认子路由名称 + // redirect: 'PyttnUsdt' + // }, + { + path: 'PytnUsdt', + // name: 'PyttnUsdt', // 默认子路由名称 + component: () => import("../components/PytnUsdt.vue") + }, + { + path: 'OigeUsdt', + component: () => import("../components/OigeUsdt.vue") + }, + { + path: 'GqlUsdt', + component: () => import("../components/GqlUsdt.vue") + }, + { + path: 'RpnUsdt', + component: () => import("../components/RpnUsdt.vue") + } + ] + } ]; const router = new VueRouter({ - mode: "history", - base: process.env.BASE_URL, - routes, + mode: "history", + base: process.env.BASE_URL, + routes, }); -export default router; +export default router; \ No newline at end of file diff --git a/src/views/AboutView.vue b/src/views/AboutView.vue deleted file mode 100644 index 3fa2807..0000000 --- a/src/views/AboutView.vue +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index ed00610..a26188e 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -8,10 +8,14 @@

OIGEUSDT

GQLUSDT

RPNUSDT

--> -

PYTNUSDT

-

OIGEUSDT

-

GQLUSDT

-

RPNUSDT

+

PYTNUSDT

+

OIGEUSDT

+

GQLUSDT

+

RPNUSDT

@@ -45,9 +49,11 @@ - +
+
+
@@ -55,63 +61,115 @@ import $ from 'jquery'; // import 'layui-src/src/layui.js'; // import 'layui-src/src/css/layui.css'; - import HelloWorld from '@/components/HelloWorld.vue'; + import PytnUsdt from '@/components/PytnUsdt.vue'; // import '../../static/kline/src/klineCharts.js'; export default { name: "HomeView", components: { - HelloWorld + PytnUsdt }, data() { return { - title:"PYTN" + title: "PYTN", + fullPath:"" }; }, + computed: { + isMobile() { + return window.innerWidth <= 768; // 根据你的需求设置移动端的判断条件 + } + }, mounted() { - $('.interval_btn').on('click', function(){ - if(kcChart != null || kcChart != undefined){ - var _this = $(this); - kcCurrentData.interval = _this.attr('data-interval'); - // 请求历史数据 - kcHistoryKeyId = 1; - var rang = setKLineVisibleRange(parseInt(Date.now() / 1000)); - $.ajax({ - url: "https://dfmg.dficoins.com/api/getkkline", - type: 'get', - async: false, - data: { - symbol: getSymbol(), - interval: getSecondsByInterval(kcCurrentData.interval), - times: kcHistoryKeyId, - from: rang.from, - to: rang.to + (365 * 86400) - }, - beforeSend: function(){ - loading_index = layer.load(1, { - shade: [0.1, '#fff'] //0.1透明度的白色背景 - }); - }, - success:function (result) { //成功回调 - console.log(result); - if(result.status){ - loadMoreKline(result.data, true, result.code); - $('.interval_btn').removeClass('active'); - _this.addClass('active'); - }else{ - - } - layer.close(loading_index); - }, - error: function(xhr){ - layer.close(loading_index); - } - }); - } + $('.interval_btn').on('click', function() { + if (kcChart != null || kcChart != undefined) { + var _this = $(this); + kcCurrentData.interval = _this.attr('data-interval'); + // 请求历史数据 + kcHistoryKeyId = 1; + var rang = setKLineVisibleRange(parseInt(Date.now() / 1000)); + $.ajax({ + url: "https://dfmg.dficoins.com/api/getkkline", + type: 'get', + async: false, + data: { + symbol: getSymbol(), + interval: getSecondsByInterval(kcCurrentData.interval), + times: kcHistoryKeyId, + from: rang.from, + to: rang.to + (365 * 86400) + }, + beforeSend: function() { + loading_index = layer.load(1, { + shade: [0.1, '#fff'] //0.1透明度的白色背景 + }); + }, + success: function(result) { //成功回调 + console.log(result); + if (result.status) { + loadMoreKline(result.data, true, result.code); + $('.interval_btn').removeClass('active'); + _this.addClass('active'); + } else { + + } + layer.close(loading_index); + }, + error: function(xhr) { + layer.close(loading_index); + } + }); + } }) + + //手机设备的简单适配 + $('.site-tree-mobile').on('click', function() { + $('body').addClass('site-mobile'); + }); + $('.site-mobile-shade').on('click', function() { + $('body').removeClass('site-mobile'); + }); + window.addEventListener('resize', this.handleResize); + // 初始化设置 fullPath + this.fullPath = this.$route.fullPath.split('/')[1]; + // 监听路由改变 + this.$router.afterEach((to, from) => { + this.fullPath = to.fullPath.split('/')[1]; + }); + }, + destroyed() { + window.removeEventListener('resize', this.handleResize); }, methods: { - handleClick(name){ + handleResize() { + if (this.isMobile) { + location.reload(); + } + }, + handleClick(name) { this.title = name + switch (name) { + case 'PYTN': + this.$router.push({ + path: '/PytnUsdt' + }); + break; + case 'OIGE': + this.$router.push({ + path: '/OigeUsdt' + }); + break; + case 'GQL': + this.$router.push({ + path: '/GqlUsdt' + }); + break; + default: + this.$router.push({ + path: '/RpnUsdt' + }); + break; + } + $('body').removeClass('site-mobile'); } } };