| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676 |
- <template>
- <ul :class="[{'many':students.length >= 2}]">
- <li v-for="(s,i) in students.slice(0, maxShowNum)" :class="s.className">
- <div v-show="i<10" class="centerLi">
- <!-- <div class="power" v-if="s.RealHr != 0"> -->
- <div class="power">
- <power :cur-power="s.PowerPercent" :cur-hr="s.RealHr"></power>
- </div>
- <div class="userinfo">
- <div class="lt">
- <span>
- <em v-if="s.RealHr != 0">{{ s.ActivePercent |max100 }}</em>
- <em v-else>---</em>
- <s>%</s>
- </span>
- </div>
- <div class="md">
- <div class="head">
- <img :src="s.Head" alt="" v-if="s.Head" :class="[{'boy':s.Sex == 1},{'girl':s.Sex == 2}]">
- <!-- <img src="../static/img/people/flyhead.png" alt="" v-if="!s.Head" :class="[{'boy':s.Sex == 1},{'girl':s.Sex == 2}]"> -->
- <default-head v-if="!s.Head" :class="[{'boy':s.Sex == 1},{'girl':s.Sex == 2}]"></default-head>
- <div class="names">
- <span>
- {{ s.Name }}
- </span>
- </div>
- </div>
- <img src="../assets/imgs/student/star.svg" class="IsPrivate" alt="IsPrivate" v-if="s.IsPrivate == 1">
- <img src="../assets/imgs/student/birthday.png" class="IsBirthday" alt="IsBirthday" v-if="s.IsBirthday == 1">
- </div>
- <div class="rt">
- <span>
- <div :class="[{'heartJump':true}]">
- <div class="heartImgContainer">
- <img src="../assets/imgs/student/heart.svg" class=""/>
- </div>
- <em class="fastJump" v-if="s.RealHr != 0"
- v-show="parseInt(s.ActivePercent) > 90">{{ s.RealHr }}
- </em>
- <em class="normalJump" v-if="s.RealHr != 0"
- v-show="parseInt(s.ActivePercent) <= 90 && parseInt(s.ActivePercent) > 30">{{ s.RealHr }}
- </em>
- <em class="slowJump" v-if="s.RealHr != 0"
- v-show="parseInt(s.ActivePercent) <= 30">{{ s.RealHr }}
- </em>
- <em v-else>---</em>
- </div>
- </span>
- </div>
- </div>
- <div class="userSport">
- <span>
- <img src="../assets/imgs/student/calc.svg" class=""/>
- <em>{{ s.Cle |fmtInt }}</em>
- </span>
- <span>
- <img src="../assets/imgs/student/ck.svg" class=""/>
- <em>{{ s.Ck |fmtFloat }}</em>
- </span>
- <span>
- <img src="../assets/imgs/student/ei.svg" class=""/>
- <em>{{ s.EI |fmtInt }}</em>
- </span>
- <!-- <span>
- <img src="../assets/imgs/student/sport.svg" class=""/>
- <em>{{ s.PureCalorieNoVo2 |fmtInt }}</em>
- </span> -->
- </div>
- </div>
- </li>
- <li v-for="(s,i) in studentsFake" :class="FakeclassName" v-show="students"
- v-if="students.length > 0">
- <div class="fakePart"></div>
- </li>
- </ul>
- </template>
- <script>
- import power from '@/components/power'
- import defaultHead from '@/components/defaultHead'
- export default {
- data() {
- return {
- maxShowNum: 10, //最大显示记录数
- studentsFake: [],
- FakeclassName: ''
- }
- },
- props: ['students'],
- watch: {
- 'students': {
- // 自动计算补全空白处
- handler(newName, oldName) {
- if (!newName) {
- console.log('没有传入学生数据');
- }
- let sum = 0;
- let that = this;
- sum = newName.length;
- that.studentsFake = 0;
- if (sum <= 2) {
- that.studentsFake = 2 - sum;
- }
- else if (sum >= 3) {
- that.studentsFake = 10 - sum;
- }
- else if (sum >= 10) {
- that.studentsFake = 0
- }
- let numberClass = '';
- let colorClass = '';
- for (let i = 0; i < sum; i++) {
- switch (true) {
- // case sum == 1:
- // numberClass = 'max';
- // break;
- // case sum == 2:
- case sum <= 2:
- numberClass = 'two';
- break;
- case sum > 2:
- numberClass = 'ten';
- break;
- }
- let per = parseInt(newName[i].ActivePercent);
- switch (true) {
- case per >= 90:
- colorClass = 'red';
- break;
- case per <= 89 && per > 79:
- colorClass = 'brown';
- break;
- case per <= 79 && per > 69:
- colorClass = 'yellow';
- break;
- case per <= 69 && per > 54:
- colorClass = 'green';
- break;
- case per <= 54 && per > 39:
- colorClass = 'violet';
- break;
- case per <= 39:
- colorClass = 'blue';
- break
- }
- newName[i].className = numberClass + ' ' + colorClass;
- that.FakeclassName = numberClass + ' ' + colorClass;
- }
- },
- deep: true,
- immediate: true
- }
- },
- filters: {
- fmtNum(val) {
- if (val == 0) {
- return '--'
- } else {
- if (parseInt(val) < 0) return 0;
- if (parseInt(val) > 0) return val
- }
- },
- fmtFloat(val) {
- if (val == 0) {
- return '0.0'
- } else {
- return parseFloat(val).toFixed(1);
- }
- },
- fmtInt(val) {
- if (val == 0) {
- return '0'
- } else {
- // return parseFloat(val).toFixed(2);
- return parseInt(val);
- }
- },
- max100(val) {
- if (val <= 100) {
- return val
- } else {
- return 100
- }
- }
- },
- components: {
- power, defaultHead
- }
- }
- </script>
- <style lang="scss" scoped>
- @mixin cube {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- em, i, ul, li, s {
- margin: 0;
- padding: 0;
- list-style: none;
- font-style: normal;
- text-decoration: none;
- }
- ul {
- @include cube;
- width: 100%;
- display: inline-flex;
- align-items: center;
- align-content: center;
- justify-content: center;
- flex-wrap: wrap;
- flex-grow: 1;
- &.many {
- justify-content: space-between;
- }
- }
- .blue .centerLi {
- // background: linear-gradient(#007ec7 0%, #007dc6 33%, #4cbbfc 100%);
- background: #007ec7;
- }
- .violet .centerLi {
- // background: linear-gradient(#3500ac 0%, #4300ad 33%, #7766f8 100%);
- background: #3519AB;
- }
- .green .centerLi {
- // background: linear-gradient(#0ab105 0%, #0ab105 33%, #37e06b 100%);
- background: #05A200;
- }
- .yellow .centerLi {
- // background: linear-gradient(#ffb308 0%, #f5c600 33%, #ffe61f 100%);
- background: #ffb308;
- }
- .brown .centerLi {
- // background: linear-gradient(#ff6200 0%, #ff6200 34.48%, #ff9d2b 100%);
- background: #ff6200;
- }
- .red .centerLi {
- // background: linear-gradient(#d11122 0%, #d11122 48.28%, #ff3445 100%);
- background: #d11122;
- }
- .slowJump {
- animation: moveAct 3s infinite;
- -webkit-animation: moveAct 3s infinite; /*Safari and Chrome*/
- animation-direction: alternate; /*轮流反向播放动画。*/
- animation-timing-function: ease-in-out; /*动画的速度曲线*/
- /* Safari 和 Chrome */
- -webkit-animation-direction: alternate; /*轮流反向播放动画。*/
- -webkit-animation-timing-function: ease-in-out; /*动画的速度曲线*/
- }
- .normalJump {
- animation: moveAct 2s infinite;
- -webkit-animation: moveAct 2s infinite; /*Safari and Chrome*/
- animation-direction: alternate; /*轮流反向播放动画。*/
- animation-timing-function: ease-in-out; /*动画的速度曲线*/
- /* Safari 和 Chrome */
- -webkit-animation-direction: alternate; /*轮流反向播放动画。*/
- -webkit-animation-timing-function: ease-in-out; /*动画的速度曲线*/
- }
- .fastJump {
- animation: moveAct 1s infinite;
- -webkit-animation: moveAct 1s infinite; /*Safari and Chrome*/
- animation-direction: alternate; /*轮流反向播放动画。*/
- animation-timing-function: ease-in-out; /*动画的速度曲线*/
- /* Safari 和 Chrome */
- -webkit-animation-direction: alternate; /*轮流反向播放动画。*/
- -webkit-animation-timing-function: ease-in-out; /*动画的速度曲线*/
- }
- @keyframes moveAct {
- 0% {
- transform: scale(1); /*开始为原始大小*/
- }
- 25% {
- transform: scale(1.1); /*放大1.1倍*/
- }
- 50% {
- transform: scale(1);
- }
- 75% {
- transform: scale(1.1);
- }
- }
- @-webkit-keyframes moveAct /*Safari and Chrome*/
- {
- 0% {
- transform: scale(1); /*开始为原始大小*/
- }
- 25% {
- transform: scale(1.1); /*放大1.1倍*/
- }
- 50% {
- transform: scale(1);
- }
- 75% {
- transform: scale(1.1);
- }
- }
- .centerLi {
- width: 99.8%;
- height: 100%;
- overflow: hidden;
- float: left;
- color: #fff;
- border-radius: 0.1rem;
- }
- .power {
- margin-top: 0.1rem;
- margin-right: 0.1rem;
- }
- .userinfo {
- @include cube;
- .lt {
- width: 31%;
- float: left;
- padding-right: 4%;
- margin-top: 0.2rem;
- span {
- float: right;
- em {
- color: white;
- font-size: 0.75rem;
- line-height: 1.90rem;
- font-weight: bold;
- letter-spacing: 0.03rem;
- }
- s {
- font-size: 0.4rem;
- float: right;
- text-align: right;
- margin-top: 0.43rem;
- font-family: "Arial Black";
- font-weight: bold;
- }
- }
- }
- .md {
- width: 30%;
- float: left;
- padding-top: 3%;
- height: 2rem;
- .head {
- @include cube;
- height: 2rem;
- img {
- @include cube;
- width: 1.7rem;
- height: 1.7rem;
- border-radius: 250rem;
- &.girl {
- border: 2px solid #EA26EA;
- }
- &.boy {
- border: 2px solid #39B6FF;
- }
- }
- }
- .names {
- @include cube;
- width: 1.36rem;
- background: rgba(0, 0, 0, 0.7);
- font-size: 0.25rem;
- text-align: center;
- padding: 1% 1%;
- border-radius: 250rem;
- position: relative;
- bottom: 0.37rem;
- }
- .IsPrivate {
- width: 0.6rem;
- float: right;
- position: relative;
- right: -0.15rem;
- bottom: 2.09rem;
- }
- .IsBirthday {
- width: 1.1rem;
- float: left;
- position: relative;
- bottom: 2.18rem;
- left: 0.4rem;
- }
- }
- .rt {
- width: 32%;
- float: right;
- margin-top: 0.2rem;
- .heartJump {
- width: 100%;
- float: right;
- letter-spacing: 0.03rem;
- span {
- float: right;
- }
- }
- > span {
- width: 100%;
- text-align: right;
- float: right;
- font-size: 0.727rem;
- line-height: 1.90rem;
- font-weight: bold;
- padding-right: 15%;
- }
- em {
- color: white;
- width: 80%;
- float: right;
- text-align: right;
- }
- .heartImgContainer {
- width: 20%;
- // height: 2rem;
- float: right;
- }
- img {
- width: 0.36rem;
- float: right;
- margin-right: 0%;
- margin-top: 0.60rem;
- }
- }
- }
- .userSport {
- @include cube;
- line-height: 0.8rem;
- margin-top: 0.1rem;
- span {
- width: 33.333%;
- float: left;
- img {
- width: 0.32rem;
- float: left;
- margin-left: 0.36rem;
- margin-top: 0.2rem;
- }
- em {
- float: left;
- font-size: 0.38rem;
- font-family: Georgia, Arial;
- vertical-align: top;
- margin-left: 0.12rem;
- }
- }
- }
- .max {
- width: 9.5rem;
- height: 3.5rem;
- margin-top: 25%;
- .userinfo {
- height: 2.2rem;
- }
- .userSport {
- span:nth-child(1)>img {
- margin-left: 0.43rem;
- }
- span:nth-child(2)>img {
- margin-left: 0.46rem;
- }
- span:nth-child(3)>img {
- margin-left: 0.4rem;
- }
- }
- }
- .two {
- width: 9.5rem;
- height: 3.5rem;
- margin-top: 0.1rem;
- // margin-top: 0.2rem;
- .userinfo {
- height: 2.2rem;
- }
- .userSport {
- span:nth-child(1)>img {
- margin-left: 0.43rem;
- }
- span:nth-child(2)>img {
- margin-left: 0.46rem;
- }
- span:nth-child(3)>img {
- margin-left: 0.4rem;
- }
- }
- }
- .ten {
- width: 3.12rem;
- height: 1.46rem;
- margin-top: 0.1rem;
- .power {
- margin-top: 0.03rem;
- margin-right: 0.01rem;
- }
- /deep/ .powerContainer {
- height: 0.16rem;
- }
- /deep/ .powerContainer img {
- position: relative;
- right: -0.1rem;
- bottom: 0.1rem;
- width: 0.2rem;
- }
- .userinfo {
- height: 0.92rem;
- .lt {
- width: 33%;
- margin-top: -0.55rem;
- padding-right: 2.5%;
- em {
- font-size: 0.38rem;
- line-height: 2.0rem;
- letter-spacing: 0.01rem;
- }
- s {
- font-size: 0.2rem;
- margin-top: 0.73rem;
- }
- }
- .md {
- height: 1.0rem;
- margin-top: -0.01rem;
-
- .head {
- height: 0.9rem;
- img {
- width: 0.75rem;
- height: 0.75rem;
- border-width: 2px !important;
- }
- }
-
- .names {
- width: 0.72rem !important;
- font-size: 0.15rem !important;
- bottom: 0.22rem !important;
- }
-
- .IsPrivate {
- width: 0.25rem;
- bottom: 0.92rem;
- // bottom: 2.65rem;
- right: -0.03rem;
- }
-
- .IsBirthday {
- width: 0.49rem;
- bottom: 0.98rem;
- left: 0.23rem;
- }
- }
-
- .rt {
- margin-top: -0.55rem;
- span {
- font-size: 0.345rem;
- line-height: 2.0rem;
- padding-right: 5%;
-
- em {
- letter-spacing: 0.01rem;
- }
- }
- .heartJump {
- margin-right: 0.12rem;
- }
- .heartImgContainer {
- width: 20%;
- }
- img {
- width: 0.16rem;
- margin-right: 0%;
- margin-top: 0.8rem;
- }
- }
- }
- .userSport {
- line-height: 0.3rem;
- margin-top: 0rem;
- img {
- width: 0.18rem;
- margin-top: 0.08rem;
- }
- span:nth-child(1)>img {
- margin-left: 0.23rem;
- }
- span:nth-child(2)>img {
- margin-left: 0.23rem;
- }
- span:nth-child(3)>img {
- margin-left: 0.2rem;
- }
- em {
- font-size: 0.2rem;
- margin-top: 0.03rem;
- margin-left: 0.06rem;
- // line-height: 0.8rem;
- }
- }
- }
- .fakePart {
- width: 100%;
- height: 100%;
- background-color: rgba(255, 255, 255, 0.13);
- border-radius: 0.1rem;
- }
- </style>
|