10.10综合交易所原始源码_移动端
admin
2026-01-06 04d8c6bfd48267c7b2eaccaa03170618d83e4cbd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
<template>
  <div class="foreign-container-box">
    <section class="banner-container">
      <van-swipe class="swipe-box" :autoplay="5000" indicator-color="white">
        <van-swipe-item>
          <img src="@/assets/image/foreign/banner1.png" alt="">
        </van-swipe-item>
        <van-swipe-item>
          <img src="@/assets/image/foreign/banner2.png" alt="">
        </van-swipe-item>
        <van-swipe-item>
          <img src="@/assets/image/foreign/banner3.jpg" alt="">
        </van-swipe-item>
        <van-swipe-item>
          <img src="@/assets/image/foreign/banner4.jpg" alt="">
        </van-swipe-item>
      </van-swipe>
    </section>
    <div class="pt-5 px-6">
      <van-notice-bar class="text-26 textColor" left-icon="" :scrollable="false" background="transparent">
        <div slot="left-icon" class=" flex items-center more-img"><img class="w-10 h-10  more-img"
            src="../../assets/Horn.png" alt="">
        </div>
        <van-swipe vertical class="notice-swipe" :autoplay="2000" :show-indicators="false">
          <van-swipe-item v-for="item in announceList" :key="item.id" @click="toAnnounceDetail(item.uuid)">{{ item.title
          }}
          </van-swipe-item>
        </van-swipe>
        <div class="ml-20 flex items-center " slot="right-icon" @click.stop="$router.push('/cryptos/announce')"><img
            class="w-10 h-10 more-img" src="../../assets/more.png" alt="">
        </div>
      </van-notice-bar>
    </div>
    <section class="nav">
      <foreign-ex-nav :defaultEtfListData="defaultListData" />
    </section>
    <div class="divider"></div>
    <section class="hots-container">
      <div class="header">
        <div class="title">{{ t('Hots') }}</div>
        <div class="icon-group" @click="onRoute('/foreign/quotation')">
          <span>{{ t('更多') }}</span>
          <div class="icon arrow">
            <img src="@/assets/image/quotes/right-arrow.png" alt="">
          </div>
        </div>
      </div>
      <div class="hots-symbol flex">
        <div class="hots-symbol-item" v-for="(item, index) in hotListDataNameArr" :key="item.symbol"
          @click="itemClick(item)">
          <p class="name">
            <span name-l>{{ item.symbol }}</span>
            <span class="name-r">{{ item.close }}</span>
          </p>
          <div class="trend" v-if="item.symbol">
            <m-echarts :dataObj="item" :ratio="Number(item.changeRatio)" :index="item.symbol" />
          </div>
          <div class="direction flex">
            <div class="sell">
              <span class="mr-1" v-if="item.netChange > 0" :class="item.netChange > 0 ? 'text-up' : 'text-down'">+{{
                item.netChange }}</span>
              <span class="mr-1" v-else :class="item.netChange > 0 ? 'text-up' : 'text-down'">{{ item.netChange
              }}</span>&nbsp;
            </div>
            <div class="buy">
              <span :class="item.changeRatio > 0 ? 'text-up' : 'text-down'">{{ `${item.changeRatio}%` }}</span>
 
            </div>
          </div>
        </div>
      </div>
    </section>
    <section class="market-container">
      <div class="header">
        <div class="title">{{ t('Market') }}</div>
        <!-- <div class="icon-group" @click="onRoute('/foreign/quotation')">
          <div class="icon arrow">
            <img src="@/assets/image/quotes/right-arrow.png" alt="">
          </div>
        </div> -->
      </div>
      <div class="tabs flex">
        <div class="tab-item flex-1" v-for="(item, index) in tabList" @click="selectIndex(index, item.value)"
          :class="[tabIndex === index ? 'active' : '']" :key="index">
          {{ item.title }}
        </div>
      </div>
      <div class="symbol-table">
        <ul>
          <li v-for="(item) in defaultListData" :key="item.symbol" @click="itemClick(item)">
            <div class="flex-l">
              <p>
                <span class="mr-1" :class="item.changeRatio > 0 ? 'text-up' : 'text-down'" v-if="item.netChange > 0">+{{
                  item.netChange }}</span>
                <span class="mr-1" :class="item.changeRatio > 0 ? 'text-up' : 'text-down'" v-else>{{ item.netChange
                }}</span>&nbsp;
                <span :class="item.changeRatio > 0 ? 'text-up' : 'text-down'">{{ `${item.changeRatio}%` }}</span>
              </p>
              <p>{{ item.symbol.toUpperCase() }}</p>
              <p class="gray-text">{{ item.current_time ? item.current_time.slice(11) : '-' }}</p>
            </div>
            <div class="flex-r">
              <div class="flex justify-end h-full flex-wrap">
                <div class="flex-r-item">
                  <p class="flex text-primary justify-end" :class="item.open < 1 ? 'text-up' : 'text-down'">
                    <span class="font-semibold text-lg">{{
                      item.open.toString() 
                    }}</span>
                    <span class="text-xs">{{ item.open.toString().substr(item.open.toString().length - 1) }}</span>
                  </p>
                  <div class="text-gray">
                    <span class="mr-1.5">H: {{ item.high }}</span>
                  </div>
                </div>
                <div class="last flex-r-item">
                  <p class="flex text-primary justify-end" :class="item.close < 1 ? 'text-up' : 'text-down'">
                    <span class="font-semibold text-lg">{{
                      item.close.toString().substr(0, item.close.toString().length
                        - 1)
                    }}</span>
                    <span class="text-xs">{{ item.close.toString().substr(item.close.toString().length - 1) }}</span>
                  </p>
                  <div class="text-gray">
                    <span>L: {{ item.low }}</span>
                  </div>
                </div>
              </div>
            </div>
          </li>
        </ul>
      </div>
    </section>
 
  </div>
</template>
 
<script setup>
import { ref, onMounted, watch } from "vue";
import { useRouter } from 'vue-router';
import { useI18n } from "vue-i18n";
import MEcharts from "@/components/ex-echarts/index.vue";
import ForeignExNav from "@/components/trade/foreign-ex-nav/index.vue"
import { _getNewsList1, _getPopupNews } from '@/service/user.api'
import { _getRealtimeByType, _publicRealtimeTop } from '@/service/quotes.api'
defineOptions({
  name: 'homeIndex'
});
const props = defineProps({
  index: {
    type: Number,
    default: 0
  },
  tabActive: {
    type: Number,
    default: 0
  }
})
 
const { t } = useI18n()
 
const tabIndex = ref(1)
const defaultListData = ref([])
const symbolType = ref('commodities') //默认查询外汇
const tabList = ref([
  { title: t('外汇'), value: "forex" },
  { title: t('大宗商品'), value: "commodities" },
  { title: t('指数'), value: "indices" },
  { title: t('加密货币'), value: "cryptos" },
])
const hotListDataNameArr = ref([])
const router = useRouter()
 
const announceList = ref([])
 
onMounted(async () => {
  letMeGo()
  getRealtimeByType()
  getNews()
})
 
const emit = defineEmits(['changeLetMego'])
const letMeGo = () => {
  emit('changeLetMego', () => {
    getRealtimeByType()
    publicRealtimeTop()
  })
}
 
 
const getNews = () => {
  _getNewsList1({
    // language: this.$i18n.locale,
  }).then(res => {
    announceList.value = res
  })
}
 
const toAnnounceDetail = (announceId) => {
  if (announceId) {
    router.push({ path: '/cryptos/AnnounceDetail', query: { id: announceId } })
  }
}
 
const selectIndex = (index, value) => {
  tabIndex.value = index
  symbolType.value = value
  getRealtimeByType()
}
 
 
const publicRealtimeTop = () => {
  _publicRealtimeTop({
    type: 'forex',
  }).then(data => {
    hotListDataNameArr.value = data.slice(0, 3) || []
  }).catch((e) => {
  })
}
 
const getRealtimeByType = () => {
  let type = symbolType.value == 'cryptos' ? 'cryptos' : 'forex';
  _getRealtimeByType({
    type: type,
    pageNo: 1,
    category: symbolType.value
  }).then(data => {
    localStorage.setItem('quotesList', JSON.stringify(data))
    defaultListData.value = data
  })
}
 
const onRoute = (path) => {
  router.push(path)
}
 
const itemClick = (item) => {
  router.push({ path: '/foreign/coinChart', query: { symbol: item.symbol } })
}
 
watch(() => props.tabActive, (val) => {
  if (props.index === val) {
    letMeGo()
  }
})
</script>
 
<style lang="scss" scoped>
.foreign-container-box {
  padding-bottom: 50px;
 
  .font-semibold {
    font-size: 14px;
  }
 
  .header {
    display: flex;
 
    .title {
      flex: 1;
      font-weight: 700;
      font-size: 20px;
      line-height: 28px;
      color: $text_color;
    }
 
    .icon-group {
      display: flex;
      text-align: right;
      align-items: center;
 
      span {
        font-size: 14px;
      }
 
      .icon {
        display: inline-block;
        width: 28px;
        height: 28px;
        padding: 4px;
        margin-left: 2px;
      }
    }
  }
 
  .banner-container {
    margin-top: 20px;
    height: 160px;
    padding: 0 12px;
 
    .swipe-box {
      border-radius: 8px;
    }
 
    .van-swipe-item {
      color: $text_color;
      font-size: 20px;
      line-height: 160px;
      text-align: center;
      background-color: $selectSymbol_background;
 
      img {
        display: block;
        height: 160px;
        width: 100%;
        object-fit: cover;
      }
    }
  }
 
  .hots-container {
    margin-top: 20px;
    padding: 0 12px;
 
    .header {
      .title {
        font-size: 20px;
        font-weight: 700;
      }
 
      .icon.arrow {
        width: 14px;
        height: 28px;
 
        img {
          margin-top: 6px;
          filter: $filter;
        }
      }
    }
 
    .hots-symbol {
      gap: 0 3.3%;
    }
 
    .hots-symbol-item {
      font-size: 12px;
      font-weight: 600;
      margin: 6px 0;
      padding: 4px;
      background: $hot-item-bg;
      border-radius: 4px;
      flex-shrink: 0;
      width: 31%;
 
      .name {
        padding: 0 4px;
        display: flex;
        justify-content: center;
      }
 
      .trend {
        height: 65px;
      }
 
      .direction {
        // padding: 0 10px;
        justify-content: space-evenly;
 
        span {
          font-size: 12px;
          line-height: 16px;
        }
 
        .buy {
          text-align: right;
        }
 
        .sell {
          text-align: left;
        }
      }
    }
 
    .hots-symbol-item:nth-child(2) {
      // margin: 6px 8px;
    }
 
  }
 
  .market-container {
    margin-top: 20px;
    padding: 0 12px;
 
    .title {
      font-size: 20px;
      font-weight: 700;
    }
 
    .icon.arrow {
      width: 14px;
      height: 28px;
 
      img {
        margin-top: 6px;
      }
    }
 
    .tabs {
      // padding: 0 12px;
      margin-top: 10px;
      // height: 40px;
      min-height: 40px;
      line-height: 24px;
      color: #BBBCBD;
 
      .tab-item {
        margin: 4px;
        text-align: center;
        padding: 4px 4px;
        font-size: 12px;
        color: $text_color5;
        background: $US_tab_background;
        border-radius: 10px;
        background-size: cover;
      }
 
      .active {
        font-weight: 400;
        color: $color_main !important;
        background: $US_tabActice_background;
        border-radius: 10px;
        background-size: cover;
      }
    }
 
    .symbol-table {
      li {
        margin-top: 20px;
        display: flex;
        font-weight: 600;
        font-size: 14px;
        line-height: 18px;
 
        .gray-text {
          color: #BCBDC2;
          font-size: 12px;
        }
 
        .flex-l {
          width: 130px;
        }
 
        .flex-r {
          flex: 1;
 
          .flex-r-item {
            flex: 1;
            align-self: center;
            text-align: right;
 
            .last-item {
              padding: 0 6px;
 
              p {
                text-align: right;
                width: 70px;
                height: 24px;
                line-height: 24px;
                border-radius: 4px;
                color: $text_color;
                font-weight: 600;
                font-size: 14px;
              }
            }
          }
 
          .last {}
        }
      }
    }
  }
}
 
 
 
:deep(.van-notice-bar__content) {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
 
.van-notice-bar {
  padding: 0;
  height: 30px;
}
 
.notice-swipe {
  flex: 1;
  margin-left: 10px;
  height: 30px;
  line-height: 30px;
}
</style>