|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- <!doctype html>
- <html>
-
- <head>
- <meta charset="UTF-8">
- <title></title>
- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
- <link href="css/mui.min.css" rel="stylesheet" />
- <link href="css/style.css" rel="stylesheet" />
- <link rel="stylesheet" type="text/css" href="css/mui.picker.min.css" />
- <style type="text/css">
- #username,
- #sex,
- #birth,
- #phone,
- #gexin {
- margin-right: 40px;
- white-space: normal;
- margin-left: 100px;
- }
-
- .mui-content-padded {
- margin-top: 25px;
- }
-
- .mui-btn {
- padding: 10px;
- }
- </style>
- <script src="js/mui.min.js"></script>
- <script type="text/javascript" src="js/serverurl.js"></script>
- <script type="text/javascript" src="js/userinfos.js"></script>
- <script type="text/javascript" src="js/tools.js"></script>
- <script src="js/mui.picker.min.js"></script>
- <script type="text/javascript">
- function OpenSexPicker() {
- userPicker.show(function(items) {
- document.getElementById("sex").innerText = items[0].text;
- document.getElementById("hidsex").value = items[0].value;
- });
- }
-
- function RefreshUserInfo() {
- mui.post(api + '/user/getStuByUserId', {
- data: users.ID
- }, function(des) {
- if (des.code == "200") {
- SetLogin(des.data)
- plus.webview.currentWebview().close();
- plus.nativeUI.toast("修改成功。");
- }
- }, 'json')
- }
-
- function OpenSelectedDate(inputobj, typename) {
- var optionsJson = '{"type":"' + typename + '","beginYear":1910,"endYear":2100}';
- var options = JSON.parse(optionsJson);
- var picker = new mui.DtPicker(options);
- picker.show(function(rs) {
- //input赋值
- document.getElementById(inputobj).innerText = rs.text;
- if (typename == "date") {
- document.getElementById(inputobj + "Text").innerText = rs.text;
- }
- picker.dispose();
- });
- }
- var userPicker;
- function jsonDateFormatDateTime(strDate) { //json日期格式转换为正常格式
- if(strDate != undefined && strDate != null) {
- var date = eval('new Date(' + strDate.replace(/\d+(?=-[^-]+$)/,
- function(a) {
- return parseInt(a, 10) - 1;
- }).match(/\d+/g) + ')');
- return formatDateTime(date);
- } else {
- return '';
- }
- }
- mui.plusReady(function() {
- if (CheckLogin()) {
- document.getElementById("username").innerText = users.username;
- document.getElementById("ids").innerText = users.ids;
- document.getElementById("hidsex").value = users.sex;
- document.getElementById("sex").innerText = users.sexname;
- document.getElementById("birth").innerText = jsonDateFormatDateTime(users.birth);
- document.getElementById("phone").innerText = users.phone;
- if (users.photo != undefined && users.photo != null) {
- document.getElementById("photo").src = web + '/' + users.photo;
- //document.getElementById("hidphoto").value = users.photo;
- }
- userPicker = new mui.PopPicker();
- GetDictionaryData(userPicker, "usersex");
- //头像
- mui(".mui-table-view-cell").on("tap", "#head", function(e) {
- var a = [{
- title: "拍照"
- }, {
- title: "从手机相册选择"
- }];
- plus.nativeUI.actionSheet({
- title: "修改头像",
- cancel: "取消",
- buttons: a
- }, function(b) {
- switch (b.index) {
- case 0:
- break;
- case 1:
- getImage();
- break;
- case 2:
- galleryImg();
- break;
- default:
- break
- }
- })
- });
- //性别
- mui(".mui-table-view-cell").on("tap", "#asex", function(e) {
- e.detail.gesture.preventDefault();
- OpenSexPicker();
- });
- //出生年月
- mui(".mui-table-view-cell").on("tap", "#abirth", function(e) {
- e.detail.gesture.preventDefault();
- OpenSelectedDate("birth", "month");
- });
- //身份证
- mui(".mui-table-view-cell").on("tap", "#aid", function(e) {
- e.detail.gesture.preventDefault();
- var btnArray = ['确定', '取消'];
- mui.prompt('请输入您的身份证号:', '您的身份证号', '修改身份证号', btnArray, function(e) {
- if (e.index == 0) {
- if (!isIdCardNo(e.value)) {
- plus.nativeUI.toast("请您填写正确的身份证号。");
- } else {
- document.getElementById("ids").innerText = e.value;
- }
- } else {
-
- }
- });
- });
- document.getElementById("saveuserinfo").addEventListener("tap", function() {
- // var xhr = new plus.net.XMLHttpRequest();
- // xhr.responseType = "json";
- // xhr.onreadystatechange = function() {
- // switch(xhr.readyState) {
- // case 4:
- // if(xhr.status == 200) {
- // plus.nativeUI.closeWaiting();
- // if(xhr.response.result == "ok") {
- // plus.webview.currentWebview().opener().evalJS("document.getElementById('username').innerText='" + document.getElementById('username').innerText + "';");
- // plus.webview.currentWebview().opener().evalJS("document.getElementById('phone').innerText='" + document.getElementById('phone').innerText + "';");
- // plus.webview.currentWebview().opener().evalJS("document.getElementById('photo').src='" + serverdomain + '/' + document.getElementById('hidphoto').value + "';");
- // RefreshUserData();
- // plus.webview.currentWebview().close();
- // plus.nativeUI.toast("修改成功。");
- // } else {
- // plus.nativeUI.toast("操作失败,请重试。");
- // }
- // } else {
- // plus.nativeUI.closeWaiting();
- // plus.nativeUI.toast("操作失败,请重试。");
- // }
- // break;
- // default:
- // break;
- // }
- // }
- // xhr.open("GET", encodeURI(serverdomain + "/WebService/UserService.ashx?Action=teacherModify&content={'mobile':'" + document.getElementById("phone").innerText +
- // "','photo':'" + document.getElementById("hidphoto").value +
- // "','realName':'" + document.getElementById("username").innerText +
- // "','sexID':'" + document.getElementById("hidsex").value +
- // "','birthDate':'" + document.getElementById("birth").innerText + "','ids':'" + document.getElementById("ids").value + "'}"));
- // xhr.send();
- plus.nativeUI.showWaiting("加载中..."); //
- var param = {
- sex: document.getElementById("hidsex").value, //
- ids: document.getElementById("ids").innerText,
- birthday: document.getElementById("birth").innerText,
- id: users.ID
- }
- mui.post(api + '/user/updateStuByStuTerminal', {
- data: JSON.stringify(param)
- }, function(res) {
- plus.nativeUI.closeWaiting();
- if (res.code == "200") {
- RefreshUserInfo()
- }
- }, 'json')
- });
- }
- });
- </script>
- </head>
-
- <body>
- <header class="mui-bar mui-bar-nav">
- <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
- <h1 class="mui-title">个人信息</h1>
- </header>
- <div class="mui-content">
- <div class="mui-scroll-wrapper kuang">
- <div class="mui-scroll">
- <ul class="mui-table-view">
- <li class="mui-table-view-cell">
- <a id="head" class="mui-navigate-right">头像
- <span class="mui-pull-right head">
- <img class="head-img rightph" id="photo" src="images/user-photo.png" />
- <input type="hidden" id="hidphoto" />
- </span>
- </a>
- </li>
- <li class="mui-table-view-cell">
- <a id="ausername">姓名<span class="mui-pull-right " id="username"></span></a>
- </li>
- <li class="mui-table-view-cell">
- <input type="hidden" id="hidsex" />
- <a id="asex">性别<span class="mui-pull-right mui-navigate-right" id="sex">女</span></a>
- </li>
- <li class="mui-table-view-cell">
- <a id="abirth">出生年月<span class="mui-pull-right mui-navigate-right" id="birth"></span></a>
- </li>
- <li class="mui-table-view-cell">
- <a id="aid">身份证号<span class="mui-pull-right " id="ids" maxlength="18" min="15"></span></a>
- </li>
- <li class="mui-table-view-cell">
- <a id="aphone">手机号<span class="mui-pull-right " id="phone"></span></a>
- </li>
- </ul>
- <div class="mui-content-padded">
- <button id='saveuserinfo' class="mui-btn mui-btn-block mui-btn-primary">保存</button>
- </div>
- </div>
- </div>
-
- </div>
-
- </body>
-
- </html>
|