工作半年总结 -web前端

<form id="searchForm" name="searchForm" action="/admin/user/index">
    <input type="hidden" name="page" id="page" value="@paginator.getPage()"/>
    <input type="hidden" name="pageSize"  value="@paginator.getPageSize()"/>
form>
<div class="bs-docs-section-6em">
    <ul class="nav nav-tabs">
        <li class="active"><a href="#" ><span class="glyphicon glyphicon-th-list" >span> .。。管理a>li>
        <div class="pull-right f-margin-top-f60px">
            <a data-func="add" class="btn glyphicon glyphicon-plus" data-toggle="modal" data-target="#bs-modal-add">添加a>
        div>

    ul>
    <table class="table table-striped  table-bordered table-hover" id="overall">
        <thead >
        <tr>
            <th>XXXXth>
            <th>XXXX/th>
            <th>XXXth>
            <th>XXXth>
            <th>XXXXth>
            <th>XXXXth>
            <th  ><p  align="center">操作p>th>
        tr>
        thead>
        <tbody>
        @for(mapEntry<-list){
        <tr>
        <td>@mapEntry.getCmsUserId()td>
        <td>DummyCmsUserName td>
        <td>@mapEntry.getUserId()td>
            @if(u != null){
                <td>@u.get(0).get(mapEntry.getUserId().toString())td>
            }else{
                <td> td>
            }
            <td>@UserVerifiedType.getFromCode(mapEntry.getVerifiedType().toString()).getMsg()td>
            <td>@mapEntry.getRecommendReason()td>

        <td><input  class="btn "   type="button"   data-toggle="modal" id = "@mapEntry.getUserCmsUserId()" data-target="#bs-modal-edit"    value="编辑" />
            <input  class="btn "   type="button"   data-toggle="modal" id = "@mapEntry.getUserCmsUserId()" data-target="#bs-modal-delete"      value="删除" />
             @if(mapEntry.getIsTop()==0){ <input  class="btn "   type="button"   data-toggle="modal" _top="@mapEntry.getIsTop()" id = "@mapEntry.getUserCmsUserId()" data-target="#bs-modal-istop"    value="置顶"   />
            }else{
              <input  class="btn  "   type="button"   data-toggle="modal" _top="@mapEntry.getIsTop()"  id = "@mapEntry.getUserCmsUserId()" style="  font-weight:bold"data-target="#bs-modal-istop"   value="取消"   />
            }
        td>

        }
        tr>
        tbody>
        table>
    <script src='@routes.Assets.at("/javascripts/userTheme.js")' type="text/javascript">script>
    @Page(paginator)
<div id="bs-modal-istop" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×span>button>
                <h4 class="modal-title">置顶h4>
            div>
            <div class="modal-body">
                <p>p>
            div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消button>
                <button type="button" class="btn btn-primary" func="istop">确认button>
            div>
        div>
    div>
div>
<div id="bs-modal-error" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×span>button>
                <h4 class="modal-title">出错啦!h4>
            div>
            <div class="modal-body">
                <p>p>
            div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">确认button>
            div>
        div>
    div>
div>
<div id="bs-modal-add" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×button>
                <h4 class="modal-title">添加关联h4>
            div>
            <div class="modal-body">
                <form class="form-horizontal">

                    <div class="form-group">
                        <label for="cmsUserId" class="col-lg-3 control-label">户ID:label>
                        <div class="col-lg-4">
                            <input type="text" class="form-control" id="cmsUserId" placeholder="户ID">
                        div>
                    div>
                    <div class="form-group">
                        <label for="userId" class="col-lg-3 control-label">ID:label>
                        <div class="col-lg-4">
                            <input type="text" class="form-control " id="userId" placeholder="ID">  <a data-func="search" class=" form-control btn glyphicon glyphicon-search" data-toggle="modal" data-target="#bs-modal-search ">a>
                        div>
                    div>
                    <div class="form-group">
                        <label for="reason" class="col-lg-3 control-label">ccc:label>
                        <div class="col-lg-4">
                            <textarea id="reason" cols="24" rows="5">textarea>
                        div>
                    div>

                    <div id="dropdownSatus" class="form-group" data-selectedid="2333">
                        <label for="verifiedType"  class="col-lg-3 control-label" >类型:label>
                        <div class="col-lg-4 form-control-static">
                            <select  name="collocation_division" id = "verifiedType">
                            @for(c <- verifiedType){
                            <option value="@c.getCode" >@c.getMsgoption>
                            }
                        select>
                        div>

                    div>
                form>

            div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭button>
                <button type="button" class="btn btn-primary" func="confirm">保存button>
            div>
        div>
    div>
div>
<div id="bs-modal-edit" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×button>
                <h4 class="modal-title">修改关联h4>
            div>
            <div class="modal-body">
                <form class="form-horizontal">

                    <div class="form-group">
                        <label for="cmsUserId_edit" class="col-lg-3 control-label">ID:label>
                        <div class="col-lg-4">
                            <input type="text" class="form-control" id="cmsUserId_edit" placeholder="ID">
                            <input type="hidden"  name ="userCmsUserId" id="userCmsUserId" >
                        div>
                    div>
                    <div class="form-group">
                        <label for="userId_edit" class="col-lg-3 control-label">ID:label>
                        <div class="col-lg-4">
                            <input type="text" class="form-control" id="userId_edit" placeholder="ID"><a data-func="search" class=" form-control btn glyphicon glyphicon-search" data-toggle="modal" data-target="#bs-modal-search-edit ">a>
                        div>
                    div>
                    <div class="form-group">
                        <label for="reason_edit" class="col-lg-3 control-label">由:label>
                        <div class="col-lg-4">
                            <textarea id="reason_edit" cols="24" rows="5">textarea>
                        div>
                    div>

                    <div id="dropdownSatus_edit" class="form-group" data-selectedid="2333">
                        <label for="verifiedType_edit"  class="col-lg-3 control-label" >label>
                        <div class="col-lg-4 form-control-static">
                            <select  name="collocation_division" id = "verifiedType_edit" orteus="true" >
                                @for(c <- verifiedType){
                                <option value="@c.getCode" >@c.getMsgoption>
                                }
                            select>
                        div>

                    div>
                form>

            div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭button>
                <button type="button" class="btn btn-primary" func="confirm">保存button>
            div>
        div>
    div>
div>
<div id="bs-modal-delete" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×span>button>
                <h4 class="modal-title">删除!h4>
            div>
            <div class="modal-body">
                <p>确定要删除该关联关系么?p>
            div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭button>
                <button type="button" class="btn btn-danger" func="confirm">删除button>
            div>
        div>
    div>
div>
<div id="bs-modal-search" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×button>
                <h4 class="modal-title">查找h4>
            div>
            <div class="modal-body">
                <form class="form-horizontal">

                    <div class="form-group">
                        <label for="cmsUserId" class="col-lg-3 control-label">用户名:label>
                        <div class="col-lg-4">
                            <input type="text" class="form-control" id="username" placeholder="用户名">
                        div>
                    div>
                    <div class="form-group">
                        <label for="userId" class="col-lg-3 control-label">密码:label>
                        <div class="col-lg-4">
                            <input type="text" class="form-control" id="password" placeholder="密码">
                        div>
                    div>
                form>
            div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭button>
                <button type="button" class="btn btn-primary" func="confirm">查询button>
            div>
        div>
    div>
div>
<div id="bs-modal-search-edit" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×button>
                    <h4 class="modal-title">查找真实用户IDh4>
                div>
                <div class="modal-body">
                    <form class="form-horizontal">

                        <div class="form-group">
                            <label for="cmsUserId" class="col-lg-3 control-label">用户名:label>
                            <div class="col-lg-4">
                                <input type="text" class="form-control" id="username_edit" placeholder="用户名">
                            div>
                        div>
                        <div class="form-group">
                            <label for="userId" class="col-lg-3 control-label">密码:label>
                            <div class="col-lg-4">
                                <input type="text" class="form-control" id="password_edit" placeholder="密码">
                            div>
                        div>
                    form>
                div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭button>
                    <button type="button" class="btn btn-primary" func="confirm">查询button>
                div>
            div>
        div>
    div>
    div>

<script>

    var _id;
     var msg ;
      var _top;
    $('#bs-modal-istop').on('show.bs.modal' , function(event){
             _id = $( event.relatedTarget ).attr("id");
              _top =  $( event.relatedTarget ).attr("_top");
             if(_top == 0) {msg ="确定将该搭配师置顶么?";
             }else{
             msg = "确定要取消置顶么?";
             }
              $('#bs-modal-istop .modal-body p').text( msg );
            });
     $('#bs-modal-istop').on( 'hidden.bs.modal' , function(){
            _id = '';

        });

   $('#bs-modal-istop [func="istop"]' ).on( 'click' , function(){
            var _url = '/admin/user/isTop?id='+_id;
                $.ajax( {
                    url     : _url,
                    dataType: 'json',
                    success : function( rtn ){
                        if( rtn.code == 200 ){
                        $('#searchForm').submit();
                        }else{
                          $('#bs-modal-istop').modal('hide');
                            showError( rtn.msg );

                        }
                    },
                    fail    : function( rtn ){
                   $('#bs-modal-istop').modal('hide');
                        showError( rtn.msg );
                    }
                } );
      });


        $('#bs-modal-add').on('show.bs.modal' , function(event){
        hideAndRmoveAllTips( $('#bs-modal-add .modal-body') );
        });
         $('#bs-modal-add [func="confirm"]' ).on( 'click' , function(){
          hideAndRmoveAllTips( $('#bs-modal-add .modal-body') );
          var _userId  = $('#userId').val().trim();
          var _cmsUserId =$('#cmsUserId').val().trim();
          var _reason = $('#reason').val().trim();
          var _type = document.getElementById("verifiedType").value;

            if(_userId != '' &&  _cmsUserId != '' && _reason != '' ){
                  var _url = '/admin/user/addData';
                        $.ajax( {
                            url     : _url,
                            data    :{
                             userId: _userId,
                             cmsUserId:_cmsUserId,
                             recommendReason:_reason,
                             verifiedType:_type
                            },
                            dataType: 'json',
                            success : function( rtn ){
                                if( rtn.code == 200 ){
                                gotoPage(1);
                                }else{
                                  $('#bs-modal-add').modal('hide');
                                    showError( rtn.msg );

                                }
                            },
                            fail    : function( rtn ){
                           $('#bs-modal-add').modal('hide');
                                showError( rtn.msg );
                            }
                        } );
             }
            else{
                     if( _userId == '' ){
                                addAndshowTips( $('#userId'), '“用户ID”不能为空!');
                     }
                     if( _cmsUserId == '' ){
                                addAndshowTips( $('#cmsUserId'), '“马甲ID”不能为空!');
                     }
                     if( _reason == '' ){
                                addAndshowTips( $('#reason'), '“推荐理由”不能为空!');
                     }
             }
      });

        function selectSetValue(val,obj){
          for(var i=0;i
'; obj.closest('.form-group').append( _str ); } function hideAndRmoveAllTips( wrap ){ wrap.find('.alertWrapper').remove(); } function addAndshowError( wrap , msg ){ var _str = ''; wrap.append( _str ); } function showError( msg ){ $('#bs-modal-error').on('show.bs.modal' , function(){ $('#bs-modal-error .modal-body p').text( msg ); }); $('#bs-modal-error').modal('show'); }; script>

你可能感兴趣的:(工作)