2021-03-20

大屏幕数字滚动

vue大数据展示屏幕实现数字的滚动效果,例如大屏上需要展示的数据啦,销售总额,一类的总的数据实时增加!

<template>
    <div class="chartNum">
                <h3 class="orderTitle">销售总额</h3>
                <div class="units" >
                  <span v-for="(item,index) in unit" :key="index">{{item}}</span>
                </div>
                <div class="box-item">
                    <li :class="{'number-item': !isNaN(item), 'mark-item': isNaN(item) }"
                        v-for="(item,index) in orderNum"
                        :key="index">
                            <span v-if="!isNaN(item)">
                              <i ref="numberItem">0123456789</i>
                            </span>
                        <span class="comma" v-else>{{item}}</span>
                    </li>
                    <li>元</li>
                </div>
            </div>
</template>
<script>
    export default {
        data() {
            return {
                orderNum: ['0','0', '0', ',', '0', '0', '0', ',', '0', '0', '0'], // 默认订单总数
                newNumber: 732516851,
                unit:['亿','千万','百万','十万','万','千']
            };
        },

        methods: {
            increaseNumber () {
                this.timer = setInterval(() => {
                    // 修改需要展示的数据
                    this.newNumber = this.newNumber + 1;
                    this.toOrderNum(this.newNumber);
                    this.setNumberTransform();
                }, 1000);
            },
               // 设置文字滚动
            setNumberTransform () {
              const numberItems = this.$refs.numberItem; // 拿到数字的ref,计算元素数量
              const numberArr = this.orderNum.filter(item => !isNaN(item));
              // 结合CSS 对数字字符进行滚动,显示订单数量
              for (let index = 0; index < numberItems.length; index++) {
                const elem = numberItems[index];
                elem.style.transform = `translate(-50%, -${numberArr[index] * 10}%)`;
              }
            },
            // 处理总订单数字
            toOrderNum(num) {
              num = num.toString();
              // 把订单数变成字符串
              if (num.length < 9) {
                num = '0' + num; // 如未满八位数,添加"0"补位
                this.toOrderNum(num); // 递归添加"0"补位
              } else if (num.length === 9) {
                // 订单数中加入逗号
                num = num.slice(0, 3) + ',' + num.slice(3, 6) + ',' + num.slice(6, 9);
                this.orderNum = num.split(''); // 将其便变成数据,渲染至滚动数组
              } 
              else {
                // 订单总量数字超过八位显示异常
                this.$message.warning('订单总量数字过大,显示异常,请联系客服');
              }
            }
        },
        mounted() {
            this.increaseNumber();
        }
    };
</script>
<style scoped lang='scss'>
.units{
  display: flex;
  width: 500px;
  margin-bottom: 10px;
  span{
    width: 60px;
    height: 20px;
    font-size: 20px;
    font-weight: 900;
    margin-right: 12px;
    text-align: center;
  }
}
.units>span:nth-child(4){
  margin-left: 15px;
}
.orderTitle{
  width: 570px;
    text-align: center;
    font-size: 40px;
    margin-bottom: 10px;
}
     /*订单总量滚动数字设置*/
    .box-item {
        position: relative;
        height: 100px;
        font-size: 65px;
        line-height: 41px;
        text-align: center;
        list-style: none;
        color: #2D7CFF;
        writing-mode: vertical-lr;
        text-orientation: upright;
        /*文字禁止编辑*/
        -moz-user-select: none; /*火狐*/
        -webkit-user-select: none; /*webkit浏览器*/
        -ms-user-select: none; /*IE10*/
        -khtml-user-select: none; /*早期浏览器*/
        user-select: none;
        /* overflow: hidden; */
    }
    /* 默认逗号设置 */
    .mark-item {
        width: 10px;
        height: 100px;
        margin-right: 5px;
        line-height: 10px;
        font-size: 48px;
        position: relative;
        & > span {
            position: absolute;
            width: 100%;
            bottom: 0;
            writing-mode: vertical-rl;
            text-orientation: upright;
        }
    }
    /*滚动数字设置*/
    .number-item {
        width: 60px;
        height: 90px;
        background: #ccc;
        list-style: none;
        margin-right: 10px;
        background:rgba(250,250,250,1);
        border-radius:4px;
        border:1px solid rgba(221,221,221,1);
        & > span {
            position: relative;
            display: inline-block;
            width: 100%;
            height: 100%;
            writing-mode: vertical-rl;
            text-orientation: upright;
            overflow: hidden;
            & > i {
                font-style: normal;
                position: absolute;
                top: 11px;
                left: 50%;
                transform: translate(-50%,0);
                transition: transform 1s ease-in-out;
                letter-spacing: 10px;
            }
        }
    }
    .number-item:last-child {
        margin-right: 0;
    }
</style>

在这里插入图片描述

2021-03-26 20:54:33,596 - Model - INFO - Epoch 1 (1/200): 2021-03-26 20:57:40,380 - Model - INFO - Train Instance Accuracy: 0.571037 2021-03-26 20:58:16,623 - Model - INFO - Test Instance Accuracy: 0.718528, Class Accuracy: 0.627357 2021-03-26 20:58:16,623 - Model - INFO - Best Instance Accuracy: 0.718528, Class Accuracy: 0.627357 2021-03-26 20:58:16,623 - Model - INFO - Save model... 2021-03-26 20:58:16,623 - Model - INFO - Saving at log/classification/pointnet2_msg_normals/checkpoints/best_model.pth 2021-03-26 20:58:16,698 - Model - INFO - Epoch 2 (2/200): 2021-03-26 21:01:26,685 - Model - INFO - Train Instance Accuracy: 0.727947 2021-03-26 21:02:03,642 - Model - INFO - Test Instance Accuracy: 0.790858, Class Accuracy: 0.702316 2021-03-26 21:02:03,642 - Model - INFO - Best Instance Accuracy: 0.790858, Class Accuracy: 0.702316 2021-03-26 21:02:03,642 - Model - INFO - Save model... 2021-03-26 21:02:03,643 - Model - INFO - Saving at log/classification/pointnet2_msg_normals/checkpoints/best_model.pth 2021-03-26 21:02:03,746 - Model - INFO - Epoch 3 (3/200): 2021-03-26 21:05:15,349 - Model - INFO - Train Instance Accuracy: 0.781606 2021-03-26 21:05:51,538 - Model - INFO - Test Instance Accuracy: 0.803641, Class Accuracy: 0.738575 2021-03-26 21:05:51,538 - Model - INFO - Best Instance Accuracy: 0.803641, Class Accuracy: 0.738575 2021-03-26 21:05:51,539 - Model - INFO - Save model... 2021-03-26 21:05:51,539 - Model - INFO - Saving at log/classification/pointnet2_msg_normals/checkpoints/best_model.pth 我有类似于这样的一段txt文件,请你帮我写一段代码来可视化这些训练结果
02-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值