admin
2026-02-06 8402f0794434bac13c0de02d47fb5c28d6e2639c
src/components/tabHead.vue
@@ -1,7 +1,7 @@
<template>
  <div class="tab_head">
    <div class="head_left">
      <div class="icon" @click="searchShow = true" v-if="leftShow">
    <div class="head_left flex-center">
      <div class="icon" @click="searchShow = true" v-if="leftShow" style="margin-right:.2666rem;">
        <van-icon name="search" size=".5em" />
      </div>
      <slot name="left"></slot>
@@ -16,35 +16,20 @@
      <slot></slot>
    </div>
    <!-- 搜索弹窗 -->
    <van-popup
      v-model="searchShow"
      round
      position="bottom"
      :style="{ height: '80%' }"
    >
    <van-popup v-model="searchShow" round position="bottom" :style="{ height: '80%' }">
      <div class="popup_head">
        <van-icon name="arrow-left" size=".5em" @click="searchShow = false" />
        <div class="popup_input">
          <van-field
            v-model="searchValue"
            :placeholder="$t('hj37')"
            left-icon="search"
            clearable
          />
          <van-field v-model="searchValue" :placeholder="$t('hj37')" left-icon="search" clearable />
        </div>
        <van-button type="primary" round @click="submit">{{
          $t("Search")
        }}</van-button>
      </div>
      <van-list
        v-model="loading"
        :finished="finished"
        :finished-text="$t('hj43')"
        @load="onLoad"
        v-if="(lists && lists.length > 0) || !finished"
      >
        <van-cell v-for="item in lists" :key="item.id">
      <van-list v-model="loading" :finished="finished" :finished-text="$t('hj43')" @load="onLoad"
        v-if="(lists && lists.length > 0) || !finished">
        <van-cell v-for="item in lists" :key="item.id" @click="toDetails(item)">
          <div class="search_item">
            <div class="search_item_left">
              <div class="search_item_left_name">{{ item.name }}</div>
@@ -72,6 +57,8 @@
<script>
import * as api from "@/axios/api";
import handleDt from "@/utils/deTh";
import config from "@/config";
import { Toast } from "vant";
export default {
  name: "tabHead",
  data() {
@@ -82,7 +69,7 @@
      loading: false, // 是否加载
      finished: true, // 是否加载完成
      pageNum: 1,
      pageSize: 20
      pageSize: 20,
    };
  },
  props: {
@@ -105,15 +92,16 @@
  },
  async mounted() {
    this.init();
    this.getInfoSite();
    // this.getInfoSite();
  },
  methods: {
    // 跳转客服页面
    aRouter1() {
      // 跳转客服页面
      window.open(this.onlineService);
      window.open(config.onlineService);
      // Toast(this.$t("kf1"));
    },
    // 获取客服地址
    async getInfoSite() {
      // 获取客服地址
      let data = await api.getInfoSite();
      if (data.status === 0) {
        this.onlineService = data.data.onlineService;
@@ -129,7 +117,7 @@
      // 跳转设置页面
      this.$router.push("/setting");
    },
    onLoad: handleDt.throttle(async function(a, b) {
    onLoad: handleDt.throttle(async function (a, b) {
      // 搜索列表加载
      this.finished = false;
      let opt = {
@@ -146,6 +134,8 @@
      if (data.status === 0 && data.data.list) {
        this.lists = [...this.lists, ...data.data.list];
      } else if (data.status != 0) {
        this.finished = true;
      }
      if (data.data.list && data.data.list.length <= 0) {
@@ -165,6 +155,22 @@
      // 提交搜索
      this.init();
      this.onLoad();
    },
    // 点击进入详情
    toDetails(item) {
      const obj = {
        pid: item.code || "",
        type: item.stock_type || ""
      };
      window.localStorage.setItem("kLine", JSON.stringify(obj));
      this.$router.push({
        path: "/kline",
        query: {
          code: item.code,
          type: item.stock_type
        }
      });
    }
  }
};