1
admin
2026-01-31 732c30b33f782c2d2ebb62eacda2fb7a453a7ecd
src/page/kline/index.vue
@@ -8,12 +8,15 @@
              <img src="../../assets/img/zuojiantou.png" alt />
            </div>
            <div class="right_title">
              <div class="t_t" style="white-space: nowrap">
              <div class="t_t line-one" style="white-space: nowrap">
                <span>{{ singDetails.name }}</span>
              </div>
              <!-- <div class="t_t" style="white-space: nowrap">
                <span>{{ singDetails.name }}({{ singDetails.gid }})</span>
              </div>
              <div class="b_t">
                <span>{{ singDetails.spell }}</span>
              </div>
              </div> -->
            </div>
          </div>
          <!-- 隐藏右侧金额显示 -->
@@ -44,7 +47,7 @@
                          (
                            Number($store.state.userInfo.userIndexAmt) / 0.9
                          ).toFixed(2)
                        : "₹" + $store.state.userInfo.userIndexAmt
                        : "" + $store.state.userInfo.userIndexAmt
                    }}
                  </span>
                  <span
@@ -55,7 +58,7 @@
                    style="white-space: nowarp"
                  >
                    {{
                      "₹ " +
                      " " +
                      parseFloat(
                        $store.state.userInfo.enableAmt.toFixed(2)
                      ).toLocaleString()
@@ -63,7 +66,7 @@
                  </span>
                </div>
                <div class="sanjiao">
                </div>
              </div>
              <div class="bottom_balance">
@@ -74,6 +77,13 @@
            </div>
          </div> -->
        </div>
        <div class="flex-start" style="font-size: .4rem;">
          <span class="i_icon">{{ bayType }}</span>
          <span class="i_hint" style="color:#777">{{ singDetails.spell }}</span>
        </div>
        <div class="detail_title_a">
          {{ singDetails.name }}({{ singDetails.gid }})
        </div>
        <div class="real_time_detail">
          <div class="left_now_price">
            <div class="top_now">
@@ -82,7 +92,7 @@
              }}</span> -->
              <span
                :class="singDetails.hcrate > 0 ? 'price green' : 'price red'"
                >{{ singDetails.nowPrice | _toString }}</span
                >{{ singDetails.nowPrice }}</span
              >
            </div>
            <div class="bottom_now">
@@ -93,7 +103,7 @@
                }}{{ (singDetails.nowPrice - singDetails.preclose_px).toFixed(2) }}</span> -->
                <span v-else>
                  {{
                    (singDetails.nowPrice - singDetails.preclose_px) | _toString
                    (singDetails.nowPrice - singDetails.preclose_px).toFixed(2)
                  }}</span
                >
              </div>
@@ -121,7 +131,7 @@
                  :class="
                    singDetails.hcrate > 0 ? 'number green' : 'number red'
                  "
                  >{{ singDetails.open_px | _toString }}</span
                  >{{ singDetails.open_px }}</span
                >
              </div>
              <div class="rights topes">
@@ -133,7 +143,7 @@
                  :class="
                    singDetails.hcrate > 0 ? 'number green' : 'number red'
                  "
                  >{{ singDetails.today_max | _toString }}</span
                  >{{ singDetails.today_max }}</span
                >
              </div>
            </div>
@@ -147,7 +157,7 @@
                  :class="
                    singDetails.hcrate > 0 ? 'number green' : 'number red'
                  "
                  >{{ singDetails.preclose_px | _toString }}</span
                  >{{ singDetails.preclose_px }}</span
                >
              </div>
              <div class="rights bots">
@@ -159,7 +169,7 @@
                  :class="
                    singDetails.hcrate > 0 ? 'number green' : 'number red'
                  "
                  >{{ singDetails.today_min | _toString }}</span
                  >{{ singDetails.today_min }}</span
                >
              </div>
            </div>
@@ -167,16 +177,16 @@
        </div>
      </div>
      <div class="k_line_detail">
        <Kline :type="singDetails.type" />
        <Kline :key="key" :type="singDetails.type" />
      </div>
      <div
        class="priect_top_bottom"
        style="display: none"
        v-if="
          kLineDetails.if_us != 1 &&
          kLineDetails.type != 'hk' &&
          kLineDetails.type != 'hk' &&
          kLineDetails.if_zhishu == 0
            kLineDetails.type != 'hk' &&
            kLineDetails.type != 'hk' &&
            kLineDetails.if_zhishu == 0
        "
      >
        <div class="t_title">
@@ -423,25 +433,19 @@
          />
          <img src="../../assets/img/shoucangle.png" alt v-else />
        </div>
        <div class="right_xx" @click="handleJj()">
          <a href="#"><img src="../../assets/img/xiaoxi.png" alt /></a>
        </div>
        <!-- <div class="right_xx" @click="handleJj()">
          <a href="#"><img src="../../assets/img/xiaoxi.png" alt/></a>
        </div> -->
      </div>
      <div class="rights">
        <div class="buy_btn">
        <!-- <div class="buy_btn">
          <div class="top_buy" @click="goBuy(0)">
            <span>{{ $t("hj84") }}</span>
          </div>
          <div class="bottom_buy">
            <span>{{ singDetails.nowPrice | _toString }}</span>
          </div>
        </div>
        </div> -->
        <div class="sell_btn" @click="goBuy(1)">
          <div class="top_sell">
            <span>{{ $t("hj85") }}</span>
          </div>
          <div class="bottom_sell">
            <span>{{ singDetails.nowPrice | _toString }}</span>
          </div>
        </div>
      </div>
@@ -471,29 +475,55 @@
      newsdetailList: [],
      bayType: "",
      timer: null,
      key: 0,
      messageInstances: [] // 保存所有消息提示实例
    };
  },
  components: {
    Kline,
    Kline
  },
  created() {
    // 进入页面的时候清除所以得计时器,防止页面切换的时候出现多个定时器
    let end = setTimeout(function() {}, 0);
    for (let i = 0; i <= end; i++) {
      clearInterval(i);
    }
    const { query } = this.$route;
    this.kLineDetails = query;
    if (query.if_us === "1") {
      this.getSingDetailUs();
    } else {
      this.getSingDetails();
      this.timer = setInterval(() => {
        this.getSingDetails();
      }, 500);
      }, 5000);
    }
    this.getOpation();
    // this.$Lazyload();
    this.getUserInfo();
    this.getNohknews();
  },
  beforeDestroy() {
    this.clearInterval(this.timer); // 在组件销毁前清除定时器
    clearInterval(this.timer); // 在组件销毁前清除定时器
    // 关闭所有消息提示
    this.messageInstances.forEach(instance => {
      if (instance && typeof instance.close === 'function') {
        instance.close();
      }
    });
    this.messageInstances = [];
  },
  destroyed() {
    clearInterval(this.timer); // 在组件销毁前清除定时器
    // 确保所有消息提示都已关闭
    this.messageInstances.forEach(instance => {
      if (instance && typeof instance.close === 'function') {
        instance.close();
      }
    });
    this.messageInstances = [];
  },
  // beforeDestroy() {
  //   this.Klinetype = false;
@@ -501,7 +531,7 @@
  // },
  methods: {
    async getHknews() {
      await api.queryIndexNews().then((res) => {
      await api.queryIndexNews().then(res => {
        if (res.status === 0) {
          this.newsdetailList = res.data.data;
        }
@@ -521,31 +551,35 @@
        if (data.status === 0) {
          this.getOpation();
          this.optionBtn = false;
          this.$message({
          const messageInstance = this.$message({
            message: this.$t("hj97"),
            type: "success",
            type: "success"
          });
          this.messageInstances.push(messageInstance);
        } else {
          this.optionBtn = false;
          this.$message({
          const messageInstance = this.$message({
            message: data.msg,
            type: "warning",
            type: "warning"
          });
          this.messageInstances.push(messageInstance);
        }
      } else {
        let data = await api.addOption({ code: this.kLineDetails.code });
        if (data.status === 0) {
          this.getOpation();
          this.optionBtn = false;
          this.$message({
          const messageInstance = this.$message({
            message: this.$t("hj96"),
            type: "success",
            type: "success"
          });
          this.messageInstances.push(messageInstance);
        } else {
          this.$message({
          const messageInstance = this.$message({
            message: data.msg,
            type: "warning",
            type: "warning"
          });
          this.messageInstances.push(messageInstance);
          this.optionBtn = false;
        }
      }
@@ -568,7 +602,7 @@
    },
    async getOpation() {
      let opts = {
        code: this.$route.query.code,
        code: this.$route.query.code
      };
      let data = await api.isOption(opts);
      if (data.status === 0) {
@@ -581,9 +615,9 @@
    async getSingDetails() {
      let opts = {
        code: this.kLineDetails.code,
        stockType: this.kLineDetails.type,
        stockType: this.kLineDetails.type
      };
      await api.getSingleStock(opts).then((res) => {
      await api.getSingleStock(opts).then(res => {
        if (res.status === 0) {
          this.singDetails = res.data.stock;
          this.bayType = res.data.stock.type;
@@ -595,7 +629,7 @@
          }
          const obj = {
            pid: res.data.stock.code,
            type: res.data.stock.type,
            type: res.data.stock.type
          };
          window.localStorage.setItem("kLine", JSON.stringify(obj));
          // console.log(this.singDetails)
@@ -613,9 +647,9 @@
    async getSingDetailUs() {
      let opts = {
        code: this.kLineDetails.code,
        stockType: this.kLineDetails.type,
        stockType: this.kLineDetails.type
      };
      await api.getUsDetail(opts).then((res) => {
      await api.getUsDetail(opts).then(res => {
        // console.log(res,1111123);
        // var that = this
        // if(!res){
@@ -659,8 +693,8 @@
      this.$router.push({
        path: "/newPage",
        query: {
          listid: item.id,
        },
          listid: item.id
        }
      });
    },
    goBuy(index) {
@@ -677,13 +711,14 @@
          spell: this.singDetails.spell,
          if_us: this.kLineDetails.if_us,
          bayType: this.bayType,
        },
          gid: this.singDetails.gid
        }
      });
      if (navigator.vibrate) {
        // 支持
        navigator.vibrate([55]);
      }
    },
    }
  },
  filters: {
    getName(spell) {
@@ -745,8 +780,8 @@
        .replace(/年|月/g, "-")
        .replace(/日/g, " ");
      return beijingDatetime; // 2017-03-31 16:02:06
    },
  },
    }
  }
};
</script>
@@ -859,8 +894,24 @@
  padding: 0 0.3rem;
  background: #fff;
  .detail_title_a {
    font-size: 0.45rem;
    font-weight: 500;
    margin-top: 0.2rem;
    line-height: 0.45rem;
  }
  .i_icon {
    border-radius: 0 26em 26em 0;
    background: #07c160;
    color: #fff;
    padding: 0.1em 0.5em 0.1em 0.4em;
    margin-right: 0.3em;
    font-size: 0.8em;
  }
  .top_back {
    width: 50%;
    width: 90%;
    height: 1.2rem;
    display: flex;
    align-items: center;
@@ -870,22 +921,26 @@
      height: 80%;
      display: flex;
      align-items: center;
      margin-right: 10vw;
      > img {
        margin-top: 0.2rem;
        // margin-top: 0.2rem;
        width: 0.6rem;
        height: 0.6rem;
      }
    }
    .right_title {
      width: 3rem;
      height: 80%;
      width: 70%;
      // height: 80%;
      display: flex;
      align-items: center;
      justify-content: center;
      .t_t {
        width: 100%;
        height: 70%;
        display: flex;
        height: 100%;
        line-height: 1.2rem;
        align-items: center;
        font-size: 0.4615rem;
@@ -908,7 +963,7 @@
.k_line_detail {
  width: 100%;
  height: calc(100vh - 300px);
  height: 100vw;
  background: #fff;
  border-radius: 0 0 0.3rem 0.3rem;
}
@@ -929,9 +984,10 @@
    .top_now {
      width: 100%;
      // height: 65%;
      font-size: 0.741rem;
      font-size: 25px;
      display: flex;
      align-items: center;
      font-weight: bold;
      span {
        font-weight: 500;
@@ -952,7 +1008,7 @@
  }
  .right_ets {
    max-width: 60%;
    max-width: 70%;
    height: 100%;
    > div {
@@ -968,6 +1024,7 @@
        justify-content: space-between;
        align-items: center;
        padding: 0 0.1rem;
        .titles {
          padding-right: 0.1rem;
        }
@@ -1131,6 +1188,7 @@
    height: 70%;
    display: flex;
    align-items: center;
    padding-left: 0.3rem;
    > div {
      width: 50%;
@@ -1147,28 +1205,31 @@
  }
  .rights {
    width: 70%;
    width: 80%;
    height: 70%;
    display: flex;
    align-items: center;
    justify-content: space-around;
    justify-content: center;
    padding-right: 0.2rem;
    > div {
      border-radius: 0.15rem;
    }
    .buy_btn {
      width: 45%;
      height: 100%;
      width: 50%;
      height: 80%;
      background: rgb(225, 59, 69);
      color: #fff;
      border-radius: 3rem 0 0 3rem !important;
      .top_buy {
        width: 100%;
        height: 45%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: flex-end;
        align-items: center;
        font-size: 0.4rem;
      }
      .bottom_buy {
@@ -1183,17 +1244,20 @@
    }
    .sell_btn {
      width: 45%;
      height: 100%;
      background: rgb(68, 155, 84);
      width: 100%;
      height: 80%;
      background: #c4d600;
      color: #fff;
      // border-radius: 0 3rem 3rem 0 !important;
      border-radius: 3rem  !important;
      .top_sell {
        width: 100%;
        height: 45%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: flex-end;
        align-items: center;
        font-size: 0.4rem;
      }
      .bottom_sell {