my_healthData.html 6.0 KB
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <script src="../../assets/js/fontsize.js"></script>
    <link rel="stylesheet" href="../../assets/css/api.css"/>
    <link rel="stylesheet" href="../../assets/css/my_f.css"/>
    <link rel="stylesheet" href="../../assets/icon/iconfont.css">
    <title></title>
    <style>
        body, html {
            background-color: #f4f4f4;
            height: 100%;
        }

        .data_item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin: 0 0.55rem 0 0.37rem;
            background-color: #fff;
            padding: 0.2rem 0.27rem;
            font-size: 16px;
            color: #A09F9F;
            border-bottom: 1px solid #fafafa;
        }

        .data_item:active {
            background-color: rgba(0, 0, 0, 0.1);
        }

        .data_item_right {
            font-size: 13px;
            color: #424242;
        }

        .data_box {
            background-color: #fff;
        }

        .icon-xiangyou {
            color: #C0C0C0;
            margin-left: 0.16rem;
        }
    </style>
</head>
<body>
<div id="loadStart"></div>
<div id="app" v-cloak>
    <div class="data_box">
        <div class="data_item" @click="openSugar"><span>血糖</span>
            <div class="data_item_right"><span>{{sugar_data}}mmol/L</span><span class="iconfont icon-xiangyou"></span>
            </div>
        </div>
        <div class="data_item" @click="openPress"><span>血压</span>
            <div class="data_item_right"><span>{{puser_data}}mmHg</span><span class="iconfont icon-xiangyou"></span>
            </div>
        </div>
        <div class="data_item" @click="open_des('病历材料','病例日期','疾病类别','医院名称',1)"><span>增加病历材料</span>
            <div class="data_item_right"><span>专家帮您简析病因</span><span class="iconfont icon-xiangyou"></span></div>
        </div>
        <div class="data_item" @click="open_des('体检报告','体检日期','体检名称','体检机构',2)"><span>增加体检报告</span>
            <div class="data_item_right"><span>专家帮您解析体检报告</span><span class="iconfont icon-xiangyou"></span></div>
        </div>
        <div class="data_item" @click="open_des('检验报告','检验日期','检验名称','检验机构',3)"><span>增加检验报告</span>
            <div class="data_item_right"><span>专家帮您解析检验报告</span><span class="iconfont icon-xiangyou"></span></div>
        </div>
    </div>
</div>
</body>
</html>
<script type="text/javascript" src="../../assets/js/api.js"></script>
<script type="text/javascript" src="../../assets/js/public.js"></script>
<script type="text/javascript" src="../../assets/js/fastclick.js"></script>
<script>
    new FastClick(document.body);
</script>
<script type="text/javascript" src="../../assets/js/vue.min.js"></script>
<script type="text/javascript" src="../../assets/js/axios.min.js"></script>
<script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            type: '',
            value: 0,
            high: '0',
            low: '0',
            sugar_data: '0',
            puser_data: '0/0',
            rid: ''
        },
        created: function () {

            // apiready = function () {
                // var app = this;
               // app.rid = api.pageParam.rid;
                this.rid = localStorage.getItem('rid');
                this.healthData();
                // api.addEventListener({
                //     name: 'sugar'
                // }, function (ret, err) {
                //     app.healthData();
                // });
                // api.addEventListener({
                //     name: 'pressure'
                // }, function (ret, err) {
                //     app.healthData();
                // });
            // }
        },
        methods: {
            // 记录血压
            openPress: function () {
                var app = this;
                openView('my_pressure', '../my/my_pressure', '手动血压记录', 'my_pressure', false, {rid: app.rid})
            },
            // 记录血糖
            openSugar: function () {
                var app = this;
                openView('my_sugar', '../my/my_sugar', '记血糖', 'my_sugar', false, {rid: app.rid})
            },
            // 增加报告
            open_des: function (name, date_type, type_name, type_home, type_id) {
                var app = this;
                openView('my_report', '../my/my_report', name, 'my_report', false, {
                    date_type: date_type,
                    type_name: type_name,
                    type_home: type_home,
                    type_id: type_id,
                    rid: app.rid
                })
            },
            // 获取血糖,血压
            healthData: function () {
                var app = this;
                var post = {
                    rid: app.rid
                };
                var header = {
                    "XX-Device-Type": getDevice(),
                    'XX-Token': getToken()
                };
                getRequest('post', 'user/index/healthData', post, header).then(function (res) {
                    console.log(res);
                    if (res.data.code == 1) {
                        var puser_data = res.data.data.puser.data;
                        var suger_data = res.data.data.suger.data;
                        app.sugar_data = !isNaN(suger_data) ? res.data.data.suger.data : 0;
                        app.puser_data = !isNaN(puser_data) ? res.data.data.puser.data : 0/0;
                    }
                    loadEnd();

                })
            }
        }
    })