1
PC-20250623MANY\Administrator
2025-09-23 01d33e0271209b14ed364ccdb5d6ed0270a906af
src/views/home/components/HomeLtr.vue
@@ -69,6 +69,7 @@
</template>
<script>
let _timers = []
import HQChart from "hqchart";
import "hqchart/src/jscommon/umychart.resource/css/tools.css";
import "hqchart/src/jscommon/umychart.resource/font/iconfont.css";
@@ -954,7 +955,7 @@
    ],
    SplashTitle: "loading...",
    Symbol: "600015.sh",
    IsAutoUpdate: true, // 是自动更新数据
    IsAutoUpdate: false, // 是自动更新数据
    AutoUpdateFrequency: 15000,
    IsApiPeriod: true,
    IsShowRightMenu: false, // 是否显示右键菜单
@@ -1078,6 +1079,10 @@
      ID: 5,
    },
    {
      Name: i18n.t("hjsfz"),
      ID: 6,
    },
    {
      Name: i18n.t("hj92"),
      ID: 7,
    },
@@ -1128,7 +1133,6 @@
      chartType: "kline",
      KLineChart: null, // 图形控件  K线图
      Chart: null, // 图形控件  分时图
      timerss: null,
      isShow: false,
    };
  },
@@ -1146,11 +1150,17 @@
    this.init();
  },
  beforeDestroy() {
    if (this.timerss) {
      clearInterval(this.timerss);
    }
    this.clearTime();
  },
  methods: {
    // 清除所有定时器
    clearTime() {
      _timers.forEach(id => {
        clearInterval(id);
        clearTimeout(id);
      });
      _timers = [];
    },
    init() {
      this.OnSize();
      this.SetChartStyle();
@@ -1205,7 +1215,8 @@
    SetChartStyle() {
      EastMoney.HQData.SetMinuteChartCoordinate();
      var blackStyle = HQChart.Chart.HQChartStyle.GetStyleConfig(
        HQChart.Chart.STYLE_TYPE_ID.WHITE_ID
        // HQChart.Chart.STYLE_TYPE_ID.WHITE_ID // 白色风格
        HQChart.Chart.STYLE_TYPE_ID.BLACK_ID // 黑色风格
      ); // 读取黑色风格配置
      blackStyle.UpBarColor = "#449b54"; //上涨
@@ -1213,6 +1224,7 @@
      HQChart.Chart.JSChart.SetStyle(blackStyle);
    },
    handleClick(tab) {
      this.clearTime();
      this.KLineChart.ChangePeriod(tab.$attrs.Id);
    },
@@ -1247,14 +1259,14 @@
      data,
      callback // 第3方数据替换接口
    ) {
      if (this.timerss) {
        clearInterval(this.timerss);
        this.timerss = null;
      }
      EastMoney.HQData.Log("[HQChartDemo::NetworkFilter] data", data);
      this.timeChange(data, callback);
      this.timerss = setInterval(() => {
      let timerId = setInterval(() => {
        this.timeChange(data, callback);
      }, 5000);
      }, 2000);
      _timers.push(timerId);
    },
    timeChange(data, callback) {
      EastMoney.HQData.Log("[HQChartDemo::NetworkFilter] data", data);
@@ -1308,14 +1320,14 @@
    #hqchart_minute {
      height: 0;
      flex: 1;
      background-color: #fff;
      // background-color: #fff;
      position: relative;
    }
    #hqchart_kline {
      height: 0;
      flex: 1;
      background-color: #fff;
      // background-color: #fff;
      position: relative;
    }
  }