123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309 |
- <template>
- <view class="container">
- <view class="tiele-index">首页</view>
- <view class="swiper">
- <view class="swiper-box">
- <swiper circular="true" autoplay="true" @change="swiperChange">
- <swiper-item v-for="swiper in banner" :key="swiper.id" @click="ToBanner(swiper)"><image :src="swiper.pic"></image></swiper-item>
- </swiper>
- <view class="indicator"><view class="dots" v-for="(swiper, index) in banner" :class="[swiperCurrent >= index ? 'on' : '']" :key="index"></view></view>
- </view>
- </view>
- <view class="notice-box">
- <view class="notice-title flex_item">
- <image src="../../static/img/img31.png"></image>
- <view class="title">通知</view>
- </view>
- <view class="notice-list flex">
- <view class="notice-tpl" @click="navTo('/pages/index/information')">
- <image src="../../static/img/img02.png"></image>
- <view class="name">行业资讯</view>
- </view>
- <view class="notice-tpl" @click="navTo('/pages/index/pingtai')"> <!-- @click="navTo('/pages/index/introduce')" -->
- <image src="../../static/img/img03.png"></image>
- <view class="name">平台介绍</view>
- </view>
- <view class="notice-tpl" @click="navTo('/pages/index/notice')">
- <image src="../../static/img/img04.png"></image>
- <view class="name">通知公告</view>
- </view>
- <view class="notice-tpl" @click="navTo('/pages/index/share')">
- <image src="../../static/img/img05.png"></image>
- <view class="name">分享好友</view>
- </view>
- </view>
- </view>
- <!-- <image class="logo-img" @click="navTo('/pages/index/information')" src="../../static/img/img44.png"></image> -->
- <view class="notice-box">
- <view class="notice-title flex_item">
- <image src="../../static/img/img32.png"></image>
- <view class="title">行情</view>
- </view>
- <view class="quotation-list">
- <view class="quotation-tpl" v-for="(ls,index) in list" :key='index' v-if="ls.name!='USDT'">
- <view class="tpl title">{{ls.name}}/USDT</view>
- <view class="tpl num">{{ls.usdt}}</view>
- <view class="tpl money">¥{{ls.price}}</view>
- <view class="tip-box">
- <image src="../../static/img/img30.png"></image>
- <view class="tip" v-if="ls.up > 0">{{ls.up }}%</view>
- <view class="tip grenn" v-if="ls.up == 0 || ls.up < 0">{{ls.up }}%</view>
- </view>
- </view>
- </view>
- </view>
- <view class="list-box flex">
- <image src="../../static/img/img45.png"></image>
- <image src="../../static/img/img46.png"></image>
- </view>
- </view>
- </template>
- <script>
- import { interceptor } from '@/utils/loginUtils';
- import { loadIndexs,moneyType } from '@/api/index.js';
- import { mapState } from 'vuex';
- export default {
- data() {
- return {
- swiperCurrent: 0,
- banner: [],
- list:''
- };
- },
- computed: {
- ...mapState(['loginInterceptor','hasLogin']),
- },
- onLoad: function(option) {
- if (option.spread) {
- // 存储其他邀请人
- uni.setStorageSync('spread', option.spread);
- }
- },
- onShow: function() {
- // 判断是否强制登录
- if (this.loginInterceptor && !this.hasLogin) {
- // 登录拦截
- interceptor();
- }else{
- this.loadData();
- this.moneyType();
- }
- },
- //下拉刷新
- onPullDownRefresh() {
- this.loadData();
- this.moneyType();
- setTimeout(function () {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- methods: {
- // 请求载入数据
- async loadData() {
- let obj = this;
- loadIndexs({}).then(({ data }) => {
- obj.banner = data.banner;
- });
- },
- moneyType(){
- let obj = this;
- moneyType({index:1}).then(({ data }) => {
- console.log(data)
- obj.list = data;
- obj.list.forEach((e,index) => {
-
- e.up = parseFloat(e.up*100).toFixed(2);
- });
- });
- },
- /**
- * 统一跳转接口,拦截未登录路由
- * navigator标签现在默认没有转场动画,所以用view
- */
- navTo(url) {
- uni.navigateTo({
- url
- });
- },
- //轮播图
- swiperChange(e) {
- let index = e.detail.current;
- this.swiperCurrent = index;
- },
- }
- };
- </script>
- <style lang="scss">
- page {
- min-height: 100%;
- background-color: #ffffff;
- .container {
- width: 100%;
- padding: 25rpx 40rpx;
- }
- }
- .tiele-index{
- font-weight: 500;
- font-size: 50rpx;
- padding: 15% 0rpx 30rpx 0rpx;
- }
- .top-head {
- position: fixed;
- top: 0;
- z-index: 99;
- width: 100%;
- background-color: #272f41;
- padding: 15rpx 35rpx;
- color: #edc959;
- image {
- width: 80rpx;
- height: 80rpx;
- }
- .top-name {
- padding-left: 15rpx;
- }
- }
- //轮播图
- .swiper {
- width: 100%;
- display: flex;
- justify-content: center;
- border-radius: 15rpx;
- .swiper-box {
- width: 100%;
- height: 335rpx;
- overflow: hidden;
- // box-shadow: 0upx 8upx 25upx rgba(0, 0, 0, 0.2);
- //兼容ios,微信小程序
- border-radius: 15rpx;
- position: relative;
- z-index: 1;
- swiper {
- width: 100%;
- height: 100%;
- swiper-item {
- image {
- width: 100%;
- height: 100%;
- border-radius: 15rpx;
- }
- }
- }
- .indicator {
- position: absolute;
- bottom: 20upx;
- left: 20upx;
- background-color: rgba(255, 255, 255, 0.4);
- width: 150upx;
- height: 5upx;
- border-radius: 3upx;
- overflow: hidden;
- display: flex;
- .dots {
- width: 0upx;
- background-color: rgba(255, 255, 255, 1);
- transition: all 0.3s ease-out;
- &.on {
- width: (100%/3);
- }
- }
- }
- }
- }
- .notice-box{
- padding: 40rpx 0rpx;
- .notice-title{
- padding-bottom: 30rpx;
- image{
- width:35rpx;
- height: 32rpx;
- }
- .title{
- font-size: 34rpx;
- font-weight: bold;
- font-style: italic;
- color: #333333;
- margin-left: 15rpx;
- }
- }
- .notice-list{
- .notice-tpl{
- image{
- width: 99rpx;
- height: 113rpx;
- }
- .name{
- font-size: 26rpx;
- color: #5D616D;
- }
- }
- }
- }
- .logo-img{
- width: 100%;
- height: 210rpx;
- }
- .quotation-list{
- display: flex;
- flex-wrap: wrap;
- .quotation-tpl{
- position: relative;
- padding: 22rpx 24rpx;
- height: 220rpx;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- width:31%;
- margin-bottom: 4%;
- margin-right: 2%;
- // &:nth-child(2n + 1) {
- // margin-right: 2%;
- // }
- .tpl{
- z-index: 99;
- position: relative;
- font-size: 24rpx;
- padding-bottom: 10rpx;
- }
- .title{
- color: #333333;
- font-weight: bold;
- padding-bottom: 21rpx !important;
- }
- .num{
- color: #FB3A2F;
- }
- .money{
- color: #666666;
- }
- .tip-box{
- image{
- width: 100%;
- height: 118rpx;
- position: absolute;
- bottom: 0;
- left: 0;
- }
- .tip{
- position: relative;
- color: #FB3A2F;
- font-size: 26rpx;
- text-align: center;
- font-weight: 600;
- padding-top: 25rpx;
- }
- .grenn{
- color: #606266;
- }
-
- }
- }
- }
- .list-box{
- image{
- width: 326rpx;
- height: 210rpx;
- }
- }
- </style>
|