XIGUASSR
2022-11-10 f891d8d35067d3bb40e2b48ecc4ab28e26f00bcd
src/page/list/trading-list.vue
@@ -11,15 +11,29 @@
                  <img src="../../assets/img/searchs.png" alt />
                </div>
                <div class="search_input">
                  <input type="text" class="searchs"  placeholder="输入品种名称/代码搜索" ref="search" id="sousuo" onkeyup="value=value.replace(/[^a-zA-Z0-9]/g,'')" v-model="gpcode"  @input="gpinput"/>
                  <input
                    type="text"
                    class="searchs"
                    placeholder="输入品种名称/代码搜索"
                    ref="search"
                    id="sousuo"
                    onkeyup="value=value.replace(/[^a-zA-Z0-9]/g,'')"
                    v-model="gpcode"
                    @input="gpinput"
                  />
                </div>
              </div>
            </div>
          </div>
          <div class="tab_class">
            <div class="scroll_tab">
              <div class="tab_items" v-for="(item, index) in tabsClassArr" :key="index" :class="index == 0 ? 'mrt' : ''"
                @click="handleTabsItem(item, index)">
              <div
                class="tab_items"
                v-for="(item, index) in tabsClassArr"
                :key="index"
                :class="index == 0 ? 'mrt' : ''"
                @click="handleTabsItem(item, index)"
              >
                <span :class="tabsItemIndex === index ? 'active' : ''">{{ item.name }}</span>
              </div>
            </div>
@@ -47,57 +61,90 @@
            </div>
          </div>
          <div class="list" :class="isToken == '' ? 'listHeight' : 'listHeights'">
            <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad"
              :immediate-check="false">
            <van-list
              v-model="loading"
              :finished="finished"
              finished-text="没有更多了"
              @load="onLoad"
              :immediate-check="false"
            >
              <div class="van-clearfix">
                <div class="list_items">
                  <div class="item" v-for="(item, index) in listArr" :key="index">
                  <div class="item" v-for="(item, index) in listArr" :key="index" @click="handleGoToKlineDetail(item, index)">
                    <div class="left_title">
                      <div class="tp">
                        <span class="collection" @click="options(item)">
                        <span class="collection" @click.stop="options(item)">
                          <span class="shu" :class="item.isOption == '1' ? 'shublue' : ''"></span>
                        </span>
                        <span class="title_color">{{ tabsItemIndex == 3 ? item.futuresName : tabsItemIndex ==
                            2 ? item.name : tabsItemIndex == 0 ? item.name : item.indexName
                        }}</span>
                        <span class="title_color">
                          {{ tabsItemIndex == 3 ? item.futuresName : tabsItemIndex ==
                          2 ? item.name : tabsItemIndex == 0 ? item.name : item.indexName
                          }}
                        </span>
                      </div>
                      <div class="bt">
                        <span>{{ tabsItemIndex == 3 ? item.futuresCode : tabsItemIndex == 2 ? item.code : tabsItemIndex
                            ==
                            0 ? item.code : item.indexCode
                        }}</span>
                        <span>
                          {{ tabsItemIndex == 3 ? item.futuresCode : tabsItemIndex == 2 ? item.code : tabsItemIndex
                          ==
                          0 ? item.code : item.indexCode
                          }}
                        </span>
                      </div>
                    </div>
                    <div class="center_price">
                      <div class="tp">
                        <span class="price_color" v-if="tabsItemIndex == 0 || tabsItemIndex == 2"
                          :class="item.hcrate > 0 ? 'green' : 'red'">{{ item.nowPrice
                          }}</span>
                        <span class="price_color" v-else>{{ tabsItemIndex == 3 ? Number(item.nowPrice).toFixed(2) :
                            item.currentPoint
                        }}</span>
                        <span
                          class="price_color"
                          v-if="tabsItemIndex == 0 || tabsItemIndex == 2"
                          :class="item.hcrate > 0 ? 'green' : 'red'"
                        >
                          {{ item.nowPrice
                          }}
                        </span>
                        <span class="price_color" v-else>
                          {{ tabsItemIndex == 3 ? Number(item.nowPrice).toFixed(2) :
                          item.currentPoint
                          }}
                        </span>
                      </div>
                      <div class="bt">
                        <span v-if="tabsItemIndex == 3 || tabsItemIndex == 1">{{ '手续费:' + item.transFee }}</span>
                        <span
                          v-if="tabsItemIndex == 3 || tabsItemIndex == 1"
                        >{{ '手续费:' + item.transFee }}</span>
                        <span v-else>{{ item.today_min }}</span>
                      </div>
                    </div>
                    <div class="right_bs">
                      <div class="tp">
                        <span class="price_color" v-if="tabsItemIndex == 0 || tabsItemIndex == 2"
                          :class="item.hcrate > 0 ? 'green' : 'red'">{{ item.hcrate }}</span>
                        <span class="price_color" v-if="tabsItemIndex == 1"
                          :class="item.floatRate > 0 ? 'green' : 'red'">{{
                              item.floatRate + '%'
                          }}</span>
                        <span class="price_color" v-if="tabsItemIndex == 3"
                          :class="((item.nowPrice - item.lastClose) / item.lastClose * 100).toFixed(2) > 0 ? 'green' : 'red'">{{
                              item.lastClose == "" ? 0.00 : ((Number(item.nowPrice) - Number(item.lastClose)) /
                                Number(item.lastClose) * 100).toFixed(2) + '%'
                          }}</span>
                        <span
                          class="price_color"
                          v-if="tabsItemIndex == 0 || tabsItemIndex == 2"
                          :class="item.hcrate > 0 ? 'green' : 'red'"
                        >{{ item.hcrate }}</span>
                        <span
                          class="price_color"
                          v-if="tabsItemIndex == 1"
                          :class="item.floatRate > 0 ? 'green' : 'red'"
                        >
                          {{
                          item.floatRate + '%'
                          }}
                        </span>
                        <span
                          class="price_color"
                          v-if="tabsItemIndex == 3"
                          :class="((item.nowPrice - item.lastClose) / item.lastClose * 100).toFixed(2) > 0 ? 'green' : 'red'"
                        >
                          {{
                          item.lastClose == "" ? 0.00 : ((Number(item.nowPrice) - Number(item.lastClose)) /
                          Number(item.lastClose) * 100).toFixed(2) + '%'
                          }}
                        </span>
                      </div>
                      <div class="bt">
                        <div v-if="tabsItemIndex != 1 && tabsItemIndex != 3">{{ item.stock_type.toUpperCase() }}</div>
                        <div
                          v-if="tabsItemIndex != 1 && tabsItemIndex != 3"
                        >{{ item.stock_type.toUpperCase() }}</div>
                        <!-- class="codeIcon" -->
                      </div>
                    </div>
@@ -105,7 +152,6 @@
                </div>
              </div>
            </van-list>
          </div>
        </div>
        <div class="bottom_content" v-if="tabsIndex === 0">
@@ -117,7 +163,14 @@
                  <img src="../../assets/img/searchs.png" alt />
                </div>
                <div class="search_input">
                  <input type="text"  class="searchs" placeholder="输入品种名称/代码搜索"  onkeyup="value=value.replace(/[^a-zA-Z0-9]/g,'')" v-model="gpcodes"  @input="gpinputs" />
                  <input
                    type="text"
                    class="searchs"
                    placeholder="输入品种名称/代码搜索"
                    onkeyup="value=value.replace(/[^a-zA-Z0-9]/g,'')"
                    v-model="gpcodes"
                    @input="gpinputs"
                  />
                </div>
              </div>
            </div>
@@ -135,8 +188,13 @@
          </div>
          <div class="list zxlist">
            <van-list v-model="loadings" :finished="finisheds" finished-text="没有更多了" @load="onLoads"
              :immediate-check="false">
            <van-list
              v-model="loadings"
              :finished="finisheds"
              finished-text="没有更多了"
              @load="onLoads"
              :immediate-check="false"
            >
              <div class="van-clearfix">
                <div class="list_items">
                  <div class="item" v-for="(item, index) in listArrs" :key="item.indexCode">
@@ -153,19 +211,18 @@
                    </div>
                    <div class="center_price">
                      <div class="tp">
                        <span class="price_color">{{item.nowPrice}}</span>
                      </div>
                      <div class="bt">
                        <span>{{ item.addTime }}</span>
                      </div>
                    </div>
                    <div class="right_bs">
                      <div class="tp">
                        <span class="price_color" :class="item.hcrate > 0 ? 'green' : 'red'">{{ item.hcrate }}</span>
                        <span
                          class="price_color"
                          :class="item.hcrate > 0 ? 'green' : 'red'"
                        >{{ item.hcrate }}</span>
                      </div>
                      <div class="bt">
                        <!-- <div>{{ item.stock_type.toUpperCase() }}</div> -->
@@ -176,9 +233,7 @@
                </div>
              </div>
            </van-list>
          </div>
        </div>
      </div>
    </div>
@@ -186,7 +241,12 @@
    <div class="top_title" ref="topTitle">
      <div>
        <div class="tabs_title">
          <div class="tb" v-for="(item, index) in tabsArr" :key="index" @click="handleTabsClick(item, index)">
          <div
            class="tb"
            v-for="(item, index) in tabsArr"
            :key="index"
            @click="handleTabsClick(item, index)"
          >
            <span :class="index === tabsIndex ? 'active' : ''">{{ item }}</span>
          </div>
        </div>
@@ -198,19 +258,37 @@
              </div>
              <div class="right">
                <span v-if="$store.state.userInfo.userAmt==undefined">¥0.00</span>
                <span  v-if="$store.state.userInfo&&tabsItemIndex == 1" style="white-space: nowarp;" >{{ '¥' + $store.state.userInfo.userIndexAmt
                }}</span>
                <span  v-if="$store.state.userInfo.userAmt!=undefined&&tabsItemIndex == 0" style="white-space: nowarp;" >{{ '¥ ' + $store.state.userInfo.userAmt
                }}</span>
                <span  v-if="$store.state.userInfo.userAmt!=undefined&&tabsItemIndex == 2" style="white-space: nowarp;">{{ '¥ ' + $store.state.userInfo.userAmt
                }}</span>
                <span  v-if="$store.state.userInfo&&tabsItemIndex == 3" style="white-space: nowarp;">{{
                    '¥' + $store.state.userInfo.userFuturesAmt
                }}</span>
                <span v-if="$store.state.userInfo&&tabsItemIndex == 1" style="white-space: nowarp;">
                  {{ '¥' + $store.state.userInfo.userIndexAmt
                  }}
                </span>
                <span
                  v-if="$store.state.userInfo.userAmt!=undefined&&tabsItemIndex == 0"
                  style="white-space: nowarp;"
                >
                  {{ '¥ ' + $store.state.userInfo.userAmt
                  }}
                </span>
                <span
                  v-if="$store.state.userInfo.userAmt!=undefined&&tabsItemIndex == 2"
                  style="white-space: nowarp;"
                >
                  {{ '¥ ' + $store.state.userInfo.userAmt
                  }}
                </span>
                <span v-if="$store.state.userInfo&&tabsItemIndex == 3" style="white-space: nowarp;">
                  {{
                  '¥' + $store.state.userInfo.userFuturesAmt
                  }}
                </span>
              </div>
              <div class="sanjiao">
                <img :class="dialogFlag ? 'xuanz' : ''" style="transition: all 0.5s;" src="../../assets/img/xiala.png"
                  alt />
                <img
                  :class="dialogFlag ? 'xuanz' : ''"
                  style="transition: all 0.5s;"
                  src="../../assets/img/xiala.png"
                  alt
                />
              </div>
            </div>
            <div class="bottom_balance">
@@ -224,61 +302,94 @@
      <div class="cards">
        <div class="card_item">
          <div class="tops_title">
            <div><span>{{ '总资产' }}</span></div>
            <div>
              <span>{{ '总资产' }}</span>
            </div>
          </div>
          <div class="bottom_price">
            <div>
              <p v-if="this.$store.state.settingForm.indexDisplay && !this.$store.state.settingForm.futuresDisplay"
                class="account">¥{{ $store.state.hide ? '****' : Number($store.state.userInfo.userAmt +
                    $store.state.userInfo.userIndexAmt).toFixed(2)
                }}</p>
              <p v-else-if="!this.$store.state.settingForm.indexDisplay && this.$store.state.settingForm.futuresDisplay"
                class="account">¥{{ $store.state.hide ? '****' : Number($store.state.userInfo.userAmt +
                    $store.state.userInfo.userFuturesAmt).toFixed(2)
                }}</p>
              <p v-else-if="!this.$store.state.settingForm.indexDisplay && !this.$store.state.settingForm.futuresDisplay"
                class="account">¥{{ $store.state.hide ? '****' : Number($store.state.userInfo.userAmt).toFixed(2) }}</p>
              <p v-else-if="this.$store.state.settingForm.indexDisplay && this.$store.state.settingForm.futuresDisplay"
                class="account">¥{{ $store.state.hide ? '****' : Number($store.state.userInfo.userAmt +
                    $store.state.userInfo.userIndexAmt + $store.state.userInfo.userFuturesAmt).toFixed(2)
                }}</p>
              <p
                v-if="this.$store.state.settingForm.indexDisplay && !this.$store.state.settingForm.futuresDisplay"
                class="account"
              >
                ¥{{ $store.state.hide ? '****' : Number($store.state.userInfo.userAmt +
                $store.state.userInfo.userIndexAmt).toFixed(2)
                }}
              </p>
              <p
                v-else-if="!this.$store.state.settingForm.indexDisplay && this.$store.state.settingForm.futuresDisplay"
                class="account"
              >
                ¥{{ $store.state.hide ? '****' : Number($store.state.userInfo.userAmt +
                $store.state.userInfo.userFuturesAmt).toFixed(2)
                }}
              </p>
              <p
                v-else-if="!this.$store.state.settingForm.indexDisplay && !this.$store.state.settingForm.futuresDisplay"
                class="account"
              >¥{{ $store.state.hide ? '****' : Number($store.state.userInfo.userAmt).toFixed(2) }}</p>
              <!-- <p
                v-else-if="this.$store.state.settingForm.indexDisplay && this.$store.state.settingForm.futuresDisplay"
                class="account"
              >
                ¥{{ $store.state.hide ? '****' : Number($store.state.userInfo.userAmt +
                $store.state.userInfo.userIndexAmt + $store.state.userInfo.userFuturesAmt).toFixed(2)
                }}
              </p> -->
            </div>
          </div>
        </div>
        <div class="card_item">
          <div class="tops_title">
            <div><span>{{ '强平线' }}</span></div>
            <div>
              <span>{{ '强平线' }}</span>
            </div>
          </div>
          <div class="bottom_price">
            <div><span v-show="tabsItemIndex == 1">{{ $store.state.hide ? '****' :
            <div>
              <span v-show="tabsItemIndex == 1">
                {{ $store.state.hide ? '****' :
                Number(($store.state.userInfo.enableIndexAmt +
                  $store.state.userInfo.allIndexFreezAmt) * indexSettingInfo.forceSellPercent).toFixed(2)
            }}</span>
              <span v-show="tabsItemIndex == 0">{{ $store.state.hide ? '****' : Number(($store.state.userInfo.enableAmt
                  +
                  $store.state.userInfo.allFreezAmt) * settingInfo.forceStopPercent).toFixed(2)
              }} </span>
              <span v-show="tabsItemIndex == 2">{{ $store.state.hide ? '****' : Number(($store.state.userInfo.enableAmt
                  +
                  $store.state.userInfo.allFreezAmt) * settingInfo.forceStopPercent).toFixed(2)
              }} </span>
              <span v-show="tabsItemIndex == 3">{{ $store.state.hide ? '****' :
                  Number(($store.state.userInfo.enableFuturesAmt +
                    $store.state.userInfo.allFuturesFreezAmt) * futuresSettingInfo.forceSellPercent).toFixed(2)
              }}</span>
                $store.state.userInfo.allIndexFreezAmt) * indexSettingInfo.forceSellPercent).toFixed(2)
                }}
              </span>
              <span v-show="tabsItemIndex == 0">
                {{ $store.state.hide ? '****' : Number(($store.state.userInfo.enableAmt
                +
                $store.state.userInfo.allFreezAmt) * settingInfo.forceStopPercent).toFixed(2)
                }}
              </span>
              <span v-show="tabsItemIndex == 2">
                {{ $store.state.hide ? '****' : Number(($store.state.userInfo.enableAmt
                +
                $store.state.userInfo.allFreezAmt) * settingInfo.forceStopPercent).toFixed(2)
                }}
              </span>
              <span v-show="tabsItemIndex == 3">
                {{ $store.state.hide ? '****' :
                Number(($store.state.userInfo.enableFuturesAmt +
                $store.state.userInfo.allFuturesFreezAmt) * futuresSettingInfo.forceSellPercent).toFixed(2)
                }}
              </span>
            </div>
          </div>
        </div>
        <div class="card_item">
          <div class="tops_title">
            <div><span>{{ tabsItemIndex == 1 ? '指数' : tabsItemIndex == 0 ? '沪深' : tabsItemIndex == 2 ? '科创' :
            <div>
              <span>
                {{ tabsItemIndex == 1 ? '指数' : tabsItemIndex == 0 ? '沪深' : tabsItemIndex == 2 ? '科创' :
                tabsItemIndex ==
                  3 ? '期货' : ''
            }}</span><span>{{ '资产' }}</span></div>
                3 ? '期货' : ''
                }}
              </span>
              <span>{{ '资产' }}</span>
            </div>
          </div>
          <div class="bottom_price">
            <div><span v-show="tabsItemIndex == 1">{{ '¥ ' + $store.state.userInfo.userIndexAmt }}</span>
            <div>
              <span v-show="tabsItemIndex == 1">{{ '¥ ' + $store.state.userInfo.userIndexAmt }}</span>
              <span v-show="tabsItemIndex == 0">{{ '¥ ' + $store.state.userInfo.userAmt }}</span>
              <span v-show="tabsItemIndex == 2">{{ '¥ ' + $store.state.userInfo.userAmt }}</span>
              <span v-show="tabsItemIndex == 3">{{ '¥ ' + $store.state.userInfo.userFuturesAmt }}</span>
@@ -287,10 +398,13 @@
        </div>
        <div class="card_item">
          <div class="tops_title">
            <div><span>{{ '可用资金' }}</span></div>
            <div>
              <span>{{ '可用资金' }}</span>
            </div>
          </div>
          <div class="bottom_price">
            <div><span v-show="tabsItemIndex == 1">{{ '¥ ' + $store.state.userInfo.enableIndexAmt }}</span>
            <div>
              <span v-show="tabsItemIndex == 1">{{ '¥ ' + $store.state.userInfo.enableIndexAmt }}</span>
              <span v-show="tabsItemIndex == 0">{{ '¥ ' + $store.state.userInfo.enableAmt }}</span>
              <span v-show="tabsItemIndex == 2">{{ '¥ ' + $store.state.userInfo.enableAmt }}</span>
              <span v-show="tabsItemIndex == 3">{{ '¥ ' + $store.state.userInfo.enableFuturesAmt }}</span>
@@ -299,33 +413,45 @@
        </div>
        <div class="card_item">
          <div class="tops_title">
            <div><span>{{ '冻结保证金' }}</span></div>
            <div>
              <span>{{ '冻结保证金' }}</span>
            </div>
          </div>
          <div class="bottom_price">
            <div><span v-show="tabsItemIndex == 1">{{ '¥ ' + $store.state.userInfo.allIndexFreezAmt }}</span>
            <div>
              <span v-show="tabsItemIndex == 1">{{ '¥ ' + $store.state.userInfo.allIndexFreezAmt }}</span>
              <span v-show="tabsItemIndex == 0">{{ '¥ ' + $store.state.userInfo.allFreezAmt }}</span>
              <span v-show="tabsItemIndex == 2">{{ '¥ ' + $store.state.userInfo.allFreezAmt }}</span>
              <span v-show="tabsItemIndex == 3">{{ '¥ ' + $store.state.userInfo.allFuturesFreezAmt }}</span>
              <span
                v-show="tabsItemIndex == 3"
              >{{ '¥ ' + $store.state.userInfo.allFuturesFreezAmt }}</span>
            </div>
          </div>
        </div>
        <div class="card_item">
          <div class="tops_title">
            <div><span>{{ '持仓总盈亏' }}</span></div>
            <div>
              <span>{{ '持仓总盈亏' }}</span>
            </div>
          </div>
          <div class="bottom_price">
            <div><span
            <div>
              <span
                :class="$store.state.userInfo.allIndexProfitAndLose > 0 ? ' red' : $store.state.userInfo.allIndexProfitAndLose < 0 ? ' green' : ''"
                v-show="tabsItemIndex == 1">{{ '¥ ' + $store.state.userInfo.allIndexProfitAndLose }}</span>
                v-show="tabsItemIndex == 1"
              >{{ '¥ ' + $store.state.userInfo.allIndexProfitAndLose }}</span>
              <span
                :class="$store.state.userInfo.allProfitAndLose > 0 ? ' red' : $store.state.userInfo.allProfitAndLose < 0 ? ' green' : ''"
                v-show="tabsItemIndex == 0">{{ '¥ ' + $store.state.userInfo.allProfitAndLose }}</span>
                v-show="tabsItemIndex == 0"
              >{{ '¥ ' + $store.state.userInfo.allProfitAndLose }}</span>
              <span
                :class="$store.state.userInfo.allProfitAndLose > 0 ? ' red' : $store.state.userInfo.allProfitAndLose < 0 ? ' green' : ''"
                v-show="tabsItemIndex == 2">{{ '¥ ' + $store.state.userInfo.allProfitAndLose }}</span>
                v-show="tabsItemIndex == 2"
              >{{ '¥ ' + $store.state.userInfo.allProfitAndLose }}</span>
              <span
                :class="$store.state.userInfo.allFuturesProfitAndLose > 0 ? 'red' : $store.state.userInfo.allFuturesProfitAndLose < 0 ? ' green' : ''"
                v-show="tabsItemIndex == 3">{{ '¥ '+Number($store.state.userInfo.allFuturesProfitAndLose).toFixed(2)}}</span>
                v-show="tabsItemIndex == 3"
              >{{ '¥ '+Number($store.state.userInfo.allFuturesProfitAndLose).toFixed(2)}}</span>
            </div>
          </div>
        </div>
@@ -335,6 +461,7 @@
</template>
<script>
import { Toast } from 'mint-ui'
import * as api from "@/axios/api";
import elalert from "@/components/elalert.vue";
export default {
@@ -352,7 +479,7 @@
      pageNums: 1,
      stockPlate: "",
      alertShow: false,
      isToken: '',
      isToken: "",
      elType: "warning",
      indexSettingInfo: {},
      futuresSettingInfo: {},
@@ -378,36 +505,38 @@
          name: "科创",
          type: 2
        },
        // {
        //   name: "期货",
        //   type: 3
        // }
        {
          name: "期货",
          type: 3
          name: "新股",
          type: 4
        }
      ],
      tabsItemIndex: 0,
      listArr: [],
      listArrs: [],
      listArrs: []
    };
  },
  created() {
    if(this.$route.query.type==1){
    if (this.$route.query.type == 1) {
      //选中sousuo输入框
      this.$nextTick(() => {
        this.$refs.search.focus();
      })
      });
    }
  },
  mounted() {
    this.loading=true;
    this.loading = true;
    this.getStock();
    this.isToken = window.localStorage.getItem('USERTOKEN')
    this.getUserInfo()
    this.getIndexSettingInfo()
    this.getSettingInfo()
    this.getFuturesSetting()
    this.isToken = window.localStorage.getItem("USERTOKEN");
    this.getUserInfo();
    this.getIndexSettingInfo();
    this.getSettingInfo();
    this.getFuturesSetting();
  },
  methods: {
    onLoad() {
@@ -449,28 +578,26 @@
      this.loading = true;
      this.finished = false;
      switch (this.tabsItemIndex) {
            case 1:
              this.getListMarket();
              break;
            case 0:
              this.stockPlate = "";
              this.getStock();
              break;
            case 2:
              this.stockPlate = "科创";
              this.getStocks();
              break;
            case 3:
              this.getFutures();
              break;
          }
        case 1:
          this.getListMarket();
          break;
        case 0:
          this.stockPlate = "";
          this.getStock();
          break;
        case 2:
          this.stockPlate = "科创";
          this.getStocks();
          break;
        case 3:
          this.getFutures();
          break;
      }
    },
    gpinputs() {
      this.pageNums= 1;
      this.pageNums = 1;
      this.listArrs = [];
      this.loadings = true;
      this.finisheds = false;
@@ -487,60 +614,57 @@
    async getUserInfo() {
      // 获取用户信息
      //   let showcookie = this.getCookie('USER_TOKEN');
      let data = await api.getUserInfo()
      let data = await api.getUserInfo();
      if (data.status === 0) {
        // this.getProductSetting()
        this.$store.state.userInfo = data.data
        this.$store.state.userInfo = data.data;
      } else {
        Toast(data.msg)
        Toast(data.msg);
      }
      this.$store.state.user = this.user
      this.$store.state.user = this.user;
    },
    async getIndexSettingInfo() {
      // 网站设置信息 指数
      let data = await api.getIndexSetting()
      let data = await api.getIndexSetting();
      if (data.status === 0) {
        // 成功
        this.indexSettingInfo = data.data
        this.indexSettingInfo = data.data;
      } else {
        Toast(data.msg)
        Toast(data.msg);
      }
    },
    async getFuturesSetting() {
      // 网站设置信息 期货
      let data = await api.getFuturesSetting()
      let data = await api.getFuturesSetting();
      if (data.status === 0) {
        // 成功
        this.futuresSettingInfo = data.data
        this.futuresSettingInfo = data.data;
      } else {
        Toast(data.msg)
        Toast(data.msg);
      }
    },
    async getSettingInfo() {
      let data = await api.getSetting()
      let data = await api.getSetting();
      if (data.status === 0) {
        // 成功
        this.settingInfo = data.data
        this.settingInfo = data.data;
      } else {
        Toast(data.msg)
        Toast(data.msg);
      }
    },
    async getListMarket() {
      let val = {
        pageNum: this.pageNum,
        pageSize: 15,
        pageSize: 15
      };
      // 获取指数列表
      let result = await api.getListMarket(val)
      let result = await api.getListMarket(val);
      this.loading = false;
      if (result.status === 0) {
        if (this.tabsItemIndex == 1) {
          this.listArr = result.data
          this.listArr = result.data;
          this.finished = true;
        }
      } else {
        this.texts = result.msg;
        this.alertShow = true;
@@ -552,19 +676,18 @@
        pageNum: this.pageNum,
        pageSize: 15,
        stockPlate: this.stockPlate,
        keyWords:this.gpcode,
      }
      let data = await api.getStock(opt)
        keyWords: this.gpcode
      };
      let data = await api.getStock(opt);
      this.loading = false;
      if (data.status === 0) {
        if (data.data.list.length < 15) {
          this.finished = true;
        }
        if (this.tabsItemIndex == 0) {
          data.data.list.forEach(element => {
            this.listArr.push(element)
          })
            this.listArr.push(element);
          });
        }
      } else {
        this.texts = data.msg;
@@ -577,33 +700,91 @@
        pageNum: this.pageNum,
        pageSize: 15,
        stockPlate: this.stockPlate,
        keyWords:this.gpcode,
      }
      let data = await api.getStock(opt)
        keyWords: this.gpcode
      };
      let data = await api.getStock(opt);
      this.loading = false;
      if (data.status === 0) {
        if (data.data.list.length < 15) {
          this.finished = true;
        }
        if (this.tabsItemIndex == 2) {
          data.data.list.forEach(element => {
            this.listArr.push(element)
          })
            this.listArr.push(element);
          });
        }
      } else {
        this.texts = data.msg;
        this.alertShow = true;
      }
    },
    handleGoToKlineDetail(item) {
      var codes ="";
      var names = "";
      var stock_type = "";
      var soks = "";
      var if_zhishu = '0';
      switch (this.tabsItemIndex) {
        case 0:
          codes = item.code;
          names = item.name;
          stock_type = item.stock_type;
          soks = this.filterSH(item.stock_type);
          if_zhishu = '0';
          break;
          case 1:
          codes = item.indexGid;
          names = item.indexName;
          stock_type = 'sh';
          if_zhishu = item.indexCode;
          soks = 0;
          break;
          case 2:
          codes = item.code;
          names = item.name;
          stock_type = item.stock_type;
          soks = this.filterSH(item.stock_type);
          if_zhishu = '0';
          break;
          case 3:
          codes = item.futuresGid;
          names = item.futuresName;
          soks = 0;
          stock_type = 'qh';
          if_zhishu = item.indexGid;
          break;
        default:
          break;
      }
      this.$router.push({
        path: "/kline",
        query: {
          name: names,
          stockplate: item.stock_plate,
          code: codes,
          type: stock_type,
          sok:  soks,
          if_zhishu: if_zhishu,
        }
      });
    },
    filterSH(val) {
      if (val === "sh") {
        return 1;
      } else if (val === "bj" || val === "sz") {
        return 0;
      }
    },
    async getFutures() {
      // 获取期货列表
      let opt = {
        homeShow: 1,
        pageNum: this.pageNum,
        pageSize: 15
      }
      let data = await api.getListFutures(opt)
      };
      let data = await api.getListFutures(opt);
      this.loading = false;
      if (data.data.length < 15) {
        this.finished = true;
@@ -611,8 +792,8 @@
      if (data.status === 0) {
        if (this.tabsItemIndex == 3) {
          data.data.forEach(element => {
            this.listArr.push(element)
          })
            this.listArr.push(element);
          });
        }
      } else {
        this.texts = data.msg;
@@ -625,14 +806,14 @@
      let opt = {
        pageNum: this.pageNums,
        pageSize: 15,
        keyWords:this.gpcodes,
      }
      let data = await api.getMyList(opt)
        keyWords: this.gpcodes
      };
      let data = await api.getMyList(opt);
      this.loadings = false;
      if (data.status == 0) {
        data.data.list.forEach(element => {
          this.listArrs.push(element)
        })
          this.listArrs.push(element);
        });
      }
      if (data.data.list.length < 15) {
        this.finisheds = true;
@@ -641,7 +822,7 @@
    handleTabsClick(item, index) {
      if (index == 0) {
        if (this.dialogFlag) {
          this.$refs['topTitle'].style.height = '1.2821rem'
          this.$refs["topTitle"].style.height = "1.2821rem";
          setTimeout(() => {
            this.dialogFlag = false;
@@ -650,7 +831,6 @@
            this.finisheds = false;
            this.tabsIndex = index;
            this.getMyList();
          }, 800);
        } else {
          this.listArrs = [];
@@ -658,7 +838,6 @@
          this.finisheds = false;
          this.tabsIndex = index;
          this.getMyList();
        }
      } else {
        this.tabsIndex = index;
@@ -675,12 +854,12 @@
          this.getListMarket();
          break;
        case 0:
          this.stockPlate = ""
          this.stockPlate = "";
          this.listArr = [];
          this.getStock();
          break;
        case 2:
          this.stockPlate = "科创"
          this.stockPlate = "科创";
          this.listArr = [];
          this.getStocks();
          break;
@@ -708,8 +887,8 @@
        default:
          break;
      }
      if (val.isOption == '1') {
        let data = await api.delOption({ code: codes })
      if (val.isOption == "1") {
        let data = await api.delOption({ code: codes });
        if (data.status === 0) {
          switch (this.tabsItemIndex) {
            case 1:
@@ -743,9 +922,9 @@
              this.getFutures();
              break;
          }
          this.refreshList()
          this.refreshList();
        } else {
          console.log(data.msg)
          console.log(data.msg);
        }
      } else {
        let data = await api.addOption({ code: codes });
@@ -758,14 +937,14 @@
              this.getListMarket();
              break;
            case 0:
              this.stockPlate = ""
              this.stockPlate = "";
              this.pageNum = 1;
              this.finished = false;
              this.listArr = [];
              this.getStock();
              break;
            case 2:
              this.stockPlate = "科创"
              this.stockPlate = "科创";
              this.pageNum = 1;
              this.finished = false;
              this.listArr = [];
@@ -779,43 +958,41 @@
              break;
          }
        } else {
          console.log(data.msg)
          console.log(data.msg);
        }
      }
    },
    async optionszx(val) {
        let data = await api.delOption({ code: val.stockGid })
        if (data.status === 0) {
          this.listArrs = [];
          this.pageNums = 1;
          this.finisheds = false;
          this.getMyList()
        } else {
          console.log(data.msg)
        }
      let data = await api.delOption({ code: val.stockGid });
      if (data.status === 0) {
        this.listArrs = [];
        this.pageNums = 1;
        this.finisheds = false;
        this.getMyList();
      } else {
        console.log(data.msg);
      }
    },
    async refreshList() {
      // 刷新指数
      if (this.loading) {
        return
        return;
      }
      let opt = {
        pageNum: 1,
        pageSize: this.currentNum
      }
      let data = await api.getListMarket(opt)
      this.list = data.data
      };
      let data = await api.getListMarket(opt);
      this.list = data.data;
    },
    handleCollectionClick(item) {
      item.collection = !item.collection;
    },
    openDialog() {
      if (!this.dialogFlag) {
        this.$refs['topTitle'].style.height = '6.9rem'
        this.$refs["topTitle"].style.height = "6.9rem";
      } else {
        this.$refs['topTitle'].style.height = '1.2821rem'
        this.$refs["topTitle"].style.height = "1.2821rem";
      }
      this.dialogFlag = !this.dialogFlag;
    }
@@ -850,7 +1027,7 @@
      //17:35:2922-06-2022
      return h + ":" + m + ":" + c;
    }
  },
  }
};
</script>
@@ -860,7 +1037,7 @@
  height: calc(100% - 1.3rem);
  background: #fff;
  >.content {
  > .content {
    width: 100%;
    height: 100%;
  }
@@ -941,7 +1118,7 @@
  overflow: hidden;
  border-radius: 0 0 0.2rem 0.2rem;
  >div {
  > div {
    width: 100%;
    height: 1.2821rem;
    display: flex;
@@ -985,7 +1162,7 @@
  display: -webkit-box;
  white-space: nowrap;
  >div {
  > div {
    display: inline-block;
    width: 15%;
    height: 100%;
@@ -1075,14 +1252,14 @@
    margin-top: -0.5rem;
    width: 100%;
    >div {
    > div {
      width: 100%;
      height: 1.0256rem;
      display: flex;
      margin: 0.5rem 0;
      >div {
        >div {
      > div {
        > div {
          display: flex;
          align-items: center;
        }
@@ -1119,12 +1296,12 @@
.list_title {
  width: 100%;
  height: 1rem;
  margin-top: .29rem;
  margin-top: 0.29rem;
  padding: 0 0.3rem;
  color: #a1a2a4;
  display: flex;
  >div {
  > div {
    display: flex;
    align-items: center;
  }
@@ -1203,7 +1380,6 @@
    height: 70%;
    display: flex;
    align-items: center;
    .left {
      width: 0.8rem;
@@ -1215,7 +1391,6 @@
      display: flex;
      align-items: center;
      justify-content: center;
      span {
        display: inline-block;
@@ -1305,7 +1480,7 @@
  width: 48%;
  height: 1.5385rem;
  background: #f6f6f7;
  border-radius: .2rem;
  border-radius: 0.2rem;
  margin-top: 0.2rem;
  .tops_title {
@@ -1313,7 +1488,7 @@
    height: 40%;
    display: flex;
    align-items: flex-end;
    padding-left: .5rem;
    padding-left: 0.5rem;
  }
  .bottom_price {
@@ -1321,13 +1496,12 @@
    height: 60%;
    display: flex;
    align-items: center;
    padding-left: .5rem;
    padding-left: 0.5rem;
    span {
      font-weight: 600;
    }
  }
}
.shublue {