1
jhzh
2024-10-24 e0eddb9df4bf0beca048072386fe89a106817a2c
1
7 files modified
320 ■■■■■ changed files
src/API/trade.api.js 37 ●●●●● patch | view | raw | blame | history
src/components/contract-header/index.vue 2 ●●● patch | view | raw | blame | history
src/components/trade-deep-data/index.vue 28 ●●●●● patch | view | raw | blame | history
src/components/trade-head/index.vue 6 ●●●●● patch | view | raw | blame | history
src/page/TtrendDetails/index.vue 29 ●●●●● patch | view | raw | blame | history
src/page/perpetualContract/index.vue 55 ●●●●● patch | view | raw | blame | history
src/page/trade/index.vue 163 ●●●● patch | view | raw | blame | history
src/API/trade.api.js
@@ -39,6 +39,7 @@
// 开仓初始化参数
export const _initOpen = (symbol) => {
    symbol = symbol.toLowerCase();
    if(symbol=='orbital'){
        symbol = 'mother'
    }
@@ -56,6 +57,15 @@
    }
    if(symbol=='fpp'){
        symbol = 'fil'
    }
    if(symbol=='ask'||symbol=='ASK'){
        symbol = 'gas'
    }
    if(symbol=='jkrt'){
        symbol = 'axs'
    }
    if(symbol=='egt'){
        symbol = 'ethw'
    }
  return request({
    url: "/api/contractApplyOrder!openview.action",
@@ -80,6 +90,33 @@
// 平仓初始化参数
export const _initClose = (symbol) => {
    if(symbol=='orbital'){
        symbol = 'mother'
    }
    if(symbol=='zyd'){
        symbol = 'zkp'
    }
    if(symbol=='dea'){
        symbol = 'dia'
    }
    if(symbol=='axfd'){
        symbol = 'xeta'
    }
    if(symbol=='smk'){
        symbol = 'og'
    }
    if(symbol=='fpp'){
        symbol = 'fil'
    }
    if(symbol=='ask'||symbol=='ASK'){
        symbol = 'gas'
    }
    if(symbol=='jkrt'){
        symbol = 'axs'
    }
    if(symbol=='egt'){
        symbol = 'ethw'
    }
  return request({
    url: "/api/contractApplyOrder!closeview.action",
    method: "GET",
src/components/contract-header/index.vue
@@ -14,7 +14,7 @@
              @click="onSidebar"
            /> -->
            <div class="flex pl-21 textColor" @click="onSidebar">
              <div class="font-35">{{ newname }}</div>
              <div class="font-35">{{ newname | symbol }}</div>
              <div class="ml-15">{{ title }}</div>
            </div>
            <div
src/components/trade-deep-data/index.vue
@@ -195,7 +195,33 @@
    startDeepSocket() {
      // 开启socket链接
      this.closeSocket();
    if(this.symbol=='orbital'){
        this.symbol = 'mother'
    }
    if(this.symbol=='zyd'){
        this.symbol = 'zkp'
    }
    if(this.symbol=='dea'){
        this.symbol = 'dia'
    }
    if(this.symbol=='axfd'){
        this.symbol = 'xeta'
    }
    if(this.symbol=='smk'){
        this.symbol = 'og'
    }
    if(this.symbol=='fpp'){
        this.symbol = 'fil'
    }
    if(this.symbol=='ask'){
        this.symbol = 'gas'
    }
    if(this.symbol=='jkrt'){
        this.symbol = 'axs'
    }
    if(this.symbol=='egt'){
        this.symbol = 'ethw'
    }
      this.socket = new WebSocket(`${WS_URL}/3/${this.symbol}`);
      this.socket.onopen = () => {
src/components/trade-head/index.vue
@@ -48,6 +48,12 @@
              <div class="font-35 textColor" v-else-if="symbol=='fil'">
                                FPP
              </div>
              <div class="font-35 textColor" v-else-if="symbol=='gas'">
                                ASK
              </div>
              <div class="font-35 textColor" v-else-if="symbol=='axs'">
                                JKRT
              </div>
              <div class="font-35 textColor" v-else-if="symbol=='ETHW'||symbol=='ethw'">
                                EGT
              </div>
src/page/TtrendDetails/index.vue
@@ -16,7 +16,7 @@
    <trade-head
      @openRecord="openRecord"
      :backFunc="() => $router.push('/')"
      :symbol="symbol=='mother'?'ORBITAL':(symbol=='zkp'?'ZYD':(symbol=='dia'?'DEA':(symbol=='xeta'?'AXFD':(symbol=='og'?'SMK':(symbol=='fil'?'FPP':symbol.toUpperCase())))))"
      :symbol="symbol=='mother'?'ORBITAL':(symbol=='zkp'?'ZYD':(symbol=='dia'?'DEA':(symbol=='xeta'?'AXFD':(symbol=='og'?'SMK':(symbol=='fil'?'FPP':(symbol=='gas'?'ASK':(symbol=='axs'?'JKRT':symbol.toUpperCase())))))))"
      :islevel="true"
      @update-coin="onUpdate"
      @data="quote = $event"
@@ -552,6 +552,33 @@
    },
    startAskBidSocket() {
      // 委托
      if(this.symbol=='orbital'){
          this.symbol = 'mother'
      }
      if(this.symbol=='zyd'){
          this.symbol = 'zkp'
      }
      if(this.symbol=='dea'){
          this.symbol = 'dia'
      }
      if(this.symbol=='axfd'){
          this.symbol = 'xeta'
      }
      if(this.symbol=='smk'){
          this.symbol = 'og'
      }
      if(this.symbol=='fpp'){
          this.symbol = 'fil'
      }
      if(this.symbol=='ask'){
          this.symbol = 'gas'
      }
      if(this.symbol=='jkrt'){
          this.symbol = 'axs'
      }
      if(this.symbol=='egt'){
          this.symbol = 'ethw'
      }
      this.sockets.askBid = new WebSocket(`${WS_URL}/3/${this.symbol}`);
      this.sockets.askBid.onmessage = (evt) => {
        const { data } = evt;
src/page/perpetualContract/index.vue
@@ -331,6 +331,33 @@
    },
    startQuoteSocket() {
      // 行情socket
      if(this.symbol=='orbital'){
          this.symbol = 'mother'
      }
      if(this.symbol=='zyd'){
          this.symbol = 'zkp'
      }
      if(this.symbol=='dea'){
          this.symbol = 'dia'
      }
      if(this.symbol=='axfd'){
          this.symbol = 'xeta'
      }
      if(this.symbol=='smk'){
          this.symbol = 'og'
      }
      if(this.symbol=='fpp'){
          this.symbol = 'fil'
      }
      if(this.symbol=='ask'||this.symbol=='ASK'){
          this.symbol = 'gas'
      }
      if(this.symbol=='jkrt'){
          this.symbol = 'axs'
      }
      if(this.symbol=='egt'){
          this.symbol = 'ethw'
      }
      this.sockets.quotes = new WebSocket(`${WS_URL}/1/${this.symbol}`);
      // socket.onopen =  () => {
      //     console.log('open')
@@ -347,7 +374,33 @@
    startDeepSocket() {
      // 开启socket链接
      this.closeSocket();
        if(this.symbol=='orbital'){
            this.symbol = 'mother'
        }
        if(this.symbol=='zyd'){
            this.symbol = 'zkp'
        }
        if(this.symbol=='dea'){
            this.symbol = 'dia'
        }
        if(this.symbol=='axfd'){
            this.symbol = 'xeta'
        }
        if(this.symbol=='smk'){
            this.symbol = 'og'
        }
        if(this.symbol=='fpp'){
            this.symbol = 'fil'
        }
        if(this.symbol=='ask'||this.symbol=='ASK'){
            this.symbol = 'gas'
        }
        if(this.symbol=='jkrt'){
            this.symbol = 'axs'
        }
        if(this.symbol=='egt'){
            this.symbol = 'ethw'
        }
      this.socket = new WebSocket(`${WS_URL}/3/${this.symbol}`);
      this.socket.onopen = () => {
src/page/trade/index.vue
@@ -5,7 +5,7 @@
                v-for="(item,index) in typelist" :key="index">{{item}}</div>
        </div>
        <div v-if="typeindex==0">
            <trade-head :backFunc="() => $router.push('/')" :symbol="symbol" :newname="newname" :price="price" :range="range"
            <trade-head :backFunc="() => $router.push('/')" :symbol="symbol"  :price="price" :range="range"
                :isTrade="true" @update-coin="onUpdate" @data="quote = $event" />
            <div class="trade-buy-sell flex justify-between px-30 py-30">
@@ -13,7 +13,7 @@
                    <trade-deep-data :selectValue="selectValue" @getList="getList"  :showType="showType" :symbol="symbol"
                        v-if="symbol" :price="price" class="w-290 mr-30" />
                </keep-alive>
                <trade-order-area :symbol="symbol" :init-open="initOpena" :newname="newname" :init-close="initClose" :price="price"
                <trade-order-area :symbol="symbol" :init-open="initOpena" :newname="newname | symbol" :init-close="initClose" :price="price"
                    @ordered="onOrdereda" />
            </div>
@@ -194,6 +194,16 @@
    } from "@/utils/utis";
    export default {
        filters: {
                symbol(value) {
                    // 过滤器逻辑
                    return value; // 示例
                },
                newname(value) {
                    // 过滤器逻辑
                    return value; // 示例
                },
        },
        name: "TradePage",
        components: {
            ContractHeader,
@@ -379,12 +389,47 @@
            ...mapActions("user", ["GET_UERS_KYC"]),
            typeclick(e) {
                this.typeindex = e
                if(e==0){
                    this.initParama(this.symbol)
                }else{
                    // this.symbol = 'wld'
                    this.initParam(this.symbol)
                }
                console.log(e);
                // var storedSymbol = localStorage.getItem("symbol");
                // console.log("storedSymbol",storedSymbol);
                // this.symbol = storedSymbol
                // this.symbol = this.$route.params.symbol.toLowerCase()
                // this.newname = this.symbol
                this.symbol = this.$route.params.symbol.toLowerCase()
                // if(e==0){
                //         this.symbol=this.symbol.toLowerCase()
                //         console.log(this.symbol);
                //         if(this.symbol=='orbital'){
                //             this.symbol = 'mother'
                //         }else if(this.symbol=='zyd'){
                //             this.symbol = 'zkp'
                //         }else if(this.symbol=='dea'){
                //             this.symbol = 'dia'
                //         }else if(this.symbol=='axfd'){
                //             this.symbol = 'xeta'
                //         }else if(this.symbol=='smk'){
                //             this.symbol = 'og'
                //         }else if(this.symbol=='fpp'){
                //             this.symbol = 'fil'
                //         }else if(this.symbol=='ask'){
                //             this.symbol = 'gas'
                //             console.log(this.symbol);
                //         }else if(this.symbol=='jkrt'){
                //             this.symbol = 'axs'
                //         }else if(this.symbol=='egt'){
                //             this.symbol = 'ethw'
                //         }else{
                //         }
                //             // this.initParam(this.symbol)
                //     }else{
                //         // this.symbol = this.$route.params.symbol.toLowerCase()
                //     }
                    // this.symbol = this.$route.params.symbol.toLowerCase()
                    // this.symbol = this.$route.params.symbol.toLowerCase()
                //     this.newname = this.symbol
                // }else{
                //     // this.symbol = 'wld'
                //     // this.initParam(this.symbol)
                this.$forceUpdate()
            },
            onUpdate(symbol,name) {
@@ -638,13 +683,40 @@
              }
            },
            startDeepSocket() {
                if(this.symbol=='orbital'){
                    this.symbol = 'mother'
                }
                if(this.symbol=='zyd'){
                    this.symbol = 'zkp'
                }
                if(this.symbol=='dea'){
                    this.symbol = 'dia'
                }
                if(this.symbol=='axfd'){
                    this.symbol = 'xeta'
                }
                if(this.symbol=='smk'){
                    this.symbol = 'og'
                }
                if(this.symbol=='fpp'){
                    this.symbol = 'fil'
                }
                if(this.symbol=='ask'){
                    this.symbol = 'gas'
                }
                if(this.symbol=='jkrt'){
                    this.symbol = 'axs'
                }
                if(this.symbol=='egt'){
                    this.symbol = 'ethw'
                }
                console.log('这里',this.symbol);
              // 开启socket链接
              if(this.typeindex==0){
                  this.closeSocketa();
              }else{
                  this.closeSocket();
              }
              // if(this.typeindex==0){
              //     this.closeSocketa();
              // }else{
              //     this.closeSocket();
              // }
              this.socket = new WebSocket(`${WS_URL}/3/${this.symbol}`);
            
              this.socket.onopen = () => {
@@ -674,6 +746,33 @@
                console.log("symbol", this.symbol);
                if (!this.symbol) {
                    return;
                }
                if(this.symbol=='orbital'){
                    this.symbol = 'mother'
                }
                if(this.symbol=='zyd'){
                    this.symbol = 'zkp'
                }
                if(this.symbol=='dea'){
                    this.symbol = 'dia'
                }
                if(this.symbol=='axfd'){
                    this.symbol = 'xeta'
                }
                if(this.symbol=='smk'){
                    this.symbol = 'og'
                }
                if(this.symbol=='fpp'){
                    this.symbol = 'fil'
                }
                if(this.symbol=='ask'||this.symbol=='ASK'){
                    this.symbol = 'gas'
                }
                if(this.symbol=='jkrt'){
                    this.symbol = 'axs'
                }
                if(this.symbol=='egt'){
                    this.symbol = 'ethw'
                }
                this.socket = new WebSocket(`${WS_URL}/1/${this.symbol}`);
                this.socket.onmessage = (evt) => {
@@ -758,6 +857,7 @@
            },
            init(symbol) {
              // 初始化页面
              debugger
              this.symbol = symbol.toLowerCase();
              this.fetchQoutes(symbol);
              this.fetchDeepData(symbol);
@@ -891,6 +991,33 @@
        },
        startQuoteSocket() {
          // 行情socket
          if(this.symbol=='orbital'){
              this.symbol = 'mother'
          }
          if(this.symbol=='zyd'){
              this.symbol = 'zkp'
          }
          if(this.symbol=='dea'){
              this.symbol = 'dia'
          }
          if(this.symbol=='axfd'){
              this.symbol = 'xeta'
          }
          if(this.symbol=='smk'){
              this.symbol = 'og'
          }
          if(this.symbol=='fpp'){
              this.symbol = 'fil'
          }
          if(this.symbol=='ask'||this.symbol=='ASK'){
              this.symbol = 'gas'
          }
          if(this.symbol=='jkrt'){
              this.symbol = 'axs'
          }
          if(this.symbol=='egt'){
              this.symbol = 'ethw'
          }
          this.sockets.quotes = new WebSocket(`${WS_URL}/1/${this.symbol}`);
          // socket.onopen =  () => {
          //     console.log('open')
@@ -912,10 +1039,10 @@
                    symbol
                },
            } = to;
            let catchTradeSymbol = getStorage("tradeSymbol");
            if (catchTradeSymbol) {
                symbol = catchTradeSymbol;
            }
            // let catchTradeSymbol = getStorage("tradeSymbol");
            // if (catchTradeSymbol) {
            //     symbol = catchTradeSymbol;
            // }
            if (symbol) {
                // debugger
                // if(that.typeindex==0){