|
- <!DOCTYPE html>
- <html class="ui-page-login">
-
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
- <title></title>
- <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>
- .area {
- margin: 20px auto 0px auto;
- }
-
- .mui-input-group:first-child {
- margin-top: 20px;
- }
-
- .mui-input-group label {
- width: 30%;
- text-align: center;
- }
-
- .mui-input-row label~input,
- .mui-input-row label~select,
- .mui-input-row label~textarea {
- width: 70%;
- }
-
- .mui-checkbox input[type=checkbox],
- .mui-radio input[type=radio] {
- top: 6px;
- }
-
- .mui-content-padded {
- margin-top: 25px;
- }
-
- .mui-btn {
- padding: 10px;
- }
-
- #sextext,
- #culturetext,
- #schooltext,
- #departtext,
- #provincetext {
- line-height: 40px;
- text-overflow: ellipsis;
- overflow: hidden;
- }
- </style>
- <script src="js/mui.min.js"></script>
- <script src="js/serverurl.js"></script>
- <script src="js/userinfos.js"></script>
- <script type="text/javascript" src="js/tools.js"></script>
- <script src="js/mui.picker.min.js"></script>
- <script src="js/city.data-3.js" type="text/javascript" charset="utf-8"></script>
- <script type="text/javascript">
- function OpenAndSetPicker(picker, field) {
- picker.show(function(items) {
- if (items[0].value != undefined && items[0].value != null && items[0].value != '') {
- document.getElementById(field + "text").innerText = items[0].text;
- document.getElementById(field + "id").value = items[0].value;
- if (field == "school") {
- var whcdid = document.getElementById("cultureid").value;
- if (whcdid == "") {
- plus.nativeUI.toast("请选择文化程度。");
- return;
- }
- GetDepartData(userPickerdepart, "" + items[0].value + "", "" + whcdid + "");
- }
- } else {
- plus.nativeUI.toast("当前校区暂无对应专业。");
- return false;
- }
- });
- }
- var userPickersex, userPickerculture, userPickerschool, userPickerdepart;
- var provincePicker;
- var _getParam = function(obj, param) {
- return obj[param] || '';
- };
- mui.plusReady(function() {
- var userid = plus.webview.currentWebview().userid;
-
- if (CheckLogin()) {
- userPickersex = new mui.PopPicker();
- userPickerculture = new mui.PopPicker();
- userPickerschool = new mui.PopPicker();
- userPickerdepart = new mui.PopPicker();
- var provincePicker = new mui.PopPicker({
- layer: 3
- });
- provincePicker.setData(cityData3);
- var showCityPickerButton = document.getElementById('selprovince');
- showCityPickerButton.addEventListener('tap', function(event) {
- provincePicker.show(function(items) {
-
- document.getElementById("provinceid").value = _getParam(items[0], 'text');
- document.getElementById("cityid").value = _getParam(items[1], 'text');
- document.getElementById("areaid").value = _getParam(items[2], 'text');
- document.getElementById("provincetext").innerText = _getParam(items[0], 'text') + " " + _getParam(items[1],
- 'text') + " " + _getParam(items[2], 'text');
- //返回 false 可以阻止选择框的关闭
- //return false;
- });
- }, false);
-
- GetDictionaryData(userPickersex, "usersex"); //性别
- GetDictionaryDataBySource(userPickerculture, "DegreeOfEducation"); //文化程度
- GetSchoolData(userPickerschool); //绑定校区
- document.getElementById("selsex").addEventListener("tap", function() {
- OpenAndSetPicker(userPickersex, "sex");
- });
- document.getElementById("selculture").addEventListener("tap", function() {
- OpenAndSetPicker(userPickerculture, "culture");
- });
- document.getElementById("selschool").addEventListener("tap", function() {
- OpenAndSetPicker(userPickerschool, "school");
- });
- document.getElementById("seldepart").addEventListener("tap", function() {
- OpenAndSetPicker(userPickerdepart, "depart");
- });
- document.getElementById("reg").addEventListener("tap", function() {
- if (document.getElementById("username").value == "" || document.getElementById("sexid").value == "" ||
- document.getElementById("phone").value == "" ||
- document.getElementById("address").value == "" || document.getElementById("cultureid").value == "" ||
- document.getElementById("schoolid").value == "" || document.getElementById("departid") == "" ||
- document.getElementById("paymentQuota").value == "" || document.getElementById("provinceid").value == "" ||
- document.getElementById("cityid").value == "" || document.getElementById("areaid").value == "") {
- plus.nativeUI.toast("提交失败!请您填写完整表单信息。");
- return;
- }
- if (!isIdCardNo(document.getElementById("ids").value)) {
- plus.nativeUI.toast("请您填写正确的身份证号。");
- return;
- }
- var moneytest = /^(0|[1-9]\d*|(0|[1-9]\d*)\.\d*[1-9])$/;
- if (!moneytest.test(document.getElementById("paymentQuota").value)) {
- plus.nativeUI.toast("请您填写正确的金额。");
- return;
- }
- var phonereg = /(^0?[1][3578][0-9]{9}$)/;
- if (!phonereg.test(document.getElementById("phone").value)) {
- plus.nativeUI.toast("请您填写正确的手机号。");
- return;
- }
- if (userid != undefined && userid != null) {
- plus.nativeUI.showWaiting("加载中...");
-
- var param = {
- id: userid,
- username: document.getElementById("username").value,
- sex: document.getElementById("sexid").value,
- phone: document.getElementById("phone").value,
- address: document.getElementById("address").value,
- culture: document.getElementById("cultureid").value,
- school: document.getElementById("schoolid").value,
- depart: document.getElementById("departid").value,
- paymentQuota: document.getElementById("paymentQuota").value,
- rTeacher: users.ID,
- ids: document.getElementById("ids").value,
- renarks: document.getElementById("renarks").value,
- province: document.getElementById("provinceid").value,
- city: document.getElementById("cityid").value,
- county: document.getElementById("areaid").value
- }
-
- mui.post(api + '/user/updatestu', {
- data: JSON.stringify(param)
- }, function(res) {
- plus.nativeUI.closeWaiting();
- if (res.code == "200") {
- plus.webview.currentWebview().opener().opener().evalJS('GetCount();');
- plus.webview.currentWebview().opener().evalJS('GetData(1, "tablereg");');
- plus.webview.currentWebview().close();
- plus.nativeUI.toast("修改成功。");
- }
- }, 'json')
-
- } else {
-
- var param = {
- username: document.getElementById("username").value,
- sex: document.getElementById("sexid").value,
- phone: document.getElementById("phone").value,
- address: document.getElementById("address").value,
- culture: document.getElementById("cultureid").value,
- school: document.getElementById("schoolid").value,
- depart: document.getElementById("departid").value,
- paymentQuota: document.getElementById("paymentQuota").value,
- rTeacher: users.ID,
- ids: document.getElementById("ids").value,
- renarks: document.getElementById("renarks").value,
- province: document.getElementById("provinceid").value,
- city: document.getElementById("cityid").value,
- county: document.getElementById("areaid").value
- }
-
- mui.post(api + '/user/register', {
- data: JSON.stringify(param)
- }, function(res) {
- if (res.code == "200") {
- plus.webview.currentWebview().opener().evalJS('GetCount();');
- plus.webview.currentWebview().close();
- plus.nativeUI.toast("录入成功。");
- }
- }, 'json')
-
- }
-
- });
- //绑定数据
- if (userid != undefined && userid != null) {
- GetData(userid);
- }
- } else {
-
- }
- });
-
- function GetData(uid) {
-
- plus.nativeUI.showWaiting("加载中...");
-
-
- mui.post(api + '/user/getstubyid', {
- data: uid
- }, function(res) {
- plus.nativeUI.closeWaiting();
- if (res.code == "200") {
- document.getElementById("username").value = res.data.username;
- document.getElementById("sexid").value = res.data.sexid;
- document.getElementById("sextext").innerText = res.data.sex;
- document.getElementById("phone").value = res.data.phone;
- document.getElementById("address").value = res.data.address;
- document.getElementById("ids").value = res.data.ids;
- document.getElementById("cultureid").value = res.data.cultureid;
- document.getElementById("culturetext").innerText = res.data.culture;
- document.getElementById("schoolid").value = res.data.schoolid;
- document.getElementById("schooltext").innerText = res.data.school;
- GetDepartData(userPickerdepart, "" + res.data.schoolid + "", "" + res.data.cultureid + "");
- document.getElementById("departid").value = res.data.departid;
- document.getElementById("departtext").innerText = res.data.depart;
- document.getElementById("paymentQuota").value = res.data.paymentQuota;
- document.getElementById("renarks").value = res.data.renarks;
- document.getElementById("provinceid").value = res.data.province;
- document.getElementById("cityid").value = res.data.city;
- document.getElementById("areaid").value = res.data.county;
- document.getElementById("provincetext").innerText = res.data.province + " " + res.data.city + " " + res.data.county;
- }
- }, '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">
- <form class="mui-input-group">
- <div class="mui-input-row">
- <label>姓 名</label>
- <input id='username' type="text" class="mui-input-clear mui-input" placeholder="请输入姓名">
- </div>
- <div class="mui-input-row" id="selsex">
- <label>性 别</label>
- <input type="hidden" id="sexid" />
- <span id="sextext">请选择</span><span class="mui-pull-right mui-navigate-right"></span>
- </div>
- <div class="mui-input-row">
- <label>手 机 号</label>
- <input id='phone' type="number" class="mui-input-clear mui-input-numbox" placeholder="请输入手机号">
- </div>
- <div class="mui-input-row" id="selprovince">
- <label>省市县/区</label>
- <input type="hidden" id="provinceid" />
- <input type="hidden" id="cityid" />
- <input type="hidden" id="areaid" />
- <span id="provincetext">请选择</span><span class="mui-pull-right mui-navigate-right"></span>
- </div>
- <div class="mui-input-row">
- <label>家庭住址</label>
- <input id='address' type="text" class="mui-input-clear mui-input" placeholder="乡镇/村/街/号">
- </div>
- <div class="mui-input-row">
- <label>身份证号</label>
- <input id='ids' type="text" class="mui-input-clear mui-input" placeholder="" maxlength="18" min="15">
- </div>
- <div class="mui-input-row" id="selculture">
- <label>文化程度</label>
- <input type="hidden" id="cultureid" />
- <span id="culturetext">请选择</span><span class="mui-pull-right mui-navigate-right"></span>
- </div>
- <div class="mui-input-row" id="selschool">
- <label>报考校区</label>
- <input type="hidden" id="schoolid" />
- <span id="schooltext">请选择</span><span class="mui-pull-right mui-navigate-right"></span>
- </div>
- <div class="mui-input-row" id="seldepart">
- <label>报考专业</label>
- <input type="hidden" id="departid" />
- <span id="departtext">请选择</span><span class="mui-pull-right mui-navigate-right"></span>
- </div>
- <div class="mui-input-row">
- <label>缴费额度</label>
- <input id='paymentQuota' type="number" class="mui-input-clear mui-input-numbox" placeholder="请输入缴费额度" value="0">
- </div>
- <div class="mui-input-row" style="height: 125px;">
- <label>备 注</label>
- <textarea id="renarks" rows="5" placeholder=""></textarea>
- </div>
- </form>
-
- <div class="mui-content-padded">
- <button id='reg' class="mui-btn mui-btn-block mui-btn-primary">提交</button>
- </div>
-
- </div>
-
- </body>
-
- </html>
|