| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746 |
- <template>
- <div class="content">
- <div class="top" :style="{backgroundColor:bgColor}">
- <span class="watchState">{{watchText}}</span>
- <div class="toprow">
- <div class="lt">
- <div class="activeLevel">
- <div v-if="activeState">
- <s>%</s>
- <em>{{activeLevel}}</em>
- </div>
- <div v-else>
- <s class="noValue">--</s>
- </div>
- </div>
- <span>{{activeLevelText}}</span>
- </div>
- <div class="md">
- <div class="headContainer">
- <img src="../static/images/main/testhead.png"/>
- </div>
- <span class="username">
- <em>{{username}}</em>
- <img src="../static/images/main/male.png" height="60" width="60" v-if="sex == 1"/>
- <img src="../static/images/main/female.png" height="60" width="60" v-if="sex == 2"/>
- </span>
- </div>
- <div class="rt">
- <div class="heartJump">
- <div v-if="activeState">
- <img src="../static/images/main/heart.png" height="74" width="86"/>
- <em :class="[
- {'normalJump':activeLevel > 30 && activeLevel <= 90},
- {'fastJump':activeLevel > 90},
- {'slowJump':activeLevel < 30},
- ]">{{heartRate}}</em>
- </div>
- <div v-else>
- <s class="noValue">--</s>
- </div>
- </div>
- <span>瞬时心率</span>
- </div>
- </div>
- </div>
- <div class="info">
- <ul>
- <li><em>{{height}}</em><span>身高cm</span></li>
- <li><em>{{age}}</em><span>年龄</span></li>
- <li><em>{{weight}}</em><span>体重kg</span></li>
- <li><em>{{peaceHeart}}</em><span>静息心率</span></li>
- </ul>
- </div>
- <div class="row">
- <div class="rowCenter" v-if="!watchState" @click="connectWatch">
- <img src="../static/images/main/chain.png"/>
- <em>心率带未连接</em>
- <button>点击连接</button>
- </div>
- </div>
- <div class="middle">
- <ul>
- <li>
- <div class="center">
- <em>{{cal}}</em>
- <img src="../static/images/main/normal.png"/>
- <span>卡路里</span>
- </div>
- </li>
- <li>
- <div class="center">
- <em>{{sportCal}}</em>
- <img src="../static/images/main/redfire.png"/>
- <span>运动卡路里</span>
- </div>
- </li>
- <li>
- <div class="center">
- <em>{{ck}}</em>
- <img src="../static/images/main/ck.png" class="ck"/>
- <span>CK</span>
- </div>
- </li>
- </ul>
- </div>
- <div class="bottom">
- <h5>5分钟心率趋势图</h5>
- <span>最大心率 : {{heartMax}} 平均心率 : {{heartAverage}}</span>
- <Line-example
- :width="screenWidth"
- :height="screenHeight"
- :dataLabels="dataLabels"
- :datadatasets="dataDatasets"
- />
- <em v-if="activeState" :class="[
- {'normalJump':activeLevel > 30 && activeLevel <= 90},
- {'fastJump':activeLevel > 90},
- {'slowJump':activeLevel < 30},
- ]">{{heartRate}}</em>
- </div>
- <mu-dialog title="" width="600" max-width="80%" :esc-press-close="false"
- :overlay-close="false" :open.sync="openAlert">
- <p v-if="!watchs">
- 没有任何设备
- </p>
- <div class="watchList" v-else>
- <p>请选择设备</p>
- <ul>
- <li v-for="w in watchs" @click="choiceWatch">{{w.name}} <em>信号:{{w.level}}</em></li>
- </ul>
- </div>
- <br>
- <mu-button slot="actions" flat color="primary" @click="closeAlertDialog" v-if="watchListState">取消
- </mu-button>
- <mu-button slot="actions" flat color="primary" @click="searchWatch" v-else>搜索</mu-button>
- </mu-dialog>
- </div>
- </template>
- <script>
- import LineExample from '../components/LineExample'
- export default {
- data() {
- return {
- dataLabels: [],
- dataDatasets: [],
- watchText: '',
- watchState: false,//false
- bgColor: '#028FE1',
- activeLevel: 0,
- activeLevelText: '激活放松',
- heartRate: 0,
- activeState: false,//false
- openAlert: false,//false
- alertState: false,//false
- watchListState: false,//false
- username: '王胜寒',
- sex: 1,
- height: 148,
- age: 8,
- weight: 38,
- peaceHeart: 100,
- heartMax: 0,
- heartAverage: 0,
- cal: 0,
- sportCal: 0,
- ck: 0,
- screenWidth: document.body.clientWidth,
- screenHeight: parseInt(document.documentElement.clientHeight / 5),
- watchs: [],
- }
- },
- mounted() {
- this.getBodyInfo();
- this.activeLevel = 0;
- this.watchs = [
- // {name: 'CL831-0022750', id: 1, rssi: -90, level: '强'},
- // {name: 'CL831-0022767', id: 2, rssi: -30, level: '弱'},
- ]
- },
- watch: {
- activeLevel(val) {
- let that = this;
- switch (true) {
- case parseInt(val) < 39 :
- that.bgColor = '#028FE1';
- that.activeLevelText = '激活放松';
- break;
- case parseInt(val) < 54 && parseInt(val) >= 39 :
- that.bgColor = '#6D29FA';
- that.activeLevelText = '动态热身';
- break;
- case parseInt(val) < 69 && parseInt(val) >= 54 :
- that.bgColor = '#0AB105';
- that.activeLevelText = '脂肪燃烧';
- break;
- case parseInt(val) < 79 && parseInt(val) >= 69 :
- that.bgColor = '#B9CB01';
- that.activeLevelText = '糖分消耗';
- break;
- case parseInt(val) < 89 && parseInt(val) >= 79 :
- that.bgColor = '#EA8813';
- that.activeLevelText = '心肺训练';
- break;
- case parseInt(val) >= 90 :
- that.bgColor = '#D11122';
- that.activeLevelText = '峰值锻炼';
- break;
- }
- }
- },
- methods: {
- connectWatch() {
- // 打开蓝牙适配器
- this.Toast('蓝牙适配器打开成功!');
- let that = this;
- plus.bluetooth.openBluetoothAdapter({
- success: function (e) {
- that.Toast('蓝牙适配器打开成功!');
- that.openAlert = true;
- return e
- },
- fail: function (e) {
- that.Toast('打开失败! 请确认蓝牙开关已开启');
- }
- });
- },
- closeAlertDialog() {
- this.openAlert = false;
- },
- searchWatch() {
- // test
- this.watchs = [
- {name: 'CL831-0022750', id: 1, rssi: -90, level: '强'},
- {name: 'CL831-0022767', id: 2, rssi: -30, level: '弱'},
- ];
- this.watchListState = true;
- },
- choiceWatch() {
- },
- // 获取基础身体数据
- getBodyInfo() {
- }
- },
- components: {
- LineExample
- }
- }
- </script>
- <style scoped>
- .top {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .top .watchState {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- height: 20px;
- line-height: 20px;
- color: #fff;
- text-align: center;
- margin-top: 10px;
- margin-bottom: 10px;
- }
- .toprow {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .toprow .lt {
- width: 30%;
- float: left;
- overflow: hidden;
- }
- .toprow .md {
- width: 40%;
- float: left;
- overflow: hidden;
- }
- .toprow .rt {
- width: 30%;
- float: right;
- overflow: hidden;
- }
- .toprow .lt .activeLevel {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- margin-top: 10px;
- color: #fff;
- }
- .activeLevel div {
- width: 86px;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .activeLevel s {
- float: right;
- font-size: 20px;
- }
- .activeLevel em {
- font-size: 40px;
- text-align: right;
- font-weight: bold;
- float: right;
- }
- .toprow .lt span {
- width: 80px;
- height: 20px;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- color: #fff;
- border: 1px solid #fff;
- border-radius: 250px;
- text-align: center;
- line-height: 20px;
- font-size: 12px;
- }
- .toprow .md .headContainer {
- width: 70%;
- height: 70%;
- border: 3px solid rgba(255, 255, 255, 0.71);
- border-radius: 250px;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .headContainer img {
- width: 100%;
- height: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .activeLevel .noValue {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- font-weight: bold;
- font-size: 40px;
- text-align: center;
- float: none;
- }
- .username {
- width: 100%;
- height: 30px;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- font-size: 14px;
- color: #fff;
- margin-top: 10px;
- }
- .username em {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- text-align: center;
- }
- .username img {
- position: relative;
- bottom: 20px;
- float: right;
- width: 15px;
- height: 15px;
- right: 15%;
- }
- .heartJump {
- width: 90%;
- overflow: hidden;
- float: left;
- margin: 0 auto;
- margin-top: 10px;
- color: #fff;
- }
- .heartJump div {
- width: 86px;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .heartJump img {
- width: 16px;
- height: 14px;
- float: right;
- }
- .heartJump em {
- font-size: 40px;
- text-align: right;
- font-weight: bold;
- float: right;
- }
- .heartJump .noValue {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- font-weight: bold;
- font-size: 40px;
- text-align: center;
- float: none;
- }
- .toprow .rt span {
- width: 80px;
- height: 20px;
- overflow: hidden;
- float: left;
- color: #fff;
- border: 1px solid #fff;
- border-radius: 250px;
- text-align: center;
- line-height: 20px;
- font-size: 12px;
- }
- .info {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .info ul {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- margin-top: 10px;
- margin-bottom: 10px;
- }
- .info li {
- width: 25%;
- border-left: 1px solid #fff;
- border-right: 1px solid #fff;
- float: left;
- text-align: center;
- }
- .info li:nth-child(2) {
- border-color: #E2E2E2;
- }
- .info li:nth-child(3) {
- border-color: #E2E2E2;
- border-left: 0;
- }
- .info li em {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- color: #363636;
- font-size: 20px;
- text-align: center;
- }
- .info li span {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- color: #C4C4C4;
- font-size: 12px;
- text-align: center;
- }
- .row {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- background: #EFEFEF;
- padding-top: 10px;
- padding-bottom: 10px;
- }
- .row .rowCenter {
- width: 208px;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- line-height: 30px;
- }
- .rowCenter img {
- width: 11px;
- height: 11px;
- float: left;
- margin-top: 10px;
- margin-right: 5px;
- }
- .rowCenter em {
- font-size: 14px;
- color: #FF4040;
- margin-right: 15px;
- }
- .rowCenter button {
- width: 92px;
- height: 27px;
- text-align: center;
- line-height: 27px;
- color: black;
- background: #FFDE93;
- border-radius: 6px;
- border: none;
- outline: none;
- }
- .middle {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- border-bottom: 10px solid #EFEFEF;
- }
- .middle ul {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- padding-top: 10px;
- padding-bottom: 10px;
- }
- .middle li {
- width: 33%;
- float: left;
- border-left: 1px solid #fff;
- border-right: 1px solid #fff;
- }
- .middle li .center {
- width: 72px;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .middle li:nth-child(2) {
- border-color: #E2E2E2;
- }
- .middle li img {
- width: 15px;
- float: right;
- margin-top: 4px;
- margin-right: 5px;
- }
- .middle li em {
- float: right;
- text-align: right;
- color: #000;
- font-weight: bold;
- font-size: 22px;
- }
- .middle li span {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- text-align: right;
- color: #9A9A9A;
- font-size: 12px;
- }
- .middle .ck {
- width: 19px;
- height: 19px;
- margin-top: 6px;
- }
- .bottom {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .bottom h5 {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- color: #363636;
- font-size: 16px;
- text-align: center;
- font-weight: normal;
- margin-top: 14px;
- }
- .bottom span {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- text-align: center;
- font-size: 12px;
- color: #9A9A9A;
- }
- .bottom em {
- position: relative;
- bottom: 160px;
- right: 20px;
- float: right;
- color: #FF4040;
- background: #fff;
- }
- .slowJump {
- animation: mymove 3s infinite;
- -webkit-animation: mymove 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: mymove 2s infinite;
- -webkit-animation: mymove 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: mymove 1s infinite;
- -webkit-animation: mymove 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 mymove {
- 0% {
- transform: scale(1); /*开始为原始大小*/
- }
- 25% {
- transform: scale(1.1); /*放大1.1倍*/
- }
- 50% {
- transform: scale(1);
- }
- 75% {
- transform: scale(1.1);
- }
- }
- @-webkit-keyframes mymove /*Safari and Chrome*/
- {
- 0% {
- transform: scale(1); /*开始为原始大小*/
- }
- 25% {
- transform: scale(1.1); /*放大1.1倍*/
- }
- 50% {
- transform: scale(1);
- }
- 75% {
- transform: scale(1.1);
- }
- }
- /deep/ .mu-dialog {
- background-color: rgba(0, 0, 0, 0.75);
- color: #fff;
- border-radius: 20px;
- background-size: 100%;
- background-origin: content-box;
- filter: blur(0.5px);
- }
- /deep/ .mu-dialog p {
- color: #fff;
- text-align: center;
- }
- /deep/ .mu-dialog .mu-primary-text-color {
- margin: 0 auto;
- border-radius: 9px;
- background-color: rgba(255, 255, 255, 0.1);
- color: #fff;
- }
- .watchList {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- min-height: 100px;
- overflow-y: scroll;
- }
- .watchList li {
- width: 100%;
- padding-left: 5%;
- padding-right: 5%;
- padding-top: 5px;
- padding-bottom: 5px;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- background-color: rgba(255, 255, 255, 0.29);
- color: #fff;
- border-radius: 9px;
- font-size: 12px;
- margin-bottom: 5px;
- }
- .watchList li em {
- float: right;
- text-align: right;
- }
- </style>
|