| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792 |
- <template>
- <v-page>
- <view class="d-flex flex-col">
- <!-- 头部 -->
- <v-header
- class="nav_bar"
- :left-text="$t('base.a1')"
- :left-arrow="false"
- :left-click="personalCenter"
- >
- <template #left>
- <van-icon name="user-circle-o" class="fn-25" />
- </template>
- <template #title>
- <view class="d-flex align-center justify-center">
- <img class="m-x-xs h-20" :src="logoMap.home_logo" />
- <p>{{ app.appName }}</p>
- </view>
- </template>
- <template #right>
- <v-link to="/pages/list/list?isSearch=1" class="d-flex align-center">
- <van-icon class="fn-20" name="search" />
- </v-link>
- </template>
- </v-header>
- <view class="layout-main">
- <!-- 轮播 -->
- <swiper
- class="my-swipe m-x-md rounded-sm overflow-hidden"
- :autoplay="true"
- indicator-color="white"
- >
- <swiper-item
- class="my_swipe_item"
- v-for="(item, idx) in home"
- :key="idx"
- >
- <img width="100%" height="100%" fit="cover" :src="item.imgurl" />
- </swiper-item>
- </swiper>
- <!-- 公告 -->
- <v-notice-bar
- v-if="notice.length"
- class="m-t-md m-x-md bg-panel-1 box-shadow rounded-xs"
- >
- <template #left-icon>
- <van-icon
- class="m-r-sm fn-16"
- @click="() => _router.push({ path: '/pages/notice/index' })"
- name="volume-o"
- />
- </template>
- <v-link
- class="fn-13 eps-1"
- :to="{ path: '/pages/notice/detail', query: { id: notice[0].id } }"
- >{{ notice[0].title }}</v-link
- >
- <template #right-icon>
- <view
- class="m-l-xs notice-more"
- @click="_router.push({ path: '/pages/notice/index' })"
- >{{ $t("common.more") }}</view
- >
- </template>
- </v-notice-bar>
- <!-- 次一级导航 -->
- <view class="nav2 p-x-md m-t-xl d-flex justify-around fn-center">
- <v-link tag="div" to="/pages/invite/index" class="item">
- <view class="icon fn-22">
- <img class="h-54" src="static/img/4.png" />
- </view>
- <view class="fn-12">{{ $t("base.b7") }}</view>
- </v-link>
- <view
- tag="div"
- class="item"
- @click="handleSwiper('/pages/base/option-list')"
- >
- <view class="icon fn-22">
- <img class="h-54" src="static/img/homeqiquanicon.png" />
- </view>
- <view class="fn-12">{{ $t("base.a4") }}</view>
- </view>
- <!-- <v-link
- tag="div"
- class="item"
- :to="{
- path: '/pages/base/exchange-operation',
- query: {
- tel: 'exchange-operation',
- },
- }"
- >
- <view class="icon fn-22">
- <img class="h-54" src="static/img/8.png" />
- </view>
- <view class="fn-12">{{ $t("exchange.a1") }}</view>
- </v-link> -->
- <v-link
- tag="div"
- class="item"
- @click.prevent.stop.native="
- handleSwiper('/pages/base/exchange-operation')
- "
- >
- <view class="icon fn-22">
- <img class="h-54" src="static/img/8.png" />
- </view>
- <view class="fn-12">{{ $t("exchange.a1") }}</view>
- </v-link>
- <!-- <view @click="personalCenter" class="item">
- <view class="icon fn-22">
- <img class="h-54" src="static/img/homehuiyuan.png" />
- </view>
- <view class="fn-12">{{ $t("base.a6") }}</view>
- </view> -->
- <!-- h5端跳转下载链接 -->
- <!-- <v-link tag="div" to="/pages/help/index" class="item">
- <view class="icon fn-22">
- <img class="h-54" src="static/img/homexueyuan.png" />
- </view>
- <view class="fn-12">{{ $t("base.a7") }}</view>
- </v-link> -->
- <v-link
- tag="div"
- :to="{
- path: '/pages/pledge/index',
- query: {
- tel: 'exchange-operation',
- },
- }"
- class="item"
- >
- <view class="icon fn-22">
- <img class="h-54" src="static/img/homexueyuan1.png" />
- </view>
- <view class="fn-12">{{ $t("pledge.funcname") }}</view>
- </v-link>
- </view>
- <!-- 指数 -->
- <view class="stock-swipe d-flex p-x-md m-t-xl" v-if="false">
- <view
- class="swipe_right flex-fill box-shadow"
- v-for="(item, idx) in indexList"
- :key="idx"
- @click="
- _router.push({
- path: '/pages/exchange/index',
- query: {
- code: item.pair_name,
- },
- })
- "
- >
- <view
- class="stock-index item flex-fill p-x-xs p-y-xs rounded-xs box-size bg-panel-3"
- :key="idx"
- :class="{ 'm-l-md': idx }"
- >
- <view class="stock-index-img fn-12 color-gray-6 m-b-md">
- <view>{{ item.pair_name }}</view>
- </view>
- <view class="fn-18 color-light">{{ item.close }}</view>
- <view
- class="d-flex flex-col align-center fn-sm"
- :class="item.increase * 1 < 0 ? 'color-sell' : 'color-buy'"
- >
- <view class="stock-item-3">{{ item.increaseStr }}</view>
- <view class="color-theme-6"
- >≈ {{ getOldPrice(item.close, item.increase) }}</view
- >
- </view>
- </view>
- </view>
- </view>
- <!-- 科创板 -->
- <view class="head_info m-y-xl">
- <van-tabs
- v-if="marketList.length"
- :active="infoActive"
- background="transparent"
- :border="false"
- animated
- class="tabs-border border-b"
- >
- <van-tab
- v-for="parentItem in marketList"
- :key="parentItem.coin_name"
- :title="parentItem.coin_name"
- class="a"
- >
- <view class="w-12/12 p-t-md">
- <view class="fn-center w-max">
- <v-link
- :to="{
- path: '/pages/exchange/index',
- query: { code: item.pair_name },
- }"
- class="m-b-md m-x-md rounded-sm bg-panel-7 box-shadow link-active d-flex align-center p-r-md p-y-md box-size"
- v-for="item in parentItem.collect
- ? collect
- : parentItem.marketInfoList"
- :key="item.pair_name"
- >
- <view
- class="fn-18 w-2/12 d-flex align-center justify-center"
- >
- <img
- class="d-block h-30 w-30"
- :src="item.coin_icon"
- alt=""
- />
- <!-- <van-icon
- v-show="isCoolect(item)"
- class="color-theme-1"
- name="star"
- />
- <van-icon v-show="!isCoolect(item)" name="star-o" /> -->
- </view>
- <view class="color-light fn-left w-4/12">
- <view class="d-flex align-end">{{ item.pair_name }}</view>
- </view>
- <view class="fn-left align-end color-light w-3/12">
- <view class="d-flex align-end">{{ item.close }}</view>
- </view>
- <view class="fn-right w-3/12">
- <span
- :class="
- item.increase * 1 < 0 ? 'color-sell' : 'color-buy'
- "
- >{{ item.increaseStr }}</span
- >
- </view>
- </v-link>
- </view>
- </view>
- </van-tab>
- </van-tabs>
- </view>
- </view>
- <!-- 个人主页弹出层 -->
- <van-popup
- class="personalCenter-main colbg"
- :show="show"
- @close="show = false"
- position="left"
- custom-style="width:75%;height:100%"
- >
- <view class="personalCenter-top">
- <view class="app-nav"></view>
- <view class="theme-switch m-r-md">
- <label
- class="v-switch border rounded-xs d-flex"
- @click="changtTheme"
- >
- <view
- class="icon border"
- :class="
- theme == 'light'
- ? 'bg-gradient-green active'
- : 'bg-gradient-green'
- "
- >
- <view class="left color-light">{{ $t("common.light") }}</view>
- <view class="right color-light">{{ $t("common.dark") }}</view>
- </view>
- </label>
- </view>
- <view class="information p-l-md" @click="toAccountSettings">
- <img
- :src="logoMap.login_logo"
- class="h-50 w-50 d-block m-r-xs rounded-max flex-shrink"
- />
- <view class="inf-rig flex-fill">
- <span class="fn-lg color-light" v-if="isLogin">{{
- user.account
- }}</span>
- <span class="fn-lg color-light" v-else @click.stop>
- Hello,
- <v-link to="/pages/login/index" class="color-theme-1">{{
- $t("base.b3")
- }}</v-link>
- </span>
- <span class="inf-rig-cent fn-sm color-default"
- >UID:{{ isLogin ? user.user_id : "-" }}</span
- >
- </view>
- <v-link
- v-if="false"
- to="/pages/invite/level"
- style="padding: 3px 4px 6px"
- class="bg-panel-4 border border-r-0 rounded-tl-lg rounded-bl-lg border-buy"
- @click.native.stop
- >
- <span class="fn-xs color-buy">{{ $t("base.e6") }}</span>
- </v-link>
- </view>
- </view>
- <view class="personalCenter-center border-b border-gray-5">
- <view class="d-flex justify-around">
- <v-link
- to="/pages/assets/recharge"
- tag="div"
- class="d-flex flex-col align-center"
- >
- <img src="static/img/13.png" alt="" class="h-44" />
- <span class="fn-md color-light p-y-xs">{{ $t("base.b5") }}</span>
- </v-link>
- <v-link
- to="/pages/assets/draw"
- tag="div"
- class="d-flex flex-col align-center"
- >
- <img src="static/img/8.png" alt="" class="h-44" />
- <span class="fn-md color-light p-y-xs">{{ $t("base.b6") }}</span>
- </v-link>
- <v-link
- to="/pages/invite/index"
- tag="div"
- class="d-flex flex-col align-center"
- >
- <img src="static/img/4.png" alt="" class="h-44" />
- <span class="fn-md color-light p-y-xs">{{ $t("base.b7") }}</span>
- </v-link>
- </view>
- </view>
- <view class="personalCenter-bottom">
- <!-- <v-link
- to="/pages/otc/direct-recharge"
- tag="div"
- class="per-bot p-y-sm p-l-sm border-b d-flex align-center"
- >
- <img :src="$localImgUrl('Page9.png')" alt="" class="h-20 m-r-xs">
- <span class="color-light">{{ $t("common.direct-recharge-a1") }}</span>
- </v-link> -->
- <v-link
- to="/pages/commission/index"
- tag="div"
- class="per-bot p-y-sm p-l-sm border-b d-flex align-center"
- >
- <img :src="$localImgUrl('Page1.png')" alt="" class="m-r-xs h-20" />
- <span class="color-light">{{ $t("base.c1") }}</span>
- </v-link>
- <v-link
- to="/pages/otc/pays"
- tag="div"
- class="per-bot p-y-sm p-l-sm border-b d-flex align-center"
- >
- <img :src="$localImgUrl('Page9.png')" alt="" class="h-20 m-r-xs">
- <span class="color-light">{{$t('otc.j6')}}</span>
- </v-link>
- <v-link
- to="/pages/auth/index"
- tag="div"
- class="per-bot p-y-md p-l-sm border-b d-flex align-center"
- >
- <img :src="$localImgUrl('Page2.png')" alt="" class="h-20 m-r-xs" />
- <span class="color-light">{{ $t("base.c2") }}</span>
- </v-link>
- <v-link
- to="/pages/safe/index"
- tag="div"
- class="per-bot p-y-md p-l-sm border-b d-flex align-center"
- >
- <img :src="$localImgUrl('Page3.png')" alt="" class="h-20 m-r-xs" />
- <span class="color-light">{{ $t("base.c3") }}</span>
- </v-link>
- <v-link
- to="/pages/notice/index"
- tag="div"
- class="per-bot p-y-md p-l-sm border-b d-flex align-center"
- >
- <img :src="$localImgUrl('Page4.png')" alt="" class="h-20 m-r-xs" />
- <span class="color-light">{{ $t("base.c4") }}</span>
- </v-link>
- <v-link
- to="/pages/assets/address-list"
- tag="div"
- class="per-bot p-y-md p-l-sm border-b d-flex align-center"
- >
- <img :src="$localImgUrl('Page5.png')" alt="" class="h-20 m-r-xs" />
- <span class="color-light">{{ $t("base.c5") }}</span>
- </v-link>
- <v-link
- to="/pages/accountSettings/accountSettings"
- tag="div"
- class="per-bot p-y-md p-l-sm border-b d-flex align-center"
- >
- <img :src="$localImgUrl('Page7.png')" alt="" class="h-20 m-r-xs" />
- <span class="color-light">{{ $t("base.c6") }}</span>
- </v-link>
- <!-- <v-link
- to="/pages/pledge/index"
- tag="div"
- class="per-bot p-y-md p-l-sm border-b d-flex align-center"
- >
- <img :src="$localImgUrl('Page7.png')" alt="" class="h-20 m-r-xs" />
- <span class="color-light">{{ $t("pledge.funcname") }}</span>
- </v-link> -->
- <view class="per-bot p-y-md p-l-sm border-b d-flex align-center">
- <img :src="$localImgUrl('Page6.png')" alt="" class="h-20 m-r-xs" />
- <span class="color-light">
- <v-lang
- @change="
- marketList = [];
- indexData();
- "
- ></v-lang>
- <i class="iconfont m-l-xs fn-sm"></i>
- </span>
- </view>
- <view class="h-100"></view>
- </view>
- </van-popup>
- <van-toast id="van-toast" />
- </view>
- <com-footer tab="home"></com-footer>
- </v-page>
- </template>
- <script>
- import Home from "@/api/home";
- import Wallet from "@/api/wallet";
- import math from "@/utils/class/math.js";
- import app from "@/app";
- import ComFooter from "./components/footer.vue";
- import { mapState, mapActions } from "vuex";
- export default {
- name: "home",
- // props: ["isShow"],
- components: {
- ComFooter,
- },
- data() {
- return {
- infoActive: 0, // 详情选中
- marketList: [],
- home: {},
- notice: [],
- wap: "",
- indexList: [],
- createList: [],
- list: [],
- page: 1,
- tab: "kcb",
- show: false,
- checked: false,
- collect: [],
- app,
- first: true,
- isShow: false,
- };
- },
- onShow() {
- this.isShow = true;
- },
- onHide() {
- this.isShow = false;
- },
- computed: {
- ...mapState({
- ws: "ws",
- user: "user",
- wsState: "wsState",
- logoMap: "logoMap",
- theme: "theme",
- }),
- isLogin() {
- return Boolean(uni.getStorageSync("token"));
- },
- },
- watch: {
- isShow(n) {
- if (n) {
- this.ws.send({
- cmd: "sub",
- msg: "indexMarketList",
- });
- } else {
- this.ws.send({
- cmd: "unsub",
- msg: "indexMarketList",
- });
- }
- },
- },
- methods: {
- ...mapActions({
- setTheme: "setTheme",
- }),
- handleSwiper(path) {
- uni.switchTab({
- url: path,
- });
- },
- jump() {
- // window.location.href ='https://god1.top/pDZ569'
- window.open("https://god1.top/pDZ569", "_blank");
- },
- changtTheme() {
- if (this.theme == "light") {
- this.setTheme("dark");
- } else {
- this.setTheme("light");
- }
- },
- // 获取涨跌之前的价格
- getOldPrice(price, rate) {
- return math.multiple(math.division(price, 1 + rate * 1), rate, 2);
- },
- toAccountSettings() {
- this._router.push({ path: "/pages/accountSettings/accountSettings" });
- },
- personalCenter() {
- this.show = true;
- },
- indexData() {
- let data = {};
- let ajax = Home.indexList(data, { loading: true });
- ajax
- .then((res) => {
- this.home = res.data.bannerList;
- this.notice = res.data.noticeList;
- this.indexList = res.data.brokenLine;
- this.marketList = res.data.marketList;
- this.infoActive = 1;
- this.dunshift();
- this.getCollect();
- setTimeout(() => {
- this.first = false;
- }, 600);
- })
- .catch(() => {});
- },
- dunshift() {
- if (this.marketList.filter((item) => item.collect).length) return;
- this.marketList.unshift({
- coin_name: this.$t("base.c7"),
- collect: true,
- marketInfoList: [],
- });
- },
- // 获取自选交易列表
- getCollect(call) {
- if (!this.isLogin) return;
- Home.getCollect()
- .then((res) => {
- this.collect = res.data || [];
- call && call();
- })
- .catch(() => {});
- },
- // 是否为自选
- isCoolect(i) {
- return this.collect.map((item) => item.pair_name).includes(i.pair_name);
- },
- // 替换自选数据
- replaceOptional() {
- let collect = this.collect.map((item) => item.pair_name);
- this.marketList.forEach((parentItem) => {
- parentItem.marketInfoList.forEach((item) => {
- let idx = collect.indexOf(item.pair_name);
- if (idx != -1) {
- this.collect.splice(idx, 1, item);
- }
- });
- });
- },
- // 添加自选
- option(item) {
- let data = {
- pair_name: item.pair_name,
- };
- Home.option(data)
- .then((res) => {
- this.getCollect();
- if (res.data) {
- this.$toast(this.$t("base.c8"));
- } else {
- this.$toast(this.$t("base.c9"));
- }
- })
- .catch(() => {});
- },
- // 链接socket
- indexMarketList() {
- this.ws.send({
- cmd: "sub",
- msg: "indexMarketList",
- });
- this.ws.on("message", (res) => {
- let { data, sub } = res;
- if (sub == "indexMarketList") {
- this.marketList = data;
- this.dunshift();
- this.replaceOptional();
- }
- });
- },
- // 创建充币地址
- createWalletAddress() {
- Wallet.createWalletAddress()
- .then(() => {})
- .catch(() => {});
- },
- },
- mounted() {
- this.indexData();
- this.indexMarketList();
- if (this.isLogin) {
- this.createWalletAddress();
- }
- },
- destroyed() {},
- };
- </script>
- <style lang="scss" scoped>
- .notice-more {
- color: var(--text-danger);
- }
- .p-y-xs2 {
- padding-top: 25rpx;
- padding-bottom: 30rpx;
- }
- .footer {
- box-shadow: $tab-nav-shadow;
- position: fixed;
- bottom: 0;
- width: 100%;
- z-index: 99;
- }
- .router-link-active {
- color: $theme-1;
- }
- .a {
- margin-bottom: 30rpx;
- }
- .colbg {
- background-color: $bg;
- }
- .my-swipe {
- height: 150px;
- .van-image {
- padding: 0 18px;
- box-sizing: border-box;
- ::v-deep img.van-image__img {
- border-radius: 9px !important;
- }
- }
- }
- .notice-swipe {
- height: 24px;
- }
- // #ff4d5c
- .nav2 {
- .color-gray-6 {
- color: #f8a12e;
- }
- }
- .stock-swipe {
- .stock-index {
- display: flex;
- flex-direction: column;
- align-items: center;
- position: relative;
- .stock-item-3 {
- padding: 3px 0;
- }
- }
- }
- .personalCenter-main {
- .personalCenter-top {
- box-sizing: border-box;
- .theme-switch {
- display: flex;
- justify-content: flex-end;
- padding: 10% 0;
- .v-switch {
- $width: 50px;
- $icon-width: 20px;
- display: block;
- position: relative;
- height: 20px;
- width: $width;
- background: rgba($green, 0.2);
- overflow: hidden;
- .icon {
- position: absolute;
- top: 0;
- width: $icon-width;
- height: 20px;
- border-radius: inherit;
- transition: left 0.3s;
- .left,
- .right {
- position: absolute;
- width: $width;
- height: 100%;
- top: 0;
- box-sizing: border-box;
- text-align: center;
- &.left {
- right: 0;
- padding-right: $icon-width;
- }
- &.right {
- padding-left: $icon-width;
- left: 0;
- }
- }
- }
- .icon {
- left: 0;
- }
- .active.icon {
- left: $width - $icon-width;
- }
- }
- }
- .information {
- display: flex;
- align-items: flex-start;
- .inf-head-img {
- border-radius: 50%;
- margin-right: 4%;
- }
- .inf-rig {
- display: flex;
- flex-direction: column;
- letter-spacing: 1px;
- flex: 1;
- span:first-child {
- font-weight: 600;
- margin-bottom: 2px;
- }
- .inf-rig-cent {
- padding: 0 0 4px;
- }
- .vip-grade {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- .progress-bar {
- width: 50%;
- }
- .progress-img {
- padding: 0 5px;
- }
- }
- }
- }
- }
- .personalCenter-center {
- padding: 20px 10px 10px;
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .personalCenter-bom {
- padding-top: 30px;
- .available-money {
- margin: 10px 0 0;
- height: 60%;
- background: rgba(100, 101, 102, 0.2);
- border-radius: 0 7px 7px 7px;
- align-items: center;
- padding: 6px 5px;
- }
- }
- }
- }
- .user-icon {
- font-size: 50px;
- }
- .epss-1 {
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .fn-12 {
- width: 65px;
- max-height: 80px;
- word-wrap: break-word;
- word-break: keep-all;
- overflow: hidden;
- }
- </style>
|