|
- <!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 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;
- mui.plusReady(function() {
- if(CheckLogin()) {
- document.getElementById("username").innerText = users.username;
- document.getElementById("hidsex").value = users.sex;
- document.getElementById("sex").innerText = users.sexname;
- document.getElementById("birth").innerText = 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;
- }
- document.getElementById("gexin").innerText = users.gexin;
- 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", "#ausername", function(e) {
- e.detail.gesture.preventDefault();
- var btnArray = ['确定', '取消'];
- mui.prompt('请输入您的新姓名:', '您的姓名', '修改姓名', btnArray, function(e) {
- if(e.index == 0) {
- document.getElementById("username").innerText = e.value;
- } else {}
- })
- });
- //性别
- 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", "#aphone", function(e) {
- e.detail.gesture.preventDefault();
- var btnArray = ['确定', '取消'];
- mui.prompt('请输入您的新手机:', '您的手机', '修改手机', btnArray, function(e) {
- if(e.index == 0) {
- document.getElementById("phone").innerText = e.value;
- } else {
-
- }
- })
- });
- //个性签名
- mui(".mui-table-view-cell").on("tap", "#agexin", function(e) {
- e.detail.gesture.preventDefault();
- var btnArray = ['确定', '取消'];
- mui.prompt('请输入您的新个性签名:', '您的个性签名', '修改个性签名', btnArray, function(e) {
- if(e.index == 0) {
- document.getElementById("gexin").innerText = e.value;
- } else {
-
- }
- })
- });
- document.getElementById("saveuserinfo").addEventListener("tap", function() {
-
-
- var param={
- id:users.ID,
- photo:document.getElementById("phone").innerText,
- realName:document.getElementById("username").innerText,
- sexID:document.getElementById("hidsex").value,
- remark:document.getElementById("gexin").innerText,
- birthDate:document.getElementById("birth").innerText//
- }
- console.log(JSON.stringify(param))//
- mui.post(api+'/user/updatetea',{data:JSON.stringify(param)},function(res){
- plus.nativeUI.closeWaiting();
- if(res.code=="200"){
- 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 + "';");
- users.username=param.realName;
- users.phone=param.photo;
- users.sexid=param.sexID;
- users.gexin=param.remark;
- users.birth=param.birthDate;
- localStorage.setItem('taigangteacherUserModel', JSON.stringify(users));//
- RefreshUserData();
- plus.webview.currentWebview().close();
- plus.nativeUI.toast("修改成功。");
- }
- },'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 mui-navigate-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="aphone">手机号<span class="mui-pull-right mui-navigate-right" id="phone"></span></a>
- </li>
- <li class="mui-table-view-cell">
- <a id="agexin">个性签名<span class="mui-pull-right mui-navigate-right" id="gexin"></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>
|