审查视图

html/my/my_pressure.html 12.7 KB
dl authored
1 2 3 4 5 6 7 8 9
<!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>
10 11
    <link rel="stylesheet" href="../../assets/css/jeDate-test.css">
    <link rel="stylesheet" href="../../assets/css/jedate.css">
李洪娟 authored
12 13 14
    <link rel="stylesheet" href="../../assets/css/demos.css">
    <link rel="stylesheet" href="../../assets/css/weui.min.css">
dl authored
15 16 17 18
    <link rel="stylesheet" href="../../assets/css/api.css"/>
    <link rel="stylesheet" href="../../assets/css/my_f.css"/>
    <link rel="stylesheet" href="../../assets/css/style.css">
    <link rel="stylesheet" href="../../assets/icon/iconfont.css">
19
李洪娟 authored
20
dl authored
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
    <title></title>
    <style>
        body, html {
            background-color: #f4f4f4;
            height: 100%;
        }

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

        .data_item_right {
            font-size: 14px;
            color: #A09F9F;
            display: flex;
            align-items: center;
李洪娟 authored
45
            justify-content: center;
dl authored
46 47 48
        }

        .data_item_right input {
李洪娟 authored
49 50
            text-align: center;
            padding-left: 0.5rem;
dl authored
51 52
            color: #A09F9F;
            flex: 1;
李洪娟 authored
53
dl authored
54 55 56 57
        }

        .data_box {
            background-color: #fff;
58 59 60
            /*display:flex;*/
            /*justify-content:space-between;*/
            /*align-items: center;*/
dl authored
61 62 63 64 65 66
        }

        .icon-xiangyou {
            color: #C0C0C0;
            margin-left: 0.16rem;
        }
李洪娟 authored
67 68 69
        #jedate{
            left:0.5rem
        }
70 71 72 73 74
        #chosetime{
            outline:none;
            /*!*height:0.68rem;*!*/
            border:none;
        }
dl authored
75 76 77 78 79 80
    </style>
</head>
<body>
<div id="loadStart"></div>
<div id="app">
    <div class="data_box">
81
        <div class="data_item"><span>测量时间</span>
82 83 84 85
            <!--<div class="data_item_right"><span>{{date_info?date_info:default_date}}</span>-->
                <!--&lt;!&ndash;<span class="iconfont icon-xiangyou"></span>&ndash;&gt;-->
            <!--</div>-->
            <div class="data_item_right">
86 87 88
                <div class="date_box" >
                    <!--<div class="jeinpbox" style="width:95%"><input type="text" class="jeinput" id="test04" v-model="default_date" placeholder="请选择测量时间" style="width:96%;outline:none;border:none"  readonly></div>-->
                    <input type="datetime-local" id="chosetime" placeholder="请选择测量时间">
李洪娟 authored
89
                </div>
90
                <p class="iconfont icon-xiangyou"></p>
dl authored
91 92 93 94 95 96 97 98 99 100 101 102 103
            </div>
        </div>
        <div class="data_item" @click="choose_high">
            <span>高压(收缩压)</span>
            <div class="data_item_right"><span>{{high}}</span><span class="iconfont icon-xiangyou"></span></div>
        </div>
        <div class="data_item" @click="choose_low">
            <span>低压(舒张压)</span>
            <div class="data_item_right"><span>{{low}}</span><span class="iconfont icon-xiangyou"></span></div>
        </div>
        <div class="data_item">
            <span>心率</span>
            <div class="data_item_right">
李洪娟 authored
104
                <input type="number" placeholder="" v-model="heart_num" style="width:1.5rem">
dl authored
105 106 107 108 109 110 111 112 113 114
                <span>次/分钟</span>
                <span class="iconfont icon-xiangyou"></span>
            </div>

        </div>
    </div>
    <div class="save_btn" @click="save_data">保存</div>
</div>
</body>
</html>
115 116 117
<script type="text/javascript" src="../../assets/js/jquery-2.1.4.js"></script>
<script type="text/javascript" src="../../assets/js/fastclick.js"></script>
<script type="text/javascript" src="../../assets/js/jquery-weui.js"></script>
dl authored
118
<script type="text/javascript" src="../../assets/js/api.js"></script>
119
dl authored
120 121
<script type="text/javascript" src="../../assets/js/public.js"></script>
<script type="text/javascript" src="../../assets/js/fastclick.js"></script>
李洪娟 authored
122
dl authored
123 124
<script>
    new FastClick(document.body);
李洪娟 authored
125
dl authored
126
</script>
李洪娟 authored
127
dl authored
128 129 130 131
<script type="text/javascript" src="../../assets/js/vue.min.js"></script>
<script type="text/javascript" src="../../assets/js/weui.min.js"></script>
<script type="text/javascript" src="../../assets/js/axios.min.js"></script>
<script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
132 133
<script type="text/javascript" src="../../assets/js/index.js"></script>
<script type="text/javascript" src="../../assets/js/datePicker.js"></script>
李洪娟 authored
134
<script type="text/javascript" src="../../assets/js/jquery-1.10.1.min.js"></script>
135
<!--<script type="text/javascript" src="../../assets/js/mypressure.js"></script>-->
dl authored
136
李洪娟 authored
137
<script type="text/javascript" src="../../assets/js/jedate.js"></script>
138
<!--<script type="text/javascript" src="../../assets/js/demo.js"></script>-->
dl authored
139 140

李洪娟 authored
141
<script>
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333
    var app = new Vue({
        el: '#app',
        data: {
            year: '',
            month: '',
            day: '',
            hour: '',
            minute: '',
            date_info: '',
            default_date: '',
            popupVisible: false,
            high_list: [],
            low_list: [],
            high: '请选择高压(mmHg)',
            low: '请选择低压(mmHg)',
            heart_num: '',
            rid: ''
        },
        created: function () {
            // apiready = function () {
            // app.rid = api.pageParam.rid;
            this.rid=localStorage.getItem("rid");
            console.log(this.rid)
            this.getPressure();
            for (var i = 0; i < 300; i++) {
                this.high_list.push({
                    "label": i,
                    "value": i,
                })
            }
            // }
        },
        methods: {
            // 日期选择

            // dateSelect: function () {
            //     // if (api.systemType == 'ios') {
            //     //     api.openPicker({
            //     //         type: 'date_time',
            //     //         date: new Date(),
            //     //         maxDate: getTimeDetil(0),
            //     //         title: '测量时间'
            //     //     }, function (ret, err) {
            //     //         if (ret) {
            //     //             app.year = ret.year;
            //     //             app.month = ret.month;
            //     //             app.day = ret.day;
            //     //             app.hour = ret.hour;
            //     //             app.minute = ret.minute;
            //     //             app.date_info = app.year + '-' + add0(app.month) + '-' + add0(app.day) + ' ' + add0(app.hour) + ':' + add0(app.minute);
            //     //             if (checkDate(app.date_info, 2)) {
            //     //                 return app.date_info
            //     //             } else {
            //     //                 toastMsg('请选择正确的测量时间');
            //     //                 return app.date_info = ''
            //     //             }
            //     //         } else {
            //     //             console.log(err)
            //     //         }
            //     //     });
            //     // }
            //     // else {
            //     //     api.openPicker({
            //     //         type: 'date',
            //     //         title: '测量时间',
            //     //     }, function (ret, err) {
            //     //         if (ret) {
            //     //             app.year = ret.year;
            //     //             app.month = ret.month;
            //     //             app.day = ret.day;
            //     //             api.openPicker({
            //     //                 type: 'time',
            //     //                 title: '测量时间'
            //     //             }, function (rets, errs) {
            //     //                 if (rets) {
            //     //                     app.hour = rets.hour;
            //     //                     app.minute = rets.minute;
            //     //                     app.date_info = app.year + '-' + add0(app.month) + '-' + add0(app.day) + ' ' + add0(app.hour) + ':' + add0(app.minute);
            //     //                     if (checkDate(app.date_info, 2)) {
            //     //                         return app.date_info
            //     //                     } else {
            //     //                         toastMsg('请选择正确的测量时间');
            //     //                         return app.date_info = ''
            //     //                     }
            //     //                 } else {
            //     //                     console.log(errs)
            //     //                 }
            //     //             });
            //     //         } else {
            //     //             console.log(err)
            //     //         }
            //     //     });
            //     // }
            // },
            // 选择高压
            choose_high: function () {
                var app=this;
                weui.picker(app.high_list, {
                    onChange: function (result) {

                    },
                    onConfirm: function (result) {
                        app.high = result[0].label;
                    }
                });

            },
            // 选择低压
            choose_low: function () {
                var app=this;
                weui.picker(app.high_list, {
                    onChange: function (result) {

                    },
                    onConfirm: function (result) {
                        app.low = result[0].label;
                    }
                });
            },
            // 保存数据
            save_data: function () {
                var app=this;
                app.default_date=$("#test04").val();

                if (app.default_date == '') {
                    toastMsg('请选择测量时间')
                }
                else if (app.high == '请选择高压(mmHg)') {
                    toastMsg('请选择高压数据')
                }
                else if (app.low == '请选择低压(mmHg)') {
                    toastMsg('请选择低压')
                } else if (app.heart_num == '') {
                    toastMsg('请输入心率')
                }
                else {
                    var header = {
                        "XX-Device-Type": getDevice(),
                        'XX-Token': getToken()
                    };
                    var post = {
                        rid: app.rid,
                        time: app.date_info,
                        data: app.high + '/' + app.low,
                        type: 2,
                        rate: app.heart_num
                    };
                    getRequest('post', 'user/index/setBoolData', post, header).then(function (res) {

                        // alert(JSON.stringify(res))
                        if (res.data.code == 1) {
                            toastMsg('记录成功!');
                            setTimeout(function () {
                                api.sendEvent({
                                    name: 'pressure',
                                });
                                api.closeWin()
                            }, 1000);
                        } else {
                            toastMsg(res.msg)
                        }
                    })
                }
            },
            getPressure: function () {
                var app=this;
                var rid=localStorage.getItem("rid")

                var header = {
                    "XX-Device-Type": getDevice(),
                    'XX-Token': getToken()
                };
                var post = {
                    rid: rid,
                    type: 2
                };
                getRequest('post', 'user/index/getLastBoolData', post, header).then(function (res) {
                    console.log(res.data.data.high)
                    // alert(JSON.stringify(res))
                    if (res.data.code == 1) {
                        app.date_info = res.data.data.time;
                        app.high = res.data.data.high;
                        app.low = res.data.data.low;
                        app.heart_num = res.data.data.rate;
                    } else {
                        toastMsg(res.data.msg)
                    }
                    loadEnd()
                })
            }
        }
    })
李洪娟 authored
334
dl authored
335
</script>