1
jhzh
2026-02-27 5dfb843c29fdcc1693961b70a36ddee3fea85a4a
src/page/list/tradingList/data.list.vue
@@ -92,13 +92,15 @@
            <van-col :span="active == 'DZ' ? '12' : '7'">
              <div >
                <div class="tp" style="display: flex;flex-direction: column;">
                  <span style="margin-bottom: 10px;font-size: .32rem;color: #858093;">{{$t('最新价')}}</span>
                  <span style="margin-bottom: 10px;font-size: .32rem;color: #858093;">{{$t('hj40')}}</span>
                  <div style="display: flex;">
                    <span class="price_color" style="font-size: 16px;font-weight: bold;">
                      {{ item.nowPrice  }}
                    </span>
                    <img v-if="item.hcrateP.charAt(0) == '-'" style="width: 18px;" src="@/assets/home/greeensvg.png"/>
                    <img v-else style="width: 18px;" src="@/assets/home/R10OVD4.png"/>
                    <div v-if="active != 'DZ'">
                      <img v-if="item.hcrateP.charAt(0) == '-'" style="width: 18px;" src="@/assets/home/greeensvg.png"/>
                      <img v-else style="width: 18px;" src="@/assets/home/R10OVD4.png"/>
                    </div>
                  </div>
                </div>
                <div class="bt" v-if="active != 'DZ'">
@@ -124,12 +126,12 @@
          <div class="box-a" v-if="active == 'DZ'">
            <div class="box_a_left">
              {{ $t("kpsj") }}:{{
                $moment(item.startTime).format("DD-MM-YYYY hh:mm:ss A")
                formatTimestamp(item.startTime)
              }}
            </div>
            <div class="box_a_right">
              {{ $t("gbsj") }}:{{
                $moment(item.endTime).format("DD-MM-YYYY hh:mm:ss A")
                formatTimestamp(item.endTime)
              }}
            </div>
          </div>
@@ -187,9 +189,11 @@
      this.getStock(this.active, e, 1);
    },
    sousuo(e) {
      //  if (this.loadings) return;  // 避免重复触发
      this.finished = false;
      this.listArr = [];
      this.pageNumVal = 1;
      this.num = 1
      this.loadings = true;
      this.getStock(this.active, this.zxactive, 1);
    },
@@ -221,6 +225,20 @@
    // }, 5000);
  },
  methods: {
    formatTimestamp(timestamp) {
      const date = new Date(timestamp);  // 将时间戳转换为 Date 对象
      const day = date.getDate();        // 日期
      const month = date.getMonth() + 1; // 月份(从 0 开始,所以下标要加 1)
      const year = date.getFullYear();   // 年份
      const hours = date.getHours();     // 小时
      const minutes = date.getMinutes(); // 分钟
      const seconds = date.getSeconds(); // 秒钟
      // 格式化为 "日月年/时分秒" 格式
      return `${year}${this.$t('年')}${month}${this.$t('月')}${day}${this.$t('日')}/${hours}:${minutes}:${seconds}`;
      // return `${month}`;
    },
    filterSH(val) {
      if (val === "sh") {
        return 1;
@@ -264,6 +282,7 @@
    // 获取列表
    getStock: handleDt.debounce(async function (a, b, c) {
      console.log(a,b,c);
      a = this.active;
      let stockType = "";
      if (a !== "") {
@@ -271,25 +290,22 @@
        stockType = array[0].name;
      } else {
        let array = this.zxtabsList.filter((item) => item.key === b);
        console.log(this.zxtabsList, b);
        stockType = array[0].name;
      }
      let pageNumVal = c || this.pageNumVal;
      let opt = {
        pageNum: pageNumVal,
        pageSize: 20 * this.num,
        // pageSize: 15 * this.num,
        pageSize: 15 ,
        stockPlate: "",
        keyWords: this.sousuo,
        stockType: stockType,
        orderBy: "",
      };
      // console.log();
      // api.positionzx;
      let data;
      if (a !== "") {
        if (a == "JP") {
          //印股
          //日股
          opt.stockType = "JP";
          data = await api.getStockByType(opt);
        } else {
@@ -305,20 +321,27 @@
      if (data.status === 0) {
        if (pageNumVal !== 1) {
          this.listArr = [...this.listArr, ...data.data.list];
          this.loadings = false;
          // this.finished = true;
          if (this.listArr.length < 15) {
            this.finished = true;
          }
        } else {
          this.listArr = []
          if (this.active) {
            if (this.active === data.data.stockType) {
              this.listArr = data.data.list;
              this.loadings = false;
              // this.finished = true;
              if (this.listArr.length % 20) {
              console.log(this.listArr.length%15);
              if (this.listArr.length < 15) {
                this.finished = true;
              }
            } else {
              this.listArr = data.data.list;
              this.loadings = false;
              // this.finished = true;
              if (this.listArr.length % 20) {
              if (this.listArr.length < 15) {
                this.finished = true;
              }
            }
@@ -326,8 +349,8 @@
            if (this.zxactive === data.data.stockType) {
              this.listArr = data.data.list;
              this.loadings = false;
              this.finished = true;
              if (this.listArr.length % 20) {
              // this.finished = true;
              if (this.listArr.length < 15) {
                this.finished = true;
              }
            }
@@ -355,7 +378,7 @@
    initWebSocket() {
      console.log("initWebSocket");
      this.Trade = new WhrWebSocket({
        path: `wss://wss.yanshiz.com/websocket-server `,
        path: `wss://ws.jafco1.cc/websocket-server `,
        onmessage: this.getTradeMessage,
      });
@@ -374,9 +397,14 @@
    onLoads() {
      console.log("onLoads");
      // this.pageNumVal++;
      this.loadings = true;
      this.num += 1;
      // this.finished = true;
      this.pageNumVal++;
      if(this.listArr.length==0){
        this.num = 1
      }else{
        this.num += 1;
      }
      this.getStock();
    },
    optionszx() {},