123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <!DOCTYPE html>
- <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
- <head>
- <th:block th:include="include :: header('编辑用户信息')" />
- </head>
- <body class="white-bg">
- <div class="wrapper wrapper-content animated fadeInRight ibox-content">
- <form class="form-horizontal m" id="form-notice-edit" th:object="${user}">
- <input id="uid" name="uid" th:field="*{uid}" type="hidden">
- <div class="form-group">
- <label class="col-sm-2 control-label">昵称:</label>
- <div class="col-sm-10">
- <input id="nick" name="nick" th:field="*{nick}" class="form-control" type="text" required>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">性别:</label>
- <div class="col-sm-10">
- <select name="gender" id="gender" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{gender}"></option>
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">手机号码:</label>
- <div class="col-sm-10">
- <p id="editPhone" th:text="*{phone}"></p>
- <a href="javascript:void(0)" id="removePhone">解绑</a>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">用户头像图:</label>
- <div class="col-sm-10">
- <img src="" id="addImgUrl" style="width:70px;height:70px;" alt="" th:src="*{avatar}">
- <input type="file" id="addUploadFile" name="uploadFile"
- accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
- <button class="btn btn-success" type="button" id="uploadBtn">上传</button>
- <input type="hidden" id="avatar" name="avatar" th:field="*{avatar}" class="form-control validate[required]"/>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">修改卿卿号:</label>
- <div class="col-sm-10">
- <input id="erbanNo" name="erbanNo" th:field="*{erbanNo}" class="form-control" type="text" required>
- </div>
- </div>
- </form>
- </div>
- <th:block th:include="include :: footer" />
- <th:block th:include="include :: summernote-js" />
- <script type="text/javascript">
- var prefix = ctx + "users/user";
- var cropper;
- $(function() {
- $('#removePhone').on('click', function () {
- $.ajax({
- type: "post",
- url: prefix + "/untiedPhone",
- data: {
- uid: $('#uid').val(),
- erBanNo: $('#editErbanNo').val()
- },
- dataType: 'json',
- beforeSend: function () {
- $.modal.loading("正在处理中,请稍后...");
- $.modal.disable();
- },
- success: function(result) {
- if (typeof callback == "function") {
- callback(result);
- }
- $.operate.successCallback(result);
- }
- })
- });
- });
- $('#uploadBtn').on('click',function () {
- var formdata = new FormData();
- formdata.append("file", $('#addUploadFile').get(0).files[0]);
- $.ajax({
- url: ctx + "file/upload",
- data: formdata,
- type: "post",
- processData: false,
- contentType: false,
- success: function(result) {
- $('#addImgUrl').attr('src',result.data);
- $("input[name='avatar']").val(result.data);
- }
- })
- });
- $("#form-notice-edit").validate({
- focusCleanup: true
- });
- function edit() {
- var nick = $("input[name='nick']").val();
- var gender = $('#gender').val();
- var avatar = $("input[name='avatar']").val();
- var erbanNo = $("input[name='erbanNo']").val();
- var uid = $("input[name='uid']").val();
- var phone = $('#editPhone').html();
- $.ajax({
- cache : true,
- type : "POST",
- url : ctx + "users/user/edit",
- data : {
- "nick": nick,
- "gender": gender,
- "avatar": avatar,
- "erbanNo": erbanNo,
- "uid": uid,
- "phone" : phone,
- "avatar" : avatar
- },
- async : false,
- error : function(request) {
- $.modal.alertError("系统错误");
- },
- success : function(data) {
- $.operate.successCallback(data);
- }
- });
- }
- function submitHandler() {
- if ($.validate.form()) {
- edit();
- }
- }
- </script>
- </body>
- </html>
|