审查视图

html/my/my_detail.html 30.6 KB
dl authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
<!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">
    <title></title>
    <script src="../../assets/js/fontsize.js"></script>
    <link rel="stylesheet" href="../../assets/css/weui.min.css">
    <link rel="stylesheet" href="../../assets/css/api.css"/>
    <link rel="stylesheet" href="../../assets/css/style.css">
    <link rel="stylesheet" href="../../assets/css/pay_form_f.css">
    <link rel="stylesheet" href="../../assets/icon/iconfont.css">
    <style>
        body {
            /*padding-bottom: 1rem;*/
        }

        .detail_top {
            margin: 0 0.46rem;
        }

        .detail_item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 14px;
            color: #999797;
            border-bottom: 1px solid #f2f2f2;
            padding: 0 0.25rem;
        }

        .detail_item_img {
            height: 0.45rem;
            width: 0.45rem;
            display: flex;
            justify-content: center;
            align-items: center;
            border-radius: 50%;
            overflow: hidden;
        }

        .detail_item img {
            width: 100%;
        }

        .detail_item_right {
            display: flex;
            align-items: center;
朱振飞 authored
52
            position: relative;
dl authored
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
        }

        .detail_item_right .iconfont {
            color: #C0C0C0;
            font-size: 12px;
        }

        .detail_item_right .detail_item_input {
            color: #999797;
        }

        .detail_item_right .detail_item_input input {
            text-align: right;
            color: #999797;
            padding: 0.3rem 0;
        }

        .detail_item_right .detail_item_input input::-webkit-input-placeholder {
            color: #999797;
            /*font-size: 10px;*/
            text-align: right;
        }

        .detail_item label, .detail_item span {
            color: #999797;
            padding: 0.3rem 0;
            margin: 0;
        }

        .detail_item ul li {
            font-size: 15px;
        }

        .detail_item:last-child {
            margin-bottom: 1rem;
        }

        .save_person {
            position: fixed;
            /*margin: 0.3rem 0 0 0;*/
        }
朱振飞 authored
94 95 96 97 98 99 100 101
        .img_input{
            position: absolute;
            width: 100%;
            height: 100%;
            left: 0;
            top: 0;
            opacity: 0;
        }
dl authored
102 103 104 105 106 107 108 109 110

    </style>
</head>
<body>
<div id="loadStart"></div>
<div id="app" v-cloak>
    <div class="detail_top">
        <div class="detail_item">
            <div>头像</div>
朱振飞 authored
111
            <div class="detail_item_right" >
dl authored
112 113 114 115
                <span class="detail_item_img padding0">
                    <img :src="head_img?head_img:'../../assets/image/default_img.png'" alt="">
                </span>
                <span class="iconfont icon-xiangyou"></span>
朱振飞 authored
116
                <input type="file"  @change="takePhotos"  accept="image/jpeg,image/x-png,image/gif" id="" value=""  class="img_input">
dl authored
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
            </div>
            <mt-popup v-model="popupVisible_head_img" position="bottom">
                <ul class="moreoul">
                    <li @click="takePhotos('camera')">拍照</li>
                    <li @click="takePhotos('album')">从相册中选择</li>
                    <li @click="popupVisible_head_img=false" style="border-top: 2px solid #f0f0f0">取消</li>
                </ul>
            </mt-popup>
        </div>
        <form action="">
            <div class="detail_item">
                <div>姓名</div>
                <div class="detail_item_right">
                    <div class="detail_item_input"><input type="text" placeholder="请输入姓名" v-model="name"></div>
                    <span class="iconfont icon-xiangyou"></span></div>
            </div>
            <div class="detail_item">
                <div>性别</div>
                <div class="detail_item_right">
                    <div class="service_input sex_box">
                        <div class="female">
                            <input type="radio" id="male" name="sex" :checked="checked_male"
                                   @click="checked_male=!checked_male"/>
                            <label for="male"></label>
                        </div>
                        <div class="male">
                            <input type="radio" id="female" name="sex" :checked="!checked_male"
                                   @click="checked_male=!checked_male"/>
                            <label for="female"></label>
                        </div>
                    </div>
                    <span class="iconfont icon-xiangyou"></span>
                </div>
            </div>
            <div class="detail_item">
                <div>手机号</div>
                <div class="detail_item_right">
                    <div class="detail_item_input"><input type="number" placeholder="请输入手机号" v-model.trim="phone"></div>
                    <span class="iconfont icon-xiangyou"></span>
                </div>
            </div>
朱振飞 authored
158
            <div class="detail_item" @click="broSelect" id="broDate">
dl authored
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
                <div>生日</div>
                <div class="detail_item_right">
                    <div class="detail_item_input">
                        <span>{{broth_info}}</span>
                    </div>
                    <span class="iconfont icon-xiangyou"></span></div>
            </div>
            <div class="detail_item">
                <div>身份证号</div>
                <div class="detail_item_right">
                    <div class="detail_item_input"><input type="text" placeholder="请输入身份证号" v-model="idcard"></div>
                    <span class="iconfont icon-xiangyou"></span>
                </div>
            </div>
            <div class="detail_item" @click="heightSelect">
                <div>身高</div>
                <div class="detail_item_right">
                    <div class="detail_item_input"><span>{{height}}</span></div>
                    <span class="iconfont icon-xiangyou"></span>
                </div>
            </div>
            <div class="detail_item" @click="weightSelect">
                <div>体重</div>
                <div class="detail_item_right">
                    <div class="detail_item_input"><span>{{weight}}</span>
                        <span class="iconfont icon-xiangyou"></span>
                    </div>
                </div>
            </div>
            <div class="detail_item" @click="getMarry">
                <div>婚姻状态</div>
                <div class="detail_item_right">
                    <span v-if="merry==1">已婚</span>
                    <span v-else-if="merry==0">未婚</span>
                    <span v-else></span>
                    <span class="iconfont icon-xiangyou"></span>
                </div>
            </div>
            <div class="detail_item" v-if="type!=0||user_type_name=='亲友资料'" @click="relation_fun">
                <div>亲友关系</div>
                <div class="detail_item_right">
                    <div class="detail_item_input"><span>{{relation}}</span></div>
                    <span class="iconfont icon-xiangyou"></span>
                </div>
            </div>
            <div class="detail_item" v-else @click="educations">
                <div>文化程度</div>
                <div class="detail_item_right">
                    <div class="detail_item_input"><span>{{education}}</span></div>
                    <span class="iconfont icon-xiangyou"></span>
                </div>
            </div>
            <div class="detail_item" @click="getPosition">
                <div>职业</div>
                <div class="detail_item_right">
                    <div class="detail_item_input"><span>{{pro}}</span></div>
                    <span class="iconfont icon-xiangyou"></span>
                </div>
            </div>
            <div class="detail_item" @click="doctors">
                <div>医保类型</div>
                <div class="detail_item_right">
                    <div class="detail_item_input"><span>{{doctor}}</span></div>
                    <span class="iconfont icon-xiangyou"></span>
                </div>
            </div>
        </form>
    </div>
    <div class="save_btn save_person" @click="setPersonal" v-if="type==0">保存</div>
    <div class="save_btn save_person" @click="newRecord" v-else>添加</div>
</div>
</body>
</html>
<script type="text/javascript" src="../../assets/js/api.js"></script>
<script type="text/javascript" src="../../assets/js/vue.min.js"></script>
<script type="text/javascript" src="../../assets/js/index.js"></script>
<script type="text/javascript" src="../../assets/js/weui.min.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/axios.min.js"></script>
<script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
朱振飞 authored
243
<script type="text/javascript" src="../../assets/js/datePicker.js"></script>
dl authored
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
<script>
    var app = new Vue({
        el: '#app',
        data: {
            checked_male: true,
            broth_info: '',
            default_bro: '',
            education: '',
            education_value: '',
            pro: '',
            pro_value: '',
            doctor: '',
            doctor_value: '',
            popupVisible_head_img: false,
            weight_list: [],
            weight: '',
            head_img: '',
            name: '',
            phone: '',
            idcard: '',
            getCulture_data: [],//文化程度
            getMedical_data: [],//医保类型
            rid: '',
            user_info: [],
            height_list: [],
            height: '',
            position_list: [],
            type: '',
            merry_list: [
                {
                    "label": '未婚',
                    "value": 0,
                },
                {
                    "label": '已婚',
                    "value": 1,
                },
            ],
            merry: -1,
            merry_value: '',
            relationShip: [],
            relation: '',
            relation_value: '',
            user_type_name: ''
        },
        created: function () {
朱振飞 authored
290 291 292 293 294 295 296 297 298 299 300 301 302 303
            var app = this;
            for (var i = 0; i < 300; i++) {
                app.weight_list.push({
                    "label": i + 'kg',
                    "value": i,
                })
            }
            for (var j = 50; j < 300; j++) {
                app.height_list.push(
                    {
                        "label": j + 'cm',
                        "value": j,
                    }
                )
dl authored
304
            }
朱振飞 authored
305 306 307 308 309 310 311 312 313 314 315
            app.user_type_name = localStorage.getItem('name');
            app.rid = localStorage.getItem('rid');
            // alert(app.rid)
            app.type = localStorage.getItem('type');
            if (app.type == 0) {
                app.getUserinfo();
            }
            app.getJob();
            app.getCulture();
            app.getMedical();
            app.getRelationship();
dl authored
316 317 318 319
        },
        methods: {
            // 获取个人信息
            getUserinfo: function () {
朱振飞 authored
320
                var app = this;
dl authored
321 322 323 324 325 326 327 328 329 330 331
                var post = {
                    rid: app.rid
                };
                var header = {
                    "XX-Device-Type": getDevice(),
                    "XX-Token": getToken()
                };
                getRequest('post', 'user/index/getUserRecord', post, header).then(function (res) {
                    if (res.data.code == 1) {
                        // alert(JSON.stringify(res));
                        app.user_info = res.data.data;
朱振飞 authored
332
                        app.head_img = 'http://wx.cijievip.com/'+app.user_info.avatar;
dl authored
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355
                        app.name = app.user_info.name ? app.user_info.name : '';
                        app.user_info.sex == 1 ? app.checked_male = true : app.checked_male = false;
                        app.phone = app.user_info.mobile;
                        app.broth_info = app.user_info.birthday ? timestampToTime(app.user_info.birthday, 1) : '';
                        app.idcard = app.user_info.idcard;
                        app.merry = app.user_info.marry;
                        app.pro = app.user_info.job_name ? app.user_info.job_name : '';
                        app.education_value = app.user_info.culture;
                        app.pro_value = app.user_info.job;
                        app.doctor_value = app.user_info.medical;
                        app.height = app.user_info.height ? app.user_info.height + 'cm' : '';
                        app.weight = app.user_info.weight ? app.user_info.weight + 'kg' : '';
                        app.doctor = app.user_info.medical_name ? app.user_info.medical_name : '';
                        app.education = app.user_info.culture_name ? app.user_info.culture_name : '';
                        app.relation_value = app.relation;
                        app.relation = app.user_info.relation_name ? app.user_info.relation_name : '';
                        loadEnd();
                    } else {
                        // toastMsg(res.data.msg)
                    }
                })
            },
            // 选择头像
朱振飞 authored
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371
            takePhotos: function () {
                var app = this;
                var file = e.target.files[0];e
                var imgSize=file.size/1024;
                if(imgSize>200){
                    alert('请上传大小不要超过200KB的图片')
                }else{
                    var reader = new FileReader();
                    reader.readAsDataURL(file); // 读出 base64
                    reader.onloadend = function () {
                        // 图片的 base64 格式, 可以直接当成 img 的 src 属性值
                        var dataURL = reader.result;
                        // 下面逻辑处理
                        $.ajax({
                            type:"post",
                            url:baseurl + "user/index/upAvatar",
dl authored
372 373 374
                            headers: {
                                "XX-Device-Type": getDevice(),
                                "XX-Token": getToken()
朱振飞 authored
375 376 377 378 379 380 381 382 383 384 385 386
                            },
                            async:true,
                            data:{
                                avatar:dataURL,
                                avatar_wx:1,
                                token:token,
                                uid:uid
                            },
                            success:function(e){
                                that.avatar=dataURL;
                                alert('修改成功');
                                $(".tsk").show().delay(1500).hide(0);
dl authored
387
                            }
朱振飞 authored
388 389 390
                        });
                    };
                }
dl authored
391
朱振飞 authored
392 393 394 395 396 397 398
                if (ret) {
                    api.ajax({
                        url: baseurl + "user/index/upAvatar",
                        method: 'post',
                        data: {
                            files: {
                                file: ret.data
dl authored
399
                            }
朱振飞 authored
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416
                        },
                        headers: {
                            "XX-Device-Type": getDevice(),
                            "XX-Token": getToken()
                        }
                    }, function (res, err) {
                        // alert(JSON.stringify(res));
                        if (res) {
                            app.head_img = res.data.url
                        } else {

                        }
                    });
                } else {
                    // alert(JSON.stringify(err));
                    toastMsg('取消')
                }
dl authored
417 418 419
            },
            // 选择生日
            broSelect: function () {
朱振飞 authored
420
                var app = this;
朱振飞 authored
421 422 423 424 425 426 427 428 429 430 431 432 433
                var calendar = new datePicker();
                calendar.init({
                    'trigger': '#broDate', /*按钮选择器,用于触发弹出插件*/
                    'type': 'date', /*模式:date日期;datetime日期时间;time时间;ym年月;*/
                    // 'minDate':getTimeDetil(3), /*最小日期*/
                    'minDate': '', /*最小日期*/
                    'maxDate': formatDate(new Date(), 1), /*最大日期*/
                    'onSubmit': function () {/*确认时触发事件*/
                        console.log(calendar.value);
                        if (calendar.value) {
                            app.broth_info = calendar.value;
                            calendar.onClose()
                        }else {
dl authored
434 435 436
                            toastMsg('出生日期不能比今天晚');
                            return app.broth_info = app.default_bro
                        }
朱振飞 authored
437 438 439
                    },
                    'onClose': function () {/*取消时触发事件*/
                        // api.closeWin();
dl authored
440
                    }
朱振飞 authored
441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460
                })
                // api.openPicker({
                //     type: 'date',
                //     title: '选择出生日期'
                // }, function (ret, err) {
                //     if (ret) {
                //         app.bro_year = ret.year;
                //         app.bro_month = ret.month;
                //         app.bro_day = ret.day;
                //         app.broth_info = app.bro_year + '-' + add0(app.bro_month) + '-' + add0(app.bro_day);
                //         if (checkDate(app.broth_info, 2)) {
                //             return app.broth_info
                //         } else {
                //             toastMsg('出生日期不能比今天晚');
                //             return app.broth_info = app.default_bro
                //         }
                //     } else {
                //         console.log(JSON.stringify(err));
                //     }
                // });
dl authored
461 462 463
            },
            // 选择身高
            heightSelect: function () {
朱振飞 authored
464
                var app = this;
dl authored
465 466 467 468 469 470 471 472 473 474 475
                weui.picker(app.height_list, {
                    defaultValue: [170],
                    onChange: function (result) {
                    },
                    onConfirm: function (result) {
                        app.height = result[0].label;
                    }
                });
            },
            // 选择体重
            weightSelect: function () {
朱振飞 authored
476
                var app = this;
dl authored
477 478 479 480 481 482 483 484 485 486 487 488 489
                weui.picker(app.weight_list,
                    {
                        defaultValue: [50],
                        onChange: function (result) {

                        },
                        onConfirm: function (result) {
                            app.weight = result[0].label;
                        }
                    });
            },
            // 选择婚姻状况
            getMarry: function () {
朱振飞 authored
490
                var app = this;
dl authored
491 492 493 494 495 496 497 498 499 500 501
                weui.picker(app.merry_list, {
                    onChange: function (result) {
                    },
                    onConfirm: function (result) {
                        app.merry = result[0].value;
                    }
                });
            },

            // 获取文化程度
            getCulture: function () {
朱振飞 authored
502
                var app = this;
dl authored
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523
                var header = {
                    'XX-Device-Type': getDevice(),
                    'XX-Token': getToken()
                };
                getRequest('post', 'user/index/getCulture', null, header).then(function (res) {
                    // alert(JSON.stringify(res.data.data));
                    if (res.data.code == 1) {
                        for (var i in res.data.data) {
                            app.getCulture_data.push({
                                "label": res.data.data[i].culture_name,
                                "value": res.data.data[i].id,
                            })
                        }
                        // loadEnd();
                    } else {
                        toastMsg(res.data.msg)
                    }
                })
            },
            // 选择文化程度
            educations: function () {
朱振飞 authored
524
                var app = this;
dl authored
525 526 527 528 529 530 531 532 533 534 535
                weui.picker(app.getCulture_data, {
                    onChange: function (result) {
                    },
                    onConfirm: function (result) {
                        app.education = result[0].label;
                        app.education_value = result[0].value;
                    }
                });
            },
            // 获取职业
            getJob: function () {
朱振飞 authored
536
                var app = this;
dl authored
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558
                var header = {
                    'XX-Device-Type': getDevice(),
                    'XX-Token': getToken()
                };
                getRequest('post', 'user/index/getJobs', null, header).then(function (res) {
                    // alert(JSON.stringify(res.data.data));
                    if (res.data.code == 1) {
                        for (var i in res.data.data) {
                            app.position_list.push({
                                "label": res.data.data[i].name,
                                "value": res.data.data[i].id,
                            })
                        }

                        // loadEnd();
                    } else {
                        toastMsg(res.data.msg)
                    }
                })
            },
            // 选择职业
            getPosition: function () {
朱振飞 authored
559
                var app = this;
dl authored
560 561 562 563 564 565 566 567 568 569 570
                weui.picker(app.position_list, {
                    onChange: function (result) {
                    },
                    onConfirm: function (result) {
                        app.pro = result[0].label;
                        app.pro_value = result[0].value;
                    }
                });
            },
            // 获取医保类型数据
            getMedical: function () {
朱振飞 authored
571
                var app = this;
dl authored
572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592
                var header = {
                    'XX-Device-Type': getDevice(),
                    'XX-Token': getToken()
                };
                getRequest('post', 'user/index/getMedical', null, header).then(function (res) {
                    // alert(JSON.stringify(res.data.data));
                    if (res.data.code == 1) {
                        for (var i in res.data.data) {
                            app.getMedical_data.push({
                                "label": res.data.data[i].medical_name,
                                "value": res.data.data[i].id,
                            })
                        }
                        // loadEnd();
                    } else {
                        toastMsg(res.data.msg)
                    }
                })
            },
            // 选择医保类型
            doctors: function () {
朱振飞 authored
593
                var app = this;
dl authored
594 595 596 597 598 599 600 601 602 603 604 605 606
                weui.picker(app.getMedical_data,
                    {
                        onChange: function (result) {
                        },
                        onConfirm: function (result) {
                            app.doctor = result[0].label;
                            app.doctor_value = result[0].value;
                        }
                    });
            },

            // 获取亲友关系
            getRelationship: function () {
朱振飞 authored
607
                var app = this;
dl authored
608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627
                var header = {
                    'XX-Device-Type': getDevice(),
                    'XX-Token': getToken()
                };
                getRequest('post', 'user/index/getRelationship ', null, header).then(function (res) {
                    if (res.data.code == 1) {
                        for (var i in res.data.data) {
                            app.relationShip.push({
                                "label": res.data.data[i].name,
                                "value": res.data.data[i].id,
                            })
                        }
                        loadEnd();
                    } else {
                        toastMsg(res.data.msg)
                    }
                })
            },
            // 选择亲友关系
            relation_fun: function () {
朱振飞 authored
628
                var app = this;
dl authored
629 630 631 632 633 634 635 636 637 638 639 640
                weui.picker(app.relationShip,
                    {
                        onChange: function (result) {
                        },
                        onConfirm: function (result) {
                            app.relation = result[0].label;
                            app.relation_value = result[0].value;
                        }
                    });
            },
            // 添加亲友
            newRecord: function () {
朱振飞 authored
641
                var app = this;
dl authored
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782
                var post = {
                    rid: app.rid,
                    relation: app.relation_value,
                    avatar: app.head_img,
                    name: app.name,
                    sex: app.checked_male ? 1 : 0,
                    mobile: app.phone,
                    birthday: app.broth_info,
                    idcard: app.idcard,
                    height: app.height,
                    weight: app.weight,
                    marry: app.merry,
                    job: app.pro_value,
                    medical: app.doctor_value
                };
                var header = {
                    "XX-Device-Type": getDevice(),
                    "XX-Token": getToken(),
                };
                if (app.name == '') {
                    toastMsg('请输入姓名')
                } else if (!mobileReg.test(app.phone)) {
                    toastMsg('请输入正确的手机号')
                }
                else if (app.broth_info == '') {
                    toastMsg('请选择生日')
                } else if (!id_card.test(app.idcard)) {
                    toastMsg('身份证号码不正确')
                } else if (app.height == '') {
                    toastMsg('请选择身高')
                } else if (app.weight == '') {
                    toastMsg('请选择体重')
                }
                else if (app.merry == -1) {
                    toastMsg('请选择婚姻状况')
                } else if (app.relation_value == '') {
                    toastMsg('请选择亲友关系')
                } else if (app.pro_value == '') {
                    toastMsg('请选择职业')
                }
                else if (app.doctor_value == '') {
                    toastMsg('请选择医保类型')
                } else {
                    getRequest('post', 'user/index/newRecord', post, header).then(function (res) {
//                         alert(JSON.stringify(res))
                        if (res.data.code == 1) {
                            toastMsg(res.data.msg);
                            api.alert({
                                title: '添加成功',
                                msg: '继续完善信息',
                            }, function (ret, err) {
                                if (ret.buttonIndex == 1) {
                                    api.openFrame({
                                        name: 'my_health',
                                        url: './my_health.html',
                                        // bounces: true,
                                        rect: {
                                            x: 0,
                                            y: 0,
                                            w: 'auto',
                                            h: 'auto',
                                        },
                                        pageParam: {
                                            rid: res.data.data.rid
                                        }
                                    });
                                }
                            });

                        } else {
                            toastMsg(res.data.msg)
                        }
                    })
                }
            },
            // 设置信息
            setPersonal: function () {
                var post = {
                    rid: app.rid,
                    avatar: app.head_img,
                    name: app.name,
                    sex: app.checked_male ? 1 : 0,
                    mobile: app.phone,
                    birthday: app.broth_info,
                    idcard: app.idcard,
                    height: app.height,
                    weight: app.weight,
                    marry: app.merry,
                    culture: app.education_value,
                    job: app.pro_value,
                    medical: app.doctor_value
                };
                var header = {
                    "XX-Device-Type": getDevice(),
                    "XX-Token": getToken(),
                };
                if (app.name == '') {
                    toastMsg('请输入姓名')
                } else if (!mobileReg.test(app.phone)) {
                    toastMsg('请输入正确的手机号')
                }
                else if (app.broth_info == '') {
                    toastMsg('请选择生日')
                } else if (!id_card.test(app.idcard)) {
                    toastMsg('身份证号码不正确')
                } else if (app.height == '') {
                    toastMsg('请选择身高')
                } else if (app.weight == '') {
                    toastMsg('请选择体重')
                }
                else if (app.merry ==-1) {
                    toastMsg('请选择婚姻状况')
                } else if (app.education_value == '') {
                    toastMsg('请选择文化程度')
                } else if (app.pro_value == '') {
                    toastMsg('请选择职业')
                }
                else if (app.doctor_value == '') {
                    toastMsg('请选择医保类型')
                }
                else {
                    getRequest('post', 'user/index/setPersonal', post, header).then(function (res) {
                        // alert(JSON.stringify(res));
                        if (res.data.code == 1) {
                            app.user_info = res.data.data;
                            api.sendEvent({
                                name: 'changeInfo',
                            });
                            toastMsg(res.data.msg);
                            setTimeout(function () {
                                api.closeWin();
                            }, 1000)
                        } else {
                            toastMsg(res.data.msg)
                        }
                    })
                }
            },
        }
    })
</script>