Browse Source

fix style

Karsa 3 years ago
parent
commit
63a170a7aa
3 changed files with 30 additions and 4 deletions
  1. 1 1
      .env.production
  2. 26 0
      src/utils/utils.ts
  3. 3 3
      src/views/chartShow/index.vue

+ 1 - 1
.env.production

@@ -1 +1 @@
-VITE_BASEURL = 'https://ficc.hzinsights.com/v1'
+VITE_BASEURL = 'https://chartlib.hzinsights.com/v1'

+ 26 - 0
src/utils/utils.ts

@@ -49,4 +49,30 @@ export const browser = ():string => {
 	}else {
 		return ''
 	}
+}
+
+// 判断设备
+export const getTerminal = () => {
+  // 获取终端的相关信息
+  var Terminal = {
+    // 辨别移动终端类型
+    platform: function () {
+      var u = navigator.userAgent,
+        app = navigator.appVersion;
+      return {
+        // android终端或者uc浏览器
+        android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1,
+        // 是否为iPhone或者QQHD浏览器
+        iPhone: u.indexOf('iPhone') > -1,
+        // 是否iPad
+        iPad: u.indexOf('iPad') > -1
+      };
+    }()
+  }
+  // 根据不同的终端,跳转到不同的地址
+  if (Terminal.platform.android) {
+    return 'android';
+  } else if (Terminal.platform.iPhone || Terminal.platform.iPad) {
+    return 'ios';
+  }
 }

+ 3 - 3
src/views/chartShow/index.vue

@@ -32,7 +32,7 @@ import { IDataProps, ILunarItem, IParams, ISeasonDataItemProps } from '@/types';
 import Highcharts from 'highcharts';
 import { defaultOpts, seasonOptions } from '@/utils/chartOptions';
 import moment from 'moment';
-import { browser } from '@/utils/utils';
+import { browser,getTerminal } from '@/utils/utils';
 
 export default defineComponent({
   components: {
@@ -319,6 +319,7 @@ export default defineComponent({
         // 季节图x轴显示月/日
         const xAxis = {
           ...defaultOpts.xAxis,
+          // tickInterval: 24 * 3600 * 1000 * 30,
           labels: {
             formatter: function (ctx: any) {
               return Highcharts.dateFormat('%m/%d', ctx.value);
@@ -371,8 +372,7 @@ export default defineComponent({
             };
 
         //农历图调整顶部缩进
-        ['FF','Safari'].includes(browser())
-        if (state.chartInfo.Calendar === '农历' && !['FF','Safari'].includes(browser())) chart = {
+        if (state.chartInfo.Calendar === '农历' && browser() !== 'FF' && getTerminal() !== 'ios') chart = {
           spacing: [-26, 8, 2, 8]
         }